フィルターのクリア

add vertical lines to an image

23 ビュー (過去 30 日間)
maryam
maryam 2013 年 8 月 29 日
コメント済み: Image Analyst 2018 年 2 月 18 日
i've loaded an image and i'd like to add some vertical lines on it,could anybody help me? the image is voltage curve and i need the exact value of the voltage at any time. so i decided to add vertical lines to it,and then by using graph digitizer extract the values.

採用された回答

Image Analyst
Image Analyst 2013 年 8 月 29 日
編集済み: Image Analyst 2013 年 8 月 29 日
Is it a color image or a grayscale image? Do you want the lines burned into the image, or above it in the overlay?
[rows, columns, numberOfColorChannels] = size(yourImage);
spacing = 50; % Whatever.
for row = 1 : spacing : rows
line([1, columns], [row, row]);
end
for column = 1 : spacing : columns
line([column, column], [1, rows]);
end
If you want them in the overlay, simply use the line() function. If you want it burned into a grayscale image:
grayImage(:, columnNumber) = 255; % White = 255, can pick any intensity.
grayImage(rowNumber, :) = 255;
Same thing for color, just do it in whatever color channels you want. You can also control the color of the line that way.
  3 件のコメント
Journi Northorp
Journi Northorp 2018 年 2 月 17 日
Can you give me an example please? I have to make vertical lines in white for every other column of a 20x20 matrix.
Image Analyst
Image Analyst 2018 年 2 月 18 日
Try this:
m(:, 2:2:end) = 255;
where m is your matrix.

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

その他の回答 (1 件)

David Sanchez
David Sanchez 2013 年 8 月 29 日
The following draws a vertical line on your_image from pixel (20, 10) to pixel (20, 50):
image(your_image);
hold on
x=[20 20];
y=[10 50];
line(x,y)
hold off

Community Treasure Hunt

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

Start Hunting!

Translated by