eliminazione classe per scanner qr tramite webcam
This commit is contained in:
parent
0e938c1df1
commit
42ce8d5fd6
@ -6,14 +6,7 @@
|
||||
|
||||
package puntocassa;
|
||||
|
||||
import com.github.sarxos.webcam.Webcam;
|
||||
import com.google.zxing.BinaryBitmap;
|
||||
import com.google.zxing.LuminanceSource;
|
||||
import com.google.zxing.MultiFormatReader;
|
||||
import com.google.zxing.NotFoundException;
|
||||
import com.google.zxing.Result;
|
||||
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
|
||||
import com.google.zxing.common.HybridBinarizer;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
|
@ -1,51 +0,0 @@
|
||||
/*
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
|
||||
*/
|
||||
package puntocassa.utils;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author assis
|
||||
*/
|
||||
import com.github.sarxos.webcam.Webcam;
|
||||
import com.google.zxing.*;
|
||||
import com.google.zxing.client.j2se.BufferedImageLuminanceSource;
|
||||
import com.google.zxing.common.HybridBinarizer;
|
||||
|
||||
import java.awt.Dimension;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class QRScanner {
|
||||
|
||||
public static void main(String[] args) {
|
||||
Webcam webcam = Webcam.getDefault();
|
||||
webcam.setViewSize(new Dimension(1280, 720));
|
||||
webcam.open();
|
||||
|
||||
while (true) {
|
||||
BufferedImage image = webcam.getImage();
|
||||
if (image == null) continue;
|
||||
|
||||
LuminanceSource source = new BufferedImageLuminanceSource(image);
|
||||
BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
|
||||
|
||||
try {
|
||||
List<String> dataResult = new ArrayList<>();
|
||||
Result result = new MultiFormatReader().decode(bitmap);
|
||||
System.out.println("QR Code trovato: " + result.getText());
|
||||
//decripting
|
||||
dataResult = QrCryptoService.decryptAndValidate(result.getText());
|
||||
System.out.println("QR code decriptato: " + dataResult);
|
||||
break;
|
||||
} catch (NotFoundException e) {
|
||||
// Nessun QR code trovato nel frame
|
||||
}
|
||||
}
|
||||
|
||||
webcam.close();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user