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

13 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2013 年 10 月 25 日
回答済み: MathWorks Support Team 2013 年 10 月 25 日
画像内で指定した2点を結ぶ直線上の画素値を取得する方法を教えてください。

採用された回答

MathWorks Support Team
MathWorks Support Team 2013 年 10 月 26 日
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) % 画素値のプロット

その他の回答 (0 件)

タグ

製品


リリース

R2006a

Community Treasure Hunt

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

Start Hunting!