Accessing Symbian Camera trough QCamera
Hi.
I've been searching a lot a solution but I can't find in the API or any other place...
I'm using as my target Symbian^3 and I'm reading the camera in this way just like the Qt Mobility documentation suggests:
Code:
camera = new QCamera;
viewFinder = new QCameraViewfinder;
camera->setViewfinder(viewFinder);
camera->setCaptureMode(QCamera::CaptureStillImage);
camera->start();
this->setCentralWidget(viewFinder);
It works fine and shows the camera into the screen...
However I'm developing an application which modifies the image through openCV. openCV has an object for images, IplImage. I can make the conversion between a QImage and an IplImage, so, what I need is to grab a frame each time a timer ticks into a QImage.
I've found that I can define a QCameraImageCapture and call its capture() method which will trigger the imageCaptured() signal which has the pointer to a QImage as a parameter. However this capture() method saves the image into the disk as a file... so, I don't need that. I just need to have the grabbed frame as a QImage...
I've also tried with no success using the render() method from QWidget because viewFinder is a QCameraViewfinder which is also a QWidget because when I use the pixel() method from QImage it always return (0,0,0) as the color of any pixel.
If anyone knows how to do that conversion from QCamera to QImage plz lemme know, I'll appreciate it...
Re: Accessing Symbian Camera trough QCamera
In QtMobility 1.2 there is QCameraImageCapture::setCaptureDestination() which -- with good luck -- might be supported in your device. It allows setting the capture destination to a buffer instead of a file.
Did you notice that imageCaptured() gives you a preview image of the photo just about to be saved? It should match anything that you could grab from your viewfinder.
Re: Accessing Symbian Camera trough QCamera
Hi mvuori and thanks for the reply...
well, I'll try with setCaptureDestination().... however imageCaptured() is a signal triggered when you've already saved the file... So, for a real-time application it doesn't work because each time a timer ticks you would have to save the file, process the image you've got from imageCaptured() and delete de file, lol....
well, again thanks and I'll try with setCaptureDestination()
Re: Accessing Symbian Camera trough QCamera
Well, I have a big problem because I'm using Qt Mobility 1.1... So I cannot use the setCaptureDestination()... So, anyone knows at least how to get the buffer from QCamera???
Re: Accessing Symbian Camera trough QCamera
What you need, if I understand correctly, is to get access to the viewfinder frames, not to get a captured image. What you need to do therefore is implement a class which inherits from QAbstractVideoSurface, and then do
Code:
m_camera->setViewfinder(m_surface);
Where m_surface is an instance of your QAbstractVideoSurface-derived class. Then, once you start the viewfinder, you will receive frames via the QAbstractVideoSurface::present virtual function.
One problem is that, IIRC, the QAbstractVideoSurface overload of QCamera::setViewfinder was added in QtMobility 1.2, so this method will only work if you can upgrade to that version.