I am using the OpenCV4Tegra version of OpenCV on the Tegra K1 Jetson. I am capturing video frames over USB. I am calling cvEncodeImage() to perform JPEG compression on the captured images. The question I have regards blocking of code during execution.
If a separate processing unit is compressing the current frame, I would like to use that time to stream the previous frame(s) to a hard drive. I am using cvEncodeImage() and not cvSaveImage() because I need to continue processing the image, even though I have written it to disk.
For example, I can see the blocking nature of the following sequence of calls because the results of the first call (compression) feed into the second function call (write)
CvMat *mat1 = cvEncodeImage(".jpg", img1);
Can I do something to the effect?
CvMat mat1 = cvEncodeImage(".jpg", img1); / hopefully non-blocking */
CvMat mat2 = cvEncodeImage(".jpg", img2); / hopefully non-blocking. probably must wait for previous compression to finish /
myImageWriter(mat1, “file1.foo”); / can this execute at same time as previous line? or does it have to wait for the previous function call to complete? /
myImageWriter(mat2, “file2.foo”); / ok. this definitely has to wait until encode is complete for 2nd image */
Thanks. Also, if I am in the wrong section, please advise that, too.