Problem with overlapping line on image

2 ビュー (過去 30 日間)
Mary
Mary 2015 年 10 月 23 日
回答済み: Sudhanshu Bhatt 2015 年 10 月 28 日
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 件のコメント
Image Analyst
Image Analyst 2015 年 10 月 23 日
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.

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

回答 (1 件)

Sudhanshu Bhatt
Sudhanshu Bhatt 2015 年 10 月 28 日
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!

Translated by