Slope of multiple lines in a jpeg image

조회 수: 2 (최근 30일)
Paulo
Paulo 2015년 4월 14일
댓글: Paulo 2015년 4월 14일
Hello everyone,
I have a simple question. I want to know the slope of multiple lines in an image. I wanted to try polyfit but I didn't manage to separate the corresponding points to calculate the slope.
Any suggestions ?
  댓글 수: 3
Image Analyst
Image Analyst 2015년 4월 14일
And if it's about finding some coordinates in an image, wouldn't it make sense to post the image?
Paulo
Paulo 2015년 4월 14일
Yes, I have to find the lines and then I have to find the slope for the corresponding lines. I posted the image.
I have tried using im2bw and then I tried to find the changes from 0 to 1 for every column. I saved these changes in a matrix, but I didn't manage to get the slope of the corresponding lines.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2015년 4월 14일
It would have been best if you just attached the image in the first place, don't you think. It was really easy so I just went ahead and did it all for you. See attached demo, below the image it creates:
For blob #1, the slope = 0.198371
For blob #2, the slope = -0.465403
For blob #3, the slope = 1.088155
For blob #4, the slope = -1.784847
For blob #5, the slope = 8.596451
For blob #6, the slope = 8.703217
For blob #7, the slope = -1.780951
For blob #8, the slope = 1.088187
For blob #9, the slope = -0.463639
For blob #10, the slope = 0.200490
  댓글 수: 1
Paulo
Paulo 2015년 4월 14일
Thank you very much ! I'm very grateful!

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Image Analyst
Image Analyst 2015년 4월 14일
See my polyfit demo. One of the fits is does is for a line.
  댓글 수: 1
Paulo
Paulo 2015년 4월 14일
Thank you very much for your response ! I really appreciate it. It's very helpful, but I still have problems associating the corresponding values for the polyfit function. But still Thank you!

댓글을 달려면 로그인하십시오.

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by