Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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

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

Regards, Kishan Patel.

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

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.

click to hide/show revision 3
None

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

berak gravatar image

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

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: below:

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

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;

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.