Sunday, November 22, 2015

CROP iMAGE using MATLAB

Read image into the workspace.
          I = imread('cameraman.tif');
Open Crop Image tool associated with this image. Specify a variable in which to store the cropped image. The example includes the optional return value rect in which imcrop returns the four-element position vector of the rectangle you draw.
         [I2, rect] = imcrop(I);
When you move the cursor over the image, it changes to a cross-hairs . The Crop Image tool blocks the MATLAB command line until you complete the operation.
Using the mouse, draw a rectangle over the portion of the image that you want to crop.
Perform the crop operation by double-clicking in the crop rectangle or selecting Crop Image on the context menu.
The Crop Image tool returns the cropped area in the return variable, I2. The variable rect is the four-element position vector describing the crop rectangle you specified.
now we can see the crop image by type the commend 
                                               imshow(I2);


see you with next interesting idea....

1 comment: