CN116822548B - Method for generating high recognition rate AI two-dimensional code and computer readable storage medium - Google Patents
Method for generating high recognition rate AI two-dimensional code and computer readable storage medium Download PDFInfo
- Publication number
- CN116822548B CN116822548B CN202311092130.8A CN202311092130A CN116822548B CN 116822548 B CN116822548 B CN 116822548B CN 202311092130 A CN202311092130 A CN 202311092130A CN 116822548 B CN116822548 B CN 116822548B
- Authority
- CN
- China
- Prior art keywords
- dimensional code
- identified
- blocks
- error correction
- white
- 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.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 39
- 238000003860 storage Methods 0.000 title claims description 7
- 238000012545 processing Methods 0.000 claims abstract description 15
- 238000012937 correction Methods 0.000 claims description 121
- 108091026890 Coding region Proteins 0.000 claims description 30
- 238000004422 calculation algorithm Methods 0.000 claims description 12
- 238000005516 engineering process Methods 0.000 claims description 10
- 238000007689 inspection Methods 0.000 claims description 9
- 238000009792 diffusion process Methods 0.000 claims description 6
- 238000001914 filtration Methods 0.000 claims description 6
- 239000011159 matrix material Substances 0.000 claims description 6
- 238000005192 partition Methods 0.000 claims description 6
- 238000004364 calculation method Methods 0.000 claims description 5
- 238000004891 communication Methods 0.000 claims description 4
- 238000004590 computer program Methods 0.000 claims description 4
- 238000009826 distribution Methods 0.000 claims description 3
- 238000003708 edge detection Methods 0.000 claims description 3
- 238000007781 pre-processing Methods 0.000 claims description 3
- 230000011218 segmentation Effects 0.000 claims description 3
- 230000000007 visual effect Effects 0.000 abstract description 7
- 238000013461 design Methods 0.000 description 4
- 238000013473 artificial intelligence Methods 0.000 description 2
- 230000004927 fusion Effects 0.000 description 2
- 230000000903 blocking effect Effects 0.000 description 1
- 238000013135 deep learning Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000018109 developmental process Effects 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000008030 elimination Effects 0.000 description 1
- 238000003379 elimination reaction Methods 0.000 description 1
- 238000009499 grossing Methods 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 230000000630 rising effect Effects 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K7/00—Methods or arrangements for sensing record carriers, e.g. for reading patterns
- G06K7/10—Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
- G06K7/14—Methods 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/1404—Methods for optical code recognition
- G06K7/1408—Methods for optical code recognition the method being specifically adapted for the type of code
- G06K7/1417—2D bar codes
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K7/00—Methods or arrangements for sensing record carriers, e.g. for reading patterns
- G06K7/10—Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
- G06K7/14—Methods 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/1404—Methods for optical code recognition
- G06K7/1439—Methods for optical code recognition including a method step for retrieval of the optical code
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06K—GRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
- G06K7/00—Methods or arrangements for sensing record carriers, e.g. for reading patterns
- G06K7/10—Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
- G06K7/14—Methods 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/1404—Methods for optical code recognition
- G06K7/146—Methods for optical code recognition the method including quality enhancement steps
- G06K7/1473—Methods for optical code recognition the method including quality enhancement steps error correction
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Health & Medical Sciences (AREA)
- Electromagnetism (AREA)
- General Health & Medical Sciences (AREA)
- Toxicology (AREA)
- Artificial Intelligence (AREA)
- Computer Vision & Pattern Recognition (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Quality & Reliability (AREA)
- Image Processing (AREA)
Abstract
A method for generating high recognition rate AI two-dimension code, the method is through inputting the two-dimension code content or picture that needs AI to beautify, produce the initial black and white two-dimension code, then users adjust the preset image processing model, produce the AI after beautifying two-dimension code image which accords with users' demand, carry on the machine decoding recognition to AI after beautifying two-dimension code image, will not be able to decode the AI after beautifying two-dimension code image after discernment into waiting to treat AI two-dimension code, through carrying on the same format block to initial black and white two-dimension code and waiting to treat AI two-dimension code, replace the partial block of the initial black and white two-dimension code into waiting to treat AI two-dimension code and correspond to the block of the position, then carry on the machine decoding discernment, after decoding discernment, carry on the redrawing to AI part of the AI two-dimension code, output the AI after the identifiable is beautified two-dimension code. The invention has the advantages that: the high recognition rate of the AI two-dimensional code can be guaranteed, the visual effect of the AI two-dimensional code can be guaranteed, the code generation efficiency is improved, and the use experience of a user is improved.
Description
Technical Field
The invention relates to the technical field of two-dimension code generation, in particular to a method for generating an AI two-dimension code with high recognition rate and a computer readable storage medium.
Background
With the rapid development of the technical field of the Internet, two-dimensional codes become an important tool for business and social communication, the traditional two-dimensional codes consist of monotonous black-and-white coding modules, visual aesthetic feeling is lacking, and visual connection with information or representative brands represented by the two-dimensional codes cannot be established. Therefore, in order to beautify the visual effect of the two-dimensional code, the two-dimensional code and the background image are fused, and the two-dimensional code with the background image is generated.
Through retrieval, the current artistic two-dimensional code generation method fused with the image is shown in China invention with a patent number of CN201611062539.5 (authorized bulletin number of CN 106778995B), and the method is to adjust two-dimensional code words by combining the visual saliency of the image with the Gaussian Jordan primordial elimination method to generate a binary artistic two-dimensional code combined with the two-dimensional code and the image; establishing a scanning error model of a two-dimensional code module, setting an expected scanning error constraint of the two-dimensional code module, locally adjusting the gray value of the two-dimensional code module, and fusing the gray value with a gray result of an input image to generate a gray artistic two-dimensional code; and (3) establishing an image brightness adjustment scheme, adjusting pixel values of the color original image, converting the pixel values into a gray level image, and enabling a result to be consistent with the gray level artistic two-dimensional code to generate the color artistic two-dimensional code. In the prior art, the two-dimensional code beautifying method generally comprises the steps of overlapping a background layer on a black-and-white two-dimensional code form, adjusting based on the contrast color of the background layer and the black code points of the two-dimensional code, and modifying the contrast color by adjusting the color, overlapping the picture and other methods.
At present, AI (Artificial Intelligence, chinese artificial intelligence, abbreviated as AI) drawing application is widely applied in the field of image processing, such as advertisement design, product design, game design, etc., and the principle of AI drawing application is to simulate the process of human drawing based on a large amount of data and a deep learning algorithm to obtain a corresponding image result, and a machine makes a computer generate graphic elements with diversity and innovation through the learning algorithm, thereby improving the creation efficiency. The AI drawing application can generate the AI two-dimensional code with more artistry and topic, better integrate brand image and shape more topic degrees, and the generated AI two-dimensional code has larger application scenes in the aspects of brand promotion, cultural and artistic promotion and the like, so the rising of the AI drawing application provides more possibility for the style of the two-dimensional code, but the existing AI two-dimensional code generated by the AI drawing application still has some problems:
(1) The generated AI two-dimensional code has high unrecognizable rate, the image quality is improved by using some sharpening and smoothing processing modes in the process of redrawing the two-dimensional code by using the AI drawing application, the edge of the generated AI two-dimensional code is blurred, the contrast of code points and the background is small, the generated AI two-dimensional code cannot be accurately recognized, the AI drawing application is limited by a generating algorithm, an algorithm and a parameter combination, the error probability in the process of redrawing the two-dimensional code is high, the quality of the generated AI two-dimensional code is poor, and meanwhile, the generated AI two-dimensional code has high unrecognizable rate due to the randomness of the algorithm adopted by the AI drawing application.
(2) The generation efficiency of the AI two-dimension code is low, and when the AI two-dimension code generated by the AI drawing application cannot be identified, the generated AI two-dimension code needs to be entirely redrawn, so that the production efficiency is low.
Therefore, although the fusion degree of the two-dimensional code and the background image can be improved by using the AI two-dimensional code generated by the AI drawing application, because the algorithm adopted by the AI drawing application has randomness, the probability of error occurrence in the process of redrawing the two-dimensional code by using the AI drawing application is larger, the generated AI two-dimensional code has lower recognition rate, and the efficiency of generating the code by using the AI drawing application is lower, so that further improvement is needed.
Disclosure of Invention
The technical problem to be solved by the invention is to provide a method for generating the high-recognition-rate AI two-dimensional code aiming at the prior art.
The technical scheme adopted for solving the technical problems is as follows: the method for generating the high-recognition-rate AI two-dimensional code is characterized by comprising the following steps:
firstly, inputting two-dimensional code content or two-dimensional code pictures required to be beautified by a user, and generating initial black-and-white two-dimensional codes from the two-dimensional code content or the two-dimensional code pictures required to be beautified by a two-dimensional code generating technology or a two-dimensional code decoding and transcoding technology;
Step two, a user selects a beautification style from a preset image processing model, inputs a keyword or uploads a preset image, adjusts intervention parameters of the preset image processing model, and generates an AI beautified two-dimensional code image meeting the user requirement from the initial black-and-white two-dimensional code in the step one;
thirdly, performing machine decoding identification on the AI-beautified two-dimensional code image generated in the second step, and outputting an identifiable AI-beautified two-dimensional code if the AI-beautified two-dimensional code image can be decoded and identified; if the AI is not recognized by decoding, the two-dimensional code image which is not recognized by decoding and is beautified by AI is called as an AI two-dimensional code to be processed, and then the step four is carried out;
dividing the initial black-and-white two-dimensional code generated in the first step and the AI two-dimensional code to be processed generated in the third step into N blocks, dividing the AI two-dimensional code to be processed into N blocks, and ensuring that the size and shape of any block in the AI two-dimensional code to be processed are the same as those of the block at the corresponding position of the initial black-and-white two-dimensional code, wherein N is a positive integer;
step five, selecting one or more blocks from the initial black-and-white two-dimensional code, and sequentially replacing the blocks into the blocks at the corresponding positions in the AI two-dimensional code to be processed respectively to obtain an identifiable intermediate AI two-dimensional code;
Extracting the color of the code points of the replaced blocks in the identifiable intermediate AI two-dimensional code obtained in the step five, extracting the size and the shape of the to-be-processed AI two-dimensional code at the same time, and redrawing the identifiable intermediate two-dimensional code output in the step five according to the color of the code points of the replaced blocks in the extracted identifiable intermediate AI two-dimensional code and the size and the shape of the to-be-processed AI two-dimensional code to obtain the identifiable AI-beautified two-dimensional code, and outputting the identifiable AI-beautified two-dimensional code; or directly inputting the identifiable intermediate AI two-dimensional code output in the step five into a preset image processing model for re-fusion to obtain the identifiable AI beautified two-dimensional code, and outputting the identifiable AI beautified two-dimensional code.
As an improvement, the decoding and transcoding technique in the first step specifically includes the following steps:
step 1, inputting a two-dimensional code picture input by a user;
step 2, preprocessing a two-dimensional code picture input by a user;
step 3, identifying a positioning module and a calibration module in a two-dimensional code picture input by a user, judging whether the two-dimensional code picture has the positioning module and the calibration module, and prompting the user if the two-dimensional code picture does not have the positioning module and the calibration module, wherein the two-dimensional code picture input by the user has no two-dimensional code pattern; if the positioning module and the calibration module are arranged, determining the position and the direction of the two-dimensional code in the two-dimensional code picture;
Step 4, extracting data code words and check code words in the two-dimensional code pictures according to the two-dimensional code coding rule;
step 5, performing error correction operation on the data code word according to the error correction area of the two-dimensional code, and restoring original data;
step 6, generating an image which consists of black blocks and white blocks and records data information according to the original data and the corresponding code generation rule;
step 7, disturbing the distribution of the black blocks and the white blocks, selecting one mask pattern from eight preset mask patterns, and redistributing the black blocks and the white blocks to generate an initial black-and-white two-dimensional code;
and 8, outputting the initial black-and-white two-dimensional code.
Further, the image processing model in the second step is a potential diffusion model.
Further improvement, the intervention parameters in the second step comprise one or any combination of the following parameters: diffusion coefficient, number of iterations, initial conditions, correlation, and noise strength.
As an improvement, the decoding technique in the third step specifically includes the following steps:
step A, identifying a positioning module and a calibration module of the two-dimensional code image after the AI beautification, judging whether the positioning module and the calibration module exist in the two-dimensional code image after the AI beautification, and if the positioning module and the calibration module do not exist, performing a step four; if the positioning module and the calibration module are arranged, determining the boundary and the initial position of the two-dimensional code in the two-dimensional code image after the AI beautification;
Step B, determining format information of the two-dimensional code in the two-dimensional code image after the AI beautification;
step C, removing mask information of the two-dimensional code in the two-dimensional code image after the AI beautification;
step D, determining a code generation rule of the two-dimensional code and the size of the two-dimensional code in the two-dimensional code image after the AI beautification;
step E, decoding the two-dimensional codes in the two-dimensional code image after the AI beautification according to the code generation rule determined in the step D according to the sequence of the two-dimensional codes, and obtaining the data content of the decoded two-dimensional codes;
and F, outputting the two-dimensional code data content obtained in the step E.
In the fourth step, firstly, an initial black-and-white two-dimensional code and an AI two-dimensional code to be processed are respectively divided into a coding region and an error correction coding region by using one vertical line, then the coding region and the error correction coding region of the initial black-and-white two-dimensional code are respectively divided into four blocks longitudinally by using three transverse lines, correspondingly, the coding region and the error correction coding region of the AI two-dimensional code to be processed are respectively divided into four blocks by using three transverse lines at the same position, at the moment, the coding region of the initial black-and-white two-dimensional code is divided into four blocks, the error correction coding region of the initial black-and-white two-dimensional code is also divided into four blocks, and the whole initial black-and-white two-dimensional code is divided into eight blocks; similarly, the coding region of the to-be-processed AI two-dimensional code is also divided into four blocks, the error correction coding region of the to-be-processed AI two-dimensional code is also divided into four blocks, the whole to-be-processed AI two-dimensional code is divided into eight blocks, the size and shape of the coding blocks of the initial black-and-white two-dimensional code are identical to those of the coding blocks of the corresponding positions of the to-be-processed AI two-dimensional code, and the size and shape of the error correction coding blocks of the initial black-and-white two-dimensional code are identical to those of the error correction coding blocks of the corresponding positions of the to-be-processed AI two-dimensional code;
The specific implementation scheme of the fifth step comprises the following steps:
s1, selecting one coding block from four coding blocks of an initial black-and-white two-dimensional code, and selecting one error correction coding block from four error correction coding blocks of the initial black-and-white two-dimensional code, and respectively replacing the error correction coding blocks and the code blocks at corresponding positions in an AI two-dimensional code to be processed to obtain an intermediate two-dimensional code to be identified;
s2, performing machine decoding inspection on the middle two-dimensional code to be identified obtained in the S1, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S1 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S1, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black and white two-dimensional code is different from a block combination selected in the prior S1;
s3, repeating the steps S1 and S2 sixteen times, if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, selecting one coding block from four coding blocks of the initial black-and-white two-dimensional code, selecting two error correction coding blocks from four error correction coding blocks of the initial black-and-white two-dimensional code, and respectively replacing the two error correction coding blocks with the coding blocks and the error correction coding blocks at corresponding positions in the AI two-dimensional code to be processed to obtain the intermediate two-dimensional code to be identified;
S4, performing machine decoding check on the middle two-dimensional code to be identified obtained in the S3, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S3 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S3, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black and white two-dimensional code is different from a block combination selected in the prior S3;
s5, repeating the steps S3 and S4 for twenty four times, if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, selecting two coding blocks from four coding blocks of the initial black-and-white two-dimensional code, and selecting two error correction coding blocks from four error correction coding blocks of the initial black-and-white two-dimensional code, and respectively replacing the two error correction coding blocks with the coding blocks and the error correction coding blocks at corresponding positions in the AI two-dimensional code to be processed to obtain the intermediate two-dimensional code to be identified;
s6, performing machine decoding check on the middle two-dimensional code to be identified obtained in the S5, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S5 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S5, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black and white two-dimensional code is different from a block combination selected in the prior S5;
S7, repeating the steps S5 and S6 thirty-six times, if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, selecting two encoding blocks from four encoding blocks of the initial black-and-white two-dimensional code, and selecting three error correction encoding blocks from four error correction encoding blocks of the initial black-and-white two-dimensional code, and respectively replacing the three error correction encoding blocks to the encoding blocks and the error correction encoding blocks at the corresponding positions in the AI two-dimensional code to be processed to obtain the intermediate two-dimensional code to be identified;
s8, performing machine decoding check on the middle two-dimensional code to be identified obtained in the S7, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S7 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S7, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black and white two-dimensional code is different from a block combination selected in the prior S7;
s9, repeating the steps S7 and S8 for twenty four times, if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, selecting three coding blocks from four coding blocks of the initial black-and-white two-dimensional code, and selecting three error correction coding blocks from four error correction coding blocks of the initial black-and-white two-dimensional code, and respectively replacing the three error correction coding blocks into the coding blocks and the error correction coding blocks at corresponding positions in the AI two-dimensional code to be processed to obtain the intermediate two-dimensional code to be identified;
S10, performing machine decoding inspection on the middle two-dimensional code to be identified obtained in the S9, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S9 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S9, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black-white two-dimensional code is different from a block combination selected in the prior S9;
s11, repeating the steps S9 and S10 sixteen times, if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, selecting three coding blocks from four coding blocks of the initial black-and-white two-dimensional code, and selecting four error correction coding blocks from four error correction coding blocks of the initial black-and-white two-dimensional code, and respectively replacing the four error correction coding blocks with the coding blocks and the error correction coding blocks at corresponding positions in the AI two-dimensional code to be processed to obtain the intermediate two-dimensional code to be identified;
s12, performing machine decoding inspection on the middle two-dimensional code to be identified obtained in the S11, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S11 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S11, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black and white two-dimensional code is different from a block combination selected in the prior S11;
S13, repeating the steps S11 and S12 for four times, and if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, replacing the four coding blocks and the four error correction coding blocks of the initial black-and-white two-dimensional code into the four coding blocks and the four error correction coding blocks at corresponding positions in the AI two-dimensional code to be processed respectively to obtain the intermediate two-dimensional code to be identified;
s14, performing machine decoding check on the intermediate two-dimensional code to be identified obtained in S13, and outputting an identifiable intermediate AI two-dimensional code if the intermediate two-dimensional code can be decoded and identified.
The further improvement, extracting the code point color of the replaced block in the identifiable intermediate AI two-dimensional code in the step six specifically includes the following steps:
A. firstly converting the color of a replaced block in a recognizable intermediate AI two-dimensional code into an RGB color matrix, then randomly selecting k clustering centroid points in the RGB color matrix, and marking the k clustering centroid points asm 1 ,m 2 ,…,m k K is a positive integer, k classes are established simultaneously, and the k classes are respectively marked asj 1 ,j 2 ,…,j k Class, classj k Expressed as cluster centroidm k Class to which the class belongs;
B. traversing each pixel point in the replaced partitionXMarking all pixel points in the replaced partition as X 1 ,X 2 ,…,X n First, each pixel point is calculatedX i With each cluster centroidm j Distance of (2),Wherein:X i is the firstiEach pixel point is 1 to less than or equal toi≤n,m j Is the firstjThe mass center of each cluster is less than or equal to 1j≤k,X it Is the firstiThe color properties of the individual pixel points,m jt is the firstjColor attributes of the cluster centroids are compared with each pixel point in turnX i With each cluster centroidm j Distance of each pixel pointX i Assigned to the closest cluster centroidm j Class to which they belongj k In (a) and (b);
C. pairing classesj k The centroid point in the (2) is corrected, and the calculation formula is thatWhereinm j For error-corrected classesj k The mass center of (2) is 1-1%j≤k,|j k I is a classj k The number of pixel points included in the pixel array,Y i representation classj k First, theiThe number of the objects is 1 to less than or equal toi≤|j k I, finally obtaining RGB color values of centroid points of k classes, wherein the color values are the classesj k In step six, the code point color of the replaced block in the identifiable intermediate AI two-dimensional code is determined according to the class of the current code point extracted from the corresponding replaced blockj k The RGB color values of (2) are subjected to color value adjustment.
The step six of extracting the size and shape of the AI two-dimensional code to be processed specifically comprises the following steps:
a. firstly, converting an AI two-dimensional code to be processed into a gray image, and then carrying out Gaussian filtering treatment on the gray image;
b. calculating threshold by maximum class difference method tThreshold valuetIs gray scaleThe difference between the gray value of the foreground and the gray value of the background in the image is calculated according to the formulaWhereinw0 is the proportion of the background and,u0 is the average value of the background gray values,w1 is the foreground proportion of the video camera,u1 is the average value of the foreground gray values,uis the average value of gray values of the whole image;
c. based on the calculated threshold valuet,Carrying out binary segmentation on the gray level image subjected to Gaussian filtering treatment, so as to obtain a binary image;
d. based on the binarized image obtained in the step c, determining the outline of the binarized image by using an edge detection algorithm;
e. the method comprises the steps of extracting the outline of a binarized image by using a communication component marking algorithm, calculating the area surrounded by all closed outlines, wherein 3 closed outlines with the nearest surrounded area in all closed outlines are the positioning frames in the AI two-dimensional code to be processed, extracting the central points of the three positioning frames, calculating the triangle surrounded by the central points of the three positioning frames, wherein the position of the angle with the largest angle in the triangle is the point of the right upper corner in the AI two-dimensional code to be processed, and the other two corner points are the positions of the right lower positioning point and the left upper positioning point in the AI two-dimensional code to be processed.
A computer readable storage medium having stored therein a computer program for generating a high recognition rate AI two-dimensional code, the computer program for generating a high recognition rate AI two-dimensional code, when executed by a processor, implementing any of the methods described above.
Compared with the prior art, the invention has the advantages that: combining the AI drawing and the two-dimension code generation technology, beautifying the visual effect of the two-dimension code, improving the design fusion degree of the image and the two-dimension code, and replacing partial blocks of the initial black-and-white two-dimension code to the positions corresponding to the two-dimension code after the AI is beautified by carrying out the same format blocking on the initial black-and-white two-dimension code and the two-dimension code after the AI is beautified, then carrying out machine decoding identification, and redrawing the part of the AI two-dimension code after the decoding identification is passed, so that the high identification rate of the AI two-dimension code can be ensured, the visual effect of the AI two-dimension code can be ensured, the code generation efficiency is improved, and the use experience of a user is improved.
Drawings
Fig. 1 is a flowchart of a method for generating a high recognition rate AI two-dimensional code in embodiment 1 of the present invention;
fig. 2 is a schematic diagram of the initial black-and-white two-dimensional code and the AI two-dimensional code to be processed in step four in embodiment 1 of the present invention.
Detailed Description
The invention is described in further detail below with reference to the embodiments of the drawings.
Example 1
As shown in fig. 1, the method for generating the high recognition rate AI two-dimensional code provided by the invention comprises the following steps:
firstly, inputting two-dimensional code content or two-dimensional code pictures required to be beautified by a user, and generating an initial black-and-white two-dimensional code from the two-dimensional code content or the two-dimensional code pictures required to be beautified by a two-dimensional code generating technology or a two-dimensional code decoding and transcoding technology, wherein the decoding and transcoding technology specifically comprises the following steps:
Step 1, inputting a two-dimensional code picture input by a user;
step 2, preprocessing a two-dimensional code picture input by a user;
step 3, identifying a positioning module and a calibration module in a two-dimensional code picture input by a user, judging whether the two-dimensional code picture has the positioning module and the calibration module, and prompting the user if the two-dimensional code picture does not have the positioning module and the calibration module, wherein the two-dimensional code picture input by the user has no two-dimensional code pattern; if the positioning module and the calibration module are arranged, determining the position and the direction of the two-dimensional code in the two-dimensional code picture;
step 4, extracting data code words and check code words in the two-dimensional code pictures according to the two-dimensional code coding rule;
step 5, performing error correction operation on the data code word according to the error correction area of the two-dimensional code, and restoring original data;
step 6, generating an image which consists of black blocks and white blocks and records data information according to the original data and the corresponding code generation rule;
step 7, disturbing the distribution of the black blocks and the white blocks, selecting one mask pattern from eight preset mask patterns, and redistributing the black blocks and the white blocks to generate an initial black-and-white two-dimensional code;
and 8, outputting the initial black-and-white two-dimensional code.
Step two, a user selects a beautifying style from a preset image processing model, inputs a keyword or uploads a preset image, adjusts intervention parameters of the preset image processing model, and generates an AI-beautified two-dimensional code image meeting the user requirement from the initial black-and-white two-dimensional code in the step one, wherein the image processing model is a potential diffusion model, and the intervention parameters comprise a diffusion coefficient, iteration times, initial conditions, correlation and noise intensity;
Thirdly, performing machine decoding identification on the AI-beautified two-dimensional code image generated in the second step, and outputting an identifiable AI-beautified two-dimensional code if the AI-beautified two-dimensional code image can be decoded and identified; if the two-dimensional code image cannot be decoded and identified, the two-dimensional code image after the AI beautification which cannot be decoded and identified is called as an AI two-dimensional code to be processed, and then a step four is carried out, wherein the decoding technology specifically comprises the following steps:
step A, identifying a positioning module and a calibration module of the two-dimensional code image after the AI beautification, judging whether the positioning module and the calibration module exist in the two-dimensional code image after the AI beautification, and if the positioning module and the calibration module do not exist, performing a step four; if the positioning module and the calibration module are arranged, determining the boundary and the initial position of the two-dimensional code in the two-dimensional code image after the AI beautification;
step B, determining format information of the two-dimensional code in the two-dimensional code image after the AI beautification;
step C, removing mask information of the two-dimensional code in the two-dimensional code image after the AI beautification;
step D, determining a code generation rule of the two-dimensional code and the size of the two-dimensional code in the two-dimensional code image after the AI beautification;
step E, decoding the two-dimensional codes in the two-dimensional code image after the AI beautification according to the code generation rule determined in the step D according to the sequence of the two-dimensional codes, and obtaining the data content of the decoded two-dimensional codes;
And F, outputting the two-dimensional code data content obtained in the step E.
Dividing the initial black-and-white two-dimensional code generated in the first step and the AI two-dimensional code to be processed generated in the third step into four blocks by using one vertical line (line 1), dividing the initial black-and-white two-dimensional code and the AI two-dimensional code to be processed into a coding region and an error correction coding region respectively, and then dividing the coding region and the error correction coding region of the initial black-and-white two-dimensional code into four blocks longitudinally by using three horizontal lines (line 2, line 3 and line 4), and correspondingly dividing the coding region and the error correction coding region of the AI two-dimensional code to be processed into four blocks by using three horizontal lines (line 2, line 3 and line 4) at the same position respectively, wherein the coding region of the initial black-and-white two-dimensional code is divided into four blocks at the moment, and the error correction coding region of the initial black-and-white two-dimensional code is divided into eight blocks; similarly, the coding region of the to-be-processed AI two-dimensional code is also divided into four blocks, the error correction coding region of the to-be-processed AI two-dimensional code is also divided into four blocks, the whole to-be-processed AI two-dimensional code is divided into eight blocks, the size and shape of the coding blocks of the initial black-and-white two-dimensional code are identical to those of the coding blocks of the corresponding positions of the to-be-processed AI two-dimensional code, and the size and shape of the error correction coding blocks of the initial black-and-white two-dimensional code are identical to those of the error correction coding blocks of the corresponding positions of the to-be-processed AI two-dimensional code;
Step five, the specific implementation scheme comprises the following steps of;
s1, selecting one coding block from four coding blocks of an initial black-and-white two-dimensional code, and selecting one error correction coding block from four error correction coding blocks of the initial black-and-white two-dimensional code, and respectively replacing the error correction coding blocks and the code blocks at corresponding positions in an AI two-dimensional code to be processed to obtain an intermediate two-dimensional code to be identified;
s2, performing machine decoding inspection on the middle two-dimensional code to be identified obtained in the S1, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S1 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S1, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black and white two-dimensional code is different from a block combination selected in the prior S1;
s3, repeating the steps S1 and S2 sixteen times, if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, selecting one coding block from four coding blocks of the initial black-and-white two-dimensional code, selecting two error correction coding blocks from four error correction coding blocks of the initial black-and-white two-dimensional code, and respectively replacing the two error correction coding blocks with the coding blocks and the error correction coding blocks at corresponding positions in the AI two-dimensional code to be processed to obtain the intermediate two-dimensional code to be identified;
S4, performing machine decoding check on the middle two-dimensional code to be identified obtained in the S3, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S3 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S3, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black and white two-dimensional code is different from a block combination selected in the prior S3;
s5, repeating the steps S3 and S4 for twenty four times, if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, selecting two coding blocks from four coding blocks of the initial black-and-white two-dimensional code, and selecting two error correction coding blocks from four error correction coding blocks of the initial black-and-white two-dimensional code, and respectively replacing the two error correction coding blocks with the coding blocks and the error correction coding blocks at corresponding positions in the AI two-dimensional code to be processed to obtain the intermediate two-dimensional code to be identified;
s6, performing machine decoding check on the middle two-dimensional code to be identified obtained in the S5, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S5 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S5, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black and white two-dimensional code is different from a block combination selected in the prior S5;
S7, repeating the steps S5 and S6 thirty-six times, if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, selecting two encoding blocks from four encoding blocks of the initial black-and-white two-dimensional code, and selecting three error correction encoding blocks from four error correction encoding blocks of the initial black-and-white two-dimensional code, and respectively replacing the three error correction encoding blocks to the encoding blocks and the error correction encoding blocks at the corresponding positions in the AI two-dimensional code to be processed to obtain the intermediate two-dimensional code to be identified;
s8, performing machine decoding check on the middle two-dimensional code to be identified obtained in the S7, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S7 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S7, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black and white two-dimensional code is different from a block combination selected in the prior S7;
s9, repeating the steps S7 and S8 for twenty four times, if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, selecting three coding blocks from four coding blocks of the initial black-and-white two-dimensional code, and selecting three error correction coding blocks from four error correction coding blocks of the initial black-and-white two-dimensional code, and respectively replacing the three error correction coding blocks into the coding blocks and the error correction coding blocks at corresponding positions in the AI two-dimensional code to be processed to obtain the intermediate two-dimensional code to be identified;
S10, performing machine decoding inspection on the middle two-dimensional code to be identified obtained in the S9, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S9 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S9, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black-white two-dimensional code is different from a block combination selected in the prior S9;
s11, repeating the steps S9 and S10 sixteen times, if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, selecting three coding blocks from four coding blocks of the initial black-and-white two-dimensional code, and selecting four error correction coding blocks from four error correction coding blocks of the initial black-and-white two-dimensional code, and respectively replacing the four error correction coding blocks with the coding blocks and the error correction coding blocks at corresponding positions in the AI two-dimensional code to be processed to obtain the intermediate two-dimensional code to be identified;
s12, performing machine decoding inspection on the middle two-dimensional code to be identified obtained in the S11, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S11 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S11, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black and white two-dimensional code is different from a block combination selected in the prior S11;
S13, repeating the steps S11 and S12 for four times, and if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, replacing the four coding blocks and the four error correction coding blocks of the initial black-and-white two-dimensional code into the four coding blocks and the four error correction coding blocks at corresponding positions in the AI two-dimensional code to be processed respectively to obtain the intermediate two-dimensional code to be identified;
s14, performing machine decoding check on the intermediate two-dimensional code to be identified obtained in S13, and outputting an identifiable intermediate AI two-dimensional code if the intermediate two-dimensional code can be decoded and identified.
Extracting the code point color of the replaced block in the identifiable intermediate AI two-dimensional code obtained in the step five, extracting the size and shape of the to-be-processed AI two-dimensional code at the same time, and redrawing the identifiable intermediate two-dimensional code output in the step five according to the size and shape of the replaced block code point color in the extracted identifiable intermediate AI two-dimensional code and the size and shape of the to-be-processed AI two-dimensional code to obtain the identifiable AI beautified two-dimensional code, and outputting the identifiable AI beautified two-dimensional code, wherein the extracting the code point color of the replaced block in the identifiable intermediate AI two-dimensional code specifically comprises the following steps:
A. Firstly converting the color of a replaced block in a recognizable intermediate AI two-dimensional code into an RGB color matrix, then randomly selecting k clustering centroid points in the RGB color matrix, and marking the k clustering centroid points asm 1 ,m 2 ,…,m k K is a positive integer, k classes are established simultaneously, and the k classes are respectively marked asj 1 ,j 2 ,…,j k Class, classj k Expressed as cluster centroidm k Class to which the class belongs;
B. traversing each pixel point in the replaced partitionXIn the partition to be replacedSome pixels are marked asX 1 ,X 2 ,…,X n First, each pixel point is calculatedX i With each cluster centroidm j Distance of (2),Wherein:X i is the firstiEach pixel point is 1 to less than or equal toi≤n,m j Is the firstjThe mass center of each cluster is less than or equal to 1j≤k,X it Is the firstiThe color properties of the individual pixel points,m jt is the firstjColor attributes of the cluster centroids are compared with each pixel point in turnX i With each cluster centroidm j Distance of each pixel pointX i Assigned to the closest cluster centroidm j Class to which they belongj k In (a) and (b);
C. pairing classesj k The centroid point in the (2) is corrected, and the calculation formula is thatWhereinm j For error-corrected classesj k The mass center of (2) is 1-1%j≤k,|j k I is a classj k The number of pixel points included in the pixel array,Y i representation classj k First, theiThe number of the objects is 1 to less than or equal toi≤|j k I, finally obtaining RGB color values of centroid points of k classes, wherein the color values are the classesj k In step six, the code point color of the replaced block in the identifiable intermediate AI two-dimensional code is determined according to the class of the current code point extracted from the corresponding replaced block j k The RGB color values of (2) are subjected to color value adjustment.
The method for extracting the size and the shape of the AI two-dimensional code to be processed specifically comprises the following steps:
a. firstly, converting an AI two-dimensional code to be processed into a gray image, and then carrying out Gaussian filtering treatment on the gray image;
b. calculating threshold by maximum class difference methodtThreshold valuetThe calculation formula is that the difference between the gray value of the foreground and the gray value of the background in the gray imageWhereinw0 is the proportion of the background and,u0 is the average value of the background gray values,w1 is the foreground proportion of the video camera,u1 is the average value of the foreground gray values,uis the average value of gray values of the whole image;
c. based on the calculated threshold valuet,Carrying out binary segmentation on the gray level image subjected to Gaussian filtering treatment, so as to obtain a binary image;
d. based on the binarized image obtained in the step c, determining the outline of the binarized image by using an edge detection algorithm;
e. the method comprises the steps of extracting the outline of a binarized image by using a communication component marking algorithm, calculating the area surrounded by all closed outlines, wherein 3 closed outlines with the nearest surrounded area in all closed outlines are the positioning frames in the AI two-dimensional code to be processed, extracting the central points of the three positioning frames, calculating the triangle surrounded by the central points of the three positioning frames, wherein the position of the angle with the largest angle in the triangle is the point of the right upper corner in the AI two-dimensional code to be processed, and the other two corner points are the positions of the right lower positioning point and the left upper positioning point in the AI two-dimensional code to be processed.
Example 2
The difference between this embodiment and embodiment 1 is that in step six, the identifiable intermediate AI two-dimensional code output in step five is directly input into a preset image processing model for re-fusion, so as to obtain the identifiable AI-beautified two-dimensional code, and the identifiable AI-beautified two-dimensional code is output.
Example 3
The present embodiment provides a computer-readable storage medium in which a computer program for generating a high-recognition-rate AI two-dimensional code is stored, which when executed by a processor, implements any one of the methods of embodiments 1 and 2.
Claims (7)
1. The method for generating the high-recognition-rate AI two-dimensional code is characterized by comprising the following steps:
firstly, inputting two-dimensional code content or two-dimensional code pictures required to be beautified by a user, and generating initial black-and-white two-dimensional codes from the two-dimensional code content or the two-dimensional code pictures required to be beautified by a two-dimensional code generating technology or a two-dimensional code decoding and transcoding technology;
step two, a user selects a beautification style from a preset image processing model, inputs a keyword or uploads a preset image, adjusts intervention parameters of the preset image processing model, and generates an AI beautified two-dimensional code image meeting the user requirement from the initial black-and-white two-dimensional code in the step one;
Thirdly, performing machine decoding identification on the AI-beautified two-dimensional code image generated in the second step, and outputting an identifiable AI-beautified two-dimensional code if the AI-beautified two-dimensional code image can be decoded and identified; if the AI is not recognized by decoding, the two-dimensional code image which is not recognized by decoding and is beautified by AI is called as an AI two-dimensional code to be processed, and then the step four is carried out;
dividing the initial black-and-white two-dimensional code generated in the first step and the AI two-dimensional code to be processed generated in the third step into N blocks, dividing the AI two-dimensional code to be processed into N blocks, and ensuring that the size and shape of any block in the AI two-dimensional code to be processed are the same as those of the block at the corresponding position of the initial black-and-white two-dimensional code, wherein N is a positive integer;
step five, selecting one or more blocks from the initial black-and-white two-dimensional code, and sequentially replacing the blocks into the blocks at the corresponding positions in the AI two-dimensional code to be processed respectively to obtain an identifiable intermediate AI two-dimensional code;
extracting the color of the code points of the replaced blocks in the identifiable intermediate AI two-dimensional code obtained in the step five, extracting the size and the shape of the to-be-processed AI two-dimensional code at the same time, and redrawing the identifiable intermediate two-dimensional code output in the step five according to the color of the code points of the replaced blocks in the extracted identifiable intermediate AI two-dimensional code and the size and the shape of the to-be-processed AI two-dimensional code to obtain the identifiable AI-beautified two-dimensional code, and outputting the identifiable AI-beautified two-dimensional code; or directly inputting the identifiable intermediate AI two-dimensional code output in the step five into a preset image processing model to be recombined to obtain the identifiable AI beautified two-dimensional code, and outputting the identifiable AI beautified two-dimensional code; the method for extracting the code point color of the replaced block in the identifiable intermediate AI two-dimensional code specifically comprises the following steps:
A. Firstly converting the color of a replaced block in a recognizable intermediate AI two-dimensional code into an RGB color matrix, then randomly selecting k clustering centroid points in the RGB color matrix, and marking the k clustering centroid points as m 1 ,m 2 ,…,m k K is a positive integer, k classes are established simultaneously, and the k classes are respectively marked as j 1 ,j 2 ,…,j k Class j k Represented as cluster centroid m k Class to which the class belongs;
B. traversing each pixel point X in the replaced partition, and marking all the pixel points in the replaced partition as X 1 ,X 2 ,…,X n First, each pixel point X is calculated i With each cluster centroid m j Distance dis (X) i ,m j ),Wherein: x is X i I is more than or equal to 1 and less than or equal to n and m for the ith pixel point j J is more than or equal to 1 and less than or equal to k, X is the j-th cluster centroid it For the color attribute of the ith pixel point, m jt For the color attribute of the j-th cluster centroid, sequentially comparing each pixel point X i With each cluster centroid m j Distance of each pixel point X i Assigned to cluster centroid m closest thereto j Class j to which it belongs k In (a) and (b);
C. for class j k The centroid point in the (2) is corrected, and the calculation formula is thatWherein m is j For class j after error correction k Centroid of 1.ltoreq.j.ltoreq.k, |j k I is class j k The number of the pixel points contained in the pixel array Y i Representing class j k The i-th object, i is more than or equal to 1 and less than or equal to |j k I, finally obtaining RGB color values of centroid points of k classes, wherein the color values are class j k In step six, the code point color of the replaced block in the identifiable intermediate AI two-dimensional code is determined according to the class j of the current code point extracted from the corresponding replaced block k Performing color value adjustment on RGB color values of (2);
the method for extracting the size and the shape of the AI two-dimensional code to be processed specifically comprises the following steps:
a. firstly, converting an AI two-dimensional code to be processed into a gray image, and then carrying out Gaussian filtering treatment on the gray image;
b. calculating a threshold t by using a maximum inter-class difference method, wherein the threshold t is the difference between a foreground gray value and a background gray value in a gray image, and a calculation formula is t=Max [ w0 (t) ×u0 (t) -u 2 +w1(t)*(u1(t)-u) 2 ]Wherein w0 is the background proportion, u0 is the average value of background gray values, w1 is the foreground proportion, u1 is the average value of foreground gray values, and u is the average value of gray values of the whole image;
c. based on the calculated threshold t, carrying out binary segmentation on the gray level image subjected to Gaussian filtering treatment, so as to obtain a binary image;
d. based on the binarized image obtained in the step c, determining the outline of the binarized image by using an edge detection algorithm;
e. the method comprises the steps of extracting the outline of a binarized image by using a communication component marking algorithm, calculating the area surrounded by all closed outlines, wherein 3 closed outlines with the nearest surrounded area in all closed outlines are the positioning frames in the AI two-dimensional code to be processed, extracting the central points of the three positioning frames, calculating the triangle surrounded by the central points of the three positioning frames, wherein the position of the angle with the largest angle in the triangle is the point of the right upper corner in the AI two-dimensional code to be processed, and the other two corner points are the positions of the right lower positioning point and the left upper positioning point in the AI two-dimensional code to be processed.
2. The method for generating the high-recognition-rate AI two-dimensional code according to claim 1, wherein: the decoding and transcoding technique in the first step specifically comprises the following steps:
step 1, inputting a two-dimensional code picture input by a user;
step 2, preprocessing a two-dimensional code picture input by a user;
step 3, identifying a positioning module and a calibration module in a two-dimensional code picture input by a user, judging whether the two-dimensional code picture has the positioning module and the calibration module, and prompting the user if the two-dimensional code picture does not have the positioning module and the calibration module, wherein the two-dimensional code picture input by the user has no two-dimensional code pattern; if the positioning module and the calibration module are arranged, determining the position and the direction of the two-dimensional code in the two-dimensional code picture;
step 4, extracting data code words and check code words in the two-dimensional code pictures according to the two-dimensional code coding rule;
step 5, performing error correction operation on the data code word according to the error correction area of the two-dimensional code, and restoring original data;
step 6, generating an image which consists of black blocks and white blocks and records data information according to the original data and the corresponding code generation rule;
step 7, disturbing the distribution of the black blocks and the white blocks, selecting one mask pattern from eight preset mask patterns, and redistributing the black blocks and the white blocks to generate an initial black-and-white two-dimensional code;
And 8, outputting the initial black-and-white two-dimensional code.
3. The method for generating the high-recognition-rate AI two-dimensional code according to claim 1, wherein: and the image processing model in the second step is a potential diffusion model.
4. The method for generating the high-recognition-rate AI two-dimensional code according to claim 1, wherein: the intervention parameters in the second step comprise one or any combination of the following parameters: diffusion coefficient, number of iterations, initial conditions, correlation, and noise strength.
5. The method for generating the high-recognition-rate AI two-dimensional code according to claim 1, wherein: the machine decoding and identifying technology in the third step specifically comprises the following steps:
step A, identifying a positioning module and a calibration module of the two-dimensional code image after the AI beautification, judging whether the positioning module and the calibration module exist in the two-dimensional code image after the AI beautification, and if the positioning module and the calibration module do not exist, performing a step four; if the positioning module and the calibration module are arranged, determining the boundary and the initial position of the two-dimensional code in the two-dimensional code image after the AI beautification;
step B, determining format information of the two-dimensional code in the two-dimensional code image after the AI beautification;
step C, removing mask information of the two-dimensional code in the two-dimensional code image after the AI beautification;
Step D, determining a code generation rule of the two-dimensional code and the size of the two-dimensional code in the two-dimensional code image after the AI beautification;
step E, decoding the two-dimensional codes in the two-dimensional code image after the AI beautification according to the code generation rule determined in the step D according to the sequence of the two-dimensional codes, and obtaining the data content of the decoded two-dimensional codes;
and F, outputting the two-dimensional code data content obtained in the step E.
6. The method for generating the high-recognition-rate AI two-dimensional code according to claim 1, wherein: in the fourth step, firstly, an initial black-and-white two-dimensional code and an AI two-dimensional code to be processed are respectively divided into a coding region and an error correction coding region by using one vertical line, then the coding region and the error correction coding region of the initial black-and-white two-dimensional code are respectively divided into four blocks by using three horizontal lines, correspondingly, the coding region and the error correction coding region of the AI two-dimensional code to be processed are respectively divided into four blocks by using three horizontal lines at the same position, at the moment, the coding region of the initial black-and-white two-dimensional code is divided into four blocks, the error correction coding region of the initial black-and-white two-dimensional code is also divided into four blocks, and the whole initial black-and-white two-dimensional code is divided into eight blocks; similarly, the coding region of the to-be-processed AI two-dimensional code is also divided into four blocks, the error correction coding region of the to-be-processed AI two-dimensional code is also divided into four blocks, the whole to-be-processed AI two-dimensional code is divided into eight blocks, the size and shape of the coding blocks of the initial black-and-white two-dimensional code are identical to those of the coding blocks of the corresponding positions of the to-be-processed AI two-dimensional code, and the size and shape of the error correction coding blocks of the initial black-and-white two-dimensional code are identical to those of the error correction coding blocks of the corresponding positions of the to-be-processed AI two-dimensional code;
The specific implementation scheme of the fifth step comprises the following steps:
s1, selecting one coding block from four coding blocks of an initial black-and-white two-dimensional code, and selecting one error correction coding block from four error correction coding blocks of the initial black-and-white two-dimensional code, and respectively replacing the error correction coding blocks and the code blocks at corresponding positions in an AI two-dimensional code to be processed to obtain an intermediate two-dimensional code to be identified;
s2, performing machine decoding inspection on the middle two-dimensional code to be identified obtained in the S1, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S1 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S1, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black and white two-dimensional code is different from a block combination selected in the prior S1;
s3, repeating the steps S1 and S2 sixteen times, if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, selecting one coding block from four coding blocks of the initial black-and-white two-dimensional code, selecting two error correction coding blocks from four error correction coding blocks of the initial black-and-white two-dimensional code, and respectively replacing the two error correction coding blocks with the coding blocks and the error correction coding blocks at corresponding positions in the AI two-dimensional code to be processed to obtain the intermediate two-dimensional code to be identified;
S4, performing machine decoding check on the middle two-dimensional code to be identified obtained in the S3, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S3 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S3, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black and white two-dimensional code is different from a block combination selected in the prior S3;
s5, repeating the steps S3 and S4 for twenty four times, if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, selecting two coding blocks from four coding blocks of the initial black-and-white two-dimensional code, and selecting two error correction coding blocks from four error correction coding blocks of the initial black-and-white two-dimensional code, and respectively replacing the two error correction coding blocks with the coding blocks and the error correction coding blocks at corresponding positions in the AI two-dimensional code to be processed to obtain the intermediate two-dimensional code to be identified;
s6, performing machine decoding check on the middle two-dimensional code to be identified obtained in the S5, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S5 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S5, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black and white two-dimensional code is different from a block combination selected in the prior S5;
S7, repeating the steps S5 and S6 thirty-six times, if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, selecting two encoding blocks from four encoding blocks of the initial black-and-white two-dimensional code, and selecting three error correction encoding blocks from four error correction encoding blocks of the initial black-and-white two-dimensional code, and respectively replacing the three error correction encoding blocks to the encoding blocks and the error correction encoding blocks at the corresponding positions in the AI two-dimensional code to be processed to obtain the intermediate two-dimensional code to be identified;
s8, performing machine decoding check on the middle two-dimensional code to be identified obtained in the S7, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S7 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S7, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black and white two-dimensional code is different from a block combination selected in the prior S7;
s9, repeating the steps S7 and S8 for twenty four times, if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, selecting three coding blocks from four coding blocks of the initial black-and-white two-dimensional code, and selecting three error correction coding blocks from four error correction coding blocks of the initial black-and-white two-dimensional code, and respectively replacing the three error correction coding blocks into the coding blocks and the error correction coding blocks at corresponding positions in the AI two-dimensional code to be processed to obtain the intermediate two-dimensional code to be identified;
S10, performing machine decoding inspection on the middle two-dimensional code to be identified obtained in the S9, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S9 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S9, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black-white two-dimensional code is different from a block combination selected in the prior S9;
s11, repeating the steps S9 and S10 sixteen times, if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, selecting three coding blocks from four coding blocks of the initial black-and-white two-dimensional code, and selecting four error correction coding blocks from four error correction coding blocks of the initial black-and-white two-dimensional code, and respectively replacing the four error correction coding blocks with the coding blocks and the error correction coding blocks at corresponding positions in the AI two-dimensional code to be processed to obtain the intermediate two-dimensional code to be identified;
s12, performing machine decoding inspection on the middle two-dimensional code to be identified obtained in the S11, outputting the middle two-dimensional code which can be decoded and identified if the middle two-dimensional code can be decoded and identified, repeatedly executing the S11 if the middle two-dimensional code can not be decoded and identified, and repeatedly executing the S11, wherein a block combination formed by a coding block and an error correction coding block selected from the initial black and white two-dimensional code is different from a block combination selected in the prior S11;
S13, repeating the steps S11 and S12 for four times, and if the obtained intermediate two-dimensional code to be identified cannot be decoded and identified by a machine, replacing the four coding blocks and the four error correction coding blocks of the initial black-and-white two-dimensional code into the four coding blocks and the four error correction coding blocks at corresponding positions in the AI two-dimensional code to be processed respectively to obtain the intermediate two-dimensional code to be identified;
s14, performing machine decoding check on the intermediate two-dimensional code to be identified obtained in S13, and outputting an identifiable intermediate AI two-dimensional code if the intermediate two-dimensional code can be decoded and identified.
7. A computer-readable storage medium, characterized by: the computer readable storage medium stores therein a computer program for generating a high recognition rate AI two-dimensional code, which when executed by a processor, implements the method of any of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311092130.8A CN116822548B (en) | 2023-08-29 | 2023-08-29 | Method for generating high recognition rate AI two-dimensional code and computer readable storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202311092130.8A CN116822548B (en) | 2023-08-29 | 2023-08-29 | Method for generating high recognition rate AI two-dimensional code and computer readable storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN116822548A CN116822548A (en) | 2023-09-29 |
CN116822548B true CN116822548B (en) | 2023-12-19 |
Family
ID=88118823
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202311092130.8A Active CN116822548B (en) | 2023-08-29 | 2023-08-29 | Method for generating high recognition rate AI two-dimensional code and computer readable storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116822548B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117314812A (en) * | 2023-11-28 | 2023-12-29 | 宁波邻家网络科技有限公司 | Two-dimensional code and picture fusion method, system and storage medium |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2015135701A (en) * | 2015-04-15 | 2015-07-27 | 国立大学法人 鹿児島大学 | Two-dimensional code, image reader, image reading method, program, and storage medium |
CN105718981A (en) * | 2016-01-26 | 2016-06-29 | 南京风力舰信息技术有限公司 | Processing method for preparing novel 2D code image holographic anti-counterfeiting label |
CN106778995A (en) * | 2016-11-25 | 2017-05-31 | 北京矩石科技有限公司 | A kind of art up two-dimensional code generation method and device with image co-registration |
WO2020174714A1 (en) * | 2019-02-26 | 2020-09-03 | エクスポート・ジャパン株式会社 | Printed matter with identification code for visually impaired persons added |
CN112541369A (en) * | 2020-12-14 | 2021-03-23 | 合肥高维数据技术有限公司 | Information code identification method and system |
CN114897000A (en) * | 2022-05-20 | 2022-08-12 | 成都航天思睿信息技术有限公司 | Annular two-dimensional code positioning position detection generation and identification method |
Family Cites Families (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US8864036B2 (en) * | 2012-07-09 | 2014-10-21 | Symbol Technologies, Inc. | Apparatus and method for finding target distance from barode imaging scanner |
US20140097250A1 (en) * | 2012-10-04 | 2014-04-10 | Thomas Charles Antognini | Variable formatting of digital data into a pattern |
JP2017516204A (en) * | 2014-04-10 | 2017-06-15 | アンキ,インコーポレイテッド | Generation and decoding of machine-readable optical codes with aesthetic elements |
US11120241B2 (en) * | 2019-07-30 | 2021-09-14 | Temptime Corporation | Two dimensional barcode provided with dynamic environmental indicator provided within a gap |
-
2023
- 2023-08-29 CN CN202311092130.8A patent/CN116822548B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2015135701A (en) * | 2015-04-15 | 2015-07-27 | 国立大学法人 鹿児島大学 | Two-dimensional code, image reader, image reading method, program, and storage medium |
CN105718981A (en) * | 2016-01-26 | 2016-06-29 | 南京风力舰信息技术有限公司 | Processing method for preparing novel 2D code image holographic anti-counterfeiting label |
CN106778995A (en) * | 2016-11-25 | 2017-05-31 | 北京矩石科技有限公司 | A kind of art up two-dimensional code generation method and device with image co-registration |
WO2020174714A1 (en) * | 2019-02-26 | 2020-09-03 | エクスポート・ジャパン株式会社 | Printed matter with identification code for visually impaired persons added |
CN112541369A (en) * | 2020-12-14 | 2021-03-23 | 合肥高维数据技术有限公司 | Information code identification method and system |
CN114897000A (en) * | 2022-05-20 | 2022-08-12 | 成都航天思睿信息技术有限公司 | Annular two-dimensional code positioning position detection generation and identification method |
Non-Patent Citations (4)
Title |
---|
"Design of QR-Coded Metasurfaces for RCS Reduction at mmWave";M. Al-Nuaimi et al.;《IEEE Access》;第10卷;第66267-66272页 * |
"分级安全二维码下区块链溯源方案设计";张晓宇 等;《计算机工程与应用》;第58卷(第20期);第98-107页 * |
"基于感兴趣区域和RS编码机制的QR码美化算法";徐晓宇;陆剑锋;李黎;张善卿;;《计算机应用》(第08期);第271-276+281页 * |
信息嵌入图像型二维码防伪技术研究;赵世栋;;信息与电脑(理论版)(第05期);第44-47页 * |
Also Published As
Publication number | Publication date |
---|---|
CN116822548A (en) | 2023-09-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Xu et al. | Stylized aesthetic QR code | |
CN108229234B (en) | Scannable image generation method fusing digital coding | |
CN106991462B (en) | Three-dimensional code generating method | |
CN109919830B (en) | Method for restoring image with reference eye based on aesthetic evaluation | |
CN106778995B (en) | Artistic two-dimensional code generation method and device fused with image | |
Li et al. | An aesthetic QR code solution based on error correction mechanism | |
US8605795B2 (en) | Video editing methods and systems | |
CN109657612B (en) | Quality sorting system based on facial image features and application method thereof | |
CN111340047B (en) | Image semantic segmentation method and system based on multi-scale feature and foreground and background contrast | |
CN106599965A (en) | Method and device for making image cartoony and fusing image with 2D code | |
CN116822548B (en) | Method for generating high recognition rate AI two-dimensional code and computer readable storage medium | |
JPH1153525A (en) | Facial organ detector and medium | |
CN104794693B (en) | A kind of portrait optimization method of face key area automatic detection masking-out | |
Hung et al. | Micrography QR codes | |
TWI646467B (en) | Method and system for generating two dimensional barcode with hidden data | |
CN113139557B (en) | Feature extraction method based on two-dimensional multi-element empirical mode decomposition | |
CN109003287A (en) | Image partition method based on improved adaptive GA-IAGA | |
CN114581918A (en) | Text recognition model training method and device | |
CN109492735B (en) | Two-dimensional code generation method and computer-readable storage medium | |
CN111274863A (en) | Text prediction method based on text peak probability density | |
CN113052783A (en) | Face image fusion method based on face key points | |
CN108491747B (en) | Method for beautifying QR (quick response) code after image fusion | |
CN117131895B (en) | Method for batch generation of unified vision AI two-dimension code and computer readable storage medium | |
CN116071797A (en) | Sparse face comparison countermeasure sample generation method based on self-encoder | |
CN115546011A (en) | Image processing method, image processing device, computer equipment and storage medium |
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 |