P
US10108835B2ActiveUtilityPatentIndex 70

Method and system for decoding two-dimensional code using weighted average gray-scale algorithm

Assignee: FUJIAN LANDI COMMERCIAL EQUIPPriority: Jul 23, 2015Filed: Jan 15, 2018Granted: Oct 23, 2018
Est. expiryJul 23, 2035(~9 yrs left)· nominal 20-yr term from priority
Inventors:JIANG SHENGZHANGWU WEIDONG
G06K 7/1417G06K 7/10G06T 7/187G06T 7/136G06T 7/12
70
PatentIndex Score
2
Cited by
4
References
7
Claims

Abstract

The invention provides a method and system for decoding two-dimensional code using weighted average gray-scale algorithm. The method comprises: segmenting a received two-dimensional code image into bit regions each containing one bit data; presetting a shifting threshold, and shifting four original boundary lines of the bit region outwards by a distance of the shifting threshold to obtain four preset boundary lines; calculating an average gray-scale value of the bit region using the weighted average algorithm by taking an overlapping area between pixels inside the four preset boundary lines and the bit region as a weight; binarizing the two-dimensional code image according to the average gray-scale value of the bit region; and decoding the two-dimensional code image. The influence of the pixels which have an overlapping area with the bit region on the average gray-scale value of the bit region is considered, and the decoding accuracy and success rate are high.

Claims

exact text as granted — not AI-modified
What is claimed is: 
     
       1. A method for decoding two-dimensional code using weighted average gray-scale algorithm, characterized by comprising:
 segmenting a received two-dimensional code image into bit regions each containing one bit data; 
 presetting a shifting threshold, and shifting four original boundary lines of the bit region outwards by a distance of the shifting threshold to obtain four preset boundary lines; 
 calculating an average gray-scale value of the bit region using the weighted average algorithm by taking an overlapping area between pixels inside the four preset boundary lines and the bit region as a weight; 
 binarizing the two-dimensional code image according to the average gray-scale value of the bit region; and 
 decoding the binarized two-dimensional code image; 
 wherein a solution of calculating the overlapping area between pixels inside the four preset boundary lines and the bit region includes: 
 finding all the pixels inside the four preset boundary lines; 
 selecting one selected point from the pixel and recording coordinates of the selected point and a position relationships between the selected point boundary lines of the pixels; 
 calculating distances from the selected point to the four original boundary lines of the bit region and their position relationships; 
 calculating a length and a width of the overlapping area between the pixels and the bit region; and 
 calculating the overlapping area between the pixels and the bit region. 
 
     
     
       2. The method for decoding two-dimensional code using weighted average gray-scale algorithm according to  claim 1 , wherein the shifting threshold is less than or equal to the width of one pixel. 
     
     
       3. The method for decoding two-dimensional code using weighted average gray-scale algorithm according to  claim 1 , wherein the selected point is any one of the pixels. 
     
     
       4. The method for decoding two-dimensional code using weighted average gray-scale algorithm according to  claim 1 , wherein calculating an average gray-scale value of the bit region using the weighted average algorithm by taking the overlapping area between pixels inside the four preset boundary lines and the bit region as a weight specifically includes:
 assuming that k represents the number of pixels inside the four preset boundary lines, P i  represents pixels, where i=1, 2, . . . , k, S i  represents the overlapping area between the pixels P i  and the bit region, S represents the area of the bit region, Gp i  represents the gray-scale value of the pixels P i , and Gave represents the average gray-scale value of the bit region, then the average gray-scale value Gave of the bit region is: 
 
       
         
           
             
               Gave 
               = 
               
                 
                   ∑ 
                   
                     i 
                     = 
                     1 
                   
                   k 
                 
                 ⁢ 
                 
                   
                     Gp 
                     i 
                   
                   * 
                   
                     
                       S 
                       i 
                     
                     / 
                     
                       S 
                       . 
                     
                   
                 
               
             
           
         
       
     
     
       5. The method for decoding two-dimensional code using weighted average gray-scale algorithm according to  claim 1 , wherein calculating an average gray-scale value of the bit region using the weighted average algorithm by taking the overlapping area between pixels inside the four present boundary lines and the bit region as a weight specifically includes:
 assuming that k represents the number of pixels inside the four preset boundary lines, P i  represents pixels, where i=1, 2, . . . , k, S i  represents the overlapping area between the pixels P i  and the bit region, Gp i  represents the gray-scale value of the pixel P i , and Gave represents the average gray-scale value of the bit region, the average gray-scale value Gave of the bit region is: 
 
       
         
           
             
               Gave 
               = 
               
                 
                   
                     
                       ∑ 
                       
                         i 
                         = 
                         1 
                       
                       k 
                     
                     ⁢ 
                     
                       
                         Gp 
                         i 
                       
                       * 
                       
                         S 
                         i 
                       
                     
                   
                   
                     
                       ∑ 
                       
                         i 
                         = 
                         1 
                       
                       k 
                     
                     ⁢ 
                     
                       S 
                       i 
                     
                   
                 
                 . 
               
             
           
         
       
     
     
       6. The method for decoding two-dimensional code using weighted average gray-scale algorithm according to  claim 1 , wherein binarizing the two-dimensional code image according to the average gray-scale value of the bit region specifically includes:
 calculating a gray-scale threshold of the two-dimensional code image according to the average gray-scale value of the bit region by using the Otsu method; and 
 binarizing the bit region according to the gray-scale threshold so as to obtain the binarization of the two-dimensional code image. 
 
     
     
       7. The method for decoding two-dimensional code using weighted average gray-scale algorithm according to  claim 1 , wherein binarizing the two-dimensional code image according to the average gray-scale value of the bit region specifically includes:
 calculating a gray-scale threshold of the two-dimensional code image according to the average gray-scale value of the bit region by using the average value algorithm; and 
 binarizing the bit region according to the gray-scale threshold so as to obtain the binarization of the two-dimensional code image.

Cited by (0)

No later patents cite this yet.

References (0)

No backward citations on record.