Search for line passing through a point in edge image
조회 수: 1 (최근 30일)
이전 댓글 표시
Hi all
I have an color image and I converted it to gray image then I do edge detection using 'canny'. The edge image contains horizontal, vertical and inclined lines. For specific pixel (xp,yp) in the edge image, I want to search for a vertical line that pass through this point.
Can anyone help me to find to a method to search or detect a vertical line passing in this point. Your help is highly appreciated.
I started with:
I=imread('image.jpg');
G=rgb2gray(I);
B=edge(G,'canny');
댓글 수: 3
Jan
2013년 3월 5일
@Mary: Image Analyst had posted a link to the page, where you can upload images. Then post the link inside < and > or even better in << and >>. Please explain any details of "I cuoldn't" to allow us to suggest an improvement.
채택된 답변
ChristianW
2013년 3월 4일
doc hough
댓글 수: 3
ChristianW
2013년 3월 4일
BW = diag(ones(1,100)); BW(:,[20 60])=1; BW(20:90,75)=1;
[H,T,R] = hough(BW);
P = houghpeaks(H,200);
It = T(P(:,2)) == 0; % index vector for theta == 0
lines = houghlines(BW,T,R,P(It,:));
isvline = false(size(BW));
for k = 1:length(lines)
y = lines(k).point1(2) : lines(k).point2(2);
x = lines(k).point1(1) * ones(size(y));
isvline(y,x) = true;
end
isvline(38,75) % test, is pixel(yp=38,xp=75) part of a vertical line?
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!