# How to find likely path of connection between dots

4 views (last 30 days)
jon gorecki on 8 Nov 2022
Commented: jon gorecki on 30 Nov 2022
I have a set of data (2x2000) consisting of X & Y coordinates for a series of points. These datapoints are generated as all the possible solutions to a function.
As you can see in the plot (left side) the datapoints can be grouped together into 'chains' of smooth continuous lines (I highlighted some examples in red on the Right side) and I would like to find an automated process for determining the lines which can be fitted to these datapoints.
Any help would be appreciated. Many thanks!
jon gorecki on 30 Nov 2022
unfortunately I have not come to a good end solution but I was able to chip away a few layers of the problem. In my case I am only concerned with a 'chain' of solutions that can stretch fully from the left (x=300) to the right (x=400) in a smooth continuous path.
step 1: remove any dot with a Y value of 1.1 or 2 (this removes the extreme values as I can say they are going outside of the physical domain of the problem)
Step 2: go through the points one by one and measure if they have a neighbouring point on either side (horizontally) within a Y value tolerance. If not I remove this point. I keep cycling through this loop until the solution stops changing. In this way I am able to remove many of the unwanted datapoints.
Step 3 was to do a 2D convolution with a bowtie shape mask (example below) where the rationale was that this should preferentially highlight pixels with a smooth continuous chain.
step 4: take the convoluted image and pick the point of maximum intensity at each X value. Finished
Overall it works OK, it gets quite close to the true answer but im not happy with at as its not a very precice method. I would much prefer a method to isolate individual 'chains' of datapoints as you may do by eye.
I have also tried a method to of gradient minimisation whereby I start at a datapoint and then look at the points on the right and left and find which combination of 3 points results in the minimum gradients. This method did not work very well, but I think if I increased it to 5 points (+/- 2 on each side) then it may be much improved.
Finally, I looked at functions of graydist and bwdist. I feel they could be very useful in this problem but its not immediately obvious how I would utilise them to solve this problem.

### Categories

Find more on Image Processing Toolbox in Help Center and File Exchange

R2020b

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!