Date: Nov 4, 2013 3:55 AM
Author: Barbara
Subject: cut the edges of image


I want to cut the edges of different binary images to delete the white pixels on the border.
Then resize the images to the original size.

My idea is to make the image smaller with imcrop and then add black pixels with padarray.

n_new = n-50;
smallImage = imcrop(image, [n-n_new 0 n_new m]);
noborderImage = imclearborder(smallImage, 4);
newImage = padarray(noborderImage, [0 25] );

The image gets the same size as desired. But the white pixels on the image moved to the left.

Can anyone tell me what is wrong? Or is there another way to make the pixels near the border black?