Ask Your Question

PeterWeter's profile - activity

2020-06-23 05:58:33 -0600 received badge  Popular Question (source)
2015-03-29 07:39:29 -0600 asked a question How to prepare the footage or use detection on actioncam footage?

I want to follow an object on actioncam footage(like gopro). That means, it is a fisheye-view with distortions. How to prepare the footage or use detection on actioncam footage?

2015-03-28 19:16:38 -0600 asked a question How to build your own eye detection classifier algorithm?

I created an eye classifier with 278 self-cut eye-pictures and 31 random background pictures. It detects eyes 96% of the time but also a lot of false positives. How to approach this task?

  1. Build a stronger classifier, ie more pictures?
  2. Do that later in software? How?
  3. ...
2015-03-28 16:20:52 -0600 commented question How to avoid the OpenCV out of memory exception?

@berak That solved it. Great!

2015-03-28 16:20:40 -0600 commented question How to avoid the OpenCV out of memory exception?

@matman How do you use the Mat structure? I tried CvMat img = cap.QueryFrame();

2015-03-28 13:19:31 -0600 asked a question How to avoid the OpenCV out of memory exception?

I am using OpenCvSharp and this code to get the position of a user's eyes.

CvCapture cap = CvCapture.FromCamera(CaptureDevice.Any);
using (CvWindow w = new CvWindow("Eye Tracker"))
{

    while (CvWindow.WaitKey(10) < 0 && beginn) //beginn)
    {
        using (IplImage img = cap.QueryFrame())
        using (IplImage smallImg = new IplImage(new CvSize(Cv.Round(img.Width / Scale), Cv.Round(img.Height / Scale)), BitDepth.U8, 1))
        {

            using (IplImage gray = new IplImage(img.Size, BitDepth.U8, 1))
            {
                Cv.CvtColor(img, gray, ColorConversion.BgrToGray);
                Cv.Resize(gray, smallImg, Interpolation.Linear);
                Cv.EqualizeHist(smallImg, smallImg);
            }

            using (CvHaarClassifierCascade cascade = CvHaarClassifierCascade.FromFile(@"D:\haarcascade_eye.xml"))
            using (CvMemStorage storage = new CvMemStorage())
            {
                storage.Clear();
                CvSeq<CvAvgComp> eyes = Cv.HaarDetectObjects(smallImg, cascade, storage, ScaleFactor, MinNeighbors, 0, new CvSize(30, 30));
                if (eyes.Total == 2)
                {

                    // do something
                }
                w.Image = img;
            }
        }
    }
}

It works, but the program gets bigger and bigger in memory till it finally says that it doesn't have enough and points at

CvSeq<CvAvgComp> eyes = Cv.HaarDetectObjects(smallImg, cascade, storage, ScaleFactor, MinNeighbors, 0, new CvSize(30, 30));

How to solve this out of memory exception?