Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Camera based QML element
galatea last edited by
I am trying to create a configurable system to acquire and process still images of the (main) camera of an android device. The images are never intedended to be visible to the user, that is why I want to create my own QML element for the acquisition of raw data.
While trying to implement that class (source below) I stumbled across the following problem:
If I derive my Camera-class that uses an Instance of QCamera and QCameraImageCapture from QQuickItem, everything works fine on my labtop (windows 32bit kit), but it does not work on the android device. The callback that is supposed to process the image is never called und the application output states, that the camera issues error 1001 every few seconds. If I derive the camera-class from QMainWindow and call the show()-method before initialising the camera, it works fine. Right now I fail to see, why I would need a certain kind of user interface to be present in order to work the camera of the device. I would be grateful for any kind of advise.
class Camera2:public QMainWindow//public QQuickItem
void imageCaptured(int id, QImage img);
void Camera2::imageCaptured(int id, QImage img)
QMessageBox::information(dynamic_cast<QWidget*>(this),"test",QString::number(img.height())+" x "+QString::number(img.width()), QMessageBox::Ok);