Dear all,
I’ve the following hardware setup:
Jetson Nano
Sony IMX477 CSI camera
And I want to take random pictures from an open camera stream for further analasys (some image processing).
I already can do this with the following piece of c++ code (based on this example CSI-Camera/simple_camera.cpp at master · JetsonHacksNano/CSI-Camera · GitHub):
std::string pipeline = gstreamer_pipeline(capture_width,
capture_height,
display_width,
display_height,
framerate,
flip_method);
cv::VideoCapture capture(pipeline, cv::CAP_GSTREAMER);
if(!capture.isOpened())
{
std::cout<<"Failed to open camera."<<std::endl;
return (-1);
}
cv::Mat img;
std::cout << "Hit ESC to exit" << "\n" ;
while(true)
{
if (!capture.read(img)) //Read operation takes a lot processing load...
{
std::cout<<"Capture read error"<<std::endl;
break;
}
if(imageProcessingFlag)
{
//Do my "magic" with img Mat variable
}
cv::imshow("CSI Camera",img);
int keycode = cv::waitKey(10) & 0xff ;
if (keycode == 27) break ;
}
//-------------------------
This solution has to much processing load because of the “cap.read(img)” and in my case what I really need is to read the frame when an image processing command is made (imageProcessingFlag).
It there a solution where instead of using “cap.read(img)” I could use “cap.dump()” to avoid uncessary CPU load and use “cap.read(img)” only when needed ?
I’ve tried several things but with no luck.
Thank you in advance for you help and sorry if this post is not on the right place!
Regards