How can I connect the white dots in a binary image like this?
6 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
How can I connect the white dots in a binary image like this?

These are edge points detected in an image.
0 Commenti
Risposte (1)
Image Analyst
il 6 Mar 2016
You might want to adjust your edge detection parameters first to get a better image. Other than that you can use a for loop to find the closest point to each point and use linspace() to find a path between them, then burn those points into the image
For each dot pair you've identified:
distance = sqrt((x2-x1)^2+(y2-y1)^2)
spacing = 0.4; % pixels between dots (to make sure we don't skip any)
numPoints = distance/spacing;
xLine = linspace(x1, x2, numPoints);
yLine = linspace(y1, y2, numPoints);
rows = round(yLine);
columns = round(xLine);
for k = 1 : length(xLine)
edgeImage(rows(k), columns(k)) = true;
end
2 Commenti
K M Ibrahim Khalilullah
il 18 Gen 2018
@Image Analyst I have the same problem. Is it possible to use all points together without using for loop that means one pair point(x1,y1) and (x2,y2) ;
Image Analyst
il 18 Gen 2018
Not that I know of. What's wrong with a loop? It should be fast, like less than a millisecond.
Vedere anche
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!