PRTools Contents

PRTools User Guide



Fixed mapping or generating patches from images

    B = IM_PATCH(A,PSIZE,COORD,'user')

 A Dataset or datafile with (multi-band) object images dataset
 PSIZE 2-dimensional patch size. If PSIZE is a scalar, square patches  of size PSIZE x PSIZE are generated. In case PSIZE < 1, it is  taken relative to the images size. In this case patches may  become non-square for non-square images. Default 3 x 3.
 PNUM Number of patches, see TYPE, default 1.
 COORD Given set of N x 2 image coordinates of patch centra. This may  be given either in pixels (ANY(COORD > 1) or relative to the  image size (ALL(COORD <= 1).
 TYPE 'syst': systematic sampling generating PNUM x PNUM patches.  'rand': generation of a random set of PNUM patches.  'user': user defined patch positions, see COORD.  Default: 'syst'.

 B Resulting dataset or datafile with the same number of objects  as in A. Single images are replaced by the patches.


The object images (including their N bands) are sampled and windows of size  PSIZE are generated, replacing the original image object. They are stored  as [PSIZE(1) PSIZE(2) NUM*N] image objects, in which N is the original  number of bands and NUM is either PNUM (for TYPE is 'rand' or 'user') or  PNUM x PNUM (for TYPE is 'syst').

By BAND2OBJ(B,N) individual patches can be transformed into objects.


 b = im_patch(a,0.5) % generate just the central parts of the images 
 b = im_patch(a,[3 5],2) % generates 4 patches of size 3x5 in centra of
                     % the four quadrants
 b = im_patch(a,0.1,10,'rand') % generate at random positions 10 patches
                     %each with a linear size of 0.1 of the image size.

See also

datasets, datafiles, band2obj,

PRTools Contents

PRTools User Guide

This file has been automatically generated. If badly readable, use the help-command in Matlab.