src/qrcode/Decoder.java
/**
   *  Decodes a QR Code in a PImage
   *  @param img image to decode
   *  @return String or null if none found
   */
Decodes a QR Code in a PImage
@param img image to decode
@return String or null if none found
Decodes a QR Code in a PImage @param img image to decode @return String or null if none found
public String decode(PImage img) {
    img.loadPixels();
    RGBLuminanceSource source = new RGBLuminanceSource(img.width, img.height, img.pixels);
    BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
    try {
      Result result = reader.decode(bitmap);
      return result.getText();
    } catch (NotFoundException e) {
    } catch (ChecksumException e) {
    } catch (FormatException e) {
    }
    return null;
  }
public String decode ( PImage img ) { img . loadPixels ( ) ; RGBLuminanceSource source = new RGBLuminanceSource ( img . width , img . height , img . pixels ) ; BinaryBitmap bitmap = new BinaryBitmap ( new HybridBinarizer ( source ) ) ; try { Result result = reader . decode ( bitmap ) ; return result . getText ( ) ; } catch ( NotFoundException e ) { } catch ( ChecksumException e ) { } catch ( FormatException e ) { } return null ; }
Decodes a QR Code in a PImage
  @param img image to decode
  @return String or null if none found
Decodes a QR Code in a PImage @param img image to decode @return String or null if none found
// convert to luminance source // run decoder