[go: up one dir, main page]

CN118504599A - Color bar identification code, identification code identification and decoding method and electronic equipment - Google Patents

Color bar identification code, identification code identification and decoding method and electronic equipment Download PDF

Info

Publication number
CN118504599A
CN118504599A CN202410957794.4A CN202410957794A CN118504599A CN 118504599 A CN118504599 A CN 118504599A CN 202410957794 A CN202410957794 A CN 202410957794A CN 118504599 A CN118504599 A CN 118504599A
Authority
CN
China
Prior art keywords
color
decoding
channel
image
verification
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202410957794.4A
Other languages
Chinese (zh)
Other versions
CN118504599B (en
Inventor
聂玮成
王彬
周康
季北辰
唐晴桃
谢拓
乔国公
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jiangsu Peregrine Microelectronics Co ltd
Original Assignee
Jiangsu Peregrine Microelectronics Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jiangsu Peregrine Microelectronics Co ltd filed Critical Jiangsu Peregrine Microelectronics Co ltd
Priority to CN202410957794.4A priority Critical patent/CN118504599B/en
Publication of CN118504599A publication Critical patent/CN118504599A/en
Application granted granted Critical
Publication of CN118504599B publication Critical patent/CN118504599B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14131D bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • G06K7/1443Methods for optical code recognition including a method step for retrieval of the optical code locating of the code in an image
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/20Image preprocessing
    • G06V10/26Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion
    • G06V10/267Segmentation of patterns in the image field; Cutting or merging of image elements to establish the pattern region, e.g. clustering-based techniques; Detection of occlusion by performing operations on regions, e.g. growing, shrinking or watersheds
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06VIMAGE OR VIDEO RECOGNITION OR UNDERSTANDING
    • G06V10/00Arrangements for image or video recognition or understanding
    • G06V10/40Extraction of image or video features
    • G06V10/56Extraction of image or video features relating to colour
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Electromagnetism (AREA)
  • Health & Medical Sciences (AREA)
  • Multimedia (AREA)
  • General Health & Medical Sciences (AREA)
  • Toxicology (AREA)
  • Artificial Intelligence (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Compression, Expansion, Code Conversion, And Decoders (AREA)
  • Compression Of Band Width Or Redundancy In Fax (AREA)

Abstract

The invention discloses a color bar identification code, an identification code identification and decoding method and electronic equipment. And combining the Y channel components, and forming a strip-shaped color bar identification code containing multiple standard colors by aligning and splicing single-color blocks with different standard colors, wherein the different standard colors represent different information features. In the identification and decoding process, the complete coding information of the color bar identification code can be accurately extracted from the color pattern to be identified on the basis of utilizing less computational power resources and not carrying out absolute and accurate pattern segmentation by judging the connected set characteristics of the color pattern to be identified and y component values thereof and related characteristic conditions, and carrying out the steps of angle correction, verification decoding matching and color block attribute matching, so that the high-efficiency decoding of the color bar identification code is realized.

Description

Color bar identification code, identification code identification and decoding method and electronic equipment
Technical Field
The invention relates to a data representation structure and a data identification method, in particular to a color bar code and an identification and decoding method thereof.
Background
Computer pattern recognition has become an important research branch of computer vision technology and is also an important basis for image retrieval. The local features of the image are key for identification, and the method has special advantages in aspects of providing more image detail information, providing object semantic support foundation, identifying the object under the shielding condition and the like.
Bar code technology, one of the automatic identification systems, is mature. The bar code is a graphic identifier for expressing a set of information by arranging a plurality of black bars and blanks with different widths according to a certain coding rule. Compared with other recognition technologies, the bar code has the advantages of easy symbol manufacture, simple and easy scanning operation, high information acquisition speed, high data reliability and the like.
However, the standard colors used for feature coding by the traditional bar code identification technology are only black and white, and a large gap exists in the utilization of graphic color coding information, so that the expansion space of the bar code coding information capacity is severely limited. Meanwhile, development of bar code technology based on multiple colors has a plurality of bottlenecks such as difficult pattern segmentation and positioning, larger image under illumination condition and the like.
Disclosure of Invention
The invention aims to: aiming at the prior art, a color bar code, an identification code identification and decoding method and electronic equipment are provided, and the problems that the conventional bar code technology is difficult to utilize the figure color information, the identification and decoding process has high requirements on the figure segmentation accuracy and the identification is difficult under special illumination conditions are solved.
The technical scheme is as follows: a color bar code comprises N rectangular monochromatic blocks which are aligned and spliced in sequence along the width direction of the color block; the first T rectangular color blocks are used as verification color blocks, each verification color block takes different standard colors, and the brightness components are lower than a preset threshold Th_Y1; the later (N-T) rectangular color blocks are used as coding color blocks, in the coding color block sequences, the coding color blocks of each odd sequence respectively take one color from j standard colors, the brightness component of the coding color blocks is higher than a preset threshold Th_Y2, the coding color blocks of each even sequence respectively take one color from o standard colors, the brightness component of the coding color blocks is lower than a preset threshold Th_Y1, the j standard colors and the o standard colors are not overlapped, and Th_Y2 is more than 0.5> Th_Y1; coded color blocks of different standard colors characterize different coded values.
Further, the value range of N is 20-30, the value range of T is 2-6, and the value range of Z=T+j+o is 10-20.
Further, the RGB channel values of each standard color are selected from p equal difference fixed gray values.
Further, for T verification color patches, the RGB channel value of the color of one verification color patch is {0, 0}; one channel value in the RGB channels of the colors of the residual verification color blocks is 0, and the values of the other two channels are equal; for a verification color block with a channel value {0, 0}, its characterized verification code is "- -"; for the remaining validation color patches, the validation code for a channel representation with a channel value of 0 is "-", and the validation code for a channel representation with a channel value of 1 is "+".
A method of identifying and decoding a color bar code, comprising:
step 1: preprocessing an RGB mode image to be identified containing the color bar identification code;
Step 2: positioning the bar identification code and dividing the image by judging the characteristic of the Y-channel connected set of the image to be identified;
step 3: carrying out feature condition judgment on the sub-images containing the candidate bar identification codes obtained in the step 2 one by one, and finally positioning and extracting a bar identification code decoding area;
step 4: and performing decoding operation on the bar code decoding area to obtain the decoding value of the color bar code.
Further, the step 2 includes:
Step 2.1: extracting Y channel components of each pixel in an RGB mode image to be identified, reserving 2 bits after decimal point of the converted Y component values, and performing normalization processing to form a Y channel image;
step 2.2: extracting 8 connected sets with similar numbers of all pixels in the Y channel image;
Step 2.3: bringing together 8 connected sets with similar pixel numbers and adjacent relations to form a new connected set, wherein each 8 connected set in the new connected set is called an original connected set; when the number of the original connected sets contained in the new connected sets is [ N, N+delta N ], the new connected sets are considered to be candidate bar identification codes, the Y-channel image is segmented according to the pixel coordinates of the new connected sets, and the image to be identified preprocessed in the step 1 is synchronously segmented according to the corresponding relation of the pixel coordinates, so that the Y-channel sub-image and the RGB mode sub-image containing the candidate bar identification codes are respectively obtained.
Further, the step 3 includes:
step 3.1: carrying out convolution of 8 gradient directions on a first Y-channel sub-image containing candidate bar identification codes to form 8 feature sub-images, calculating the average pixel value of each feature sub-image, sequentially marking the gradient directions corresponding to two feature sub-images with the highest average pixel value as alpha 1、α2, if alpha 1 and alpha 2 have an orthogonal relationship, determining that the candidate bar identification codes accord with a first feature condition, otherwise, carrying out first feature condition judgment on the next Y-channel sub-image containing the candidate bar identification codes; the Y channel sub-image meeting the first characteristic condition and the corresponding RGB mode sub-image are rotated by an angle alpha 1;
step 3.2: according to the original connected set boundary in the candidate bar identification code obtained in the step 2.3, dividing pixel blocks of the RGB mode sub-image subjected to the rotation processing in the step 3.1, and then extracting pixel blocks meeting any one of the following two conditions from the divided pixel blocks to serve as candidate verification color blocks; wherein the condition ①: one channel value in the RGB channels of the pixel corresponding to the pixel block is smaller than a threshold th 1, the other two channel values are larger than or equal to 2 x th 1, and the absolute value of the difference value of the two channel values is smaller than the threshold th 2; condition ②: the RGB three channel values of the corresponding pixels of the pixel block are smaller than a threshold th 1; performing verification decoding on the obtained candidate verification color block, decoding channel values with pixels smaller than a threshold th 1 into "-", and decoding channel values with pixels larger than or equal to the threshold th 1 into "+", so as to form a verification decoding string; if the verification decoding string contains a complete verification coding string defined by the color bar identification code, the candidate bar identification code is determined to meet a second characteristic condition, and a plurality of candidate verification color blocks corresponding to the verification decoding string are taken as verification areas; otherwise, returning to the step 3.1 to perform first characteristic condition judgment on the next Y-channel sub-image containing the candidate bar identification codes;
Step 3.3: for the Y channel sub-image corresponding to the candidate bar identification code meeting the second characteristic condition, carrying out threshold processing on the original connected set in the Y channel sub-image, and if the pixel value of the original connected set is smaller than 0.5, mapping the attribute mark of the original connected set to 0; if the pixel value of the original connected set is greater than or equal to 0.5, mapping the attribute mark of the original connected set to 1; acquiring attribute mark value strings of (N-T) original connected sets connected with a verification area in a Y channel sub-image, and if the attribute mark value strings are matched with color block attribute mark value strings defined by the color bar code standard bit by bit, determining that the candidate bar code meets a third characteristic condition, wherein the boundary of the (N-T) original connected sets in the candidate bar code is the boundary of a bar code decoding area for final decoding; otherwise, returning to the step 3.1 to perform first characteristic condition judgment on the next Y-channel sub-image containing the candidate bar identification codes; and extracting a bar identification code decoding area from the RGB mode sub-image corresponding to the Y channel sub-image, and dividing the bar identification code decoding area into (N-T) decoding color blocks according to the boundary of the original connected set.
Further, the steps include: and for each decoding color block in the decoding area of the bar identification code, calculating the average value of RGB channel values of all pixel points in each decoding color block to form decoding color vectors of each decoding color block, then carrying out Euclidean distance calculation on each code color vector in an odd sequence and three-dimensional vectors of each color in the j standard colors one by one, carrying out Euclidean distance calculation on each code color vector in an even sequence and three-dimensional vectors of each color in the o standard colors one by one, respectively taking the standard color corresponding to the minimum distance value as the color of each decoding color block, and taking the coding value corresponding to each standard color as the decoding value of each decoding color block.
Further, in the step 3.3, in the Y-channel sub-image, the original connected set is scanned from the center point coordinate of the verification area to the right, and the attribute mark value is recorded from the original connected set which is not in the verification area, and the scanning is stopped until the (N-T) -th original connected set is scanned, so that the attribute mark value string with (N-T) bits only containing 0 and 1 is obtained.
An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, said processor implementing said method of identifying and decoding a colour bar identification code when said program is executed.
The beneficial effects are that: the color bar code combines the Y channel components, and forms a bar code which is bar-shaped and contains multiple standard colors through alignment and splicing of single-color blocks with different standard colors, wherein the different standard colors represent different information characteristics.
In the identification and decoding process, the complete coding information of the color bar identification code can be accurately extracted from the color pattern to be identified on the basis of utilizing less computational power resources and not carrying out absolute and accurate pattern segmentation by judging the connected set characteristics of the color pattern to be identified and y component values thereof and related characteristic conditions, and carrying out the steps of angle correction, verification decoding matching and color block attribute matching, so that the high-efficiency decoding of the color bar identification code is realized.
Drawings
FIG. 1 is an example of a color bar code defined in the present invention;
FIG. 2 is a schematic diagram of the process of identifying and decoding color bar codes according to the present invention;
FIG. 3 is a schematic diagram of candidate bar codes according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of gradient directions and associated convolution kernels for feature condition determination according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of verification decoding and matching modes for feature condition determination according to an embodiment of the present invention;
fig. 6 is a schematic diagram of a pixel value matching manner after original connected set scanning for feature condition determination according to an embodiment of the present invention.
Detailed Description
The invention is further explained below with reference to the drawings.
A color bar code comprising a bar code carrier on which the color bar code is fabricated by, but not limited to, printing, spraying, printing.
Standard definition and coding mode of bar identification code:
Defining a color bar code (hereinafter called bar code), and sequentially aligning and splicing N rectangular color blocks i with single color blocks of W.H along the width W direction of the color blocks to form a rectangular bar code containing multiple standard colors, wherein the color of each rectangular color block i is denoted as c (block i), and i E [1, N ]. In the bar code, the first T rectangular color blocks are used as verification color blocks, and each color block takes different standard colors and contains lower brightness components for positioning and verifying the bar code. In the bar identification code, the latter (N-T) rectangular color blocks are used as coding color blocks, the first coding color block is marked as a sequence 1 in the coding color blocks, each odd-numbered coding color block takes one color from j standard colors and contains higher brightness components, each even-numbered coding color block takes one color from o standard colors and contains lower brightness components, and j standard colors and o standard colors are not overlapped. In the coded color block, different standard colors represent different coded values, the total coded capacity is j (N-T)/2*o(N-T)/2 when (N-T) is even, and the total coded capacity is j ((N-T-1)/2)+1*o(N-T-1)/2 when (N-T) is odd. In the present invention, N.epsilon.20, 30 is preferred, and the aspect ratio of the single rectangular color block is 1: and 8, a better bar identification code segmentation and recognition effect can be obtained. Further, w=3 mm is preferable.
Specifically, the T standard colors of the verification color block and the (j+o) standard colors of the coding color block together form a standard color set CS, and the total number of elements z=t+j+o in the set, for an image sensor or an image signal processing (isp) system with higher performance, Z may take a higher value to increase the coding information capacity of the bar code, preferably Z e [10,20]. Each element CS i in CS is a three-dimensional vector, i.e., RGB channel values corresponding to the standard colors, denoted as CS i={ r(CSi),g(CSi),b(CSi). The RGB channel values of each element in CS are selected from among p constant gray values of equal difference (or approximately equal difference), respectively. For example, for an 8bit color image, when p is 4, the channel value of each standard color in the bar code is one from the gray value set {0, 85, 170, 255 }. In the coded color block, the three-dimensional vectors of the related colors of the odd sequence form a vector element subset CSJ, wherein the elements CSJ i ={ r(CSJi),g(CSJi),b(CSJi) in the subset; the three-dimensional vectors of even-sequence related colors form a subset of vector elements CSO, elements CSO i ={ r(CSOi),g(CSOi),b(CSOi in the subset). In the invention, better graphic processing effect can be obtained when p epsilon [2,5] is preferable, wherein the higher the number of standard color elements contained in CS, the higher the value of p is needed.
Further, the Y-channel component of each CS i is extracted and normalized. For an 8bit color image, the calculation mode of each standard color Y channel component is as follows: y= (0.299r+0.587g+0.114 b) \255, the y-channel component represents the luminance value of the image, and the converted y-component value retains 2 bits after the decimal point. Wherein, for the verification color block, y is [0.00,0.30]; for odd sequences of encoded color blocks, y ε [0.70,1.00]; for even sequences of encoded color blocks, y ε 0.00,0.30. The invention sets the attribute of the standard color with the y component value lower than 0.50 as dark and the attribute of the standard color with the y component value higher than or equal to 0.50 as bright. Therefore, in one bar code, the first T rectangular color blocks have dark attributes, the other rectangular color blocks have bright and dark intervals, each dark attribute rectangular color block is marked with 0, and each bright attribute color block is marked with 1.
For T verification color patches, the RGB channel value for the color of one of the color patches is {0, 0}; one channel value in the RGB channels of the colors of the rest color blocks is 0, and the values of the other two channels are equal. For a verification color block with a channel value of {0, 0}, encoding it as a three-bit verification code of "- -"; for the remaining validation color blocks, channels with channel values of 0 are encoded as "-", and channels with channel values of 1 are encoded as "+".
Table 1 shows a standard color set of 15 color elements, each channel value of each standard color being one of 4 arithmetic values {0, 85, 170, 255 }. The first 4 colors CS 1~CS4 in the standard color set are used for verifying the color taking of the color block (dark attribute), and the corresponding verification code values are respectively: - - -, a ++ -, - ++. CS 5~CS8 is used for taking the color of even sequence (dark attribute) in the coded color block, corresponding to the coded value CO (CS i)∈{1,2, 3,4};CS9~CS15 is used for taking the color of odd sequence (bright attribute) in the coded color block, corresponding to the coded value CO (CS i) epsilon {1,2,3,4,5,6,7}. If N is an odd number, T is an 4, the coded information capacity of the standard color set is 7 (N-5)/2+1*4(N-5)/2.
TABLE 1 Standard color set
Fig. 1 shows an example of a bar code defined in table 1, which includes a rectangular color block number n=21. Wherein, the colors of the verification color blocks 1~block4 correspond to standard color CS 1、CS2、CS3、CS4 respectively, the y component values thereof correspond to dark attribute color blocks which are in the range of [0.00,0.30] respectively, and the y component values thereof are 0.00,0.30, 0.14 and 0.23 respectively, and the formed verification code string is: - - - ++ - + - + - ++. The 5 th rectangular color block corresponds to the 1 st coding color block, and y component values of color blocks of odd sequences in the coding color block meet [0.70,1.00], namely the bright attribute color block with the attribute mark value of 1; the y component values of the even sequence of color blocks in the encoded color block satisfy [0.00,0.30], namely the dark attribute color block with the attribute marking value of 0. In fig. 1, the 16-bit coded numeric string represented by the 16 coded color blocks is: 61734274512213645.
The method for identifying and decoding the color bar identification code comprises the following specific steps:
step 1: and preprocessing the RGB mode image to be identified containing the color bar identification code.
Step 1.1: the image to be identified containing the color bar identification code is acquired by the image pickup device, and the image size is set as Q.times.A pixels.
Step 1.2: and carrying out Gaussian filtering with lower intensity on all three channels of the image to be identified so as to reduce the interference of image noise on graph segmentation and positioning. The lower-intensity Gaussian filtering refers to convolution processing of the image channel value by using a Gaussian filter check with a smaller standard deviation. In this embodiment, a 3*3 gaussian filter kernel with a smaller standard deviation is: [0.075,0.124,0.075;0.124,0.204,0.124;0.075,0.124,0.075].
Step 1.3: and carrying out histogram equalization processing on the channel values of the Gaussian filtered image to be identified so as to reduce interference of image shadows or highlights on graph segmentation and positioning.
Step 2: and positioning the bar identification code and dividing the image by judging the characteristic of the Y-channel connected set of the image to be identified.
Step 2.1: and extracting Y channel components of each pixel in an image f (x, Y) to be identified in an RGB mode, reserving 2 bits after decimal point of the converted Y component values, and carrying out normalization processing to form a Y channel image g (x, Y), wherein x and Y are pixel coordinate values, x is [1, Q ], and Y is [1, A ].
Step 2.2: and 8 connected sets with similar numbers of all pixels in the Y channel image are extracted. In particular, since the decimal truncation of the Y component value is performed, and the quantization processing is equivalently performed on the Y channel component value of each pixel, pixels having a certain fine difference in the original Y component value also have the same value after quantization, that is, there is a possibility that the quantization processing has an 8-way relationship. When the difference between the pixel numbers of the two 8 connected sets is smaller than the preset pix_dif, the two connected sets are considered to have similar pixel numbers. For a group of 8-connected sets with similar pixel numbers, the average pixel quantity pix_ave of the 8-connected sets is calculated. Preferably, when the pix_dif value is taken as 0.5% -3% of the total amount of the image pixels, better connected set segmentation efficiency can be obtained.
Step 2.3: when more than pix_ave×k pixels in the 8-connected set a are within the 8-neighborhood range of any pixel in the 8-connected set B, then the 8-connected set a and the 8-connected set B are considered to have an adjacency relationship. The sets of 8 connected sets having similar numbers of pixels and having an adjacency relationship are aggregated to form a new connected set, each 8 connected set in the new connected set being referred to as an original connected set. When the number of the original connected sets contained in the new connected set is [ N, N+delta N ], the new connected set is considered as a candidate bar identification code. And (3) dividing the Y-channel image g (x, Y) according to the pixel coordinates of the new connected set, and synchronously dividing the image to be identified preprocessed in the step (1) according to the corresponding relation of the pixel coordinates to respectively obtain a Y-channel sub-image and an RGB mode sub-image containing the candidate bar identification code. And if the new connected set meeting the condition of the candidate bar identification codes does not exist, judging that the color bar identification codes do not exist in the image to be identified.
Preferably, when delta N is 5,10 and k is 5, 10%, the segmentation efficiency and accuracy can be better considered. If the number of rectangular color patches of the defined color bar code n=21, when Δn is set to 10, as shown in fig. 3, if the new connected set 1 contains 26 original connected sets, the number of which is in the interval [21,31], the new connected set 1 is the candidate bar code; and the new connected set 2 only contains 8 original connected sets, the number of which is not in the interval [21,31], the new connected set 2 is not a candidate bar identification code.
Step 3: and judging the characteristic conditions of the sub-images containing the candidate bar identification codes one by one, and finally positioning and extracting the bar identification code decoding area.
Step 3.1: as shown in fig. 4, the first Y-channel sub-image containing the candidate bar code is convolved by convolution check with respect to 8 gradient directions (0 °,45 °,90 °,135 °,180 °, -135 °, -90 °, -45 °), respectively, each convolution check candidate bar code is convolved to form 8 feature sub-images respectively, an average pixel value (i.e., an average value of Y-channels) of each feature sub-image is calculated, gradient directions corresponding to two feature sub-images with the highest average pixel value are sequentially marked as α 1、α2, if α 1 and α 2 have an orthogonal relationship, that is, the absolute value of the difference between α 1 and α 2 is 90 °, the candidate bar code is determined to be in accordance with the first feature condition for determining the bar code, otherwise, the first feature condition is determined for the next Y-channel sub-image containing the candidate bar code. The Y channel sub-image meeting the first characteristic condition and the corresponding RGB mode sub-image are rotated by an angle alpha 1 together, so that the rotation characteristic normalization of the image is realized, namely, the first angle correction ensures that the method can process bar identification codes with different rotation angles.
Step 3.2: combining the original connected set boundary in the candidate bar identification code obtained in the step 2.3, dividing pixel blocks of the RGB mode sub-image corresponding to the Y-channel sub-image which is subjected to rotation processing in the step 3.1 and meets the first characteristic condition, and extracting the pixel blocks meeting any one of the following two conditions from the divided pixel blocks to serve as candidate verification color blocks; wherein the condition ①: one channel value in the RGB channels of the pixel corresponding to the pixel block is smaller than a threshold th 1, the other two channel values are larger than or equal to 2 x th 1, and the absolute value of the difference value of the two channel values is smaller than the threshold th 2; condition ②: the RGB three channel values of the pixel corresponding to the pixel block are all smaller than the threshold th 1.
And performing verification decoding on the obtained candidate verification color block, decoding channel values with pixels smaller than the threshold value th 1 into "-", and decoding channel values with pixels larger than or equal to the threshold value th 1 into "+". If at least T color blocks in the candidate verification color blocks are continuously adjacent, verification decoding is carried out twice from the positive sequence and the negative sequence, so that two groups of verification decoding strings are formed. Wherein, the plurality of color blocks are continuously adjacent to each other, each color block can be aggregated into a whole pixel block without disconnection, and any one color block has an adjacent relation with the rest or two color blocks which are not adjacent to each other. Positive sequence verification decoding refers to scanning from the leftmost candidate verification color block to the right; reverse order validation decoding refers to scanning left from the rightmost candidate validation color block. If one group of verification decoding strings contains a complete verification coding string which is defined by a standard, the verification decoding string is matched with the verification coding string, the candidate bar identification code is determined to meet the second characteristic condition of the bar identification code, and a plurality of candidate verification color blocks corresponding to the verification decoding string are taken as verification areas; otherwise, returning to the step 3.1, performing a first feature condition judgment on the next Y-channel sub-image containing the candidate bar identification codes. And the Y channel sub-image and the corresponding RGB mode sub-image are rotated by 180 degrees to realize the second angle correction after the reverse order verification decoding is matched with the verification coding string.
In this embodiment, as shown in fig. 5, when the candidate verification color block contains 6 color pixel blocks that are continuously adjacent from left to right and th1=th2=10 is set, three channel values of RGB in the pixel block 2 satisfying the condition ② are all smaller than 10, one channel value of RGB channels in the pixels of the pixel block 1,3, 4, 5,6 satisfying the condition ① is smaller than 10, the other two channel values are larger than or equal to 20, and the absolute value of the difference value is smaller than 10. And performing positive sequence verification decoding from left to right on the 6 pixel blocks to obtain an 18-bit verification decoding string, wherein the 4 th to 15 th bits are consistent with a complete verification coding string defined by a group of standards, and considering the 2 nd to 4 th candidate verification color blocks corresponding to the 4 th to 15 th bits in the verification decoding string as verification areas.
Step 3.3: and calculating the average value of all pixel coordinates (namely the average value of the Y channels) of the verification area corresponding to the Y channel sub-image corresponding to the candidate bar identification code meeting the second characteristic condition, wherein the pixel point corresponding to the average value is the center point of the verification area. Performing threshold processing on an original connected set in the Y-channel sub-image, and if the pixel value (Y-channel value) of the original connected set is smaller than 0.5, mapping the attribute mark of the original connected set to 0; if the pixel value of the original connected set is greater than or equal to 0.5, the attribute flag of the original connected set is mapped to 1. In the Y channel sub-image, original connected set scanning is started to the right from the center point coordinate of the verification area, the attribute mark value of the original connected set is recorded from the first original connected set which is not in the verification area of the scanning, and the scanning is stopped until the (N-T) th original connected set is scanned, so that an attribute mark value string with (N-T) bits only containing 0 and 1 is obtained. As shown in fig. 6, a direction line scan_line with the center point of the verification area as the left end point represents the scan path of the original connected set. If the attribute marking value string is matched with the color block attribute marking value string defined by the standard bit by bit, the candidate bar identification code is determined to meet the third characteristic condition of the bar identification code, and the boundary of the scanned (N-T) original connected sets in the candidate bar identification code is the boundary of a bar identification code decoding area capable of being decoded finally; otherwise, returning to the step 3.1, performing a first feature condition judgment on the next Y-channel sub-image containing the candidate bar identification codes. Preferably, the standard defined verification color block number T epsilon [2,4,6] can obtain a relatively stable rectangular center, so that the connected set scanning path can completely pass through the actual coding color block area. And extracting a bar identification code decoding area from RGB mode sub-images corresponding to Y channel sub-images meeting a third characteristic condition according to the boundary of the bar identification code decoding area capable of being finally decoded, dividing the bar identification code decoding area into (N-T) decoding color blocks according to the boundary of an original connected set, marking the (N-T) decoding color blocks as d_block i, i E [1, N-T ], wherein the color vector value of each decoding color block is d_c (d_block i), and i is a color block sequence identifier increasing from left to right.
In this embodiment, the number of verification color blocks of the bar code defined by the standard is t=4, and the number of code color blocks n=17. The candidate bar identification codes comprise 26 original connected sets in total from S1 to S26, wherein S5 to S8 are verification areas. The first decoded color block not in the verification area scanned rightward from the center point of the verification area is S9, the y component value of the pixel is 0.78, and the attribute flag value is 1. And then scanning the original connected sets S9-S26 of codes sequentially according to the same attribute mark value statistics mode to obtain attribute mark value strings with intervals of 0 and 1 of 17 bits in total, wherein the attribute mark value strings are matched with the coded color block attribute mark strings defined in FIG. 2 bit by bit, and the area where the decoded color blocks S9-S26 are located is considered to be the boundary where the decoding area of the bar identification code can be decoded finally.
Step 4: the bar code decoding area is decoded.
For each decoded color block, calculating average values of RGB channel values of all pixel points in the decoded color block to form a decoded color vector c (d_block i)={r(d_blocki),g(d_blocki),b(d_blocki) of a decoded color block d_block i, and then carrying out Euclidean distance calculation on each code color vector in an odd sequence and each element in a vector element subset CSJ of a standard color set CS one by one, wherein the calculation formula is as follows:
and performing Euclidean distance calculation on each code color vector in the even sequence and each element in the vector element subset CSO of the standard color set CS one by one, wherein the calculation formula is as follows:
The CSJ i or CSO i with the smallest distance value is taken as the standard color of each decoding color block d_block i, and the coding value corresponding to the standard color is the decoding value of each decoding color block d_block i.
The foregoing is merely a preferred embodiment of the present invention and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present invention, which are intended to be comprehended within the scope of the present invention.

Claims (10)

1. The color bar code is characterized by comprising N rectangular monochromatic blocks which are aligned and spliced in sequence along the width direction of the color block; the first T rectangular color blocks are used as verification color blocks, each verification color block takes different standard colors, and the brightness components are lower than a preset threshold Th_Y1; the later (N-T) rectangular color blocks are used as coding color blocks, in the coding color block sequences, the coding color blocks of each odd sequence respectively take one color from j standard colors, the brightness component of the coding color blocks is higher than a preset threshold Th_Y2, the coding color blocks of each even sequence respectively take one color from o standard colors, the brightness component of the coding color blocks is lower than a preset threshold Th_Y1, the j standard colors and the o standard colors are not overlapped, and Th_Y2 is more than 0.5> Th_Y1; coded color blocks of different standard colors characterize different coded values.
2. The color bar code of claim 1 wherein N is in the range of 20 to 30, T is in the range of 2 to 6, and Z = T + j + o, Z is in the range of 10 to 20.
3. The color bar code of claim 1 wherein the RGB channel values for each standard color are each selected from p equal difference fixed gray values.
4. A color bar code according to claim 3 wherein for T verification color blocks, the RGB channel values for the color of one verification color block are {0, 0}; one channel value in the RGB channels of the colors of the residual verification color blocks is 0, and the values of the other two channels are equal; for a verification color block with a channel value {0, 0}, its characterized verification code is "- -"; for the remaining validation color patches, the validation code for a channel representation with a channel value of 0 is "-", and the validation code for a channel representation with a channel value of 1 is "+".
5. A method of identifying and decoding a color bar code according to any one of claims 1-4, comprising:
step 1: preprocessing an RGB mode image to be identified containing the color bar identification code;
Step 2: positioning the bar identification code and dividing the image by judging the characteristic of the Y-channel connected set of the image to be identified;
step 3: carrying out feature condition judgment on the sub-images containing the candidate bar identification codes obtained in the step 2 one by one, and finally positioning and extracting a bar identification code decoding area;
step 4: and performing decoding operation on the bar code decoding area to obtain the decoding value of the color bar code.
6. The method of identifying and decoding color bar codes according to claim 5, wherein said step 2 comprises:
Step 2.1: extracting Y channel components of each pixel in an RGB mode image to be identified, reserving 2 bits after decimal point of the converted Y component values, and performing normalization processing to form a Y channel image;
step 2.2: extracting 8 connected sets with similar numbers of all pixels in the Y channel image;
Step 2.3: bringing together 8 connected sets with similar pixel numbers and adjacent relations to form a new connected set, wherein each 8 connected set in the new connected set is called an original connected set; when the number of the original connected sets contained in the new connected sets is [ N, N+delta N ], the new connected sets are considered to be candidate bar identification codes, the Y-channel image is segmented according to the pixel coordinates of the new connected sets, and the image to be identified preprocessed in the step 1 is synchronously segmented according to the corresponding relation of the pixel coordinates, so that the Y-channel sub-image and the RGB mode sub-image containing the candidate bar identification codes are respectively obtained.
7. The method of identifying and decoding color bar codes according to claim 6, wherein said step 3 comprises:
step 3.1: carrying out convolution of 8 gradient directions on a first Y-channel sub-image containing candidate bar identification codes to form 8 feature sub-images, calculating the average pixel value of each feature sub-image, sequentially marking the gradient directions corresponding to two feature sub-images with the highest average pixel value as alpha 1、α2, if alpha 1 and alpha 2 have an orthogonal relationship, determining that the candidate bar identification codes accord with a first feature condition, otherwise, carrying out first feature condition judgment on the next Y-channel sub-image containing the candidate bar identification codes; the Y channel sub-image meeting the first characteristic condition and the corresponding RGB mode sub-image are rotated by an angle alpha 1;
step 3.2: according to the original connected set boundary in the candidate bar identification code obtained in the step 2.3, dividing pixel blocks of the RGB mode sub-image subjected to the rotation processing in the step 3.1, and then extracting pixel blocks meeting any one of the following two conditions from the divided pixel blocks to serve as candidate verification color blocks; wherein the condition ①: one channel value in the RGB channels of the pixel corresponding to the pixel block is smaller than a threshold th 1, the other two channel values are larger than or equal to 2 x th 1, and the absolute value of the difference value of the two channel values is smaller than the threshold th 2; condition ②: the RGB three channel values of the corresponding pixels of the pixel block are smaller than a threshold th 1; performing verification decoding on the obtained candidate verification color block, decoding channel values with pixels smaller than a threshold th 1 into "-", and decoding channel values with pixels larger than or equal to the threshold th 1 into "+", so as to form a verification decoding string; if the verification decoding string contains a complete verification coding string defined by the color bar identification code, the candidate bar identification code is determined to meet a second characteristic condition, and a plurality of candidate verification color blocks corresponding to the verification decoding string are taken as verification areas; otherwise, returning to the step 3.1 to perform first characteristic condition judgment on the next Y-channel sub-image containing the candidate bar identification codes;
Step 3.3: for the Y channel sub-image corresponding to the candidate bar identification code meeting the second characteristic condition, carrying out threshold processing on the original connected set in the Y channel sub-image, and if the pixel value of the original connected set is smaller than 0.5, mapping the attribute mark of the original connected set to 0; if the pixel value of the original connected set is greater than or equal to 0.5, mapping the attribute mark of the original connected set to 1; acquiring attribute mark value strings of (N-T) original connected sets connected with a verification area in a Y channel sub-image, and if the attribute mark value strings are matched with color block attribute mark value strings defined by the color bar code standard bit by bit, determining that the candidate bar code meets a third characteristic condition, wherein the boundary of the (N-T) original connected sets in the candidate bar code is the boundary of a bar code decoding area for final decoding; otherwise, returning to the step 3.1 to perform first characteristic condition judgment on the next Y-channel sub-image containing the candidate bar identification codes; and extracting a bar identification code decoding area from the RGB mode sub-image corresponding to the Y channel sub-image, and dividing the bar identification code decoding area into (N-T) decoding color blocks according to the boundary of the original connected set.
8. The method of identifying and decoding a color bar code according to claim 6 or 7, characterized in that said steps comprise: and for each decoding color block in the decoding area of the bar identification code, calculating the average value of RGB channel values of all pixel points in each decoding color block to form decoding color vectors of each decoding color block, then carrying out Euclidean distance calculation on each code color vector in an odd sequence and three-dimensional vectors of each color in the j standard colors one by one, carrying out Euclidean distance calculation on each code color vector in an even sequence and three-dimensional vectors of each color in the o standard colors one by one, respectively taking the standard color corresponding to the minimum distance value as the color of each decoding color block, and taking the coding value corresponding to each standard color as the decoding value of each decoding color block.
9. The method of claim 7, wherein in step 3.3, in the Y-channel sub-image, the original connected set is scanned from the center point coordinate of the verification area to the right, and the attribute mark value is recorded from the original connected set which is not in the verification area and is scanned until the (N-T) -th original connected set is scanned, so that the (N-T) -bit attribute mark value string containing only 0 and 1 is obtained.
10. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the method for identifying and decoding a color bar code according to any of claims 5-9 when executing the program.
CN202410957794.4A 2024-07-17 2024-07-17 Color bar identification code, identification code identification and decoding method and electronic equipment Active CN118504599B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410957794.4A CN118504599B (en) 2024-07-17 2024-07-17 Color bar identification code, identification code identification and decoding method and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410957794.4A CN118504599B (en) 2024-07-17 2024-07-17 Color bar identification code, identification code identification and decoding method and electronic equipment

Publications (2)

Publication Number Publication Date
CN118504599A true CN118504599A (en) 2024-08-16
CN118504599B CN118504599B (en) 2024-09-17

Family

ID=92233071

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410957794.4A Active CN118504599B (en) 2024-07-17 2024-07-17 Color bar identification code, identification code identification and decoding method and electronic equipment

Country Status (1)

Country Link
CN (1) CN118504599B (en)

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101088100A (en) * 2004-11-05 2007-12-12 卡勒兹普麦迪亚公司 Mixed code, and method and apparatus for generating the same, and method and appratus for decoding the same
WO2007148942A1 (en) * 2006-06-23 2007-12-27 Colorzip Media, Inc. Method of classifying colors of color based image code
CN102646187A (en) * 2011-02-20 2012-08-22 深圳市心艺来文化有限公司 Color graphics coding and identifying method
US20130092738A1 (en) * 2011-10-12 2013-04-18 University Of Rochester Color Barcodes for Mobile Applications: A Per Channel Framework
CN107247984A (en) * 2017-05-18 2017-10-13 中山大学 A kind of coding method for visualizing Quick Response Code
CA2981024A1 (en) * 2016-10-17 2018-04-17 Conduent Business Services, Llc System and method for retail store promotional price tag detection
CN108592823A (en) * 2017-12-04 2018-09-28 湖南大学 A kind of coding/decoding method based on binocular vision color fringe coding

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101088100A (en) * 2004-11-05 2007-12-12 卡勒兹普麦迪亚公司 Mixed code, and method and apparatus for generating the same, and method and appratus for decoding the same
WO2007148942A1 (en) * 2006-06-23 2007-12-27 Colorzip Media, Inc. Method of classifying colors of color based image code
CN102646187A (en) * 2011-02-20 2012-08-22 深圳市心艺来文化有限公司 Color graphics coding and identifying method
US20130092738A1 (en) * 2011-10-12 2013-04-18 University Of Rochester Color Barcodes for Mobile Applications: A Per Channel Framework
CA2981024A1 (en) * 2016-10-17 2018-04-17 Conduent Business Services, Llc System and method for retail store promotional price tag detection
CN107247984A (en) * 2017-05-18 2017-10-13 中山大学 A kind of coding method for visualizing Quick Response Code
CN108592823A (en) * 2017-12-04 2018-09-28 湖南大学 A kind of coding/decoding method based on binocular vision color fringe coding

Also Published As

Publication number Publication date
CN118504599B (en) 2024-09-17

Similar Documents

Publication Publication Date Title
CN111488756B (en) Face recognition-based living body detection method, electronic device, and storage medium
US7978911B2 (en) Method of classifying colors of color based image code
EP1271403B1 (en) Method and device for character location in images from digital camera
CN111223034B (en) Large-capacity anti-printing/photography blind watermarking system and method based on deep learning
CN100390807C (en) Trilateral poly-dimensional bar code easy for omnibearing recognition and reading method thereof
EP1870858A2 (en) Method of classifying colors of color based image code
CN113012059B (en) Shadow elimination method and device for text image and electronic equipment
CN112613502A (en) Character recognition method and device, storage medium and computer equipment
CN109635805B (en) Image text positioning method and device and image text identification method and device
CN106156684A (en) A two-dimensional code recognition method and device
CN111259891B (en) Method, device, equipment and medium for identifying identity card in natural scene
CN116596795A (en) An Underwater Image Enhancement Method Based on Semantic Guidance and Attention Fusion
EP1102180A1 (en) Content-based digital-image classification method
CN112529901A (en) Crack identification method in complex environment
CN116152834A (en) Multi-code decoding method and system based on gradient algorithm
CN112507751A (en) QR code positioning method and system
CN118504599B (en) Color bar identification code, identification code identification and decoding method and electronic equipment
CN113723410B (en) Digital identification method and device for nixie tube
CN112818983B (en) Method for judging character inversion by using picture acquaintance
CN112215781B (en) Improved local binarization method
CN117237637A (en) Image signal processing system and method
CN115205596A (en) Image classification method, device, equipment and storage medium
CN110502950B (en) A Fast Adaptive Binarization Method of QR Code with Uneven Illumination
CN113780082A (en) A Lane Line Detection Method Based on Sliding Window Search
CN112215319A (en) Two-dimensional code of color marking characteristic graph and identification method thereof

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant