//convert buffer to mat and image save
GstMapInfo map_info;
gst_buffer_map(buf, &map_info, GST_MAP_READ);
uint8_t* image_data = map_info.data;
cv::Mat image(1280, 960, CV_8UC3, image_data);
//cv::cvtColor(image, image, cv::COLOR_RGBA2BGR);
cv::imwrite("/opt/nvidia/deepstream/deepstream-6.0/sources/apps/sample_apps/deepstream_lpr_app/deepstream-lpr-app/Frames/" + std::to_string (frame_number) + ".jpg", image);
gst_buffer_unmap(buf, &map_info);
This solution is not working its give me black image.
please guide me with improved code in c++.