CN110009082B - Three-dimensional code optimization method, medium, computer device and apparatus - Google Patents

Three-dimensional code optimization method, medium, computer device and apparatus Download PDF

Info

Publication number
CN110009082B
CN110009082B CN201910294747.5A CN201910294747A CN110009082B CN 110009082 B CN110009082 B CN 110009082B CN 201910294747 A CN201910294747 A CN 201910294747A CN 110009082 B CN110009082 B CN 110009082B
Authority
CN
China
Prior art keywords
code
dimensional code
brightness
manufactured
base map
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
Application number
CN201910294747.5A
Other languages
Chinese (zh)
Other versions
CN110009082A (en
Inventor
陈绳旭
林宏
马吉良
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Cn3wm Xiamen Network Technology Co ltd
Original Assignee
Cn3wm Xiamen Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Cn3wm Xiamen Network Technology Co ltd filed Critical Cn3wm Xiamen Network Technology Co ltd
Priority to CN201910294747.5A priority Critical patent/CN110009082B/en
Publication of CN110009082A publication Critical patent/CN110009082A/en
Application granted granted Critical
Publication of CN110009082B publication Critical patent/CN110009082B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • G06K19/06009Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking
    • G06K19/06037Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code with optically detectable marking multi-dimensional coding

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Generation (AREA)
  • Processing Or Creating Images (AREA)

Abstract

The invention discloses a method, a medium, computer equipment and a device for optimizing three-dimensional codes, which comprise the following steps: obtaining a base map of a three-dimensional code to be manufactured; calculating the brightness information of the base map of the three-dimensional code to be manufactured; and acquiring code point attribute information of the three-dimensional code to be manufactured, and adjusting the brightness of the code points in the three-dimensional code to be manufactured according to the code point attribute information and the brightness information of the base map of the three-dimensional code to be manufactured. Therefore, on the premise of not influencing the code scanning performance of the finally generated three-dimensional code, the brightness of the code points is adjusted, and the visual perception effect of the finally generated three-dimensional code is improved.

Description

Three-dimensional code optimization method, medium, computer device and apparatus
Technical Field
The invention relates to the technical field of image processing, in particular to a three-dimensional code optimization method, a three-dimensional code optimization medium, a computer device and a three-dimensional code optimization device.
Background
The existing three-dimensional code generation mode can be divided into a traditional generation mode and a generation mode based on a Gaussian algorithm.
However, in the existing three-dimensional code generation method, the influence of the code points in the generated three-dimensional code on the base map is very obvious, and the code points of the three-dimensional code and the base map of the three-dimensional code to be produced cannot be effectively fused, so that the visual perception effect of the finally generated three-dimensional code is poor.
Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the art described above. Therefore, an object of the present invention is to provide an optimization method for a three-dimensional code, which can adjust the brightness of code points without affecting the code scanning performance of the finally generated three-dimensional code, so as to improve the visual and sensory effects of the finally generated three-dimensional code.
A second object of the invention is to propose a computer-readable storage medium.
A third object of the invention is to propose a computer device.
The fourth purpose of the invention is to provide an optimization device of the three-dimensional code.
In order to achieve the above object, an embodiment of a first aspect of the present invention provides a method for optimizing a three-dimensional code, including the following steps: obtaining a base map of a three-dimensional code to be manufactured; calculating the brightness information of a base map of the three-dimensional code to be manufactured; and acquiring code point attribute information of the three-dimensional code to be manufactured, and adjusting the brightness of the code points in the three-dimensional code to be manufactured according to the code point attribute information and the brightness information of the base map of the three-dimensional code to be manufactured.
According to the optimization method of the three-dimensional code, firstly, a base map of the three-dimensional code to be manufactured is obtained; then, calculating the brightness information of the base image of the three-dimensional code to be manufactured according to the acquired base image of the three-dimensional code to be manufactured; then, acquiring code point attribute information of the three-dimensional code to be manufactured, and adjusting the brightness of the code points in the three-dimensional code to be manufactured according to the code point attribute information and the brightness information of the base map of the three-dimensional code to be manufactured; therefore, on the premise of not influencing the code scanning performance of the finally generated three-dimensional code, the brightness of the code points is adjusted, and the visual perception effect of the finally generated three-dimensional code is improved.
In addition, the optimization method of the three-dimensional code proposed by the above embodiment of the present invention may further have the following additional technical features:
optionally, calculating brightness information of the base map of the three-dimensional code to be produced includes: segmenting the base map of the three-dimensional code to be manufactured to generate a plurality of segmentation areas; and calculating the average brightness of each segmentation region, and calculating the average brightness, the highest brightness and the lowest brightness of the base map of the three-dimensional code to be manufactured according to the average brightness of each segmentation region.
Optionally, the code point attribute information includes a code point position, a code point color, a code point size, and a code point shape, where adjusting brightness of a code point in the three-dimensional code to be created according to the code point attribute information and brightness information of a base map of the three-dimensional code to be created includes: acquiring the average brightness of the corresponding segmentation region according to the code point position; and calculating the transparency of the code points according to the average brightness of the corresponding segmentation region, the average brightness, the highest brightness and the lowest brightness of the base map of the three-dimensional code to be manufactured, and adjusting the brightness of the code points of the corresponding segmentation region according to the transparency of the code points.
Optionally, after the calculating the brightness information of the base map of the three-dimensional code to be produced, the method further includes: and generating an adjustable parameter according to the average brightness of the base map of the three-dimensional code to be manufactured, so as to calculate the code point transparency according to the adjustable parameter, the average brightness of the corresponding segmentation region, the average brightness, the highest brightness and the lowest brightness of the base map of the three-dimensional code to be manufactured, wherein the adjustable parameter comprises adjustable highest transparency and adjustable lowest transparency.
Optionally, when the color of the code point is black, the transparency of the black code point is calculated by the following formula:
M1=100-([(Zp1-Ds)×(Th-Ts)÷(Dh-Ds)]+Ts)
wherein M is1Indicating the transparency of the black code dot, Zp1Representing the average brightness, D, of the corresponding sliced region of the black code pointsMinimum brightness, T, of a base map representing the three-dimensional code to be producedhIndicating the adjustable maximum transparency, TsIndicating an adjustable minimum transparency, DhAnd representing the highest brightness of the base map of the three-dimensional code to be produced.
Optionally, when the code point color is white, the transparency of the white code point is calculated by the following formula:
M2=([(Zp2-Ds)×(Th-Ts)÷(Dh-Ds)]+Ts)
M2indicating the transparency of the white code dot, Zp2Representing the average brightness of the corresponding segmented region of the white code point, DsMinimum brightness, T, of a base map representing the three-dimensional code to be producedhIndicating the adjustable maximum transparency, TsIndicating an adjustable minimum transparency, DhAnd representing the highest brightness of the base map of the three-dimensional code to be made.
Optionally, the method further comprises: calculating the coverage area of each code point according to the size and the shape of each code point in the three-dimensional code to be manufactured; and calculating the ratio of the coverage area of each code point to a preset code point area reference value, and adjusting the brightness of the corresponding code point according to the ratio.
In order to achieve the above object, a second embodiment of the present invention provides a computer-readable storage medium, on which a code point adjusting program is stored, and the code point adjusting program, when executed by a processor, implements the three-dimensional code optimization method as described above.
In order to achieve the above object, a third embodiment of the present invention provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the processor implements the method for optimizing three-dimensional code as described above.
In order to achieve the above object, a fourth aspect of the present invention provides an apparatus for optimizing a three-dimensional code, including: the first acquisition module is used for acquiring a base map of the three-dimensional code to be manufactured; the calculation module is used for calculating the brightness information of the base map of the three-dimensional code to be manufactured; the second acquisition module is used for acquiring code point attribute information of the three-dimensional code to be manufactured; and the adjusting module is used for adjusting the brightness of the code points in the three-dimensional code to be manufactured according to the code point attribute information and the brightness information of the base map of the three-dimensional code to be manufactured.
According to the optimization device of the three-dimensional code, the first obtaining module obtains the base map of the three-dimensional code to be manufactured, the brightness information of the base map of the three-dimensional code to be manufactured is calculated through the calculating module after the base map of the three-dimensional code to be manufactured is obtained, and the code point attribute information of the three-dimensional code to be manufactured is obtained through the second obtaining module, so that the adjusting module can adjust the brightness of the code points in the three-dimensional code to be manufactured according to the code point attribute information and the brightness information of the base map of the three-dimensional code to be manufactured; therefore, on the premise of not influencing the code scanning performance of the finally generated three-dimensional code, the brightness of the code points is adjusted, and the visual perception effect of the finally generated three-dimensional code is improved.
Drawings
Fig. 1 is a schematic flow chart of an optimization method of a three-dimensional code according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a three-dimensional code optimization method according to another embodiment of the present invention;
FIG. 3 is a schematic diagram illustrating comparison of effects of three-dimensional codes generated according to an embodiment of the present invention and three-dimensional codes generated by a conventional three-dimensional code generation method;
FIG. 4 is a flowchart illustrating adjusting the transparency of code points according to the size and shape of code points according to an embodiment of the present invention;
fig. 5 is a block diagram illustrating an apparatus for optimizing a three-dimensional code according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
The existing three-dimensional code generation mode is difficult to effectively fuse code points of the three-dimensional code and a base map of the three-dimensional code to be manufactured, so that the finally generated three-dimensional code has poor visual perception effect; according to the optimization method of the three-dimensional code, firstly, a base map of the three-dimensional code to be manufactured is obtained; then, calculating the brightness information of the base image of the three-dimensional code to be manufactured according to the acquired base image of the three-dimensional code to be manufactured; then, acquiring code point attribute information of the three-dimensional code to be manufactured, and adjusting the brightness of the code points in the three-dimensional code to be manufactured according to the code point attribute information and the brightness information of the base map of the three-dimensional code to be manufactured; therefore, on the premise of not influencing the code scanning performance of the finally generated three-dimensional code, the brightness of the code points is adjusted, and the visual perception effect of the finally generated three-dimensional code is improved.
In order to better understand the above technical solutions, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
In order to better understand the technical solution, the technical solution will be described in detail with reference to the drawings and the specific embodiments.
Fig. 1 is a schematic flowchart of a three-dimensional code optimization method according to an embodiment of the present invention, and as shown in fig. 1, the three-dimensional code optimization method includes the following steps:
and S101, obtaining a base map of the three-dimensional code to be manufactured.
The method for obtaining the base map of the three-dimensional code to be produced can be various, for example, the base map uploaded by a user is obtained to obtain the base map of the three-dimensional code to be produced; or, a preset base map template is presented to a user to obtain a base map of the three-dimensional code to be produced according to a selection instruction of the user, and the like.
And S102, calculating the brightness information of the base map of the three-dimensional code to be manufactured.
That is, after the base map of the three-dimensional code to be produced is acquired, the brightness information of the base map of the three-dimensional code to be produced is calculated according to the acquired base map of the three-dimensional code to be produced.
The brightness information of the base map of the three-dimensional code to be produced may include, but is not limited to, an average brightness of the base map of the three-dimensional code to be produced, an area average brightness of the base map of the three-dimensional code to be produced, a highest brightness of the base map of the three-dimensional code to be produced, and a lowest brightness of the base map of the three-dimensional code to be produced.
The brightness information of the base map of the three-dimensional code to be made can be calculated in various ways.
As an example, pixel point information of a base map of a three-dimensional code to be produced is obtained, and the brightness information of the base map of the three-dimensional code to be produced is calculated according to each pixel point information; the pixel point information may include: the position information of the pixel points and the RGB information of the pixel points can be used for calculating the average brightness of the base image of the three-dimensional code to be manufactured, the area average brightness of the base image of the three-dimensional code to be manufactured, the highest brightness of the base image of the three-dimensional code to be manufactured and the lowest brightness of the base image of the three-dimensional code to be manufactured according to the position information of the pixel points and the RGB information of the pixel points.
S103, acquiring code point attribute information of the three-dimensional code to be manufactured, and adjusting the brightness of the code points in the three-dimensional code to be manufactured according to the code point attribute information and the brightness information of the base map of the three-dimensional code to be manufactured.
Namely, the code point attribute information of the three-dimensional code to be manufactured is obtained, so that the brightness of the code points in the three-dimensional code to be manufactured is adjusted according to the obtained code point attribute information of the three-dimensional code to be manufactured and the brightness information of the base map of the three-dimensional code to be manufactured obtained through calculation.
The method for adjusting the brightness of the code points in the three-dimensional code to be manufactured according to the code point attribute information and the brightness information of the base map of the three-dimensional code to be manufactured can be various, for example, the method for adjusting the transparency of the code points in the three-dimensional code to be manufactured according to the code point attribute and the brightness information of the base map of the three-dimensional code to be manufactured; or, adjusting the color of the code points in the three-dimensional code to be manufactured according to the code point attributes and the brightness information of the base map of the three-dimensional code to be manufactured; or adjusting the shape of the code points in the three-dimensional code to be manufactured according to the code point attributes and the brightness information of the base map of the three-dimensional code to be manufactured so as to achieve the purpose of adjusting the brightness of the code points in the three-dimensional code to be manufactured.
As an example, when the code point is a dark code point, the code point shape is changed such that the coverage area of the code point is increased, and the brightness corresponding to the code point is decreased, thereby achieving the purpose of adjusting the brightness of the code point.
As another example, when the code point is a dark code point, the color brightness corresponding to the code point can be directly adjusted, so as to achieve the purpose of adjusting the code point brightness.
The code point attribute information of the three-dimensional code to be produced may include, but is not limited to, a code point position, a code point color, a code point size, and a code point shape.
As an example, firstly, acquiring data information to be coded input by a user and a matrix order, a code point color and a code point shape of a selected three-dimensional code to be produced; further, determining the matrix arrangement of the three-dimensional code to be manufactured according to the data information to be coded input by the user and the selected matrix order of the three-dimensional code to be manufactured, wherein the matrix order of the three-dimensional code to be manufactured can be 12 × 12, 16 × 16, 20 × 20 and the like, and the specific form of the matrix order of the three-dimensional code to be manufactured is not limited; therefore, after the matrix arrangement of the three-dimensional code to be manufactured is determined, the position of the code point in the three-dimensional code to be manufactured is determined, and the acquisition process of the code point attribute information of the three-dimensional code to be manufactured is completed.
The method for adjusting the transparency of the code points in the three-dimensional code to be manufactured according to the acquired code point attribute information of the three-dimensional code to be manufactured and the calculated brightness information of the base map of the three-dimensional code to be manufactured can be various.
As an example, after acquiring the code point attribute of the three-dimensional code to be produced and the average brightness of the base map of the three-dimensional code to be produced, performing corresponding transparency adjustment on code points of different colors according to the code point color in the code point attribute of the three-dimensional code to be produced and the average brightness of the base map of the three-dimensional code to be produced; specifically, when the average brightness of the base map of the three-dimensional code to be produced is 50, the base map of the three-dimensional code to be produced is considered as a low-brightness base map, so that the transparency of black code points which need low brightness to be correctly read is improved, and meanwhile, the transparency of white code points which need high brightness to be correctly read is reduced, so that the visual influence of the code points in the finally generated three-dimensional code on the base map is reduced.
As another example, after the code point attribute of the three-dimensional code to be produced is obtained, the region average brightness of the base map of the corresponding three-dimensional code to be produced is obtained according to the code point position of each three-dimensional code to be produced, and further, the transparency of each code point of the three-dimensional code to be produced is adjusted according to the region average brightness of the base map of the corresponding three-dimensional code to be produced, so that the transparency of each code point is adjusted according to the average brightness of the segmentation region corresponding to each code point.
In summary, according to the optimization method of the three-dimensional code of the embodiment of the present invention, first, a base map of the three-dimensional code to be produced is obtained; then, calculating the brightness information of the base image of the three-dimensional code to be manufactured according to the acquired base image of the three-dimensional code to be manufactured; then, acquiring code point attribute information of the three-dimensional code to be manufactured, and adjusting the brightness of the code points in the three-dimensional code to be manufactured according to the code point attribute information and the brightness information of the base map of the three-dimensional code to be manufactured; therefore, on the premise of not influencing the code scanning performance of the finally generated three-dimensional code, the brightness of the code points is adjusted, and the visual perception effect of the finally generated three-dimensional code is improved.
FIG. 2 is a flowchart illustrating a method for optimizing a three-dimensional code according to another embodiment of the present invention, in order to further enhance the effect of improving the visual perception of the finally generated three-dimensional code through adjusting the transparency of code points; as shown in fig. 2, the three-dimensional code optimization method includes the following steps:
s201, obtaining a base map of the three-dimensional code to be manufactured.
This step is the same as the description about step S101 in fig. 1, and is not repeated herein.
S202, segmenting the base map of the three-dimensional code to be manufactured to generate a plurality of segmentation areas.
That is to say, after the base map of the three-dimensional code to be produced is acquired, the base map of the three-dimensional code to be produced is segmented to generate a plurality of segmented regions.
As an example, a corresponding relationship between the resolution of the base map and the segmentation mode is preset, where the segmentation mode may include the number of segmentation regions and the position arrangement relationship of the segmentation regions, for example, when the resolution of the base map is less than 560 × 560, the base map of the three-dimensional code to be produced is segmented equidistantly according to matrix 12 × 12 to obtain 144 segmentation regions; therefore, after the base image of the three-dimensional code to be manufactured is obtained, the segmentation mode is determined according to the resolution of the base image of the three-dimensional code to be manufactured, and the base image of the three-dimensional code to be manufactured is segmented according to the segmentation mode.
As another example, after a base map of a three-dimensional code to be produced is obtained, a matrix order of the three-dimensional code to be produced is further obtained, where the matrix order of the three-dimensional code to be produced may be 12 × 12, 16 × 16, 20 × 20, and the like, and then the base map of the three-dimensional code to be produced is segmented according to the matrix order of the three-dimensional code to be produced to generate a plurality of segmented regions.
And S203, calculating the average brightness of each segmentation region, and calculating the average brightness, the highest brightness and the lowest brightness of the base map of the three-dimensional code to be manufactured according to the average brightness of each segmentation region.
That is, after a plurality of segmentation regions are generated, calculating the average brightness of each segmentation region to obtain the average brightness of each segmentation region, and then calculating the average brightness, the highest brightness and the lowest brightness of a base map of a three-dimensional code to be manufactured according to the calculated average brightness of each segmentation region; it can be understood that after the average brightness of each segmentation region is calculated, the average brightness of each segmentation region is summed, and the average brightness of the base map of the three-dimensional code to be produced can be calculated according to the sum and the number of the segmentation regions, the highest value of the average brightness in the plurality of segmentation regions is taken as the highest brightness of the base map of the three-dimensional code, and the lowest value of the average brightness in the plurality of segmentation regions is taken as the lowest brightness of the base map of the three-dimensional code; thereby completing the calculation of the brightness information of the base map of the three-dimensional code to be made.
And S204, generating adjustable parameters according to the average brightness of the base map of the three-dimensional code to be manufactured.
Wherein the adjustable parameters include an adjustable maximum transparency and an adjustable minimum transparency.
As an example, after the average brightness of the base map of the three-dimensional code to be produced is obtained, whether the base map of the three-dimensional code to be produced belongs to a low-brightness base map or a high-brightness base map is judged according to the brightness of the base map of the three-dimensional code to be produced, and the adjustable parameters are calculated correspondingly; specifically, assume transparency is a linear variable from fully opaque (0) to fully transparent (100); further, when the average brightness of the acquired base map of the three-dimensional code to be manufactured is 30, judging that the average brightness of the base map of the three-dimensional code to be manufactured is lower than 50, regarding the base map of the three-dimensional code to be manufactured as a low-brightness base map, and further, adjusting the highest transparency to be 100 and the lowest transparency to be the average brightness of the base map of the three-dimensional code to be manufactured; when the average brightness of the acquired base image of the three-dimensional code to be manufactured is 70, judging that the average brightness of the base image of the three-dimensional code to be manufactured is higher than 50, and considering that the base image of the three-dimensional code to be manufactured is a high-brightness base image, and further, adjusting the highest transparency to be 100-the average brightness of the base image of the three-dimensional code to be manufactured, and adjusting the lowest transparency to be 0; therefore, the mapping relation between the average brightness of the base map of the three-dimensional code to be manufactured and the transparency of the finally generated code points is established through the adjustable parameters.
S205, code point attribute information of the three-dimensional code to be manufactured is obtained, wherein the code point attribute information comprises code point positions, code point colors, code point sizes and code point shapes.
That is, code point attribute information of the three-dimensional code to be produced is acquired.
As an example, after a base map of a three-dimensional code to be produced uploaded by a user is obtained, a matrix selection instruction of the user about the three-dimensional code to be produced is further obtained, so that the position of a code point can be determined according to a matrix order selected by the user; and then, acquiring a selection instruction of the user about the code point color, the code point size and the code point shape of the three-dimensional code to be manufactured so as to finish the acquisition process of the code point attribute information of the three-dimensional code to be manufactured.
And S206, acquiring the average brightness of the corresponding segmentation region according to the code point position.
That is, the segmentation region corresponding to the code point is determined according to the position of the code point, and the average brightness of the segmentation region corresponding to the code point is obtained.
And S207, calculating the transparency of the code points according to the average brightness of the corresponding segmentation region, the average brightness, the highest brightness and the lowest brightness of the base map of the three-dimensional code to be manufactured, and adjusting the brightness of the code points of the corresponding segmentation region according to the transparency of the code points.
As an example, by adjusting the transparency of the code point to change the brightness of the code point, when the code point color is black, the transparency of the black code point can be calculated according to the following formula:
M1=100-([(Zp1-Ds)×(Th-Ts)÷(Dh-Ds)]+Ts)
wherein M is1Indicating the transparency of the black code dot, Zp1Representing the average brightness, D, of the corresponding sliced region of the black code pointsMinimum brightness, T, of a base map representing the three-dimensional code to be producedhIndicating the adjustable maximum transparency, TsIndicating an adjustable minimum transparency, DhAnd representing the highest brightness of the base map of the three-dimensional code to be made.
And then, adjusting the transparency of the black code points according to the calculated transparency of the black code points, so as to finish the process of adjusting the transparency of the code points corresponding to the segmentation areas by calculating the transparency of the code points according to the average brightness of the corresponding segmentation areas, the average brightness, the highest brightness and the lowest brightness of the base map of the three-dimensional code to be manufactured.
As another example, by adjusting the transparency of a codepoint to change the brightness of the codepoint, when the codepoint color is white, the calculation of the transparency of the white codepoint can be performed according to the following formula:
M2=([(Zp2-Ds)×(Th-Ts)÷(Dh-Ds)]+Ts)
M2indicating the transparency of the white code dot, Zp2Representing the average brightness of the corresponding segmented region of the white code point, DsMinimum brightness, T, of a base map representing the three-dimensional code to be producedhIndicating the adjustable maximum transparency, TsIndicating an adjustable minimum transparency, DhAnd representing the highest brightness of the base map of the three-dimensional code to be made.
And then, adjusting the transparency of the white code points according to the calculated transparency of the white code points, so as to finish the process of adjusting the transparency of the code points corresponding to the segmentation areas by calculating the transparency of the code points according to the average brightness of the corresponding segmentation areas, the average brightness, the highest brightness and the lowest brightness of the base map of the three-dimensional code to be manufactured.
It should be noted that, the color of the code point does not only include black and white, for example, the color of the code point may include black, white and gray, and when the color of the code point includes black, white and gray, the transparency of the gray code point may be calculated by adding the transparency calculation formula corresponding to the gray code point, and the transparency of the gray code point may be adjusted according to the calculation result; therefore, the above description of the specific calculation formulas for the black code points and the white code points is not a limitation on the color of the code points, but is only for ease of understanding.
The adjustment process of the transparency of the code points may be changeable, for example, the transparency of the code points may be calculated first, so as to perform drawing of corresponding code points according to the calculated transparency corresponding to the code points, or after the drawing of the code points is completed, the drawn transparency of the code points may be adjusted according to the calculated transparency corresponding to the code points; therefore, the specific adjustment stage of the transparency is not limited herein.
In addition, to better describe the effect of reducing the influence of the code points on the base map of the three-dimensional code to be generated, which is achieved by the adjustment of the transparency of the code points according to the embodiment of the present invention, as shown in fig. 3, a diagram is the base map of the three-dimensional code to be generated, b diagram is the final three-dimensional code generated in a conventional three-dimensional code generation manner, and c diagram is the final three-dimensional code generated after the transparency of the code points is adjusted according to the optimization method of the three-dimensional code provided by the embodiment of the present invention, as can be seen from fig. 3, after the transparency of the code points is adjusted by the optimization method of the three-dimensional code provided by the embodiment of the present invention, the visual perception effect of the finally generated three-dimensional code is greatly improved.
In summary, according to the optimization method of the three-dimensional code of another embodiment of the present invention, first, a base map of the three-dimensional code to be produced is obtained; then, segmenting the base map of the three-dimensional code to be manufactured to generate a plurality of segmentation areas; then, calculating the average brightness of each segmentation region, and calculating the average brightness, the highest brightness and the lowest brightness of the base map of the three-dimensional code to be manufactured according to the average brightness of each segmentation region; then, generating adjustable parameters according to the average brightness of the base image of the three-dimensional code to be manufactured; then, code point attribute information of the three-dimensional code to be manufactured is obtained, wherein the code point attribute information comprises code point positions, code point colors, code point sizes and code point shapes; then, obtaining the average brightness of the corresponding segmentation region according to the position of the code point; and then, calculating the transparency of the code points according to the average brightness of the corresponding segmentation region, the average brightness of the base image of the three-dimensional code to be manufactured, the highest brightness and the lowest brightness, and adjusting the brightness of the code points according to the average brightness of the corresponding segmentation region of the code points, the average brightness of the base image of the three-dimensional code to be manufactured, the highest brightness and the lowest brightness, so as to further improve the improvement degree of the visual effect of the finally manufactured three-dimensional code after the code points are adjusted.
In some embodiments, in order to further improve the visual effect of the finally manufactured three-dimensional code, in the optimization method for the three-dimensional code provided by the embodiments of the present invention, the transparency of the code point is further adjusted according to the coverage area of the code point, as shown in fig. 4, the optimization method for the three-dimensional code further includes:
s301, calculating the coverage area of each code point according to the size and the shape of each code point in the three-dimensional code to be manufactured.
That is, the calculation of the coverage area of each code point is performed according to the size and shape of each code point in the three-dimensional code to be produced.
It can be understood that, in order to simplify the selection of the user, when the size and the shape of the code point selected by the user are obtained, the size of the circular code point or the square code point may be selected only by a length index, and when the diameter of the circular code point is equal to the side length of the square code point, the coverage areas of the code points corresponding to the circular code point and the square code point are different, so that the coverage area needs to be calculated according to the size and the shape of the code point; or, when the shapes of the partial code points are uniform and are the circular code points which can not be adjusted by the user, the calculation of the coverage area is only needed to be carried out according to the fixed code point shapes and the code point size selected by the user.
S302, calculating the ratio of the coverage area of each code point to a preset code point area reference value, and adjusting the brightness of the corresponding code point according to the ratio.
That is, the reference value of the area of the code point is preset, the ratio between the area of the code point and the reference value of the area of the code point is calculated according to the coverage area of each code point and the preset reference value of the area of the code point, and further, the transparency of the corresponding code point is adjusted according to the calculated ratio, so that the incidence relation between the area of the code point and the brightness of the code point is established, and the visual influence caused by the fact that the base map of the three-dimensional code is to be manufactured due to overlarge coverage area of the code point is prevented on the premise that the code point can be correctly identified.
In summary, according to the optimization method of the three-dimensional code of the embodiment of the present invention, firstly, the coverage area of each code point is calculated according to the size and shape of each code point in the three-dimensional code to be produced; then, calculating the ratio of the coverage area of each code point to a preset code point area reference value, and adjusting the brightness of the corresponding code point according to the ratio; therefore, on the premise of ensuring correct identification, the visual influence on the base graph of the three-dimensional code to be manufactured due to overlarge code point coverage area is prevented.
In order to implement the foregoing embodiments, an embodiment of the present invention further provides a computer-readable storage medium, on which a code point adjusting program is stored, and the code point adjusting program, when executed by a processor, implements the three-dimensional code optimization method as described above.
In order to implement the foregoing embodiments, an embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor executes the computer program to implement the three-dimensional code optimization method as described above.
In order to implement the foregoing embodiment, an embodiment of the present invention further provides an optimization apparatus for a three-dimensional code, as shown in fig. 5, the optimization apparatus for a three-dimensional code includes: a first acquisition module 10, a calculation module 20, a second acquisition module 30 and an adjustment module 40.
The first obtaining module 10 is configured to obtain a base map of a three-dimensional code to be produced.
The calculation module 20 is used for calculating the brightness information of the base map of the three-dimensional code to be made.
The second obtaining module 30 is configured to obtain code point attribute information of the three-dimensional code to be generated.
The adjusting module 40 is configured to perform transparency adjustment on the code points in the three-dimensional code to be created according to the code point attribute information and the brightness information of the base map of the three-dimensional code to be created.
That is to say, the first obtaining module 10 obtains the base map of the three-dimensional code to be produced, so that the calculating module 20 calculates the corresponding brightness information according to the base map of the three-dimensional code to be produced, which is obtained by the first obtaining module 10; the second obtaining module 30 obtains the code point attribute information of the three-dimensional code to be produced, so that the adjusting module 40 adjusts the brightness of the code point in the three-dimensional code to be produced according to the code point attribute information and the brightness information of the base map of the three-dimensional code to be produced.
It should be noted that the description in the three-dimensional code optimization method in fig. 1 is also applicable to the three-dimensional code optimization apparatus, and is not repeated herein.
In summary, according to the apparatus for optimizing a three-dimensional code according to the embodiment of the present invention, the first obtaining module obtains the base map of the three-dimensional code to be created, and after obtaining the base map of the three-dimensional code to be created, the calculating module calculates luminance information of the base map of the three-dimensional code to be created, and the second obtaining module obtains code point attribute information of the three-dimensional code to be created, so that the adjusting module adjusts luminance of the code points in the three-dimensional code to be created according to the code point attribute information and the luminance information of the base map of the three-dimensional code to be created; therefore, on the premise of not influencing the code scanning performance of the finally generated three-dimensional code, the brightness of the code points is adjusted, and the visual perception effect of the finally generated three-dimensional code is improved.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.
In the description of the present invention, it is to be understood that the terms "first", "second" and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise.
In the present invention, unless otherwise expressly stated or limited, the terms "mounted," "connected," "secured," and the like are to be construed broadly and can, for example, be fixedly connected, detachably connected, or integrally formed; can be mechanically or electrically connected; either directly or indirectly through intervening media, either internally or in any other relationship. The specific meanings of the above terms in the present invention can be understood by those skilled in the art according to specific situations.
In the present invention, unless otherwise expressly stated or limited, the first feature "on" or "under" the second feature may be directly contacting the first and second features or indirectly contacting the first and second features through an intermediate. Also, a first feature "on," "over," and "above" a second feature may be directly or diagonally above the second feature, or may simply indicate that the first feature is at a higher level than the second feature. A first feature being "under," "below," and "beneath" a second feature may be directly under or obliquely under the first feature, or may simply mean that the first feature is at a lesser elevation than the second feature.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above should not be understood to necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (8)

1. A three-dimensional code optimization method is characterized by comprising the following steps:
obtaining a base map of a three-dimensional code to be manufactured;
calculating the brightness information of the base map of the three-dimensional code to be manufactured;
acquiring code point attribute information of the three-dimensional code to be manufactured, and adjusting the brightness of the code points in the three-dimensional code to be manufactured according to the code point attribute information and the brightness information of the base map of the three-dimensional code to be manufactured;
calculating the brightness information of the base map of the three-dimensional code to be manufactured, wherein the brightness information comprises the following steps:
segmenting the base map of the three-dimensional code to be manufactured to generate a plurality of segmentation areas;
calculating the average brightness of each segmentation region, and calculating the average brightness, the highest brightness and the lowest brightness of the base map of the three-dimensional code to be manufactured according to the average brightness of each segmentation region;
the code point attribute information comprises code point positions, code point colors, code point sizes and code point shapes, wherein the brightness of the code points in the three-dimensional code to be manufactured is adjusted according to the code point attribute information and the brightness information of the base map of the three-dimensional code to be manufactured, and the method comprises the following steps:
acquiring the average brightness of the corresponding segmentation region according to the code point position;
and calculating the code point transparency according to the average brightness of the corresponding segmentation region, the average brightness of the base map of the three-dimensional code to be manufactured, the highest brightness and the lowest brightness, and adjusting the brightness of the code points of the corresponding segmentation region according to the code point transparency.
2. The method for optimizing three-dimensional code according to claim 1, further comprising, after calculating the luminance information of the base map of the three-dimensional code to be produced:
and generating an adjustable parameter according to the average brightness of the base map of the three-dimensional code to be manufactured, so as to calculate the code point transparency according to the adjustable parameter, the average brightness of the corresponding segmentation region, the average brightness, the highest brightness and the lowest brightness of the base map of the three-dimensional code to be manufactured, wherein the adjustable parameter comprises adjustable highest transparency and adjustable lowest transparency.
3. The method for optimizing three-dimensional code according to claim 2, wherein when the code dot color is black, the transparency of the black code dot is calculated by the following formula:
M1=100-([(Zp1-Ds)×(Th-Ts)÷(Dh-Ds)]+Ts)
wherein M is1Indicating the transparency of the black code dot, Zp1Representing the average brightness, D, of the corresponding sliced region of the black code pointsMinimum brightness, T, of a base map representing the three-dimensional code to be producedhIndicating the adjustable maximum transparency, TsIndicating an adjustable minimum transparency, DhAnd representing the highest brightness of the base map of the three-dimensional code to be produced.
4. The method for optimizing three-dimensional code according to claim 2, wherein when the code point color is white, the transparency of the white code point is calculated by the following formula:
M2=([(Zp2-Ds)×(Th-Ts)÷(Dh-Ds)]+Ts)
M2indicating the transparency of the white code dot, Zp2Representing the average brightness of the corresponding segmented region of the white code point, DsMinimum brightness, T, of a base map representing the three-dimensional code to be producedhIndicating the adjustable maximum transparency, TsIndicating an adjustable minimum transparency, DhAnd representing the highest brightness of the base map of the three-dimensional code to be made.
5. The method for optimizing three-dimensional code according to any one of claims 1 to 4, further comprising:
calculating the coverage area of each code point according to the size and the shape of each code point in the three-dimensional code to be manufactured;
and calculating the ratio of the coverage area of each code point to a preset code point area reference value, and adjusting the brightness of the corresponding code point according to the ratio.
6. A computer-readable storage medium, having stored thereon a code point adjustment program which, when executed by a processor, implements the optimization method of a three-dimensional code according to any one of claims 1 to 5.
7. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor, when executing the program, implements the method of optimizing three-dimensional code according to any one of claims 1-5.
8. An apparatus for optimizing a three-dimensional code, comprising:
the first acquisition module is used for acquiring a base map of the three-dimensional code to be manufactured;
the calculation module is used for calculating the brightness information of the base map of the three-dimensional code to be manufactured;
the second acquisition module is used for acquiring the code point attribute information of the three-dimensional code to be manufactured;
the adjusting module is used for adjusting the brightness of the code points in the three-dimensional code to be manufactured according to the code point attribute information and the brightness information of the base map of the three-dimensional code to be manufactured;
calculating the brightness information of the base map of the three-dimensional code to be manufactured, wherein the brightness information comprises the following steps:
segmenting the base map of the three-dimensional code to be manufactured to generate a plurality of segmentation areas;
calculating the average brightness of each segmentation region, and calculating the average brightness, the highest brightness and the lowest brightness of the base map of the three-dimensional code to be manufactured according to the average brightness of each segmentation region;
the code point attribute information comprises code point positions, code point colors, code point sizes and code point shapes, wherein the brightness of the code points in the three-dimensional code to be manufactured is adjusted according to the code point attribute information and the brightness information of the base map of the three-dimensional code to be manufactured, and the method comprises the following steps:
acquiring the average brightness of the corresponding segmentation region according to the code point position;
and calculating the code point transparency according to the average brightness of the corresponding segmentation region, the average brightness of the base map of the three-dimensional code to be manufactured, the highest brightness and the lowest brightness, and adjusting the brightness of the code points of the corresponding segmentation region according to the code point transparency.
CN201910294747.5A 2019-04-12 2019-04-12 Three-dimensional code optimization method, medium, computer device and apparatus Active CN110009082B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910294747.5A CN110009082B (en) 2019-04-12 2019-04-12 Three-dimensional code optimization method, medium, computer device and apparatus

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910294747.5A CN110009082B (en) 2019-04-12 2019-04-12 Three-dimensional code optimization method, medium, computer device and apparatus

Publications (2)

Publication Number Publication Date
CN110009082A CN110009082A (en) 2019-07-12
CN110009082B true CN110009082B (en) 2022-07-05

Family

ID=67171442

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910294747.5A Active CN110009082B (en) 2019-04-12 2019-04-12 Three-dimensional code optimization method, medium, computer device and apparatus

Country Status (1)

Country Link
CN (1) CN110009082B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110569943B (en) * 2019-08-08 2022-07-01 三维码(厦门)网络科技有限公司 Optimization method and system based on three-dimensional code

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105976006A (en) * 2016-05-04 2016-09-28 郝迎喜 QR code and QR code recognizer based on same
CN106991462A (en) * 2017-03-13 2017-07-28 三维码(厦门)网络科技有限公司 Three-dimensional code generating method
CN108062781A (en) * 2018-01-31 2018-05-22 深圳市裕同包装科技股份有限公司 A kind of system and method for visual code Mass production
CN109325570A (en) * 2018-09-18 2019-02-12 苏州广立信息技术有限公司 The generation method of dot matrix three-dimension code intelligence doorplate

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10102463B2 (en) * 2015-01-13 2018-10-16 A.T Communications Co., Ltd. Two-dimensional code generation device, two-dimensional code generation method, and non-transitory computer-readable recording medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105976006A (en) * 2016-05-04 2016-09-28 郝迎喜 QR code and QR code recognizer based on same
CN106991462A (en) * 2017-03-13 2017-07-28 三维码(厦门)网络科技有限公司 Three-dimensional code generating method
CN108062781A (en) * 2018-01-31 2018-05-22 深圳市裕同包装科技股份有限公司 A kind of system and method for visual code Mass production
CN109325570A (en) * 2018-09-18 2019-02-12 苏州广立信息技术有限公司 The generation method of dot matrix three-dimension code intelligence doorplate

Also Published As

Publication number Publication date
CN110009082A (en) 2019-07-12

Similar Documents

Publication Publication Date Title
CN108876743B (en) Image rapid defogging method, system, terminal and storage medium
US10755153B2 (en) Method of generating 3-dimensional code based on gaussian modulating function
CN103778900B (en) A kind of image processing method and system
CN103778599B (en) A kind of image processing method and system
CN104517110A (en) Binarization method and system of two-dimensional code image
US20140348428A1 (en) Dynamic range-adjustment apparatuses and methods
CN104899629B (en) A kind of image in 2 D code generation method based on RBF
WO2010050412A1 (en) Calibration index determination device, calibration device, calibration performance evaluation device, system, method, and program
JP5859749B2 (en) Contrast improvement method using Bezier curve
CN110009082B (en) Three-dimensional code optimization method, medium, computer device and apparatus
CN111127337A (en) Image local area highlight adjusting method, medium, equipment and device
CN105338214A (en) Image processing method and image processing device
CN113989127A (en) Image contrast adjusting method, system, equipment and computer storage medium
CN111311720B (en) Texture image processing method and device
CN105139345B (en) A kind of automatic search method of high-quality non-standard gamma curve
CN111462278B (en) Depth-based material sequencing rendering method, medium, equipment and device
CN111311724A (en) Shadow adding method, medium, device and apparatus for 3D characters
CN115880181A (en) Method, device and terminal for enhancing image contrast
CN112634169B (en) Remote sensing image color homogenizing method and device
CN114972702A (en) Sampling method and storage medium for industrial image target detection image training set
CN112700526B (en) Concave-convex material image rendering method and device
JP7262032B2 (en) Image processing device
CN111639660B (en) Image training method, device, equipment and medium based on convolution network
WO2024011756A1 (en) Image acquisition parameter adjustment method and system, electronic device, and storage medium
CN108122241B (en) Image binarization processing device and method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
CB03 Change of inventor or designer information
CB03 Change of inventor or designer information

Inventor after: Chen Shengxu

Inventor after: Lin Hong

Inventor after: Ma Jiliang

Inventor before: Lin Hong

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant