-
Notifications
You must be signed in to change notification settings - Fork 15
Access a Connected Camera
You can specify the camera device id explicitly by doing the following:
int main(int argc, const char * argv[])
{
auto processFrame = [](size_t frameN, Mat &input, Mat &output){
GaussianBlur(input, output, Size(7,7), 1.5, 1.5);
Canny(output, output, 0, 30, 3);
};
Ptr<Input> input = new CameraInput(0);
Processor processor;
processor.setInput(input);
processor.setProcess(processFrame);
processor.run();
return 0;
}
The CameraInput class takes an int as its first argument, the device – id of the opened video capturing device (i.e. a camera index). If there is a single camera connected, just pass 0.
The setInput method sets the Processor class to use the input instance (i.e. CameraInput).
processor.setInput(input)
You can force the image size of your input by passing a second argument specifying the desired resolution. If you would like to use the device original resolution a value of Size(-1,-1) should be passed (i.e. default value Size(-1,-1)).
Ptr<Input> input = new CameraInput(0, Size(640,480));
A third argument specifies the OpenCV color space conversion code to apply to the images. By default no code conversion is applied to the images generated by the input device (i.e. default value - 1).
Ptr<Input> input = new CameraInput(0, Size(640,480),CV_RGB2GRAY);
This is useful in the case your input device generates images in a different color spectrum to the one you would like to use in your algorithm. (e.g. CV_GRAY2RGB, CV_RGB2HLS, ... etc)
- Batch Processing
- Select an Input Device
- Select an Output Device
- Handling Mouse and Keyboard Events
- Channel Buffer size
- Create your own Input Class
- Create your own Output Class
- Create your own Project
- UML Class Diagram
-
API Reference
- Processor Class
- BatchProcessor Class
- Input Class
- Ouput Class
- ProcessFrame Class
- BatchProcessFrame Class
- MouseListener and KeyboardListener Classes