Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Access camera frame of android without drawing them and send them back to c++

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

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
5 Posts 4 Posters 696 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • thamT Offline
    thamT Offline
    tham
    wrote on last edited by
    #1

    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

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mvuori
      wrote on last edited by
      #2

      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).

      thamT 1 Reply Last reply
      1
      • M mvuori

        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).

        thamT Offline
        thamT Offline
        tham
        wrote on last edited by tham
        #3

        @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)

        DQUY05D 1 Reply Last reply
        0
        • thamT tham

          @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)

          DQUY05D Offline
          DQUY05D Offline
          DQUY05
          wrote on last edited by
          #4

          @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?

          ad1170A 1 Reply Last reply
          0
          • DQUY05D DQUY05

            @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?

            ad1170A Offline
            ad1170A Offline
            ad1170
            wrote on last edited by
            #5

            @DQUY05 Just in case that is still interesting for you. I have solved this by using the QVideoProbe and handle the frames in a slot connected to the QVideoProbe::videoFrameProbed signal.
            The QImage is created using QVideoFrame::image() function.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved