I am new in the Image processing, and I want to identify the QRCode in the image. Actually there are three finder patterns, and at first I need to find them.
So I tried some methods, first is related with binarization, but when image has shadows and strong difference in illumination, then it is difficult to make a good binary image. Actually the adaptive thershold depends on the size of the sliding window, which may be not good for a big barcodes. So even if I make a good binary image, can you suggest me methods of finding the barcode's finder pattern and barcode itself. The easiest way, if we talk about QRCode, is to find all contours of the image and select those which are square shaped and inlude two square shaped contours inside.
Also another method is to scan each horizontal line of the image to find the correct finder pattern, it depends on how well the binary image was made.
So I see the way of solving this problem, but I want to know are there any other different methods of finding the finder patterns of barcode? I think pattern matching is not good here. Can you also suggest a good binarization method, which do not depend on illumination. I tried many adaptive threshold binarization methods, but they have common problem, if the image contains a big black square, then binary image will have not a whole square, but a square with some parts of white color in the middle of the square, this is because the size of sliding window in the adaptive threshold method is not big enough.
You can look at the method used by ZXing: http://code.google.com/p/zxing/source/browse/trunk under core/src/com/google/zxing/qrcode/Detector.java
Basically it looks across the image for black-white-black-white-black in approximately a 1:1:3:1:1 pattern. Unless the angle of rotation is near 45, 135, 225, or 315 degrees, and unless the code is severely perspective-distorted, this method will find a finder pattern. It then cross-checks a couple ways -- looks vertically at that point in the image to confirm it also finds such a pattern. It also has a few more checks to throw out false positives, and then determine which pattern is which.
You could also try a Threshold Hysteresis with a rate of change control. Here is the link to the normal Threshold Hysteresis. Set the first threshold to a typical white value. Set the second threshold to less than the lowest white value in the corners.
The difference is that you want to check the difference between pixels for all values in between the first and second threshold. Ideally if the difference is positive, then act normally. But if it is negative, you only want to threshold if the difference is small.
This will be able to compensate for lighting variations, but will ignore the large changes between the background and the barcode. The final result is a binary object image, not an image of edges. Also there is no adaptive window to try and size properly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With