画像内で指定した2点​を結ぶ直線上の画素値​を取得することはでき​ますか?

13 views (last 30 days)
MathWorks Support Team
MathWorks Support Team on 25 Oct 2013
画像内で指定した2点を結ぶ直線上の画素値を取得する方法を教えてください。

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 26 Oct 2013
improfile 関数にて、2点の座標を入力引数に与えることで、指定した2点を結ぶ画素値の列ベクトルを得ることが
できます。
>> c = improfile(I,x,y)
ここで、x,yは、共に行ベクトルとなります。x,y はそれぞれx軸方向,y軸方向の座標を指定します。
例) 座標(10,200),(240,200) を結び、画像情報を取得
I = imread('cameraman.tif'); % 画像読み込み
x = [10 240]; y = [200 200]; % 2点の座標の定義
c = improfile(I,x,y); % 画素値の取得
imshow(I),axis on
hold on, plot(x,y,'*-')
figure,plot(c) % 画素値のプロット

More Answers (0)

Tags

Products


Release

R2006a

Community Treasure Hunt

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

Start Hunting!