Use ginput to crop an image
8 次查看(过去 30 天)
显示 更早的评论
k
采纳的回答
KSSV
2020-6-19
编辑:KSSV
2020-6-19
You need to define Rect to use the ginput points.
I = imread("image.jpeg") ;
imshow(I) ;
[Px,Py] = ginput(2) ;
Px = round(Px) ; Py = round(Py) ;
R = [Px(1) Py(1) Px(2)-Px(1) Py(2)-Py(1)] ; %[ x y W H]
I1 = imcrop(I,R) ;
figure
imshow(I1)
Play around with creating R...I am not sure whether they are correct here.
NOTE: While using imcrop also you do the same, select left top first and then bottom right. You define a rectangle.
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Exploration 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!