-
Notifications
You must be signed in to change notification settings - Fork 15
Save Your Output to a Folder
You can specify a path to a folder to save your algorithm results as image files.
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);
Ptr<Output> output = new ImageOutput("path/to/folder/");
Processor processor;
processor.setInput(input);
processor.setOutput(output);
processor.setProcess(processFrame);
processor.run();
return 0;
}
The ImageOutput class takes a string as its first argument, the folder path – where your images will be stored (e.g. "path/to/folder/").
The setOutput method sets the Processor class to use the output instance (i.e. ImageOutput).
processor.setOutput(output);
The Processor class will create a new thread to process the writing process to disk using the specified Output instance (i.e. ImageOutput). Each output image created by the lambda function will be directed to the ImageOutput instance and written to disk.
You can force the image size of your output by passing a second argument specifying the desired resolution. If you would like to use the original resolution a value of Size(-1,-1) should be passed (i.e. default value Size(-1,-1)).
Ptr<Output> output = new ImageOutput("path/to/folder/", Size(640,480));
A third argument specifies the number of digits your image file will contain (e.g. "00000.jpg" has 5 digits -default value-)
Ptr<Output> output = new ImageOutput("video.avi", Size(640,480), 5);
A fourth argument specifies the OpenCV color space conversion code to apply to the output images generated in the lambda function. By default no code conversion is applied to the images (i.e. default value - 1).
Ptr<Output> output = new ImageOutput("video.avi", Size(640,480), 5, CV_RGB2GRAY);
This is useful in the case you want to generate in a different color spectrum from the one you outputted in your lambda function. (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