Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Access camera frame of android without drawing them and send them back to c++



  • I would like to access the camera frames of Android mobile, process them and draw the results by the Qt5, have tried with the Android ndk but it fail(post at here). All of the examples I found teach us how to use the Intent to use the camera app, or draw the camera frame on some sort of Surface, could I access the camera frames without drawing them? All I need is reading the frames of the camera continuous and send the camera buffer to c++. Thanks



  • A widget based camera would have a QVideoSurface, but it doesn't need to draw anything. It just receives frames in present() and after converting them to a "Qt digestible format" from YUV_NV21, sends them away for something that displays them (or further processes them).



  • @mvuori I have tried with QCamera before, it do not work on Android. There is a solution which work, use the qml camera to open the camera of android, send them back to c++ api(copy the memory of the frames from gpu to cpu), convert to appropriate format(cv::Mat, QImage etc), send the frames back to qml(copy from cpu to gpu). Definitely not a good choice if you want to develop a real time computer vision app. Access the frames of android and process always a difficult issue when using c++.

    ps : Send the frames from JNI back to c++ api is not a good solution either, guess I have to give up on Qt and prefer java to develop the app.

    Edit : Tried again with Qt5.12.3, QCamera still don't work on android(camera example come with Qt5)



  • @tham said in Access camera frame of android without drawing them and send them back to c++:

    @mvuori I have tried with QCamera before, it do not work on Android. There is a solution which work, use the qml camera to open the camera of android, send them back to c++ api(copy the memory of the frames from gpu to cpu), convert to appropriate format(cv::Mat, QImage etc), send the frames back to qml(copy from cpu to gpu). Definitely not a good choice if you want to develop a real time computer vision app. Access the frames of android and process always a difficult issue when using c++.

    ps : Send the frames from JNI back to c++ api is not a good solution either, guess I have to give up on Qt and prefer java to develop the app.

    Edit : Tried again with Qt5.12.3, QCamera still don't work on android(camera example come with Qt5)

    Hello
    I use Qt5.15, running example of Qcamera on Samsung Android 11 machine, also not showing realtime video, I am also stuck with Qt C++ Camera, have you solved the problem?


Log in to reply