Effacer les filtres
Effacer les filtres

ROIのdrawre​ctangleで作成​する四角形の縦横の長​さを面積に応じて自動​で変更できるようにす​るには

1 vue (au cours des 30 derniers jours)
NAOAKI MIYAMOTO
NAOAKI MIYAMOTO le 10 Mai 2022
Commenté : NAOAKI MIYAMOTO le 13 Mai 2022
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); %切り抜き画像表示
  1 commentaire
NAOAKI MIYAMOTO
NAOAKI MIYAMOTO le 13 Mai 2022
こちらのコードが参考になります。

Connectez-vous pour commenter.

Réponses (0)

Produits


Version

R2021a

Community Treasure Hunt

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

Start Hunting!