matlab 在照片中画矩形框

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');

你可能感兴趣的:(MATLAB)