How can pass raw data of RGB/BGR format to read

asked 2018-09-21 03:58:23 -0600

kishan patel gravatar image

updated 2018-09-21 04:59:53 -0600

berak gravatar image

Actually, When i open video file of raw_data in RGB/ BGR format. It could not open. What should be wrong with this?

Please check lines of code as below:

/**
 * @function main
 */
int main( void )
{
  VideoCapture capture;
  Mat frame;

  //-- 1. Load the cascades
  if( !face_cascade.load( face_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; };
  if( !eyes_cascade.load( eyes_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; };

  //-- 2. Read the video stream
  //capture.open( -1 );
  //capture.open("test_rgb.mp4");
  //capture.open("vid_web_input1.mov");
  capture.open("video_test.rgb");
  //capture.open("rgb.avi");
  //capture.open("1.rgb");
  //capture.open("2.rgb");
  //capture.open("rtsp://admin:jenex#[email protected]:554");
  //capture.open("rgb.mov");
  //capture.open("/home/kishan/HD_CAM_1280_720.avi");
  //capture.open(0);
  if( capture.isOpened() )
  {
          int total_frames = 0;
          int frame_width, frame_height;
          //char frame_codec_type[6]={0};
          double frame_codec_type=0;

          total_frames = capture.get(CV_CAP_PROP_FRAME_COUNT);
          frame_width = capture.get(CV_CAP_PROP_FRAME_WIDTH);
          frame_height = capture.get(CV_CAP_PROP_FRAME_HEIGHT);
          frame_codec_type = capture.get(CV_CAP_PROP_FOURCC);

          printf("\nNo. of Frames= %d\nwidth= %d\nheight= %d\ntype= %lf\n",total_frames, frame_width, frame_height, frame_codec_type);
for(;;)
{
  capture >> frame;

  //-- 3. Apply the classifier to the frame
  if( !frame.empty() )
   { detectAndDisplay( frame ); }
  else
   { printf(" --(!) No captured frame -- Break!"); break; }

  int c = waitKey(10);
  if( (char)c == 'c' ) { break; }

Regards, Kishan Patel.

edit retag flag offensive close merge delete

Comments

1

It could not open. What should be wrong with this? Too general, please provide error messages and relevant code pieces, otherwise people cannot help you.

I am assuming your have a video encoded with a specific codec and want to read in the frames. The class for capturing frames is VideoCapture. If you have a problem with that you either have encoding problems (my guess now) or some hardware related problems (camera)

holger gravatar imageholger ( 2018-09-21 04:14:23 -0600 )edit

video file of raw_data in RGB/ BGR format

what exactly is this ? please be more concise.

also, we cannot help, without seing code here.

berak gravatar imageberak ( 2018-09-21 04:14:36 -0600 )edit

Okay, if( !face_cascade.load( face_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; }; if( !eyes_cascade.load( eyes_cascade_name ) ){ printf("--(!)Error loading\n"); return -1; };

//-- 2. Read the video stream //capture.open( -1 ); //capture.open("test_rgb.mp4"); //capture.open("vid_web_input1.mov"); capture.open("video_test.rgb"); //capture.open("rgb.avi"); //capture.open("1.rgb"); //capture.open("2.rgb"); //capture.open("rtsp://admin:jenex#[email protected]:554"); //capture.open("rgb.mov"); //capture.open("/home/kishan/HD_CAM_1280_720.avi"); //capture.open(0); if( capture.isOpened() ) {

kishan patel gravatar imagekishan patel ( 2018-09-21 04:29:04 -0600 )edit

I have just open and play video file of raw data in RGB/BGR format. This video file can be play by "vooya" software in ububtu system.

kishan patel gravatar imagekishan patel ( 2018-09-21 04:30:20 -0600 )edit

error: [IMGUTILS @ 0x7ffccb6f6790] Picture size 0x0 is invalid

(app:3043): GLib-GObject-CRITICAL **: g_object_set: assertion 'G_IS_OBJECT (object)' failed

kishan patel gravatar imagekishan patel ( 2018-09-21 04:31:34 -0600 )edit

for heavens sake, put your code into your question, (where it belongs), not into comments.

berak gravatar imageberak ( 2018-09-21 04:35:55 -0600 )edit

Okay, Now fine?

kishan patel gravatar imagekishan patel ( 2018-09-21 04:50:33 -0600 )edit

Well if you have problems - try to split it - Can you try the video capture part on another video and see if you can capture at all?

Your error message includes the following part: " [IMGUTILS @ 0x7ffccb6f6790] Picture size 0x0 is invalid"

Can you also try out the sample code from the video capture sample on your video?

holger gravatar imageholger ( 2018-09-21 04:52:51 -0600 )edit

Yes, I have tried to use another video_file as you can see in code. I have comment out remaining video_files.

kishan patel gravatar imagekishan patel ( 2018-09-21 04:57:00 -0600 )edit

Yes, i am using sample code name objectdetection(path: samples/cpp/tutorialcode/objectdetection)

kishan patel gravatar imagekishan patel ( 2018-09-21 05:07:19 -0600 )edit