Use ginput to crop an image

4 Ansichten (letzte 30 Tage)
Sarah Smith
Sarah Smith am 19 Jun. 2020
Bearbeitet: Sarah Smith am 19 Jun. 2020
k
  1 Kommentar
KSSV
KSSV am 19 Jun. 2020
Why ti pick points using ginput? You can use imcrop right?

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

KSSV
KSSV am 19 Jun. 2020
Bearbeitet: KSSV am 19 Jun. 2020
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.

Weitere Antworten (0)

Kategorien

Mehr zu Data Exploration finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by