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. However I set the pixelformta of camera but I didn't receive that pixelfomat from qabstractvideosurface
Forum Updated to NodeBB v4.3 + New Features

However I set the pixelformta of camera but I didn't receive that pixelfomat from qabstractvideosurface

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 2 Posters 471 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.
  • J Offline
    J Offline
    Jafar.Sag.Sibil
    wrote on last edited by Jafar.Sag.Sibil
    #1

    Look at the following codes however I set the camera pixel format but received formats does not follow the settings also the startTime and endTime both returns -1

    I'm using android which everybody said that this OS support NV_21 pixelformat

    main.cpp

    	QAbstractVideoSurface * surfacer = new VideoSurfacer;
    
    	QCamera cam ( QCameraInfo::availableCameras ( ).at ( 0 ) );
    	cam.setCaptureMode ( QCamera::CaptureMode::CaptureViewfinder );
    	cam.setViewfinder ( surfacer );
    
    	QCameraViewfinderSettings settings = cam.viewfinderSettings ( );
    	settings.setMaximumFrameRate ( 5 );
    	settings.setMinimumFrameRate ( 1 );
    	settings.setPixelAspectRatio ( 4, 3 );
    	settings.setPixelFormat ( QVideoFrame::Format_NV21 );
    	settings.setResolution ( 800, 600 );
    	cam.setViewfinderSettings ( settings );
    
    	cam.start ( );
    
    	qDebug ( ) << cam.viewfinderSettings ( ).pixelFormat ( ) << endl; // Format NV_21
    

    videosurfacer.cpp

    bool VideoSurfacer::present ( const QVideoFrame & f )
    {
    	QVideoFrame frame ( f );
    	if ( frame.isValid ( ) && frame.map ( QAbstractVideoBuffer::MapMode::ReadOnly ) )
    		{
    			qDebug ( ) << frame.pixelFormat ( ) << endl; //Format_ABGR32
    			frame.unmap ( );
    		}
    	return true;
    }
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Did you check the values returned by QCamera::supportedViewfinderPixelFormats ?

      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
      • J Offline
        J Offline
        Jafar.Sag.Sibil
        wrote on last edited by
        #3

        Yes returns a list with size of 0

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

          How did you called ?

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

          J 2 Replies Last reply
          0
          • J Offline
            J Offline
            Jafar.Sag.Sibil
            wrote on last edited by Jafar.Sag.Sibil
            #5
            qDebug ( ) << cam.supportedViewfinderSettings ( ).size ( ) << endl; // output is : 0
            
            1 Reply Last reply
            0
            • SGaistS SGaist

              How did you called ?

              J Offline
              J Offline
              Jafar.Sag.Sibil
              wrote on last edited by Jafar.Sag.Sibil
              #6

              @SGaist also

              	qDebug ( ) << cam.supportedViewfinderPixelFormats ( settings ).size ( ) << endl;
              

              didn't show anything other than 0

              1 Reply Last reply
              0
              • SGaistS SGaist

                How did you called ?

                J Offline
                J Offline
                Jafar.Sag.Sibil
                wrote on last edited by
                #7

                @SGaist I use an example of QML which works (only a camera with a videooutput) how can I get the pixelformat of this project video frames?

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

                  IIRC, QtQuick video's output supports a larger range of formats without conversions or rather, the conversion is done in the last shader of the rendering pipeline,

                  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