Skip to content

Instantly share code, notes, and snippets.

@rodriguesabner
Last active May 29, 2019 02:38
Show Gist options
  • Save rodriguesabner/549bd1c99eb40c4161c0670083d8a648 to your computer and use it in GitHub Desktop.
Save rodriguesabner/549bd1c99eb40c4161c0670083d8a648 to your computer and use it in GitHub Desktop.
Método run
@Override
public void run() {
do {
try {
Thread.sleep(100);
} catch (InterruptedException e) {
e.printStackTrace();
}
Result result = null;
BufferedImage image = null;
if (webcam.isOpen()) {
if ((image = webcam.getImage()) == null) {
continue;
}
}
LuminanceSource source = new BufferedImageLuminanceSource(image);
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
try {
result = new MultiFormatReader().decode(bitmap);
} catch (NotFoundException e) {
//No result...
}
if (result != null) {
jTextField1.setText(result.getText());
}
} while (true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment