how to use crop using coordinate?
2 ビュー (過去 30 日間)
古いコメントを表示
hi. i want to crop the red square from this pic using coordinate. lets suppose coordinate of the top-left point of the red square is w/2 and h/2
where w and h are width and hight of the pic respectively. and width and hight of the red square are 20 pixel. this is my code but it dosent work. plz help me.
pic=imread('b.jpg');
[w, h, numberOfColorChannels] = size(pic);
I=imcrop(pic,[w*0.5 h*0.5 20 20]);
imshow(I)
![black.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/268092/black.jpeg)
2 件のコメント
採用された回答
Walter Roberson
2020 年 1 月 24 日
編集済み: Walter Roberson
2020 年 1 月 24 日
You need
[h, w, numberOfColorChannels] = size(pic);
not
[w, h, numberOfColorChannels] = size(pic);
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Line Plots についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!