Android qcamera 5.4 beta
-
As said in "this post":http://qt-project.org/forums/viewthread/46837 the QCamera class should be usable in Qt 5.4 . But with the beta version of QT 5.4, I test this simple code and also "this example.":http://qt-project.org/doc/qt-5/qtmultimediawidgets-camera-example.html and I have a black screen each time. Do you have any ideas ?
Thanks a lot@#include "mainwindow.h"
#include <QApplication>
#include<QCamera>
#include<QCameraViewfinder>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);QCamera camera(QCamera::FrontFace); QCameraViewfinder viewfinder; camera.setViewfinder(&viewfinder); camera.setCaptureMode(QCamera::CaptureViewfinder); camera.start(); viewfinder.show(); MainWindow mainWindow; mainWindow.setCentralWidget(&viewfinder); mainWindow.show(); return a.exec();
}@
-
Hi and welcome to devnet,
You misread that post, I suggested to test against 5.4 to check whether it was working, nothing more.
Currently, QML is the way to access the camera. However, you can embed a QML view like e.g. "here":http://www.ics.com/blog/combining-qt-widgets-and-qml-qwidgetcreatewindowcontainer
Hope it helps
-
Faced a problem regarding the same topic. Could you please confirm the bug if it happens for you also?
-
[quote author="SGaist" date="1414017812"]Hi and welcome to devnet,
You misread that post, I suggested to test against 5.4 to check whether it was working, nothing more.
Currently, QML is the way to access the camera. However, you can embed a QML view like e.g. "here":http://www.ics.com/blog/combining-qt-widgets-and-qml-qwidgetcreatewindowcontainer
Hope it helps[/quote]
Thanks SGaist !
I want to operate some computer vision routines in real time. So I need to access the frames of the video as in OpenCV camera. I spend some times with QML but I only succeed to process the capture frame (see the following code). So because the frame is saved in the file system, we cannot process in real-time.@
import QtQuick 2.0
import QtMultimedia 5.0
import ImageProcessor 1.0
Rectangle {
width: 800
height: 600
color: "black"
state: "PhotoCapture"
Camera {
id: camera
captureMode: Camera.CaptureStillImage
imageCapture {
onImageCaptured: {
imageProcessor.processImage(preview)
}
}focus { focusMode: Camera.FocusAuto } } VideoOutput { source: camera focus : visible // to receive focus and capture key events when visible anchors.fill: parent }
ImageProcessor{
id: imageProcessor
}
Timer {
interval: 1000; running: true; repeat: true
onTriggered: {
camera.imageCapture.resolution = Qt.size(1280,960)
camera.imageCapture.capture()
}
}
}
@
That's why I waited the "the beta of QT 5.4":http://doc-snapshot.qt-project.org/qt5-5.4/cameraoverview.html[quote author="metaDom" date="1414021829"]Faced a problem regarding the same topic. Could you please confirm the bug if it happens for you also?
https://bugreports.qt-project.org/browse/QTBUG-41467[/quote]
Yes I try your code and I have the same bug as you.
I hope that Qt debeloppers will solve this problem because real-time computer vision with Qt android will be fantastic !
-
What library will you use for your processing ?
-
[quote author="SGaist" date="1414105456"]What library will you use for your processing ?[/quote]
I use "Population library ":http://www.population-image.fr/wordpress/
It is an open-source library and a good alternative of OpenCV.I cross my fingers for the release of QT 5.4 to have QWidget to access camera.