Centerline Detection in an Image
이전 댓글 표시
Hello,
I have a picture of a white tube against a black backdrop and I need to find a curve that follows the centerline of the tube. Not necessarily an equation for the curve just a graphical representation in a line graph or something. I am very very new to Matlab so I am not sure how to go about doing this.
What I have done so far is make the image in gray scale and then extracted the matrix. What I think I have to do now is find the maximum value in each row of the matrix since the white will have a higher value in the matrix. I cannot figure out how to do this though.
Another way I figured I could accomplish this is by doing a polyfit for each individual row since the values where the tube are appear to follow a quadratic relationship between the edges of the tube and the center. I could then find the maximum of each of of these polynomials and plot that. Again I don't know how to do this and the documentation doesn't help me.
So my main question is how do I find the column location of the maximum value of each row? So I get an output like:
Row | Column
1 12
2 13
3 14
4 13
5 12
6 11
7 10
or:
x=(1:7), y= 12 13 14 13 12 11 10
except obviously there are around 1000 entries for x
Thanks a lot,

채택된 답변
추가 답변 (1개)
Image Analyst
2013년 10월 14일
Something like this (untested)
[rows, columns, numberOfColorChannels] = size(yourImage);
for row = 1 : rows
thisRow = yourImage(row, :, 2); % Kth row from green channel
[maxValue, indexOfMax(row)] = max(thisRow);
end
카테고리
도움말 센터 및 File Exchange에서 Images에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

