jpg = im read(' pai Zhao . jpg '); % read image
gray jpg = RGB 2 gray(jpg); % color image grayed out.
bwjpg=im2bw(grayjpg,gray thresh(gray jpg)); %bwjpg binary image, threshold program automatically takes it out.
The rest is to cut the characters according to the peaks and valleys. Write it yourself.