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