how to fit two parallel lines

I have the datas(the red points in the pictures) that should be fitted into two parallel lines, do matlab have any functions that could fit multiple data to ensure the fitted lines are parallel?

4 个评论

Where is image?
I'm so sorry, can you see the figure now?
I see 4 read lines.
two lines are fitted using single methed

请先登录,再进行评论。

回答(2 个)

KSSV
KSSV 2017-9-26

2 个投票

3 个评论

thank you so much! That is really helpful! Do you have any suggestion on the noisy points? You can see lots of noisy points that definitely do not belong to the lines?
First..how you are plotting these red points?
the figure was drawn by 400 signals with low SNR(Signal Noise Ratio), the red points are detected by peaks. Since the SNR was low, the peaks may be detected wrongly.

请先登录,再进行评论。

John D'Errico
John D'Errico 2017-9-26

0 个投票

The problem is, there are always things in here that you know, but are not telling us.
- Do you have some expectation for the distance between those two lines?
- Why do there appear to be FOUR lines, two of which appear to be fainter than the other two? The pair of spurious lines are not even parallel to the main lines that I see.
Next, assuming there are good answers to the questions I've posed, I'd start by use of image processing techniques.
1. Binarize the image, mapping red pixels to black pixels, everything else to white. (Or vice versa if you prefer.)
2. Use erosion to kill off the extraneous pixels that are alone.
The above steps may result in two or four lines, in a mainly white image.
3. Next, I might apply a Hough transform to the image. This will find lines, though they need not be parallel lines. And it may well find more than 2 lines, since we can see more than two lines. It will give you estimates for the lines you see.
Finally, I might choose to refine the lines so extracted, perhaps using information that you have about the expected lines, and the expected distance between them. This might involve regression methods, if you extract the pixel coordinates. It might involve various statistical methods. You can probably work with the Hough transform tools in the IPT to do much of the work. (I'm not an expert with the IPT.) But the above steps will get you a great deal of the way to a solution.

1 个评论

These are helpful suggestions. More information is: The figure was drawn by 400 signals with low SNR(Signal Noise Ratio), the red points are detected by peaks. Since the SNR was low, the peaks may be detected wrongly. I want to measure the distance between two lines and other information. I know that the lines are supposed to be parallel.
And also sorry for the four lines, two dashed lines was fitted lines using single data method

请先登录,再进行评论。

标签

提问:

2017-9-26

评论:

2017-9-26

Community Treasure Hunt

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

Start Hunting!