Java版美女来找茬辅助软件源码:
原理很简单:主要是通过屏幕截图获取两张图片,然后通过将两组图片一个像素一个像素的进行比较,从而找出不同之处~
附上使用效果:

关键代码:
[java]
- public void getPic() {
- locationP = this.getLocation();
- this.setLocation(1400, 800);
- try {
- Thread.sleep(200);
- } catch (InterruptedException e1) {
- e1.printStackTrace();
- }//这里得到三个BufferedImage对象。bi1为左边的图片,bi2为右边的图片,bi3是bi1的副本用于修改。
- bi1 = r.createScreenCapture(new Rectangle(left1, top1, width, height));
- bi2 = r.createScreenCapture(new Rectangle(left2, top2, width, height));
- bi3= r.createScreenCapture(new Rectangle(left1, top1, width, height));
- /* 更改图3实际上就是更改图1.
- bi3=bi1.getSubimage(0, 0, bi1.getWidth(), bi1.getHeight());*/
- for (int i = 5; i < bi1.getHeight() - 5; i += 1) {
- for (int j = 5; j < bi1.getWidth() - 5; j += 1) {
- if (bi3.getRGB(j, i) != bi2.getRGB(j, i)) {
- bi3.setRGB(j, i, Color.BLACK.getRGB());
- }
- }
- }//这个循环就是找出颜色不同的像素并在bi3上进行颜色修改,这里我们将不同颜色的点设置为黑色
- if (model == 1) {
- p.setIcon(new ImageIcon(bi3));
- }else if(model==2){
- flag=true;
- }//这里提供了两种模式的切换
- this.setLocation(locationP);
- }
附上可以运行的jar文件和源码下载地址:
免费下载地址在 http://linux.linuxidc.com/
用户名与密码都是www.linuxidc.com
具体下载目录在 /2012年资料/2月/19日/Java版美女来找茬辅助软件源码/
