<span style="font-family:Microsoft YaHei;font-size:14px;">package ImageIO;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
/**
* 图形识别技术
* @author c
* 时间:2015-4-6
* */
public class Image {
public static void main(String[] args) throws IOException {
BufferedImage bi = (BufferedImage) ImageIO.read(new File("C:/Users/e530c/Desktop/a.png"));
//获取图像的宽度和高度
int width = bi.getWidth();
int height = bi.getHeight();
//扫描图片
for(int i=0;i<height;i++){
for(int j=0;j<width;j++){//行扫描
int dip = bi.getRGB(j, i);
if(dip == -1) System.out.print(" ");
else System.out.print("0");
}
System.out.println();//换行
}
}
}</span>
<span style="font-family:Microsoft YaHei;font-size:14px;"> 000
0000
0000 0000 000
0000000 0000 0000
0000000000 000 00000
0000000000000 000 00000
0000000000000000 000 00000
0000000000000000000 000 00000
000000000000000 000 00000
00000000000 0000 000 00000
0000 0000 000 0000
0000 0000 00000
0000 0000 0000
0000 0000 00000
0000 0000 0000
0000 0000 000
0000 0000 000
0000 0000
0000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000
0000 0000
0000 0000 000
0000 0000 000
0000 0000 0000
0000 0000 0000
0000 0000 00000
0000 00 000 0000
0000 00000 0000 00000
0000 0000000 0000 00000
0000 0000000000 0000 0000
00000000000000 0000 00000
000000000000 0000 0000
000000000000 0000 00000
000000000000 0000 00000
000000000000 000000000
0000000000000000 00000000
000000000000 0000 0000000
000000000 0000 000000
00000 0000 000000
0000 000000 0000
0000 00000000 0000
0000 0000000000 0000
0000 000000 0000 0000
0000 000000 00000 0000
0000 000000 0000 0000
0000 000000 00000 0000
0000 0000000 00000 0000
0000 000000 000000 0000
0 0000 0000000 000000 0000
00000 000 0000000 000000 0000
00000000 0000 00000 000000 0000
000000000000000 000 0000000000
00000000000000 00000000
0000000000 0000000
000
</span>
<span style="font-family:Microsoft YaHei;font-size:14px;">package ImageIO;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
/**
* 图形识别技术
* @author c
* 时间:2015-4-6
* */
public class Image {
public static void main(String[] args) throws IOException {
BufferedImage bi = (BufferedImage) ImageIO.read(new File("C:/Users/e530c/Desktop/a.png"));
//获取图像的宽度和高度
int width = bi.getWidth();
int height = bi.getHeight();
//扫描图片
for(int i=0;i<height;i++){
for(int j=0;j<width;j++){//行扫描
int dip = bi.getRGB(j, i);
if(dip == -1) System.out.print(" ");
else System.out.print("0");
}
System.out.println();//换行
}
}
}</span>
<span style="font-family:Microsoft YaHei;font-size:14px;"> 000
0000
0000 0000 000
0000000 0000 0000
0000000000 000 00000
0000000000000 000 00000
0000000000000000 000 00000
0000000000000000000 000 00000
000000000000000 000 00000
00000000000 0000 000 00000
0000 0000 000 0000
0000 0000 00000
0000 0000 0000
0000 0000 00000
0000 0000 0000
0000 0000 000
0000 0000 000
0000 0000
0000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000000000000000000000
0000 0000
0000 0000 000
0000 0000 000
0000 0000 0000
0000 0000 0000
0000 0000 00000
0000 00 000 0000
0000 00000 0000 00000
0000 0000000 0000 00000
0000 0000000000 0000 0000
00000000000000 0000 00000
000000000000 0000 0000
000000000000 0000 00000
000000000000 0000 00000
000000000000 000000000
0000000000000000 00000000
000000000000 0000 0000000
000000000 0000 000000
00000 0000 000000
0000 000000 0000
0000 00000000 0000
0000 0000000000 0000
0000 000000 0000 0000
0000 000000 00000 0000
0000 000000 0000 0000
0000 000000 00000 0000
0000 0000000 00000 0000
0000 000000 000000 0000
0 0000 0000000 000000 0000
00000 000 0000000 000000 0000
00000000 0000 00000 000000 0000
000000000000000 000 0000000000
00000000000000 00000000
0000000000 0000000
000
</span>