Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How could Camera take photo into buffer instead of saving?
Forum Updated to NodeBB v4.3 + New Features

How could Camera take photo into buffer instead of saving?

Scheduled Pinned Locked Moved Unsolved General and Desktop
5 Posts 3 Posters 675 Views 1 Watching
  • 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.
  • A Offline
    A Offline
    ajee
    wrote on last edited by
    #1

    Hi,

    I know there were many guys already asking this problem when I search on this topic. For example, on StackOverflow and on this forum. But so far I don't see any perfect solution, the purposed ideas are:

    1. After the picture is saved into flash/disk, read it out and delete the saved one. This has performed two IO operations, not friendly enough and requires lots of code.
    2. Set CapturetoBuffer, but somebody said this is not promising to work on every platform (e.g. IOS). And I tried with QML : imgCap.setCaptureDestination = CameraCapture.CaptureToBuffer, when running there is no error but it does still save to flash.

    since the posts are a bit old (two or more years ago), I just wonder if now Qt/QML has better support for this? And I wonder why consider this functionality at the first design since it has lots of usage for example QR scanning.

    Thanks

    ODБOïO 1 Reply Last reply
    0
    • A ajee

      Hi,

      I know there were many guys already asking this problem when I search on this topic. For example, on StackOverflow and on this forum. But so far I don't see any perfect solution, the purposed ideas are:

      1. After the picture is saved into flash/disk, read it out and delete the saved one. This has performed two IO operations, not friendly enough and requires lots of code.
      2. Set CapturetoBuffer, but somebody said this is not promising to work on every platform (e.g. IOS). And I tried with QML : imgCap.setCaptureDestination = CameraCapture.CaptureToBuffer, when running there is no error but it does still save to flash.

      since the posts are a bit old (two or more years ago), I just wonder if now Qt/QML has better support for this? And I wonder why consider this functionality at the first design since it has lots of usage for example QR scanning.

      Thanks

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #2

      @ajee Hi, could it be possible to create a QPixmap from the image and then use save() method ?

      QPixmap m_px = QPixmap::fromImage(newImage);
      
      // doc  : https://wiki.qt.io/Converting_QPixmap_to_QByteArray
      
      QByteArray bArray;
      QBuffer buffer(&bArray);
      buffer.open(QIODevice::WriteOnly);
      m_px.save(&buffer, "PNG");
      
      1 Reply Last reply
      0
      • A Offline
        A Offline
        ajee
        wrote on last edited by
        #3

        @LeLev Thanks. But my question is, taking photo from Camera , don't save it to flash but to buffer. What you purpose is still saving the picture to flash (default behavior of Camera ), then read it again from this saved image.

        1 Reply Last reply
        0
        • ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by
          #4

          @ajee yes. My bad, sry

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            Hi,

            Not all platforms implements the QCameraCaptureDestinationControl interface (as it might not be always possible depending on the platform). So it might indeed not work as you would like.

            However plugins are not written in stone, so you may take a look and add it to the platform you are interested in.

            It's nothing QML is responsible for.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            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