Ok !! i found an easy way to get the captcha using java
i wrote a metod to read clipboard and determine resolution to get only the captcha
but i need to do javadoc for it
Code:
import java.awt.Toolkit;
import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.DataFlavor;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.UnsupportedFlavorException;
import java.awt.image.BufferedImage;
import java.io.IOException;
//import java.nio.Buffer;
public class CutCaptcha {
BufferedImage screen = getImageFromClipboard();
private int comprimento = screen.getWidth();
private int altura = screen.getHeight();
//Metodo para pegar imagem do Clipboard
public static BufferedImage getImageFromClipboard() {
Clipboard systemClipboard = Toolkit.getDefaultToolkit().getSystemClipboard();
Transferable clipboardContents = systemClipboard.getContents(null);
if (clipboardContents == null)
return null;
else
try {
if (clipboardContents.isDataFlavorSupported(DataFlavor.imageFlavor)) {
BufferedImage image = (BufferedImage) clipboardContents.getTransferData(DataFlavor.imageFlavor);
return image;
}
} catch (UnsupportedFlavorException ufe) {
ufe.printStackTrace();
} catch (IOException ioe) {
ioe.printStackTrace();
}
return null;
}
//Obter Comprimento
public int getComprimento() {
return comprimento;
}
//Obter Altura
public int getAltura() {
return altura;
}
//Cortar imagem
public BufferedImage getCaptcha(){
if(getComprimento() == 1024 && getAltura() == 768){
return screen.getSubimage(345, 455, 200, 64);
}else {
return null;
}
}
}
now i will add more resolutions and i doing the filter for clean image
but i need a litle help to derotate text ...
please helpme with this ....
I followng this steps:
1-getCaptcha - get only the captcha -ready!
2-filterCaptcha - Clean captcha noise - working in process 68%
3-derotateCaptcha - Find bether angle to improve accuracy - NEED HELP HERE PLEASE !
4-Ocr

-ready !
5-Robot + gui class - next step !