← Back

ofxModuleWebcam

github.com/reddoLabs/ofxModuleWebcam · @reddoLabs
OF 0.11 Video/Camera

Module for ofxModule that allows easy control over Webcams.

0 0 Last commit 3y ago Created 6y ago

README

ofxModuleWebcam



Module for ofxModule that allows easy control over Webcams.

Compatible with openFrameworks 0.11.0+

Generate all project files using the openFrameworks Project Generator.

Required Addons



ofxModule

Getting started



Have a look at the sample project to get started directly and have a small explanation here.

Settings



The module can be configured in the settings.json.

{
    "Webcam": {
        "width": 640,
        "height": 480,
        "streamingMethod":"pixels"
    }
}


propertytypedescription
mirrorXbooleanmirrors Image on x-axis
mirrorYbooleanmirrors Image on y-axis
rotateintrotate the image either 0, 90, 180 or 270
streamingMethodstringtransmit type of images to other modules either "texture","pixels" or "both"
framerateintdesired camera framerate
deviceIdintthe device id (number of detection)
deviceNamestringthe device name


Communication



Control the module



Activate/ deactivate streaming:

ofJson j;
j["value"] = false; // activate the module, for deactivate use true
notifyEvent("setIdle", j);


Get messages from the module



Depending of the selected streaming method you receive the cam image as ofTexture or ofPixels. A photo arrives at the address photo, other messages represent the current live view.

void Presenter::proceedModuleEvent(ModuleEvent& e) {
		
		// update the cam image 
		if (e.type == ModuleEvent::MODULE_EVENT_TEXTURE) {
		  camTexture = e.texture;
		}else if (e.type == ModuleEvent::MODULE_EVENT_PIXELS) {
			camPic.setFromPixels(e.pixels);
		}
    }

Get this addon

HTTPS
SSH