Read QR code with BoofCV JAR in command line Windows

899 Views Asked by At

I used Zxing library for reading QR codes, however, the failure ratio to read QR codes is quite high and was looking for alternatives.

BoofCV looks good according to tests: https://boofcv.org/index.php?title=Performance:QrCode

However, I'm struggling to make it work and find any tutorials in Windows command line using JAR files.

I have the latest 0.33.1 release libraries (https://sourceforge.net/projects/boofcv/files/v0.33.1/): enter image description here

Is there any simple way to run from command line, I was expecting something like:

java -jar boofcv-recognition-0.33.1.jar -inputQRCodeImagePath [path to local image with QR code]

And then in command line to get text output of what was encoded in QR code, which I can process further.

Thanks in advance!

1

There are 1 best solutions below

0
lessthanoptimal On

This feature has was added a few months ago. Download the BoofApplications, then follow the steps below:

  1. unzip BoofApplications.zip
  2. cd BoofApplications
  3. java -jar applications.jar BatchScanQrCodes

That will print out help. To scan for QR codes in all directories in a path do the following:

java -jar applications.jar BatchScanQrCodes --Recursive -i path/to/input -o path/to/output

Every 50 files it will print out the number of files scanned. Took less than a minute to scan the entire test set of QR codes 562 images. You will then have a file which looks like:

# Found QR Codes inside of images
# ../ValidationBoof/data/fiducials/qrcodes
# Format:
# <File Name> <Total Found>
# message encoded with URLEncoder 
1 ../ValidationBoof/data/fiducials/qrcodes/decoding/v3SMS-Text.png SMSTO%3A555-123-5555%3AMessage+to+Be+Sent.
1 ../ValidationBoof/data/fiducials/qrcodes/decoding/v2SMS-Text.png SMS%3A555-123-5555
1 ../ValidationBoof/data/fiducials/qrcodes/decoding/v2Location.png geo%3A32.81361685253009%2C-117.15371310710907 
1 ../ValidationBoof/data/fiducials/qrcodes/decoding/v3VCard-BasicWikipedia.png BEGIN%3AVCARD%0D%0AVERSION%3A3.0%0D%0AN%3AGump%3BForrest%0D%0AFN%3AForrest+Gump12.01%0D%0AORG%3ABubba+Gump+Shrimp+Co.%0D%0ATITLE%3AShrimp+Man%0D%0APHOTO%3BVALUE%3DURL%3BTYPE%3DPNG%3Ahttp%3A%2F%2Fwww.printbusinesscards.com%2Fw%2Fimages%2Fclassic%2Fpbc_header_logo.png%0D%0ATEL%3BTYPE%3DWORK%2CVOICE%3A%28111%29+555-1212%0D%0ATEL%3BTYPE%3DHOME%2CVOICE%3A%28404%29+555-1212%0D%0AADR%3BTYPE%3DWORK%3A%3B%3B100+Waters+Edge%3BBaytown%3BLA%3B30314%3BUnited+States+of+America%0D%0ALABEL%3BTYPE%3DWORK%3A100+Waters+Edge%5CnBaytown%2C+LA+30314%5CnUnited+States+of+America%0D%0AADR%3BTYPE%3DHOME%3A%3B%3B42+Plantation+St.%3BBaytown%3BLA%3B30314%3BUnited+States+of+America%0D%0ALABEL%3BTYPE%3DHOME%3A42+Plantation+St.%5CnBaytown%2C+LA+30314%5CnUnited+States+of+America%0D%0AEMAIL%3BTYPE%3DPREF%2CINTERNET%3Aforrestgump%40example.com%0D%0AREV%3A20080424T195243Z%0D%0AEND%3AVCARD%0D%0A