jitter_image

PURPOSE ^

Creates multiple, slightly jittered versions of an image.

SYNOPSIS ^

function IJ = jitter_image( I, nphis, maxphi, ntrans, maxtrans, jsiz, reflectflag )

DESCRIPTION ^

 Creates multiple, slightly jittered versions of an image.

 Takes an image I, and generates a number of images that are copies of the original image
 with slight translation and rotation applied.  The original image also appears in the
 final set.  

 The parameter jsiz controls the size of the cropped images.  If jsiz gives a size that's
 substantially smaller than I then all data in the the final set will come from I.
 However, if this is not the case then I may need to be padded first.  The way this is
 done is with padarray with the 'replicate' method.  If jsiz is not specified, it is set
 to be small enough so that all translations can be fully accomodated.
 
 Rotations and translations are specified by giving a range and a maximum value for each.
 For example, if maxphi=10 and nphis=5, then the actual rotations applied are [-10 -5 0 5
 10]. Uses: linspace( -maxphi, maxphi, nphis ); Likewise if maxtrans=3 and ntrans=3 then
 the translations are [-3 0 3]. Each translation is applied in the x direction as well as
 the y direction.  Each combination of rotation, translation in x, and translation in y
 is used (for example phi=5, transx=-3, transy=0), so the total number of images
 generated is R=ntrans*ntrans*nphis)!

 If the input image is actually a MxNxK stack of images then applies op to each image in
 stack and returns an MxNxKxR where R=(ntrans*ntrans*nphis) set of images.

 This function works much faster if all of the translation end up being integer values. A
 warning will appear if non integer values are used. Also, a warning appears if the image
 needs to be grown. 

 INPUTS
   I           - BW input image (MxN) or images (MxNxK), must have odd dimensions
   nphis       - number of rotations (must be odd)
   maxphis     - max value for rotation
   ntrans      - number of translations (must be odd)
   maxtrans    - max value for translation
   jsiz        - [optional] Final size of each image in IJ 
   reflectflag - [optional] if true then also adds reflection of each image

 OUTPUTS
   IJ          - MxNxR or MxNxKxR set of images where R=(ntrans*ntrans*nphis)
 
 EXAMPLE
   load trees; I = ind2gray(X,map); I = imresize(I,[41 41]);
   % creates 21^2 images of slight translations with reflection (but no rotation) 
   IJ = jitter_image( I, 0, 0, 21, 3, [], 1 ); montage2(IJ,1,1)
   % creates 21 images of slight rotations (no translations)
   IJ = jitter_image( I, 21, 10, 0, 0, size(I) ); montage2(IJ,1,1)
   % creates 45 images of both rotation and slight translations
   % alternatively use (maxtrans=3) OR (nphis=5)
   IJ = jitter_image( I, 5, 10, 3, 2 ); montage2(IJ,1,1)

 DATESTAMP
   29-Sep-2005  2:00pm

 See also JITTER_VIDEO

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:
Generated on Sun 02-Oct-2005 19:35:28 by m2html © 2003