フィルターのクリア

How to calculate the gray value on a line segment

2 ビュー (過去 30 日間)
tao wang
tao wang 2022 年 2 月 28 日
コメント済み: tao wang 2022 年 2 月 28 日
Using the above code can realize the gray value distribution on a line segment, but you must click with the mouse. Is there a method to directly specify the pixel coordinates? It's really difficult for beginners to do this. Thank you

採用された回答

Walter Roberson
Walter Roberson 2022 年 2 月 28 日
  5 件のコメント
Walter Roberson
Walter Roberson 2022 年 2 月 28 日
The values of the abscissa and ordinate above are increased by one
No they are not. I indexed at column 50:100 (which is 51 locations) and you can see that sx starts from exactly 50 and has length 51. Exactly the same values, nothing added to them.
but if it is a straight line connected by two arbitrary points
im = imread('cameraman.tif');
ny = size(im,1);
nx = size(im,2);
xstart = randi(nx)
xstart = 101
xend = randi(nx)
xend = 91
ystart = randi(ny)
ystart = 253
yend = randi(ny)
yend = 61
[sx, cy, c] = improfile(im, [xstart xend], [ystart yend])
sx = 193×1
101.0000 100.9479 100.8958 100.8438 100.7917 100.7396 100.6875 100.6354 100.5833 100.5312
cy = 193×1
253 252 251 250 249 248 247 246 245 244
c = 193×1
164 151 121 89 65 57 55 57 56 51
Notice that sx(1) is exactly the same as xstart, and the sy(1) is exactly the same as ystart. The values have not been increased by 1.
tao wang
tao wang 2022 年 2 月 28 日
thank you very much. I'll take a closer look when I get up tomorrow. I may still have something I don't understand. I'm a little stupid. I may even bother you (if you have time)

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeImage Processing Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by