Two-dimensional code printing generation system with electronic texture
Technical Field
The invention relates to a printing technology, in particular to a two-dimensional code printing technology.
Background
The bar code technology is an automatic identification technology integrating coding, printing, data acquisition and processing, the bar code is divided into a one-dimensional code and a two-dimensional code, and the two-dimensional code has the advantages of low one-dimensional code cost, convenience in propagation and the like, and also has the advantages of large information capacity, high reliability, capability of representing various forms of data, strong confidentiality and anti-counterfeiting performance and the like.
With the rapid development of economy and information communication technology, the application of barcode technology has been related to the fields of commodity circulation, transportation, industrial control, and the like. The traditional one-dimensional bar code cannot meet new requirements in many aspects such as data storage capacity, reliability, security and anti-counterfeiting performance, and the like, so the two-dimensional bar code is increasingly emphasized and applied in more and more fields.
The two-dimensional code is a bar code for recording data symbol information by using black and white smelling figures distributed on a plane (in a two-dimensional direction) according to a certain rule by using a certain specific geometric figure. The method has the advantages of large information capacity, high reliability, flexible coding mode, strong confidentiality and anti-counterfeiting performance and the like. The two-dimensional code is used as an information carrier, is also an important method and means for information acquisition and transmission, and can play a role in improving efficiency in various fields. With the popularization of intelligent terminals and the rapid popularization of mobile networks, the two-dimensional code becomes a window of the future data era. The two-dimensional code technology is widely used in the fields of mobile electronic commerce, fast character input, food safety management and the like.
At present, the two-dimensional code used conventionally is a black printed two-dimensional code, the pattern of the two-dimensional code is formed by disordered black and white information points, the two-dimensional code is disordered in shape and is printed on the outer package of a product, the overall appearance design of the product is greatly damaged, and the overall attractive effect of the package is influenced.
The current color two-dimensional code printing technology is developed on the basis of the black and white two-dimensional code technology. In the prior art, the color two-dimensional code is obtained by replacing black with other monochrome colors, and the information amount is not increased. 201310211386.6 discloses a method for printing a color two-dimensional code, which generates color two-dimensional code data by matching a two-dimensional code image with an image stored in advance in an image database to determine a matched color image as an embedded image, in order to make the printed color two-dimensional code more beautiful.
However, the invention patent of 201310211386.6 has a problem that the images stored in the image database are limited, and there may be a case where an image that cannot be matched with the two-dimensional code image exists; meanwhile, the two-dimensional code generated by the method has insufficient anti-counterfeiting performance.
Disclosure of Invention
The present invention is an improvement of the invention patent 201310211386.6, and provides a two-dimensional code generation system capable of solving the technical problem.
As an aspect of the present invention, there is provided a two-dimensional code generation system that generates a two-dimensional code having an electronic texture, including: a receiving unit that receives two-dimensional code information to be printed; a two-dimensional code generation unit that generates a two-dimensional code image to be printed based on the received two-dimensional code information; the storage part stores a preset color image used for matching the two-dimensional code image; a matching unit that matches the two-dimensional code image with the color image in the storage unit and specifies a color image that can be displayed in the two-dimensional code image; a print image generating unit that generates a print image; a color printing section for color printing a print image; further comprising a first random number generator that generates a first random number; a second random number generator that generates a second random number; the storage part also stores array information of preset color images; an electronic texture generating section that determines an array for electronic texture in the matched color image based on the first random number generated by the first random number generator and the array information of the color image stored in the storage section, determines a color of the array for electronic texture based on the second random number generated by the second random number generator and the array information of the color image stored in the storage section, and generates a color image having electronic texture based on the array for electronic texture and the color of the array; the print image generation unit generates a print image based on the color image having the electronic texture and the two-dimensional code image.
Preferably, the color printing part is provided with a plurality of color nozzles for spraying color images.
Preferably, the array information of the color image includes an image array division and a color set corresponding to each array, and the color set includes a main color and a plurality of electronic texture colors.
Preferably, each of the arrays is a single color.
Preferably, the main color and the plurality of electronic texture colors are colors with color values larger than a threshold value, and are both black or white after binarization.
Preferably, the color of the array for the electronic texture determined by the electronic texture generating unit is one of a plurality of electronic texture colors.
Preferably, in the color image having the electronic texture, the image color of the array not used for the electronic texture is the main color of the array stored in the storage section.
Preferably, when the matching unit matches the two-dimensional code image with the color image in the storage unit, the matching unit determines whether the color image in the storage unit matches the two-dimensional code image based on a tolerance threshold, and when a ratio of a number of color values of corresponding modules of the two-dimensional code image and the color image in the storage unit, which are not consistent, to a number of all modules in the two-dimensional code image is greater than the tolerance threshold, the determining unit determines that the color image and the two-dimensional code image are not matched; when the ratio of the number of the color values of the corresponding modules of the two-dimensional code image and the color image in the storage part, which are inconsistent, to the number of all the modules in the two-dimensional code image is smaller than a tolerance threshold, the judgment part judges that the color image is matched with the two-dimensional code image.
Preferably, the tolerance threshold is smaller than the error correction threshold of the two-dimensional code.
Preferably, the tolerance threshold is 2% to 5% smaller than the error correction threshold of the two-dimensional code.
Preferably, the first random number generator generates one or more random numbers aiThe random number AiRange from 1 to the number N of arrays of color images.
Preferably, the second random number generator generates the same number of random numbers B as the first random number generator generatesiThe random number BiArray A of color imagesiThe electronic texture color number of (2).
Preferably, the electronic texture generating section combines the array a in the color imageiIs set as the B-th color in the electronic texture color numberiAnd (4) a color.
Preferably, the received two-dimensional code information includes website information of a network memory.
Preferably, the mobile terminal further comprises an image transmission unit which transmits the print image generated by the print image generation unit to a network memory for verifying the printed two-dimensional code.
Preferably, the color image generating unit embeds the color image having the electronic texture in a two-dimensional code image to generate a print image.
Preferably, the color image in the storage unit and the two-dimensional code image have the same resolution.
Preferably, the matching section further includes: the recording part is used for recording the ratio of the number of the color values of the corresponding modules of the two-dimensional code image and each color image in the storage part, which are inconsistent, to the number of all the modules in the two-dimensional code image when the two-dimensional code image is matched with the color images in the storage part; the self-subtracter is used for sequentially reducing the tolerance threshold value to the tolerance threshold value smaller than 1% by taking 1% as a step length when all the color images in the storage part are not matched with the two-dimensional code image; the judging part judges the ratio of the number of color values of corresponding modules of the two-dimensional code image and each color image in the storage part, which are inconsistent with the number of all modules in the two-dimensional code image, to the reduced tolerance threshold value and determines the color image as a matched image corresponding to the reduced tolerance threshold value if the color image with the ratio smaller than the reduced tolerance threshold value exists; if the self-subtraction part reduces the tolerance threshold value to be less than 1%, the color image with the ratio of the number of the color values of the corresponding modules of the two-dimensional code image and the color values of all the modules in the two-dimensional code image being less than the tolerance threshold value still does not exist, and the matching part gives the result that the image is not matched.
Preferably, the matching section includes a rotating section that, when matching the two-dimensional code image with the color image in the storage section, if all the color images in the storage section do not match with the two-dimensional code image, performs: (1) the rotation part rotates the image in the storage part clockwise by 90 degrees and then matches the image with the two-dimensional code image, and if a color image which is successfully matched exists, the color image which is rotated by 90 degrees is used as a color image displayed in the two-dimensional code image; (2) if the matching is unsuccessful, the rotating part rotates the image in the storage part by 180 degrees clockwise and then matches the image with the two-dimensional code image, and if a color image which is successfully matched exists, the color image which is rotated by 180 degrees is used as a color image displayed in the two-dimensional code image; (3) if the matching is unsuccessful, the rotating part rotates the image in the storage part by 270 degrees clockwise and then matches the image with the two-dimensional code image, and if a color image which is successfully matched exists, the color image which is rotated by 270 degrees is used as a color image displayed in the two-dimensional code image; (4) and if the matching is not successful, determining that no color image matched with the two-dimensional code image exists.
Drawings
Fig. 1 is a schematic system structure diagram of a two-dimensional code generation system according to an embodiment of the present invention.
Fig. 2 is a functional block diagram of a matching section in a preferred embodiment of the present invention.
Fig. 3 is a functional block diagram of a matching section in a further preferred embodiment of the present invention.
Detailed Description
In order to more clearly illustrate the technical solutions of the present invention, the present invention will be briefly described below by using embodiments, and it is obvious that the following description is only one embodiment of the present invention, and for those skilled in the art, other technical solutions can be obtained according to the embodiments without inventive labor, and also fall within the disclosure of the present invention.
Referring to fig. 1, the two-dimensional code printing generation system according to the embodiment of the present invention includes: the image processing apparatus includes a receiving section 10, a two-dimensional code generating section 20, a storage section 30, a matching section 40, a first random number generator 50, a second random number generator 60, an electronic texture generating section 70, a print image generating section 80, an image transmitting section 90, and a color printing section 100.
The receiving part 10 is used for receiving two-dimensional code data to be printed, wherein the two-dimensional code data to be printed can be information representing product data, manufacturers, dates and the like, and letters, numbers, characters or character strings formed by combining the letters, the numbers, the characters or the character strings can be used as information representing the information; the two-dimensional code data also comprises a website address of the network memory, and the stored image in the two-dimensional code data can be browsed through the website address.
The two-dimensional Code generation unit 20 may use a conventional two-dimensional Code encoding rule such as QR Code, PDF417, and Code49, and generates a two-dimensional Code image to be printed from the received two-dimensional Code information based on the two-dimensional Code encoding rule.
And the storage part 30 is used for storing a preset color image used for matching the two-dimensional code image, and the stored color image has the same resolution as the two-dimensional code image, namely the size of the basic module in the color image is the same as that of the basic module in the two-dimensional code image. The storage section 30 also stores therein array information of a preset color image including an image array division and a color set corresponding to each array, the color set including a main color and a plurality of electronic texture colors. When the image array is divided, adjacent basic modules with the same color in the image can be divided into the same array. The main color in the color set and the plurality of electronic texture colors are colors having a color value larger than a threshold value, and the threshold value is set so that they are both black or white after binarization.
A matching unit 40 that matches the two-dimensional code image with the color image stored in the storage unit 30 and specifies a color image that can be displayed in the two-dimensional code image; specifically, when the matching unit 40 matches the two-dimensional code image with the color image in the storage unit 30, it is determined whether the color image in the storage unit matches the two-dimensional code image based on a tolerance threshold, and when a ratio of a number of color values of corresponding modules of the two-dimensional code image and the color image in the storage unit that are not consistent to a number of all modules in the two-dimensional code image is greater than the tolerance threshold, the determining unit determines that the color image and the two-dimensional code image are not matched; when the ratio of the number of the color values of the corresponding modules of the two-dimensional code image and the color image in the storage part, which are inconsistent, to the number of all the modules in the two-dimensional code image is smaller than a tolerance threshold, the judgment part judges that the color image is matched with the two-dimensional code image. The tolerance threshold is set based on the error correction threshold of the two-dimensional code, and preferably, the tolerance threshold is 2% -5% smaller than the error correction threshold of the two-dimensional code. For example, when the error correction threshold of the two-dimensional code is 15%, the tolerance threshold may be set to 10% to 13%, and when the error correction threshold of the two-dimensional code is 25%, the tolerance threshold may be set to 20% to 23%.
A first random number generator 50 that generates a first random number array; random number A in the first random number arrayiMay be one or more random numbers, random number aiRange from 1 to the number N of arrays of color images. A second random number generator 60 generating a second random number array having the same number of random numbers B as the first random number arrayiThe random number BiArray A of color imagesiThe electronic texture color number of (2).
An electronic texture generating unit 70 for determining an array for electronic texture in the matched color image based on the first random number array generated by the first random number generator 50 and the array information of the color image stored in the storage unit 30, determining the color of the array for electronic texture based on the second random number array generated by the second random number generator 60 and the array information of the color image stored in the storage unit 30, and mapping the array a in the color image to the array aiIs set as the B-th color in the electronic texture color numberiA color; and array A in color imagesiThe color of the other array is set to the dominant color of the array; thereby generating a color image having the electronic texture based on the array for the electronic texture and the color of the array.
The print image generating unit 80 embeds the color image having the electronic texture generated by the electronic texture generating unit 70 into the two-dimensional code image generated by the two-dimensional code generating unit 20 based on the matching result of the matching unit, and generates a print image. The image transfer unit 90 transfers the generated print image to the network memory, and verifies the print image stored in the network memory when the printed two-dimensional code is recognized.
A color printing section 100 for color printing a print image; the printed image may be color printed using a conventional color printing apparatus, such as a printing apparatus having a plurality of color nozzles that spray a color image onto the print medium.
Referring to fig. 2, a preferred embodiment of the present invention is different from the above embodiment in that the matching unit 40 further includes: a recording unit 401, a self-decrementer 402, and a determination unit 403. The recording section 401 records a ratio of the number of color values of the corresponding blocks of the two-dimensional code image and each color image in the storage section 30 that do not coincide with each other to the number of all blocks in the two-dimensional code image when matching the two-dimensional code image with the color images in the storage section 30. And a self-subtracter 402, which takes 1% as a step length and sequentially reduces the tolerance threshold value until the tolerance threshold value is less than 1%, when all the color images in the storage part are not matched with the two-dimensional code image. The judging part 403 judges, every time the self-decrementing device 402 decrements by one step length, the ratio of the number of color values of corresponding modules of the two-dimensional code image and each color image in the storage part to the number of all modules in the two-dimensional code image and the size of the tolerance threshold after the reduction, and if there is a color image of which the ratio is smaller than the size of the tolerance threshold after the reduction, determines that the color image is a matching image corresponding to the tolerance threshold after the reduction; if the self-subtraction section 402 reduces the tolerance threshold to less than 1%, there is still no color image in which the ratio of the number of color values of the corresponding modules of the two-dimensional code image and each color image in the storage section, which are inconsistent, to the number of all modules in the two-dimensional code image is less than the tolerance threshold, the matching section 40 gives a result that there is no matching image.
With the preferred embodiment described above, even when there is no matching image in the storage unit, it is possible to further specify an image used for matching, and it is possible to generate a two-dimensional code image having a color electronic texture.
In the above embodiment, the range of the matching image is increased by lowering the tolerance threshold, but this embodiment causes a decrease in the fault tolerance value of the generated two-dimensional code image, so that the content of the generated two-dimensional code image may not be read out when it is smeared. Further improved embodiment of the present invention referring to fig. 3, the matching section 40 includes a rotating section 404, and when matching the two-dimensional code image with the color image in the storage section 30, if all the color images in the storage section 30 do not match the two-dimensional code image, the matching section 40 performs the following operations: (1) the rotation unit 404 rotates the image in the storage unit 30 by 90 degrees clockwise, and then the determination unit 403 matches the image with the two-dimensional code image, and if a successfully matched color image exists, the color image rotated by 90 degrees is regarded as a color image displayed in the two-dimensional code image; (2) if the matching is unsuccessful, the rotation section 404 rotates the image in the storage section 30 clockwise by 180 degrees, and then the determination section 403 matches the image with the two-dimensional code image, and if a color image matching successfully exists, the color image rotated by 180 degrees is regarded as a color image displayed in the two-dimensional code image; (3) if the matching is unsuccessful, the rotation section 404 rotates the image in the storage section 30 by 270 degrees clockwise, and then the determination section 403 matches the two-dimensional code image, and if a color image matching successfully exists, the color image rotated by 270 degrees is regarded as a color image displayed in the two-dimensional code image; (4) and if the matching is not successful, determining that no color image matched with the two-dimensional code image exists.
With the above-described further improved embodiment, even when there is no matching image in the storage section, the image for matching can be further specified without reducing the error tolerance of printing the two-dimensional code image, and a two-dimensional code image having a color electronic texture can be generated.
All documents referred to herein are incorporated by reference into this application as if each were individually incorporated by reference. It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.