how to use crop using coordinate?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
reza hamzeh
am 24 Jan. 2020
Bearbeitet: Walter Roberson
am 24 Jan. 2020
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 Kommentare
Akzeptierte Antwort
Walter Roberson
am 24 Jan. 2020
Bearbeitet: Walter Roberson
am 24 Jan. 2020
You need
[h, w, numberOfColorChannels] = size(pic);
not
[w, h, numberOfColorChannels] = size(pic);
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Surface and Mesh Plots 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!