GLib-GObject-CRITICAL error in code Saving specific (matching) frames from a whole video

asked 2014-01-08 05:11:02 -0500

Prak gravatar image

updated 2014-01-08 07:56:19 -0500

berak gravatar image

I want to continuously compare a video with a set of frames I have and save the sae frames occuring in that long video. I have tried using SURF and FLANN matching , but the video is not getting captured in the first place and i am getting following error :

(<unknown>:14784): GLib-GObject-CRITICAL **: g_object_set: assertion `G_IS_OBJECT (object)' failed Didnt Find Video File... OpenCV Error: Assertion failed (scn == 3 || scn == 4) in cvtColor, file /home/vuadmin/OpenCV-2.3.1/modules/imgproc/src/color.cpp, line 2834 terminate called after throwing an instance of 'cv::Exception' what(): /home/vuadmin/OpenCV-2.3.1/modules/imgproc/src/color.cpp:2834: error: (-215) scn == 3 || scn == 4 in function cvtColor

And i also get the GLib-GObject-CRITICAL error while trying out the starter_video.cpp in the Opencv/samples/cpp folder.

Please help me to figure out the issue.

edit retag flag offensive close merge delete

Comments

please check, if your input image to cvtColor has 3 or 4 channels. (it probably hasn't)

berak gravatar imageberak ( 2014-01-08 06:27:39 -0500 )edit

The cvtColor is not getting any image because the VideoCapture is not able to read the .ts video . The code is as follows: VideoCapture cap("video.ts"); if(!cap.isOpened())
{
cout << "Didnt Find Video File..." << endl; } namedWindow("videoImage",1); Mat queryImage,videoImage;int nImages=1; for (int i =1; i <=nImages; i++) { for (;;) { Mat frame; cap >> frame; // get a new frame from video cvtColor(frame, videoImage, CV_BGR2GRAY);

Prak gravatar imagePrak ( 2014-01-08 22:28:50 -0500 )edit