matlab 输入一个字符串,写入到图像中, 并可读出

clc;
clear all;
close all;

% input a character, and save to bitmap 
set(gca, 'xtick', [], 'ytick', []); 
axis off;  
%in this example, the character is w
text(0, 0, '\fontsize{90}w', 'color', 'black' ); 
saveas(gcf, 'tmp','jpg');

im = imread('tmp.jpg');
im = rgb2gray(im);

imx = imcrop(im, [150 730 150 150]);
imshow(imx);  title('imx crop');


更多推荐