PRTools contents

PRTools manual

im_patch

IM_PATCH

Generate patches from images

    B = IM_PATCH(A,PSIZE,PNUM,TYPE)
    B = IM_PATCH(A,PSIZE,COORD,'user')
    W = IM_PATCH([],PSIZE,PNUM,TYPE)
    B = A*W

Input
 A Dataset or datafile with (multi-band) object images dataset
 PSIZE 2-dimensional patch size. If PSIZE is 1-dimensional square  patches of size PSIZE x PSIZE are generated. In case PSIZE < 1,  it is taken relatuive 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 op PNUM patches  'user': user defined patch positions, see COORD Default: 'syst'.

Output
 W Mapping performing the desired patch generation
 B Resulting dataset or datafile with the same number of objects  as in A. Single images are replaced by the patches.

Description

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.

Example(s)

 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 manual