如何用 matlab 在图片上绘制矩形框 和 添加文字 ?
如何给图像添加矩形框?以及添加想要输入的文字 ? 案例程序,如下所示:
clc; close all; clear all;
image = imread('/home/wangxiao/Pictures/image/gamersky_022origin_043_20147261368D.jpg');
figure;imshow(image);
hold on
rectangle('Position',[100 100 100 100],'LineWidth',4,'EdgeColor','r');
效果如下:
添加文字:
clc; close all; clear all;
image = imread('/home/wangxiao/Pictures/image/gamersky_022origin_043_20147261368D.jpg');
figure;imshow(image);
hold on
rectangle('Position',[100 100 100 100],'LineWidth',4,'EdgeColor','r');
xlim=get(gca,'xlim');
ylim=get(gca,'ylim');
N=100;
text(sum(xlim)/2,sum(ylim)/2+N,'what you want to input, just input here !','horiz','center')
Stay Hungry,Stay Foolish ...