Functions for manipulating bounding boxes (bb). A bounding box (bb) is also known as a position vector or a rectangle object. It is a four element vector with the fields: [x y w h]. A set of n bbs can be stores as an [nx4] array, most funcitons below can handle either a single or multiple bbs. In addtion, typically [nxm] inputs with m>4 are ok (with the additional columns ignored/copied to the output). bbApply contains a number of utility functions for working with bbs. The format for accessing the various utility functions is: outputs = bbApply( 'action', inputs ); The list of functions and help for each is given below. Also, help on individual subfunctions can be accessed by: "help bbApply>action". Compute area of bbs. bb = bbApply( 'area', bb ) Shift center of bbs. bb = bbApply( 'shift', bb, xdel, ydel ) Get center of bbs. cen = bbApply( 'getCenter', bb ) Get bb at intersection of bb1 and bb2 (may be empty). bb = bbApply( 'intersect', bb1, bb2 ) Get bb that is union of bb1 and bb2 (smallest bb containing both). bb = bbApply( 'union', bb1, bb2 ) Resize the bbs (without moving their centers). bb = bbApply( 'resize', bb, hr, wr, [ar] ) Fix bb aspect ratios (without moving the bb centers). bbr = bbApply( 'squarify', bb, flag, [ar] ) Draw single or multiple bbs to image (calls rectangle()). hs = bbApply( 'draw', bb, [col], [lw], [ls], [prop], [ids] ) Embed single or multiple bbs directly into image. I = bbApply( 'embed', I, bb, [varargin] ) Crop image regions from I encompassed by bbs. [patches, bbs] = bbApply('crop',I,bb,[padEl],[dims]) Convert bb relative to absolute coordinates and vice-versa. bb = bbApply( 'convert', bb, bbRef, isAbs ) Randomly generate bbs that fall in a specified region. bbs = bbApply( 'random', pRandom ) Convert weighted mask to bbs. bbs = bbApply('frMask',M,bbw,bbh,[thr]) Create weighted mask encoding bb centers (or extent). M = bbApply('toMask',bbs,w,h,[fill],[bgrd]) USAGE varargout = bbApply( action, varargin ); INPUTS action - string specifying action varargin - depends on action, see above OUTPUTS varargout - depends on action, see above EXAMPLE See also bbApply>area bbApply>shift bbApply>getCenter bbApply>intersect bbApply>union bbApply>resize bbApply>squarify bbApply>draw bbApply>crop bbApply>convert bbApply>random bbApply>frMask bbApply>toMask Piotr's Computer Vision Matlab Toolbox Version 3.30 Copyright 2014 Piotr Dollar. [pdollar-at-gmail.com] Licensed under the Simplified BSD License [see external/bsd.txt]