TK1 + OpenCV (CUDA support)


I’m trying to simply display images from my camera in a loop. I am using OpenCV and everything is functional. However, in my OpenCV code, I call cvShowImage() + cvWaitKey(1) as part of my display.

cvWaitKey(1) takes ~100ms on the TK1, which is simply too long.

Does anybody know if cvWaitKey already take advantage of CUDA? Or if there is any other way to speed up image display?

Thanks in advance,

It’s a lot since this post, but the “problem” is actual and I faced it in these days.

I’m updating the performance of the Jetson TK1 to write a report acquiring images from a Sensoray miniPCIe frame grabber and I could not understand why I was getting 17 FPS while my elaboration time did not take more than 30 msec…

This is an example of timing I get running my application… Wait key takes 30/40 msec:

Frame capture: 3.95972 msec
Show original frame: 0.817077 msec
Convert to YUV and split channels: 2.98523 msec
Blur: 9.1891 msec
Canny: 12.1114 msec
Sobel: 11.4364 msec
T_elab: 36.7094 msec --- mean: 33.8446 - min: 26.0662 - max: 115.655

FPS: 13.2731 --- mean: 16.9988 - min: 8.23435 - max: 31.0208

Wait key: 30.1474 msec

*** Total time: 70.9715 msec

What I noticed is that removing the “cv::imshow” calling the times change a lot:

Frame capture: 17.5386 msec
Show original frame: 0.0025 msec
Convert to YUV and split channels: 3.00148 msec
Blur: 2.83315 msec
Canny: 17.9465 msec
Sobel: 2.9284 msec
T_elab: 26.8742 msec --- mean: 24.3736 - min: 18.3028 - max: 35.6302

FPS: 21.8041 --- mean: 26.9434 - min: 20.7177 - max: 39.673
Output FPS: 0.046166 msec
Wait key: 1.27382 msec

*** Total time: 45.9864 msec

So what I can say is that calling “cv::waitKey” the system switches context and returns back only when the processes related to GUI elaborations are finished.

In conclusion: as everyone knows the highgui module is not really efficient, so when evaluating elaboration times for a process, we should take in consideration this fact… not forgetting it ^_^