M-File Help: itrim View code for itrim

itrim

Trim images

This function has two different modes of functionality.

out = itrim(im, sides, n) is the image im with n pixels removed from the image sides as specified by sides which is a string containing one or more of the characters:

't' top
'b' bottom
'l' left
'r' right

[out1,out2] = itrim(im1,im2) returns the central parts of images im1 and im2 as out1 and out2 respectively. When images are rectified or warped the shapes can become quite distorted and are embedded in rectangular images surrounded by black of NaN values. This function crops out the central rectangular region of each. It assumes that the undefined pixels in im1 and im2 have values of NaN. The same cropping is applied to each input image.

[out1,out2] = itrim(im1,im2,T) as above but the threshold T in the range 0 to 1 is used to adjust the level of cropping. The default is 0.5, a higher value will include fewer NaN value in the result (smaller region), a lower value will include more (larger region). A value of 0 will ensure that there are no NaN values in the returned region.

See also

homwarp, irectify


 

© 1990-2012 Peter Corke.