Low Light Image Enhancement Using Zero-DCE algorithm
QR code decoding and Image Preprocessing
1. QR CODE DECODING AND IMAGE PREPROCESSING
EN3552 –IMAGE PROESSING AND MACHINE VISION
100584R – W.A.H.R.Weerathunge
Motivation
QR or Quick Response Code is a method of compressing
High amounts of Data to 2D data matrix images. The
Data can be Quickly Read and Decoded Using a smart
phone.
Readability at High Speed is the main advantage of QR.
The ability to extract information from partially
destroyed or distorted QR codes, and the user friendly
ness, makes QR codes practical for businesses.
Problem Statement
Preprocessing QR codes Faster for Readability and
Writing a software to read embedded information from a
captured image from Smart Phones. Acquisition in
different angles and distances, coupled with the
geometric distortion and flat distortion caused by image
capture device, the image of the QR codes will be
rotated, zoomed and stretched. To solve the problems
above, two-dimensional code image should have a series
of image processing before adopting national standards
for rapid response code decoding algorithm
Outline of the solution
Recognition Based on Image Processing
The algorithm for QR code recognition process based on
image processing is showed in fig. 1.
Binarization
Images collected are converted to grayscale format by
gray-scale processing. I have chosen the global threshold
method (OTSU method) in ordinary light condition
Tilt correction
When the image is being scanned, the position of QR
code often occurs tilt and it needs rotating operation for
correction. Researches have been done on this problem.
The proposed algorithms hollows out internal points of
the bar code, then gets the edge information and peaks
and slope detection of bar code with Hough transform
over a known point.
These methods above can be used to implement image
positioning, however, the time complexity is very high.
In This Project, I have used a novel processing technique
of simple datum line selection, rotation angle calculation
and tilt correction by the motivation gathered from
reference [1].
Algorithm Used
Threshold the RGB image to a binary image
Invert the image
Find initial and final nonzero pixel points (
matrix elements )
Store the values, get datum line
Calculate Gradient of tilt
Tilt correction
Equation: ∅ = 45 - 𝛼
Datum line gradient = ∅
Actual image tilt = 𝛼
Rotation Transformation
Transformation Matrix =
[ cos A sin A , sinA -cosA]
If scaling is considered ;
T = [ cos A sin A 0 , sin A -cos A 0 , 0 0 1 ]
Because the purpose of rotation coordinates is not
necessarily integer coordinates, in order to ensure the
image is not distorted, the gray value of purpose pixel
needs for interpolation in the image rotation
transformation.
The frequently-used methods include;
the nearest neighbor interpolation
bilinear interpolation
tri-linear interpolation
Among them, the nearest neighbor method is
comparatively simple, processing time is the shortest,
2. and the real-time performance is very well, but the
quality of the result is not high, the process of rotation
prone to jagged boundaries.
This method is for applications that require high rotation
Real-time performance,
but less demanding procedures on image quality.
As the bottle neck in preprocessing QR codes is, time
complexity, I have used nearest neighbor technique in the
software decoder.
Nearest neighbor interpolation
To geometrically transform an image, the result we seek
is an image with transformed coordinates. The result of
applying the transformation function is generally not an
integer particularly in case of rotation and scaling. This
poses a problem since the image is defined on a grid. The
solution is interpolation.
n implementation, image rotation is done as follows.
Given I[m,n] to find a transformed image X[m., n.]
where [m., n.]= A x [m, n] + B according to the above
given equation:
1. Create a dummy array X[m., n.].
2. Find the locations [m, n] in I that correspond to
locations [., n.] in the image X by applying the
inverse transformation. I.e. A-1 ([m., n.]-B) = [m, n].
This can result in non-integer locations.
3. Find the pixel value at these source locations. If
it is non-integer valued locations, use an interpolation
function.
Round off the [m, n] and take the pixel value at that
location.
Results
During the experiment, the sample pictures were
collected by shooting in different direction using the
ordinary QR code generator as expected in problem
statement. Images include Different versions of bar code;
the tilt angle exists in the image;
This experiment is carried on in the windows XP system,
using MATLAB programming to process image, and
both image encoding and decoding adopts the method
proposed in QR national standards.
The Zebra Crossing library is used to decode the bit
stream of information embedded in QR, and as the time
permitted, I have also complied part of the decoder
module, even though, not stated in problem statement, to
be further improved for implementation in future. I have
also added Results from the Custom decoder, which is in
the form of a bit stream of information.
The results are as follows
References
[1]Yunhua Gu,Weixiang Zhang,"QR code recognition
Based on Image Processing",International Conference on
Information Science and Technology ,March 26-28, 2011
Nanjing, Jiangsu, China
[2]Wikipedia/QR-code
[3]M.Sun,LS.Fu,XTYang,S.H.zhang,"Image Analysis
Method for QR
Code's Automatic Recognition",Journal of University of
Electronic
Science and Technology of China, Vo1.38,No.6,pp.122-
125,Nov.2009.