August 8, 2011

lyman lyman
Lab Rat
1 posts

How to use QML Camera image in c++ code

 

How can I access image captured by QML Camera element in c++ code ?
I want to capture an image using qml camera element, change it in some way using c++ and then display it to the user, but I can’t find the way to do this.

Any help appreciated :)

2 replies

August 10, 2011

Vijay Bhaska Reddy Vijay Bhaska Reddy
Lab Rat
399 posts

This should be possible. After you take a picture, call a method in C++ ( expose a method or class instance from C++). Once you are done with your C++ code, raise a signal and catch it inside QML. I don’t see whey this should not be possible?

August 11, 2011

mbrasser mbrasser
Ant Farmer
452 posts

Hi,

From what I understand the Camera element will save the image to a file, which you should then be able to manipulate. Maybe something like the following?

  1. Camera {
  2.     ...
  3.     onImageCaptured : {
  4.         // pass the preview URL to a processImage function exposed from C++
  5.         myApp.processImage(preview)  
  6.     }
  7. }

You’d then need to expose the manipulated image back to QML (either as a URL for a saved file, or using QDeclarativeImageProvider) for display.

If you aren’t real familiar with the ways QML and C++ can communicate with each other, http://doc.qt.nokia.com/latest/qtbinding.html provides a great reference.

Regards,
Michael

 
  ‹‹ QML Webview Element : Error on Device Program with QML but simulator and mobile browser not      Caps Lock ››

You must log in to post a reply. Not a member yet? Register here!