Ask Your Question

Suramrit's profile - activity

2015-03-11 22:59:17 -0500 received badge  Student (source)
2014-05-05 14:44:11 -0500 commented question Error reading video using VideoCapture while applying MOG

Also, I seem to be getting: Bad flag (Unrecognized or unsupported array type)

2014-05-05 14:03:45 -0500 commented question Error reading video using VideoCapture while applying MOG

Yes, it seems I am getting empty frames from the capture even in the first iteration. Why would this be happening? Already removed the useless line

2014-05-05 13:52:59 -0500 commented question Error reading video using VideoCapture while applying MOG

Sorry about that, it was for something I was trying earlier! Ive tried both using '/' and a '\', still get the same error.

2014-05-05 13:28:00 -0500 asked a question Error reading video using VideoCapture while applying MOG

I am trying to apply MOG background subtraction to an acquired video, stored in .avi format. I have taken the link at here but have changed it.

Im using the CaptureVideo as:

        #include "stdafx.h"
        #include <cv.h>
        #include <cxcore.h>
        #include <highgui.h>
        #include <cvaux.h>

        #include <opencv2/video/background_segm.hpp>
        #include <stdio.h>
        #include <opencv2/video/video.hpp>
        using namespace cv;
        using namespace std;
        Mat frame; //current frame
        Ptr<BackgroundSubtractor> pMOG; //MOG Background subtractor
        void processImages(char* firstFrameFilename);
        void processVideo(string name);//(char* videoFilename);

        string path = "C:\\Users\Suramrit Singh\Documents\Visual Studio 2010\Projects\opencvtest\opencvtest\walk2.avi"
                int main()
            {
            namedWindow("Frame");
            namedWindow("FG Mask MOG");
            pMOG= new BackgroundSubtractorMOG(); //MOG approach
            //processImages("asd1.jpg");--- cant work on single images

            processVideo(path);//("tusharwalk2.avi");
            destroyAllWindows();

            return EXIT_SUCCESS;
            }
        void processVideo(string name){//(char* videoFilename) {
            //create the capture object
            VideoCapture capture(path);

            printf("Sucess?%d",capture.isOpened());
            for(int i=0;i<6000;i++)
            {
            capture >> frame;
            capture.read(frame);


            pMOG->operator()(frame, fgMaskMOG); // -----------------creatingproblem----------------------

            IplImage* image2=cvCloneImage(&(IplImage)frame);
            printf("%d", i);
            imshow("FG Mask MOG", fgMaskMOG);
            keyboard = waitKey(1);
            }
           //delete capture object
        capture.release();
    }

Now if I change it to default cam VideoCapture capture(0), it works, but does not do so with the .avi file path provided and gives the following runtime error:

"Unhandled exception at 0x000007fd7835811c in opencvtest.exe: Microsoft C++ exception: cv::Exception at memory location 0x0081eb60.."

Please, I'm a newcomer to image processing and any help will be highly appreciated as I've been stuck at this problem for a few days now and can't seem to figure it out.

2014-05-05 12:45:34 -0500 commented answer Measuring the physical distance between two points on an image

So you mean I take a measured object in the image and use that to calculate the distance of the step? How do I use this reference, any ideas?

2014-05-04 01:02:31 -0500 asked a question Measuring the physical distance between two points on an image

As a requirement for a project, I need to find the walking step distance taken by a person, whose image while walking has been acquired. I have acquired a binary silhouette of the person using background subtraction and now need to calculate the actual physical distance of the step. Is there a method to convert pixel distance to physical distance in OpenCV? And if not, then what method can be applied to achieve the same?