Motivation: 100584R - W.A.H.R.Weerathunge

Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

QR CODE DECODING AND IMAGE PREPROCESSING

EN3552 IMAGE PROESSING AND MACHINE VISION


100584R W.A.H.R.Weerathunge

Motivation These methods above can be used to implement image


positioning, however, the time complexity is very high.
QR or Quick Response Code is a method of compressing In This Project, I have used a novel processing technique
High amounts of Data to 2D data matrix images. The of simple datum line selection, rotation angle calculation
Data can be Quickly Read and Decoded Using a smart and tilt correction by the motivation gathered from
phone. reference [1].
Readability at High Speed is the main advantage of QR.
The ability to extract information from partially Algorithm Used
destroyed or distorted QR codes, and the user friendly
ness, makes QR codes practical for businesses. Threshold the RGB image to a binary image
Invert the image
Problem Statement Find initial and final nonzero pixel points (
matrix elements )
Preprocessing QR codes Faster for Readability and Store the values, get datum line
Writing a software to read embedded information from a Calculate Gradient of tilt
captured image from Smart Phones. Acquisition in Tilt correction
different angles and distances, coupled with the
geometric distortion and flat distortion caused by image Equation: = 45 -
capture device, the image of the QR codes will be Datum line gradient =
rotated, zoomed and stretched. To solve the problems
Actual image tilt =
above, two-dimensional code image should have a series
of image processing before adopting national standards
Rotation Transformation
for rapid response code decoding algorithm
Transformation Matrix =
Outline of the solution [ cos A sin A , sinA -cosA]
Recognition Based on Image Processing
If scaling is considered ;
T = [ cos A sin A 0 , sin A -cos A 0 , 0 0 1 ]
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
Because the purpose of rotation coordinates is not
gray-scale processing. I have chosen the global threshold
necessarily integer coordinates, in order to ensure the
method (OTSU method) in ordinary light condition
image is not distorted, the gray value of purpose pixel
needs for interpolation in the image rotation
Tilt correction transformation.
When the image is being scanned, the position of QR The frequently-used methods include;
code often occurs tilt and it needs rotating operation for
the nearest neighbor interpolation
correction. Researches have been done on this problem.
bilinear interpolation
The proposed algorithms hollows out internal points of
the bar code, then gets the edge information and peaks tri-linear interpolation
and slope detection of bar code with Hough transform
over a known point. Among them, the nearest neighbor method is
comparatively simple, processing time is the shortest,
and the real-time performance is very well, but the be further improved for implementation in future. I have
quality of the result is not high, the process of rotation also added Results from the Custom decoder, which is in
prone to jagged boundaries. the form of a bit stream of information.

This method is for applications that require high rotation The results are as follows
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. References
[1]Yunhua Gu,Weixiang Zhang,"QR code recognition
3. Find the pixel value at these source locations. If Based on Image Processing",International Conference on
it is non-integer valued locations, use an interpolation Information Science and Technology ,March 26-28, 2011
Nanjing, Jiangsu, China
function.
[2]Wikipedia/QR-code
Round off the [m, n] and take the pixel value at that [3] M.Sun,LS.Fu,XTYang,S.H.zhang,"Image Analysis
Method for QR
location. Code's Automatic Recognition",Journal of University of
Electronic
Results Science and Technology of China, Vo1.38,No.6,pp.122-
125,Nov.2009.
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

You might also like