Reputation: 2189
I want to crop an image from a specific row onwards. Please help me how can I do this. I am a beginner in Matlab.
Upvotes: 6
Views: 23470
Reputation: 151
You can use imcrop function in Matlab CropIm = imcrop(I, rectangle); rectangle is a four-element position vector [xmin ymin width height] which indicates the size and position of the crop rectangle.
Im = imread('test.tif');
Im2 = imcrop(Im,[75 68 130 112]);
imshow(Im), figure, imshow(Im2)
Upvotes: 4
Reputation: 13526
This page has a lot of great info on dealing with images in matlab.
When you load an image in matlab, it is loaded as a MxNx3 matrix. The third dimension stores the RGB values of each pixel. So to crop an image you simply select just the range of rows and columns you want to keep:
cropped_image = image(RowStart:RowEnd,ColStart:ColEnd,:);
Upvotes: 9
Reputation: 9638
See this: http://www.mathworks.com/help/techdoc/creating_plots/f9-47085.html
There is a graph editor icon in the screen where you see your graph, it should look like this:
Press it, you will get a big graph editor, now try pressing on the graph or one of the functions, in the lower right part you can set ranges, this will crop the image.
Upvotes: 4