Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Help with QR Code Decoding

I’m working on something with QR codes.  There will be two components:

  • A UI to generate a QR code.  The operator will enter some info on this interface then generate the QR code.  The operator will then take a picture of the UI with their cell phone.
  • A process that interprets the QR code.  The QR code photo that was taken with the cell phone needs to be interpreted. (running on a Windows machine)

I’ve got 1) working and need help with 2).

 

I’ve got a solution created with the vision toolkit that works OK with a ‘perfect’ photo.  However, if the photo of the QR code isn’t perfect, my solution fails more often than not.  If there is skew or blurriness the QR code isn’t detected.  I’ve found that doing a manual threshold of the image helps with blurry images, but I can’t seem to get skewed images to ever work.

I’ve attached the code I’m using, sample images I’m testing against and a vision assistance script that mirrors what the code is doing.

 

I have to say that working with NI QR decode VI and Vision Assistance step can be quite painful.  If you enter the wrong settings the algorithm can sit for minutes at a time thinking.  On multiple occasions I've just killed the LabVIEW process to get out of what seems like a never ending QR detection thread.  I’m not quite sure how to handle that in the production environment.  What happens if two or three images show up that causes the algorithm to stall for 15 minutes?

 

While developing I became concerned that the issue was simply that QR codes are very sensitive to being just right.  I started looking at alternatives to NI’s decoder and found many python examples using opencv and/or ZBar QR decoder.  A quick test with these other implementations shows that all my bar codes can be decoded properly.  Surprisingly (at least to me) these other algorithms seem to work better then NI’s.  They’re at least as fast, require no specifications, and never seem to stall for minutes.  I’ve included a sample python script (it requires opencv-python and pyzbar be pip installed).  I know that LV2018+ has a native python interface node.  Perhaps the best solution here is to use that node to call a python script that detects the QR code?  (Maybe I should do the entire thing in python, I’ve been looking for an excuse to get more serious with python, maybe this is it?)

 

I apologize, this post is getting long…

 

Can anyone help with getting NI’s QR code detector to work ‘better’ with the attached images?

 

Thanks

 

LabVIEW 2017 f2 (32 bit)

Vision Development Module 17.0.0

Vision Assistant 17.0.0 (32-bit)

0 Kudos
Message 1 of 1
(1,958 Views)