Thanks, but this solution is a little bit verbose(no offense)
do we have an easier way to get the image?
besides, do we have to copy the frame before we can
do anything to it?
Thanks, but this solution is a little bit verbose(no offense)
do we have an easier way to get the image?
besides, do we have to copy the frame before we can
do anything to it?
None takenthis solution is a little bit verbose(no offense)I agree that this is quite a lot of code just to get one QImage object.
You can access pixel data from QVideoFrame object only if its mapped - and since map() is non-const method, you cannot call it on a const object.besides, do we have to copy the frame before we can do anything to it?
Anyway don't worry about the copy constructor, because copy constructor of QVideoFrame creates a shallow copy. When you call map() on the frame object, it may transfer the underlying pixel data to RAM (for example if frame data is stored in video memory), but I think it depends on the implementation - I can imagine for some implementations this pixel data can be already in the main memory. ReadOnly flag probably allows even more optimizations as the mapped pixel data will not be written back to original video frame data, but I'm not really an expert on QCamera / QVideo* stuff so you use my advice with caution
Furthermore, QImage constructor does not copy the image buffer, so you'll have to copy the image only when you process it.
Btw. what is your OS and qcamera backend ? I remember using QCamera with gstreamer backend on linux and to be honest I was not very happy with it - I couldn't get it to list possible framerates / resolutions (tested with few uvc cameras), let alone change the capture parameters...
Last edited by stampede; 1st December 2013 at 18:42. Reason: updated contents
stereoMatching (2nd December 2013)
The OS I intent to deploy areBtw. what is your OS and qcamera backend ?
OS X 10.8.5(mac mini)
win 7 64bits
android 4.1.2(Qt5.2 rc1 have bugs on this platform yet)
I use the default back end come with the binary
In truth, I don't know how to change the backend
At first, I would like to use the cv::VideoCapture to process the image
but I don't know how to link the camera lib of opencv on android with Qt5
so I decided to give QCamera a try
If I am correct, I have to process the image frame by frame in this present function?
Yes, you could do that
stereoMatching (3rd December 2013)
Bookmarks