ROIのdrawrectangleで作成する四角形の縦横の長さを面積に応じて自動で変更できるようにするには
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
ROIで指定した範囲をトリミングしたく下記のようにコード作成しました。
イメージとしては、トリミングする四角形の縦を小さくすると横が大きくなるように
ROIの大きさを調整したいです。
wとhをうまく設定できれば良いと思っているのですが、思ったように動きません。
以下作成コードです。
img = imread('画像'); % 画像の読み込み
imshow(img) % 表示
h = drawrectangle('DrawingArea',[1280,960,w,h],'Position',[1 1 50 50]);
wait(h);
%移動した後の四角形でトリミング
roi = h.Position;
imgCrop = imcrop(img,roi); % 切り抜き
figure();
imshow(imgCrop); %切り抜き画像表示
Réponses (0)
Voir également
Catégories
En savoir plus sur ROI ベース処理 dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!