Problem with overlapping line on image

2 views (last 30 days)
Mary
Mary on 23 Oct 2015
Answered: Sudhanshu Bhatt on 28 Oct 2015
I have an image.I have a line .I want to overlap this line on the image. I tried using the below lines.But I am seeing both separate. imshow(x);hold on; houghline(x,r,theta);
Any suggestions please?
Thanks, Mary
  1 Comment
Image Analyst
Image Analyst on 23 Oct 2015
I suggest you attach your image with the green and brown frame icon so we can see what you're seeing. Maybe a screenshot even.

Sign in to comment.

Answers (1)

Sudhanshu Bhatt
Sudhanshu Bhatt on 28 Oct 2015
Hi Mary,
It will be helpful if you can explain what workflow are you trying to achieve? Do you need to just plot a line on the image? Or the requirement is to highlight a line segment extracted by HOUGHLINES function?
Case 1: To draw a line on an image can be done from the code below:
% Read an image, create figure and show an image on the current Figure
% The image is provided with MATLAB, it can be found by executing
% >> which -all autumn.tif
img = imread('autumn.tif');
figure, imshow(img);
% Use hold on so we can retain current plot while plotting line
hold on;
% Plot the new line
plot([0,200],[10,200],'Color','r','LineWidth',2)
%Removing hold on the current plot
hold off;
Case 2: If you want to extract line segments based on Hough transform using HOUGHLINES and highlight them by drawing a line on the plotted image, please follow the example mentioned in the link below:
If this does not resolve your issue, please create a Technical Support Request by visiting the link below:
Thanks
Sudhanshu Bhatt

Community Treasure Hunt

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

Start Hunting!