/// <summary>
        /// Basic implementation of checking the coordinates falling within the circle.
        /// It generates a square around the center to check the bounding of the given coordinate.
        /// </summary>
        /// <param name="given"></param>
        /// <param name="marked"></param>
        /// <returns></returns>
        public static bool check_mark(Coordinate given, BLOB marked)
        {
            double radius = marked.radius;
            double new_x_right, new_x_left, new_y_top, new_y_bottom;
            new_x_right = marked.x + radius;
            new_y_top = marked.y - radius;
            new_x_left = marked.x - radius;
            new_y_bottom = marked.y + radius;
            
            bool result = false;

            if (given.x <= new_x_right && given.x >= new_x_left && given.y <= new_y_bottom && given.y >= new_y_top)
                result = true;

            return result;
        }
Esempio n. 2
0
        /// <summary>
        /// Basic implementation of checking the coordinates falling within the circle.
        /// It generates a square around the center to check the bounding of the given coordinate.
        /// </summary>
        /// <param name="given"></param>
        /// <param name="marked"></param>
        /// <returns></returns>
        public static bool check_mark(Coordinate given, BLOB marked)
        {
            double radius = marked.radius;
            double new_x_right, new_x_left, new_y_top, new_y_bottom;

            new_x_right  = marked.x + radius;
            new_y_top    = marked.y - radius;
            new_x_left   = marked.x - radius;
            new_y_bottom = marked.y + radius;

            bool result = false;

            if (given.x <= new_x_right && given.x >= new_x_left && given.y <= new_y_bottom && given.y >= new_y_top)
            {
                result = true;
            }

            return(result);
        }
Esempio n. 3
0
        public void blob_detect ()
        {
            Bitmap image = this.scanned_image;
            BlobCounter blob = new BlobCounter();
            blob.FilterBlobs = false;
            
            int blob_ht_width = 30;
            blob.MinHeight = blob_ht_width;
            blob.MinWidth = blob_ht_width;
            blob.ProcessImage(image);
            
            Blob[] b = blob.GetObjectsInformation();
            SimpleShapeChecker shapeChecker = new SimpleShapeChecker();
            /*blob_counter.Text = b.Length.ToString();
            Graphics g = Graphics.FromImage(image2);
            Pen yellowPen = new Pen(Color.Yellow, 5);
            Pen redPen = new Pen(Color.Red, 5);
            Pen greenPen = new Pen(Color.Green, 5);
            int b_counter = 0;
             */
            for (int i = 0, n = b.Length; i < n; i++)
            {
                List<IntPoint> edgePoints = blob.GetBlobsEdgePoints(b[i]);
                List<IntPoint> edges = new List<IntPoint>();
                AForge.Point center;
                float radius;

                if (shapeChecker.IsCircle(edgePoints, out center, out radius))
                {
                
                    if (b[i].Fullness * 100 >= 40 && b[i].Fullness * 100 < 100 && radius > 10)
                    {
                        Coordinate coor = new Coordinate(center.X, center.Y);
                        BLOB blb = new BLOB(coor, radius);
                        useful.Add(blb);
                    }   
                }    
            }
            
        }