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 Mat开发者_运维百科lab program that does this already?, I search already.
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);
精彩评论