Richard Whitehouse
Richard Whitehouse

Reputation: 691

Point exists in boundaries of line

As a human, it's relatively easy to see a load of points and find an obvious pattern.

e.g turning

enter image description here

into

enter image description here

What I'm trying to do is to find out whether point x, would sit on the black line on image 2, if I've only got the points of image 1, preferably using .net, but I should be able to convert other languages (whether coding / general math formulas) whether by using a plugin or not. I'm not overly fussed it being an "image", just done for visualisation.

I realise the title and tags aren't the best, but not sure on the right description and how to categorise the question. :-)

Upvotes: 0

Views: 50

Answers (1)

Olivier Jacot-Descombes
Olivier Jacot-Descombes

Reputation: 112762

I made some experiments with your 1st image in Corel Paint Shop and applied these operations: Erode, Erode, Median filter 5, Dilate. The result resembles your second image. The way to go is to do such experiments and then to implement it by using an image processing library.

enter image description here

"Erode" adds a dark border around dark pixels, i.e., it erodes the bright parts. The end effect after applying it twice is that the inner and outer dotted lines merge together and form a very thick line. The Median filter makes smoother lines and closes small wholes. "Dilate" expands the bright pixels, i.e., it makes the very thick line thinner.

You can improve the result by applying some blur at the beginning (this makes rounder shapes) and then reduce the number of colors to 2 at the end to get a sharp image.

Upvotes: 3

Related Questions