public List <DetectedDoor> GetDoors(object data)
        {
            IFrame infraredFrame = data as IFrame;

            if (infraredFrame == null)
            {
                return(null);
            }
            List <DetectedDoor> doors = new List <DetectedDoor>();

            //Image<Bgr, Byte> smoothed = img.SmoothGaussian(15);
            //Image<Gray, Byte> threshold = FilterColor(smoothed);
            //threshold = SimplifyImage(threshold, 100);

            // new method

            //new method end
            using (MemStorage stor = new MemStorage())
            {
                Bitmap bmp = infraredFrame.GetBMP();
                //Bitmap bmp2 = bmp.Clone(new Rectangle(0, 0, bmp.Width, bmp.Height), bmp.PixelFormat);
                //Image<Bgr, Byte> img = new Image<Bgr, Byte>(bmp2);
                Image <Gray, Byte> grey;
                try
                {
                    grey = new Image <Gray, Byte>(bmp);
                }
                catch (Exception)
                {
                    return(null);
                }

                //CvInvoke.cvInRangeS(img.Ptr, new MCvScalar(0.0, 0.0, 0.0), new MCvScalar(250.0, 250.0, 250.0), grey.Ptr);

                //new method
                CvInvoke.cvErode(grey.Ptr, grey.Ptr, (IntPtr)null, 1);
                CvInvoke.cvDilate(grey.Ptr, grey.Ptr, (IntPtr)null, 2);
                Image <Gray, Byte> cannyEdges = grey.Canny(180, 120);
                LineSegment2D[]    lines      = cannyEdges.HoughLinesBinary(
                    1,              //Distance resolution in pixel-related units
                    Math.PI / 45.0, //Angle resolution measured in radians.
                    20,             //threshold
                    5,              //min Line width
                    10              //gap between lines
                    )[0];           //Get the lines from the first channel

                LineSegment2D[] container = null;

                container = FilterAndMergeVerticalLines(lines, 1);
                container = FilterShortLines(container, 100);
                container = FindVerticalDoorFrameLines(container, 500, grey);

                if (container != null)
                {
                    int       boxX      = container[0].P1.X;
                    int       boxY      = container[0].P1.Y;
                    int       boxWidth  = container[1].P1.X - boxX;
                    int       boxHeight = container[1].P2.Y - boxY;
                    Rectangle newBox    = new Rectangle(boxX, boxY, boxWidth, boxHeight);
                    int       centerX   = (newBox.Left + newBox.Right) / 2;
                    int       centerY   = (newBox.Bottom + newBox.Top) / 2;
                    DetectedDoor.DetectionConfidence confidence = GetConfidence(newBox, grey.Size);
                    int          centerXOffset = centerX - (grey.Size.Width / 2);
                    double       angle         = -Math.Atan2(-centerY, centerXOffset) - Math.PI / 2;
                    DetectedDoor newDoor       = new DetectedDoor(newBox, grey.Size, confidence, angle, 0, DetectedDoor.DetectMethod.INFRARED);
                    doors.Add(newDoor);
                }
            }
            return(doors);
        }