任意の点を中心に指定​したサイズでトリミン​グを行いたい

조회 수: 4 (최근 30일)
msmsm
msmsm 2020년 12월 28일
댓글: msmsm 2020년 12월 28일
添付している1枚目(student.jpg)の画像があった時に、2枚目(student_all.jpg)の画像のようにトリミングを行いたいと考えています。トリミングの方法を「原点を中心にトリミングをしたい」と思い、原点は、student.jpgの(376,687)に位置し、原点を中心に欲しいサイズである408×408にトリミングしたいのですが、どのようにすればできるのかがわかりません。

채택된 답변

Akira Agata
Akira Agata 2020년 12월 28일
imcrop 関数を使って、以下のようにするとトリミングできます。
I = imread('student.jpg');
% 中心とcropするサイズ
cent = [376, 687];
sz = [408, 408];
% [x, y, width, height] 形式のベクトルを作成
rect = [cent - sz./2, sz];
% crop処理を実施
Icrop = imcrop(I,rect);
  댓글 수: 1
msmsm
msmsm 2020년 12월 28일
ご回答いただきありがとうございます。
実行してみたところ、上手くできました。
本当に助かりました。ありがとうございました。

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 イメージ에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!