initstate = [x y w h];
%-----------------------------------------Show the tracking result
imshow(uint8(img1));
rectangle('Position',initstate,'LineWidth',4,'EdgeColor','r');
text(5, 18, strcat('#',num2str(i)), 'Color','y', 'FontWeight','bold', 'FontSize',20);
set(gca,'position',[0 0 1 1]); 
%保存结果
%outputImg---文件夹
outputImgName = [outputImg,num2str(i),'.jpg'];
saveas(gcf, outputImgName, 'jpg');

05-07 09:59