BOXTORECT Convert box data to rectangle data. RECT = boxToRect(BOX) Converts from boxrepresentation to rectangle representation. BOX is given by [XMIN XMAX YMIN YMAX]. RECT is given by [X0 Y0 WIDTH HEIGHT], with WIDTH and HEIGHT > 0 See also boxes2d, boxToPolygon, drawBox
0001 function rect = boxToRect(box) 0002 %BOXTORECT Convert box data to rectangle data. 0003 % 0004 % RECT = boxToRect(BOX) 0005 % Converts from boxrepresentation to rectangle representation. 0006 % BOX is given by [XMIN XMAX YMIN YMAX]. 0007 % RECT is given by [X0 Y0 WIDTH HEIGHT], with WIDTH and HEIGHT > 0 0008 % 0009 % See also 0010 % boxes2d, boxToPolygon, drawBox 0011 % 0012 0013 % ------ 0014 % Author: David Legland 0015 % e-mail: david.legland@inra.fr 0016 % Created: 2012-08-23, using Matlab 7.9.0.529 (R2009b) 0017 % Copyright 2012 INRA - Cepia Software Platform. 0018 0019 rect = [box(:,1) box(:,3) box(:,2)-box(:,1) box(:,4)-box(:,3)];