最新程序处理时需要一个图形验证码工具,依据图形验证码图片解析出图片,在网络上找了一大圈,发现还是Asprise OCR比较方便。
Asprise OCR项目地址:http://asprise.com/product/ocr/index.php?lang=java
Asprise OCR使用的例子在下载包中都有,下面的例子就是里面的demo:
/* * $Id$ * */ package com.asprise.util.ocr.demo; import java.awt.image.BufferedImage; import java.io.File; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; import java.net.URL; import javax.imageio.ImageIO; import com.asprise.util.ocr.OCR; import java.lang.IllegalArgumentException; public class Demo { public static void main(String[] args) throws IOException, URISyntaxException { if(("1.4").compareTo(System.getProperty("java.vm.version")) > 0) { System.err.println("Warining: \n\nYou need Java version 1.4 or above for ImageIO to run this demo."); System.err.println("Your current Java version is: " + System.getProperty("java.vm.version")); System.err.println("\nSolutions: \n"); System.err.println("(1) Download JRE/JDK version 1.4 or above; OR \n"); System.err.println("(2) Run DemoUI, which can run on your current Java virtual machine."); System.err.println(" Double click the 'runDemoUI' to invoke it.\n"); return; } String path = "d:\\1.png"; File file = new File(path); BufferedImage image = ImageIO.read(file); String s = new OCR().recognizeEverything(image); System.out.println("\n---- RESULTS: ------- \n" + s); } }
由于试用版总是弹出一个确认付费的窗口,在网上找了一个closeWin.exe程序,在破解内容的时候,只需要打开该程序就可以实现批量破解。所有的资料都已经上传供下载了。有需要的自己拿去。