PRTools Contents

PRTools User Guide

im_patch

IM_PATCH

Fixed mapping or generating patches from images

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

Input
 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'.

Output
 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 User Guide

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