MANUALBBDRAW_OCC.m produces graphical output for DSKCF tracker MANUALBBDRAW_OCC overlays on top of the current frame the tracker bounding box and the one corresponding to the occluding object (if they exist) with different color and linewidth INPUT: -img source image -bb target bounding box bounding box in the format [topLeftX, topLeftY, bottomRightX, bottomRightY] read as [columnIndexTopLeft, rowIndexTopLeft, columnIndexBottomRight, rowIndexBottomRight] -bbOCC occluding object bounding box bounding box in the format [topLeftX, topLeftY,bottomRightX, bottomRightY] read as [columnIndexTopLeft,rowIndexTopLeft, columnIndexBottomRight, rowIndexBottomRight] -myColor and myColorCC, selected color for the bounding boxes -lWidth selected line width for the two bounding boxes OUTPUT -modifiedImage captured from matlab fig, ready to be saved See also MANUALBBDRAW_OCC_WITHLABELS, MANUALBBDRAW_OCC_WITHLABELSVISUALIZE, ZBUFFER_CDATA University of Bristol Massimo Camplani and Sion Hannuna massimo.camplani@bristol.ac.uk hannuna@compsci.bristol.ac.uk
0001 function modifiedImage=manualBBdraw_OCC(img,bb,bbOCC,myColor,myColorOCC,lWidth) 0002 0003 % MANUALBBDRAW_OCC.m produces graphical output for DSKCF tracker 0004 % 0005 % MANUALBBDRAW_OCC overlays on top of the current frame the tracker 0006 % bounding box and the one corresponding to the occluding object (if they 0007 % exist) with different color and linewidth 0008 % 0009 % INPUT: 0010 % -img source image 0011 % -bb target bounding box bounding box in the format [topLeftX, topLeftY, 0012 % bottomRightX, bottomRightY] read as [columnIndexTopLeft, rowIndexTopLeft, 0013 % columnIndexBottomRight, rowIndexBottomRight] 0014 % 0015 % -bbOCC occluding object bounding box bounding box in the format 0016 % [topLeftX, topLeftY,bottomRightX, bottomRightY] read as 0017 % [columnIndexTopLeft,rowIndexTopLeft, columnIndexBottomRight, 0018 % rowIndexBottomRight] 0019 % 0020 % -myColor and myColorCC, selected color for the bounding boxes 0021 % -lWidth selected line width for the two bounding boxes 0022 % 0023 % OUTPUT 0024 % -modifiedImage captured from matlab fig, ready to be saved 0025 % 0026 % See also MANUALBBDRAW_OCC_WITHLABELS, 0027 % MANUALBBDRAW_OCC_WITHLABELSVISUALIZE, ZBUFFER_CDATA 0028 % 0029 % University of Bristol 0030 % Massimo Camplani and Sion Hannuna 0031 % 0032 % massimo.camplani@bristol.ac.uk 0033 % hannuna@compsci.bristol.ac.uk 0034 0035 imageSize=[size(img,2),size(img,1)]; 0036 0037 0038 myFig=figure('visible','off'); 0039 set(myFig,'resize','off'); 0040 hold on; 0041 imshow(img); 0042 0043 0044 if(isempty(bb)==false & isnan(bb)==false) 0045 if(bb(1)>imageSize(1) | bb(2)>imageSize(2)) 0046 bb=[]; 0047 else 0048 bb(bb(1:2)<0)=1; 0049 if(bb(1)+bb(3)>imageSize(1)) 0050 bb(3)=imageSize(1)-bb(1); 0051 end 0052 0053 if( bb(2)+bb(4)>imageSize(2)) 0054 bb(4)=imageSize(2)-bb(2); 0055 end 0056 0057 rectangle('Position', bb,'LineWidth',lWidth,'edgecolor',myColor); 0058 end 0059 end 0060 0061 0062 0063 if(isempty(bbOCC)==false & isnan(bbOCC)==false) 0064 0065 if(bbOCC(1)>imageSize(1) | bbOCC(2)>imageSize(2)) 0066 bbOCC=[]; 0067 else 0068 bb(bbOCC(1:2)<0)=1; 0069 if(bbOCC(1)+bbOCC(3)>imageSize(1)) 0070 bbOCC(3)=imageSize(1)-bbOCC(1)+1; 0071 end 0072 0073 if( bbOCC(2)+bbOCC(4)>imageSize(2)) 0074 bbOCC(4)=imageSize(2)-bbOCC(2)+1; 0075 end 0076 rectangle('Position', bbOCC,'LineWidth',lWidth,'edgecolor',myColorOCC); 0077 end 0078 end 0079 0080 F = im2frame(zbuffer_cdata(gcf)); 0081 0082 modifiedImage=imresize(F.cdata,[size(img,1),size(img,2)]); 0083 0084 close (myFig)