Note that there are some explanatory texts on larger screens.

plurals
  1. PODetect small rectangles in image AForge
    primarykey
    data
    text
    <p>I'm trying to detect rectangles on this image:</p> <p><img src="https://i.stack.imgur.com/ON1rH.png" alt="enter image description here"></p> <p>with this code: </p> <pre><code>static void Main(string[] args) { // Open your image string path = "test.png"; Bitmap image = (Bitmap)Bitmap.FromFile(path); // locating objects BlobCounter blobCounter = new BlobCounter(); blobCounter.FilterBlobs = true; blobCounter.MinHeight = 5; blobCounter.MinWidth = 5; blobCounter.ProcessImage(image); Blob[] blobs = blobCounter.GetObjectsInformation(); // check for rectangles SimpleShapeChecker shapeChecker = new SimpleShapeChecker(); foreach (var blob in blobs) { List&lt;IntPoint&gt; edgePoints = blobCounter.GetBlobsEdgePoints(blob); List&lt;IntPoint&gt; cornerPoints; // use the shape checker to extract the corner points if (shapeChecker.IsQuadrilateral(edgePoints, out cornerPoints)) { // only do things if the corners form a rectangle if (shapeChecker.CheckPolygonSubType(cornerPoints) == PolygonSubType.Rectangle) { // here i use the graphics class to draw an overlay, but you // could also just use the cornerPoints list to calculate your // x, y, width, height values. List&lt;Point&gt; Points = new List&lt;Point&gt;(); foreach (var point in cornerPoints) { Points.Add(new Point(point.X, point.Y)); } Graphics g = Graphics.FromImage(image); g.DrawPolygon(new Pen(Color.Red, 5.0f), Points.ToArray()); image.Save("result.png"); } } } } </code></pre> <p>but it dont recognize the rectangles (walls). It just recognize the big square, and when I reduce the minHeight and minWidth, it recognize trapezoids on the writing..</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload