heine
heine

Reputation: 597

Drawing a videostream using wxWidgets

I have a relatively simple application which currently utilizes OpenCV to grab an image from a camera using cv::VideoCapture and view the resulting image in a window using imshow() running on OS X El Capitan.

In between I'm doing some basic image modification but this is not crucial to my problem.

Since the GUI implemented by OpenCV is pretty basic I decided to redo it using wxWidgets. I got it basically running similarly to the implementation linked in the tutorial section of wxWidgets. (Updated it to C++11 etc. but the idea is pretty much identical. Code is located on github.)

Now heres my problem: In best cases I get half the framerate as I get with the OpenCV only solution. OpenCV uses qt underneath. But when I look into the stack trace it comes down to similar function calls using CoreGraphics.

So my question boils down to: What is the best way do draw an image to a window with a framerate > 20fps using wxWidgets on OS X? Currently I use the DrawBitmap() function.

Bonus question: when I have the window on my Macbooks internal Retina screen the framerate gets even worse. Is there maybe any preprocessing/scaling on the picture I should do to take off load from the GUI-process?

Upvotes: 4

Views: 1800

Answers (1)

VZ.
VZ.

Reputation: 22753

The fastest is probably to use OpenGL (although I'm less sure about this under OS X which is not very OpenGL-friendly AFAIK), but I'm not really sure if the bottleneck is really DrawBitmap(), it could be the code doing the conversion to wxBitmap in the first place: if you don't use raw bitmap access, it could be quite slow.

Upvotes: 2

Related Questions