Blob edges
in
Contributed Library Questions
•
2 years ago
I'm looking to get each edge drawn as a single line, until the edges angle changes.
Is it just blobscanner or is this the way that all blob detection works?
The code below shows that the scanner goes top to bottom to find the edges of the shape so points are not in a proper order along the line, they bounce back and forth.
- import Blobscanner.*;
- PImage img;
- Detector bd;
- PVector[] edge;
- int i;
- void setup()
- {
- size(1800,900);
- img = loadImage("NavMap1.png");
- //img.filter(THRESHOLD);
- bd = new Detector(this,0,0,img.width,img.height,255);
- DetectBlobs();
- EdgeDetails();
- }
- void draw()
- {
- }
- void EdgeDetails()
- {
- for(int i=0;i<bd.getBlobsNumber();i++)
- {
- edge = bd.getEdgePoints(i);
- }
- for(int p=0;p < edge.length;p++)
- {
- stroke(0,255,0);
- point(edge[p].x,edge[p].y);
- float p1X = edge[p].x; float p1Y = edge[p].y;
- float p2X = edge[p+1íge.length].x; float p2Y = edge[p+1íge.length].y;
- line(p1X,p1Y,p2X,p2Y);
- p++;
- }
- }
- void DetectBlobs()
- {
- color contoursCol = color(255, 0, 0);
- int contoursThickness = 2;
- image(img,0,0);
- img.loadPixels();
- bd.findBlobs(img.pixels,img.width,img.height);
- bd.loadBlobsFeatures();
- //bd.drawContours(contoursCol, contoursThickness);
- }
Does anyone have a good way to do this?
I can get the edges, but I wind up with 1278 edges when i really want 20.
This is the image I'm currently working with.
1