PRTools Contents

PRTools User Guide

im_box

IM_BOX

Fixed mapping determining a rectangular enclosing a blob (0/1 image)

    B = IM_BOX(A)
    B = A*IM_BOX

If A is a 0/1 image then B is the same image with all empty (0) border  columns and rows removed.

    B = IM_BOX(A,N)

If A is a 0/1 image then B is the same image, but having in each direction  N empty (0) columns and rows around the object (1).

    B = IM_BOX(A,[NX1 NX2 NY1 NY2])

If A is a 0/1 image then B is the same image, but having NX1, NX2 empty  columns (0) left, respectively right of the object (1) and NY1, NY2 empty  rows (0) above, respectively below the object(1).

    B = IM_BOX(A,N,ALF)

Adds as many empty (0) columns or rows such that the aspect ratio of  images (height/width) equals ALF. For ALF == 1, square images are returned.  For ALF == 0, images are taken as they are and N rows and columns are  added.

Example(s)

 prdatafiles;            % make sure prdatafiles is in the path
 x = kimia_images;       % load kimia images
 x = x*im_box(0);        % remove all empty rows and columns
 x = x*im_box(0,1);      % add rows/columns to make images square
 x = x*im_resize([32 32]); % resample them 
 x = x*im_box(1,0);      % add rows/columns and keep image square
 % now all images are 34x34 and no object touches the border.
 show(gendat(x,4))       % show a few

See also

datasets, datafiles,

PRTools Contents

PRTools User Guide

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