Unsolved Display the QML screen on Ui :: MainWindow
-
@SGaist said in Display the QML screen on Ui :: MainWindow:
As I already wrote: use OpenCV directly to get the data from the camera.
As I tried the Qt Android does not support OpenCv open directly from the camera, for example the following function always returns false
capture.open(0); // mở camera 0 if(!capture.isOpened()) { qDebug() << "Could not open camera" << 0; return; }
There are many places on the forum that also talk about this
https://forum.qt.io/topic/41961/accessing-the-android-camera-in-qt/16
and
https://github.com/opencv/opencv/issues/11952Thanks!
-
Which version of OpenCV are you using ?
This merge request implemented the Androïd support.
-
@SGaist said in Display the QML screen on Ui :: MainWindow:
Which version of OpenCV are you using ?
This merge request implemented the Androïd support.I use Qt5.15, OpenCV4.5.2, I hope you can show me how to use it
with this Opencv + Qt, I am still using its features normally, except for taking video directly from the cameraRegards!
-
Did you check that you are using the API level 24 as indicated in the patch ?
-
@SGaist said in Display the QML screen on Ui :: MainWindow:
Did you check that you are using the API level 24 as indicated in the patch ?
Hi !
I am using API30, but the integration of this suite is relatively complicated, because my English is limited, so I have not done this yet, I hope that next time there will be an easier approach. Thank you very much! -
-
Tutorial of what ?
-
@SGaist
Is there any tutorial with Qt C ++? I want detailed tutorial on reading realtime camera using opencv on android, as you said, there is this merge request implemented the Android support,
I also tried using QVideoProbe, but the camera video format is still wrong, I'm stuckvoid MainWindow::handleFrame(QVideoFrame frame) { tien++; qDebug() << tien; auto input_w = frame.width(); auto input_h = frame.height(); auto cam_data = frame.bits(); Mat yuyv(input_h+input_h/2, input_w,CV_8UC1, &cam_data); Mat rgb (input_h, input_w,CV_8UC4); cvtColor(yuyv, rgb, cv::COLOR_YUV2BGRA_NV21); QImage img= QImage((const unsigned char*)(yuyv.data), yuyv.cols,yuyv.rows, QImage::Format_BGR888); }
Thanks!
@SGaist said in Display the QML screen on Ui :: MainWindow:
Which version of OpenCV are you using ?
This merge request implemented the Androïd support.
-
You did not check the type of video frame you get. From memory, on Androïd it's an OpenGL texture.
No, I do not have a tutorial at hand however there are already many applications running OpenCV in conjunction with Qt. Use the search feature of this forum. There are already been several question related to that subject.
-
@SGaist said in Display the QML screen on Ui :: MainWindow:
You did not check the type of video frame you get. From memory, on Androïd it's an OpenGL texture.
No, I do not have a tutorial at hand however there are already many applications running OpenCV in conjunction with Qt. Use the search feature of this forum. There are already been several question related to that subject.
Hello!
I am also using openecv with Qt android, everything is very good, except getting realtime data of the camera, i have also spent a lot of time searching the forum, but haven't found anyone who can do it real time from camera, thank you!