Cut images with equal size and position

Hello guys, how can i cut some images into same size and i can set (x1,y1) dan (x2,y2) for images cutting.

 Accepted Answer

Yes i can be done....define your (x1,y1) and (x2,y2). Note that they should be positive integers. Let I be your image.
iwant = I(x1:x2,y1:y2,:) ;
Also read about imcrop.

11 Comments

im using this and got the imgage still with border and there is blue plus sign i dont know where it come from.
Show us the code which you have tried. Did you go through imcrop?
I=imread ('111.jpg');
J = imcrop(I);
iwant = I(100:900,100:900,:) ;
this is the code
imshow(iwant)
it looks fine right? I don't see any problem in this.
Can I remove white border so I only get the images, and why at the upper-right there is plus sign appear?.
Do not use imcrop() interactively for this purpose.
I = imread ('111.jpg');
iwant = I(100:900,100:900,:);
I am getting fine image.
The plus sign and white border are from the imcrop(I) step. When you call imcrop() with no parameters, it looks for an image in the current figure and starts an interactive crop tool. When you call imcrop() with one parameter, it puts up the data as an image and starts an interactive crop tool. The crop tool puts up the + marker to show where cropping would occur.
You do not want to do interactive cropping: you already know the coordinates you want. You do not need imcrop() for this purpose; you can just access the array elements.
Yes .. I have not used imcrop.
Thanks for your answers Mr Roberson and KSSV
If it worked, please accept the answer to give KSSV credit for it.

Sign in to comment.

More Answers (0)

Categories

Find more on Convert Image Type in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!