Захват фреймов из opencv и glade Gstreamer - PullRequest
0 голосов
/ 26 мая 2020

Я пытаюсь заставить gstreamer захватывать кадры и помещать их в окно с картинками на форме поляны, это мой фрагмент кода, может ли кто-нибудь дать мне руководство

  GstCaps *caps = gst_sample_get_caps(sample);
        // Get a string containg the pixel format, width and height of the image        
        str = gst_caps_get_structure (caps, 0);    

        if( strcmp( gst_structure_get_string (str, "format"),"BGRx") == 0)  
        {
            // Now query the width and height of the image
            gst_structure_get_int (str, "width", &width);
            gst_structure_get_int (str, "height", &height);

            // Create a cv::Mat, copy image data into that and save the image.
            d->OpenCVImage.create(height,width,CV_8UC(4));
            memcpy( d->OpenCVImage.data, info.data, width*height*4);
        }
    }

    // Calling Unref is important!
    gst_buffer_unmap (buffer, &info);
    gst_sample_unref(sample);

#endif
    d->bImageReceived = true; 
    d->pImageEvent->set(); // Set the event, so the image will be processed
}
return GST_FLOW_OK;
...