Opencv video processing is slow

hello everyone. i have updated my opencv to opencv 3.1 and used the following instructions to process the onboard camera. the problem is that if i do simplest process on image in full hd resolution, the result isnt realtime any more.what is the problem.(1-gstreamer parameters are not set correctly,2-opencv is slow for displaying, …) thanks.

We did the test with OpenCV 3.1.0 with onboard camera, we can see it work successfully.
Here are some tips to open the default camera

  1. Please try openCV version be 3.0.0 or higher. we’re using 3.1.0
  2. GST 1.0 and related plugins must be installed.
  3. test program must be linked against built openCV 3.1.0 libs
  4. test code looks like:

VideoCapture cap(“nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720,format=(string)I420, framerate=(fraction)24/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink”); //open the default camera

if(!cap.isOpened()) { // check if we succeeded
cerr << "Fail to open camera " << endl;
return -1;
}
for(;;)
{
Mat frame;
cap >> frame; // get a new frame from camera
imshow(“original”, frame);
waitKey(1);
}
// the camera will be deinitialized automatically in VideoCapture destructor
cap.release();

Hello, Iman_Roosta:
For opencv, pipeline is too long (format transfer) and the delay is expected. Also, it’s not so optimized.
If you want more effective image processing, you can try NV release multimedia API, or GST, with CUDA processing.

opencv is more suitable for algorithm function evaluation.

br
ChenJian

thanks for your attention.could you give me an example or sample code.

Hello, Iman_Roosta:
For Multimedia API, you can install ‘Multimedia API package’ from Jetpack and check tegra_multimedia_api directory in device. There are a lot of sample code to show how multimedia works in Jetson, including a few CUDA processing codes.

br
ChenJian

@jachen

Are there any samples for covert UYVY to rgb24? so that opencv can continue to process.

thanks for your help.