0

I could generate Haar cascade classifier detecting traffic signs. When I use it with frames from webcam (1.3MP) it works pretty well in real time, but when I try to detect signs from video of mp4 format taken to phone camera (8MP), function DetectMultiScale(grayframe, 1.3, 10, Size.Empty) works way too slower (it detects though) causing huge delays, so original frame rate is not followed. My final goal is to recognize signs from Android phone camera in real time, but first I wanna create a desktop app.

I tried to change format of the videos to .wmv, .avi, .mpg, but result is the same. Probably, the reason is a resolution of the video, but I cannot resize it, otherwise it's impossible to find an object in resized frame (too small).

Here is my piece of code of C# with Emgu Cv library

     _capture = new Capture(@"videos\testing.mp4");
     Mat frame = _capture.QueryFrame();
     if (frame != null)
        {
            _cascadeClassifier = new     CascadeClassifier(Application.StartupPath + "/cascade.xml");

            var cpimg = frame.ToImage<Bgr, byte>();
            Image<Gray, Byte> grayframe = cpimg.Convert<Gray, Byte>();

            try {
                var signs = _cascadeClassifier.DetectMultiScale(grayframe, 1.3, 6, Size.Empty);

                foreach (var sign in signs)
                {
                    cpimg.Draw(sign, new Bgr(Color.Blue), 3);
                }
            }
            catch(Exception ex)
            { 
                MessageBox.Show(ex.Message);
            }
           pictureBox1.Image = cpimg.Bitmap;
        }

I changed parameteres of the function, but still it is not enough. Is there any other way to accelerate DetectMultiScale() to work in real time with the given video or any other solution?

Azik
  • 63
  • 1
  • 6

0 Answers0