Last active
May 29, 2019 02:38
-
-
Save rodriguesabner/549bd1c99eb40c4161c0670083d8a648 to your computer and use it in GitHub Desktop.
Método run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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