RECTTOBOX Convert rectangle data to box data. RECT = rectToBox(BOX) Converts from rectangle representation to box representation. BOX is given by [XMIN XMAX YMIN YMAX]. RECT is given by [X0 Y0 WIDTH HEIGHT], with WIDTH and HEIGHT > 0 Example rectToBox See also boxToRect, drawBox, drawRect ------ Author: David Legland e-mail: david.legland@grignon.inra.fr Created: 2012-08-23, using Matlab 7.9.0.529 (R2009b) Copyright 2012 INRA - Cepia Software Platform.
0001 function box = rectToBox(rect) 0002 %RECTTOBOX Convert rectangle data to box data. 0003 % 0004 % RECT = rectToBox(BOX) 0005 % Converts from rectangle representation to box 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 % Example 0010 % rectToBox 0011 % 0012 % See also 0013 % boxToRect, drawBox, drawRect 0014 % 0015 % ------ 0016 % Author: David Legland 0017 % e-mail: david.legland@grignon.inra.fr 0018 % Created: 2012-08-23, using Matlab 7.9.0.529 (R2009b) 0019 % Copyright 2012 INRA - Cepia Software Platform. 0020 0021 box = [rect(:,1) rect(:,1)+rect(:,3) rect(:,2) rect(:,2)+rect(:,4)];