08-19-2022 04:12 AM - edited 08-19-2022 04:15 AM
Hello,
After some vision operation, I estimated some points which represent the middle line of an image contour as:
After, applying B-spline algorithm, I expect a curve such as one :
However, the output result is:
Can anybody help me to solve this problem?
Thanks in advance
Solved! Go to Solution.
08-19-2022 04:01 AM
Hello,
I need to develop a program to find the middle line for variety image contours (different shapes). I have already found a way to extract the middle line by using the distance transform, skeleton and some other morphology algorithms:
Now, My problem is curve fitting. After applying B-spline algorithm, I obtained the following result:
this is in the contrary of my expectoration as:
Do you have any idea?
Thank you for your help in advance.
08-19-2022 04:37 AM - edited 08-19-2022 04:48 AM
Hi Erfan,
@Erfan_Persia wrote:
Can anybody help me to solve this problem?
Well, we would help much better once you attach a VI with your data embedded and the currently used algorithm so we can examine/run/debug/edit that VI…
Edit:
No need to post the same question twice in different threads. Keep related discussions in one place!
08-19-2022 07:22 AM
have you sorted those x,y point pairs ?
are you using all points at once or are you using subsets eg. 4 points ?
long time ago, I posted this demo to calculate bezier curves natively in LabView:
08-19-2022 03:03 PM - edited 08-19-2022 03:05 PM
Hi,
You may find the vi and data set files in the attachments.
After sorting the data, the outcome result is:
Thanks,
Erfan
08-19-2022 03:42 PM
I'm pretty sure that the problem is that the spline fit needs to get the points to fit in order, but when you say you "sorted the points" what you are actually saying is that you sorted them by one of their coordinate values... NOT the order the points should appear in.
If your data looks somewhat circular all the time, you could try something like this instead:
1. Start by doing a circle fit. LabVIEW doesn't have one, but it has a sphere fit which works as a circle fit if you just use zero for all of the Z values.
2. Take the center of that circle. From there, calculate the angle to each point.
3. Sort the points by that angle.
4. Pass the points using that sorting to the spline algorithm.
If your data doesn't always look circular you might have to get more creative with the sorting, but you need to put them in actual order, not just sort by one column of values and disregard the order of the other column.
08-19-2022 03:53 PM
My data could represent any shape !
What do you mean by "actual order" ?
08-19-2022 04:41 PM - edited 08-19-2022 04:41 PM
08-19-2022 04:59 PM
thank you for your reply !
Do you have any idea to develop the algorithm?
May I use complex numbers theory?
08-19-2022 05:07 PM
Well the best I can think of is one where you start at one end somehow, then move to the point that's closest to that, and so on. I don't know how you could reliably choose a good starting point for an arbitrary share though, and also it take a long time to run that algorithm if you add a lot of points (proportional to the square of the number of points).