matlab输出图像并在图像上框出物体
一张 M*N 大小的图片,在图像上画出一个width*height并且左上角坐标为(x,y)的矩形框,可用如下代码:
res = insertShape(img,'Rectangle',[x y width height]);
%在图像img上画一个width*height的矩形框,矩形框左上角坐标为(x,y)
举个栗子,把下图中的小狗框出来:

用一个长120宽80的矩形框把狗狗框出来
img = imread('img.jpg');
res = insertShape(img,'Rectangle',[36 81 120 80]);
imshow(res)
运行结果为:


浙公网安备 33010602011771号