Ben Fossen
Ben Fossen

Reputation: 1007

MATLAB Image cropper for multiple images?

I have 19 images and I would like to be able to crop them all the same way, cropping off the same area on each image. But I need to look at the first image and determine what part of the image I want to crop. Then I would like to apply that crop to all the other images. My idea is that I could save the four corner points from the first crop and then iterate though the other 18 images using the 4 points to properly set up the cropping. Does this seem like a good approach? Or does anyone know of a Matlab program that does this already?, I search already.

Upvotes: 3

Views: 2223

Answers (1)

yuk
yuk

Reputation: 19880

Use IMCROP function from Image Processing Toolbox.

For the first image run it interactively and save the selected rectangle coordinates as a variable (rect):

[im_cropped rect] = imcrop(im);

Then for other images apply that coordinates:

im_cropped = imcrop(im, rect);

Upvotes: 2

Related Questions