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)
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!