How can I add a vertical line on an image plotted on an axes on MATLAB GUI

5 ビュー (過去 30 日間)
Haidar
Haidar 2015 年 3 月 6 日
コメント済み: Haidar 2015 年 3 月 15 日
Hi, I am making a GUI that can browse image from directory and load it on an axes (and the user can rotate the image). I need to add a vertical line at the center of the image (preferably using button). But I am really lost here as I am new at MATLAB. So far, I can only make a GUI that can browse image and show it on an axes, and user can already rotate it using slider. Please tell me what to do to add the line using button. (Btw, I was trying to put my code here but it came out messy, anyone knows why?) Thanks a lot

採用された回答

Image Analyst
Image Analyst 2015 年 3 月 6 日
For formatting tutorial, read this: http://www.mathworks.com/matlabcentral/answers/13205-tutorial-how-to-format-your-question-with-markup Basically paste, highlight, then click {}Code.
To draw a line on your image:
hold on;
[rows, columns, numberOfColorChannels] = size(yourImage);
midColumn = columns/2;
line([midColumn, midColumn], [1, rows], 'Color', [.8, .7, 0.1]);
You can change the color and location if you want.
  5 件のコメント
Image Analyst
Image Analyst 2015 年 3 月 7 日
After the user double clicks the line to accept it, you have to decide if you want to draw a line into the overlay or burn it into the image. I attach a demo that goes over all that. If I've answered all your questions, can you mark the answer as "Accepted"?
Haidar
Haidar 2015 年 3 月 15 日
thanks! and done!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImages についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by