FROMBBTOCENTRALPOINT.m is a function for calculating target centroid and size FROMBBTOCENTRALPOINT is a function for calculating target centroid and size given the bounding box of the target OUTPUT: -centerX target's centroid coordinate (column in the image plane) -centerY target's centroid coordinate (row in the image plane) -width target's width -height target's height INPUT -bb calculated bounding box in the format [topLeftY, topLeftX, bottomRightY, bottomRightX] read as [rowIndexTopLeft, columnIndexTopLeft, rowIndexBottomRight, columnIndexBottomRight] See also SINGLEFRAMEDSKCF, FROMCENTRALPOINTTOBB University of Bristol Massimo Camplani and Sion Hannuna massimo.camplani@bristol.ac.uk hannuna@compsci.bristol.ac.uk
0001 % FROMBBTOCENTRALPOINT.m is a function for calculating target centroid and size 0002 % 0003 % FROMBBTOCENTRALPOINT is a function for calculating target centroid and 0004 % size given the bounding box of the target 0005 % 0006 % OUTPUT: 0007 % -centerX target's centroid coordinate (column in the image plane) 0008 % -centerY target's centroid coordinate (row in the image plane) 0009 % -width target's width 0010 % -height target's height 0011 % 0012 % INPUT 0013 % -bb calculated bounding box in the format [topLeftY, topLeftX, 0014 % bottomRightY, bottomRightX] read as [rowIndexTopLeft, columnIndexTopLeft, 0015 % rowIndexBottomRight, columnIndexBottomRight] 0016 % 0017 % See also SINGLEFRAMEDSKCF, FROMCENTRALPOINTTOBB 0018 % 0019 % University of Bristol 0020 % Massimo Camplani and Sion Hannuna 0021 % 0022 % massimo.camplani@bristol.ac.uk 0023 % hannuna@compsci.bristol.ac.uk 0024 0025 function [centerX,centerY,width,height]=fromBBtoCentralPoint(bb) 0026 0027 width=bb(3)-bb(1); 0028 height=bb(4)-bb(2); 0029 centerX=floor(bb(1)+width/2);%column indexes 0030 centerY=floor(bb(2)+height/2);%row indexes 0031 0032 end