Search for line passing through a point in edge image

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 件のコメント

Image Analyst
Image Analyst 2013 年 3 月 4 日
Where did you post your image? http://www.mathworks.com/matlabcentral/answers/7924-where-can-i-upload-images-and-files-for-use-on-matlab-answers Post both your original image and the Canny edge image. Tell us the pixel (xp,yp) you're looking at, or let us know if you want to do that for every pixel in the image.
Mary
Mary 2013 年 3 月 5 日
Hi Image Analyst and thank you for your comment.
I tried many times to upload the images to the forum , but I couldn't. could you please tell me the steps and the location that I can upload my images. I highly appreciate your help.
Jan
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 &gt&gt. Please explain any details of "I cuoldn't" to allow us to suggest an improvement.

サインインしてコメントする。

 採用された回答

ChristianW
ChristianW 2013 年 3 月 4 日

0 投票

doc hough

3 件のコメント

Mary
Mary 2013 年 3 月 4 日
Hi Christian and thank you for your answer
I read about Hough transform and I found these functions but I could't write the codes or the program to solve the problem. could you please help me for more details or a part of program. your help is greatly appreciated:
[H, theta, rho] = hough(BW)
[H, theta, rho] = hough(BW, ParameterName, ParameterValue)
peaks = houghpeaks(H, numpeaks)
peaks = houghpeaks(..., param1, val1, param2, val2)
lines = houghlines(BW, theta, rho, peaks)
lines = houghlines(..., param1, val1, param2, val2)
ChristianW
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?
Mary
Mary 2013 年 3 月 4 日
Thank you Christian for your answer.

サインインしてコメントする。

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by