CN110751251B - Method and device for generating and transforming two-dimensional code image matrix - Google Patents

Method and device for generating and transforming two-dimensional code image matrix Download PDF

Info

Publication number
CN110751251B
CN110751251B CN201910985270.5A CN201910985270A CN110751251B CN 110751251 B CN110751251 B CN 110751251B CN 201910985270 A CN201910985270 A CN 201910985270A CN 110751251 B CN110751251 B CN 110751251B
Authority
CN
China
Prior art keywords
dimensional code
code image
matrix
image matrix
shaped
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
CN201910985270.5A
Other languages
Chinese (zh)
Other versions
CN110751251A (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.)
Shanghai Zhangmen Science and Technology Co Ltd
Original Assignee
Shanghai Zhangmen Science and 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 Shanghai Zhangmen Science and Technology Co Ltd filed Critical Shanghai Zhangmen Science and Technology Co Ltd
Priority to CN201910985270.5A priority Critical patent/CN110751251B/en
Publication of CN110751251A publication Critical patent/CN110751251A/en
Application granted granted Critical
Publication of CN110751251B publication Critical patent/CN110751251B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • 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
    • 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/06046Constructional details
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/18Image warping, e.g. rearranging pixels individually

Landscapes

  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the disclosure discloses a method and a device for generating and transforming a two-dimensional code image matrix. One embodiment of the method comprises the following steps: performing first matrix operation by using a target deformation matrix corresponding to the target shape and an original two-dimensional code image matrix to generate a first special-shaped two-dimensional code image matrix; converting the target deformation matrix into a data stream; and generating a second special-shaped two-dimensional code image matrix according to the data stream and the first special-shaped two-dimensional code image matrix. The embodiment realizes personalized customized two-dimensional code image generation and improves user experience.

Description

Method and device for generating and transforming two-dimensional code image matrix
Technical Field
The embodiment of the disclosure relates to the technical field of computers, in particular to a method and a device for generating a two-dimensional code image matrix and transforming the two-dimensional code image matrix.
Background
Two-dimensional codes are widely used as carriers of information in various fields of the mobile internet, social contact, payment and other scenes, and the application of the two-dimensional codes can be seen. The conventional two-dimensional code is limited by the coding format, and is often a square pattern with a single shape. However, in order to meet the demands of people for information presentation, people want to have more personalized and no longer uniformly present information presentation modes. For this reason, a special-shaped two-dimensional code different from a square appears at present. In view of the complexity of the special-shaped two-dimensional codes, each special-shaped two-dimensional code can be generated only by manual and independent design.
Disclosure of Invention
This summary is provided to introduce a selection of concepts in a simplified form that are further described below in the detailed description. This summary is not intended to identify key features or essential features of the claimed subject matter, nor is it intended to be used to limit the scope of the claimed subject matter.
Some embodiments of the present disclosure propose a method and apparatus for generating and transforming a two-dimensional code image matrix to solve the technical problems mentioned in the background section above.
In a first aspect, some embodiments of the present disclosure provide a method for generating a two-dimensional code image matrix, the method comprising: performing first matrix operation by using a target deformation matrix corresponding to the target shape and an original two-dimensional code image matrix to generate a first special-shaped two-dimensional code image matrix; converting the target deformation matrix into a data stream, wherein the data stream can be restored into the target deformation matrix; generating a second special-shaped two-dimensional code image matrix according to the data stream and the first special-shaped two-dimensional code image matrix, wherein the outline shape of the second special-shaped two-dimensional code image matrix when in use is matched with the target shape, and the second special-shaped two-dimensional code image matrix contains the data stream.
In a second aspect, some embodiments of the present disclosure provide a method for transforming a two-dimensional code image matrix, the method comprising: extracting a data stream from the color components of the second special-shaped two-dimensional code image matrix; carrying out matrixing treatment on the data stream to obtain a target deformation matrix; extracting gray components of the second special-shaped two-dimensional code image matrix to obtain a first special-shaped two-dimensional code image matrix; and performing a second matrix operation on the first special-shaped two-dimensional code image matrix by using the target deformation matrix to obtain an original two-dimensional code image matrix.
In a third aspect, some embodiments of the present disclosure provide an apparatus for generating a two-dimensional code image matrix, the apparatus comprising: the first generation unit is configured to perform first matrix operation by utilizing a target deformation matrix corresponding to the target shape and an original two-dimensional code image matrix to generate a first special-shaped two-dimensional code image matrix; a conversion unit configured to convert a target deformation matrix into a data stream, wherein the data stream can be restored to the target deformation matrix; the second generation unit is configured to generate a second special-shaped two-dimensional code image matrix according to the data stream and the first special-shaped two-dimensional code image matrix, wherein the outline shape of the second special-shaped two-dimensional code image matrix when being displayed is matched with the target shape, and the second special-shaped two-dimensional code image matrix comprises the data stream.
In a fourth aspect, some embodiments of the present disclosure provide an apparatus for transforming a two-dimensional code image matrix, the apparatus including: the first extraction unit is configured to extract a data stream from the color components of the second special-shaped two-dimensional code image matrix; the processing unit is configured to matrix the data stream to obtain a target deformation matrix; the second extraction unit is configured to extract gray components of the second special-shaped two-dimensional code image matrix to obtain a first special-shaped two-dimensional code image matrix; the operation unit is configured to perform second matrix operation on the first special-shaped two-dimensional code image matrix by utilizing the target deformation matrix to obtain an original two-dimensional code image matrix.
In a fifth aspect, an embodiment of the present application provides an electronic device, including: one or more processors; a storage means for storing one or more programs; the one or more programs, when executed by the one or more processors, cause the one or more processors to implement the method as described in any of the implementations of the first aspect or to implement the method as described in any of the implementations of the second aspect.
In a sixth aspect, embodiments of the present application provide a computer readable medium having stored thereon a computer program which, when executed by a processor, implements a method as described in any of the implementations of the first aspect or implements a method as described in any of the implementations of the second aspect.
One of the above embodiments of the present disclosure has the following advantageous effects: and generating a first special-shaped two-dimensional code image matrix by using the target deformation matrix and the original two-dimensional code image matrix, converting the target deformation matrix into a data stream, and finally generating a second special-shaped two-dimensional code image matrix. Because the second special-shaped two-dimensional code image matrix is matched with the target shape, the two-dimensional code image generated by each user is more personalized, and special-shaped two-dimensional codes of various contour patterns can be generated without independently designing each special-shaped two-dimensional code; in addition, the generated special-shaped two-dimensional code can be embedded into other images according to the needs, so that the fusion effect of the two-dimensional code image and the other images is more natural. The user does not read the single-shape two-dimensional code any more, so that the user experience is improved.
One of the above embodiments of the present disclosure has the following advantageous effects: firstly extracting a data stream, then carrying out matrixing treatment on the data stream to obtain a target deformation matrix, then extracting gray components of a second special-shaped two-dimensional code image matrix to obtain a first special-shaped two-dimensional code image matrix, and finally carrying out operation on the first special-shaped two-dimensional code image matrix to obtain an original two-dimensional code image matrix. Therefore, the special-shaped two-dimensional codes with different contour patterns can be analyzed.
Drawings
The above and other features, advantages, and aspects of embodiments of the present disclosure will become more apparent by reference to the following detailed description when taken in conjunction with the accompanying drawings. The same or similar reference numbers will be used throughout the drawings to refer to the same or like elements. It should be understood that the figures are schematic and that elements and components are not necessarily drawn to scale.
FIG. 1 is a schematic illustration of one application scenario of a method for generating a two-dimensional code image matrix according to some embodiments of the present disclosure;
FIG. 2 is a flow chart of some embodiments of a method of generating a two-dimensional code image matrix according to the present disclosure;
FIG. 3 is a flow chart of some embodiments of a method of transforming a two-dimensional code image matrix according to the present disclosure;
FIG. 4 is a schematic structural diagram of some embodiments of an apparatus for generating a two-dimensional code image matrix according to the present disclosure;
FIG. 5 is a schematic structural diagram of some embodiments of an apparatus for transforming a two-dimensional code image matrix according to the present disclosure;
fig. 6 is a schematic structural diagram of an electronic device suitable for use in implementing some embodiments of the present disclosure.
Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings. Embodiments of the present disclosure and features of embodiments may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in this disclosure are merely used to distinguish between different devices, modules, or units and are not used to define an order or interdependence of functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 is a schematic diagram of one application scenario of a method for forming a two-dimensional code image matrix according to some embodiments of the present disclosure.
As shown in fig. 1, in the application scenario of fig. 1, the server 101 may perform a first matrix operation on the target deformation matrix 102 and the original two-dimensional code image matrix 103, to generate a first special-shaped two-dimensional code image matrix 104. The server 101 may convert the target deformation matrix 102 into a data stream 105. Here, the step of generating the first irregular two-dimensional code image matrix 104 and the step of converting the target deformation matrix 102 into the data stream 105 may be performed simultaneously, regardless of the order. Finally, the server 101 generates a second special-shaped two-dimensional code image matrix 106 according to the first special-shaped two-dimensional code image matrix 104 and the data stream 105.
It is understood that the method for forming the two-dimensional code image matrix may be performed by a terminal device, or may be performed by a server (e.g., the server 101 shown in fig. 1), or may be performed by various software programs. The terminal device may be, among other things, various electronic devices with information processing capabilities including, but not limited to, smartphones, tablet computers, electronic book readers, laptop and desktop computers, and the like. Further, when the execution subject is software, it may be installed in the above-listed electronic device. It may be implemented as a plurality of software or software modules, for example, for providing distributed services, or as a single software or software module. The present invention is not particularly limited herein.
It should be understood that the number of servers in fig. 1 is merely illustrative. There may be any number of servers, as desired for implementation.
With continued reference to fig. 2, a flow 200 of some embodiments of a method of generating a two-dimensional code image matrix according to the present disclosure is shown. The method for generating the two-dimensional code image matrix comprises the following steps of:
and step 201, performing a first matrix operation by using a target deformation matrix corresponding to the target shape and an original two-dimensional code image matrix, and generating a first special-shaped two-dimensional code image matrix.
In some embodiments, the execution subject of the method for generating a two-dimensional code image matrix (e.g., the server 101 shown in fig. 1; e.g., the aforementioned terminal device; e.g., software installed in the server and the terminal device) may perform a first matrix operation with the original two-dimensional code image matrix by using the target deformation matrix, so as to generate a first special-shaped two-dimensional code image matrix. Herein, the image matrix generally refers to data used by a computer to express an image. The image is a presentation result seen by the user. In some cases, the image matrix and the image may be considered as essentially identical objects. After the image is converted into a matrix form, the digital image can be analyzed and processed by adopting matrix theory and matrix algorithm.
The target shape described above may generally be a shape or shape profile that is provided or specified by a user. The target deformation matrix generally refers to a matrix form of an image formed by the target shape or a matrix form of an image formed by an outline of the target shape, for example, a matrix obtained by processing such as binarization.
The first matrix operation generally refers to matrix mathematical operation performed on the target deformation matrix and the original two-dimensional code image matrix; in some embodiments, to ensure that matrix mathematical operations (e.g., multiplication operations) are performed, larger matrices may be partitioned or transformed.
In some optional implementations of some embodiments, the original two-dimensional code image matrix is obtained by encoding target information. Conventional two-dimensional code generation methods, such as encoding information into square two-dimensional code images, are well known to those skilled in the art and will not be described herein. The target information is information that needs to be encoded to generate a two-dimensional code image matrix, for example, information such as text and picture.
Step 202, converting the target deformation matrix into a data stream.
In some embodiments, the execution body may convert the target deformation matrix into a data stream (data stream). Wherein the data stream can be restored to the target deformation matrix. The data stream is generally referred to herein as a set of ordered data sequences having bytes with a start point and an end point. Here, the above data stream generally refers to a one-dimensional data stream. The execution body may transform the target deformation matrix into a data stream in a data transformation manner.
In some optional implementations of some embodiments, the execution body may convert the target deformation matrix into an initial data stream. And error correction encoding (e.g., turbo code, etc.) is performed on the initial data stream to generate the data stream. Here, a data stream more resistant to noise and loss of information can be obtained after error correction encoding.
It should be noted that there is no sequence between the step 201 and the step 202; step 201 may be performed before or after step 202, or step 201 may be performed concurrently with step 202.
And 203, generating a second special-shaped two-dimensional code image matrix according to the data stream and the first special-shaped two-dimensional code image matrix.
In some embodiments, the executing body may generate the second irregular two-dimensional code image matrix according to the data stream and the first irregular two-dimensional code image matrix. The outline shape of the second special-shaped two-dimensional code image matrix when being displayed matches the target shape, and the second special-shaped two-dimensional code image matrix comprises the data stream. As an example, the execution subject may append the data stream to the first irregular two-dimensional code image matrix to generate a second irregular two-dimensional code image matrix.
In some embodiments, the visual effects of the first irregular two-dimensional code image matrix and the second irregular two-dimensional code image matrix may be similar when displayed. In some embodiments, the process of adding the data stream to the first shaped two-dimensional code image matrix is a data transformation of a frequency domain angle (for example, the data stream is used to replace partial data of a middle-high frequency region of the first shaped two-dimensional code image matrix when the first shaped two-dimensional code image matrix is changed into the frequency domain matrix), so that the influence on the visual effect is less.
In some optional implementations of some embodiments, the executing body may add the data stream to a color component of the first irregular two-dimensional code image matrix to obtain the second irregular two-dimensional code image matrix.
Here, the execution body may further append a data stream to the color component of the first irregular two-dimensional code image matrix by a discrete cosine transform (DCT, discrete Cosine Transform), a wavelet transform (WT, wavelet transform), or the like. Discrete cosine transform generally refers to a transform related to fourier transform, which is similar to discrete fourier transform (DFT, discrete Fourier Transform).
The color components described above generally refer to gray-scale color components (for example, a numerical range of 0 to 255) in a gray-scale image when the gray-scale image is represented by a two-dimensional array, or three color components of RGB when a color RGB image is represented by a three-dimensional array. The range of values is also 0 to 255 for each color component. The above gray scale image generally refers to an image having only one sampling color per pixel. Such images are typically displayed in gray scale from darkest black to brightest white. When the gradation is expressed by one bit, it is displayed as black and white.
In some optional implementations of some embodiments, the executing body may convert the first irregular two-dimensional code image matrix from a grayscale image matrix to a color image matrix. And then the data stream can be added into the color components of the color image matrix to generate the second special-shaped two-dimensional code image matrix.
As an example, the execution subject may convert the first special-shaped two-dimensional code image matrix into a color image matrix by a "gray level-color conversion method".
In some optional implementations of some embodiments, the execution body may further display a shape selection interface; in response to detecting a user selection operation for at least one target shape on the shape selection interface, a deformation matrix corresponding to the selected target shape is acquired as the target deformation matrix.
Here, the shape selection interface may be an interface composed of at least one shape or shape profile selection schematic. The user selection operation generally refers to a user selection operation of one shape or shape profile among at least one shape or shape profile in the interface. The deformation matrix corresponding to the shape may be a matrix generated in advance according to the shape, or may be a matrix generated in response to a user selection operation.
In some optional implementations of some embodiments, the execution body may further obtain the target shape provided by the user. And generating a corresponding deformation matrix as a target deformation matrix according to the target shape.
As an example, the user-provided target shape may be a regular or irregular shape drawn by the user. The execution body may convert the above-described regular or irregular shaped image into a matrix to obtain a target deformation matrix.
In some optional implementations of some embodiments, the executing entity may further obtain an area specified by the user in the first target image matrix. And determining the target shape according to the specified area.
Here, the first target image matrix refers to a matrix form of an image selected by the user, and may be, for example, a matrix form of a background picture or poster to which the user needs to add the second special-shaped two-dimensional code image. The designated area may be at least one area selected from a plurality of selectable areas in the first target image matrix, or may be manually defined by a user by operating the first target image matrix. As an example, the user may manually define an area directly by an operation and then determine the target shape by analyzing the contour boundary in the area.
In some optional implementations of some embodiments, the executing body may further add the second irregular two-dimensional code image matrix to a first target image matrix, to obtain a second target image matrix including the second irregular two-dimensional code image matrix. The second target image represented by the second target image matrix contains an area matched with the target shape, and the area contains a second special-shaped two-dimensional code image represented by the second special-shaped two-dimensional code image matrix. Here, the second target image generally refers to an image to which a second irregular two-dimensional code image is added. For example, a poster, a background picture, or the like to which the second special-shaped two-dimensional code image is added.
According to the method for generating the two-dimensional code image matrix disclosed by some embodiments of the present disclosure, a target deformation matrix and an original two-dimensional code image matrix are utilized to generate a first special-shaped two-dimensional code image matrix, the target deformation matrix is converted into a data stream, and finally a second special-shaped two-dimensional code image matrix is generated. Thus, the method and the device can generate the customized two-dimensional code image matrix for the user based on the requirement of the user. And the abrupt sense of the two-dimensional code in the integrated background is reduced. Because the second special-shaped two-dimensional code image matrix is matched with the target shape, the two-dimensional code image generated based on different target shapes can be more personalized, and the more personalized two-dimensional code image can be automatically generated by the device based on the target shape determined by the user without manual independent manufacturing. The two-dimensional code image display method is enriched.
With further reference to FIG. 3, a flow 300 of some embodiments of a method of transforming a two-dimensional code image matrix is shown. The process 300 of the method for transforming the two-dimensional code image matrix comprises the following steps:
step 301, extracting a data stream from the color components of the second irregular two-dimensional code image matrix.
In some embodiments, the execution body of the method of transforming the two-dimensional code image matrix (e.g. the server shown in fig. 1; e.g. the aforementioned terminal device; e.g. the software installed in the server and the terminal device) may extract the data stream from the color components of the second special-shaped two-dimensional code image matrix. The extraction of the data stream may be performed by extracting the data stream from the color component using a discrete cosine transform, a wavelet transform, or a related transform thereof.
And 302, matrixing the data stream to obtain a target deformation matrix.
In some embodiments, the execution body may matrix the data stream extracted in step 301 to obtain the target deformation matrix.
In some alternative implementations of some embodiments, the execution body may decode the data stream to obtain an initial data stream. The execution body may then matrix the initial data stream to obtain a target deformation matrix. The initial data stream generally refers to a decoded data stream. The matrixing process generally refers to a process that an executing body processes a data stream in a data transformation manner to obtain a target deformation matrix.
And 303, extracting gray components of the second special-shaped two-dimensional code image matrix to obtain a first special-shaped two-dimensional code image matrix.
In some embodiments, the executing body may obtain the first irregular two-dimensional code image matrix from the gray component of the second irregular two-dimensional code image matrix.
And step 304, performing a second matrix operation on the first special-shaped two-dimensional code image matrix by using the target deformation matrix to obtain an original two-dimensional code image matrix.
In some embodiments, the execution body may perform a second matrix operation on the target deformation matrix and the first irregular two-dimensional code image matrix to obtain an original two-dimensional code image matrix. Here, the second matrix operation may be an inverse operation of the first matrix operation.
In some optional implementations of some embodiments, the executing body may further parse the original two-dimensional code image matrix to obtain target information.
In some optional implementations of some embodiments, the second irregular two-dimensional code image matrix may be obtained by scanning a second target image by the execution subject; the second special-shaped two-dimensional code image matrix provided by the execution subject and obtained after the other subjects scan the second target image can also be obtained by the execution subject.
In some optional implementations of some embodiments, the second special-shaped two-dimensional code image matrix is generated according to the method of step 201-step 203.
According to the method for generating the two-dimensional code image matrix disclosed by some embodiments of the present disclosure, a data stream is extracted, then the data stream is subjected to matrixing processing to obtain a target deformation matrix, gray components of a second special-shaped two-dimensional code image matrix are extracted to obtain a first special-shaped two-dimensional code image matrix, and finally the first special-shaped two-dimensional code image matrix is operated to obtain an original two-dimensional code image matrix. Therefore, the special-shaped two-dimensional codes with different contour patterns can be analyzed.
With further reference to fig. 4, as an implementation of the method shown in the foregoing figures, the present disclosure provides some embodiments of an apparatus for generating a two-dimensional code image matrix, where the apparatus embodiments correspond to those method embodiments shown in fig. 2, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 4, an apparatus 400 for generating a two-dimensional code image matrix according to some embodiments includes: a first generation unit 401, a conversion unit 402, and a second generation unit 403. The first generating unit 401 is configured to perform a first matrix operation with the target deformation matrix corresponding to the target shape and the original two-dimensional code image matrix, so as to generate a first special-shaped two-dimensional code image matrix. A transformation unit 402 configured to transform the target deformation matrix into a data stream, wherein the data stream can be restored to the target deformation matrix. And a second generating unit 403 configured to generate a second irregular two-dimensional code image matrix according to the data stream and the first irregular two-dimensional code image matrix, wherein the outline shape of the second irregular two-dimensional code image matrix when the second irregular two-dimensional code image matrix is presented matches the target shape, and the second irregular two-dimensional code image matrix includes the data stream.
In an optional implementation manner of some embodiments, the original two-dimensional code image matrix is obtained by encoding target information.
In an alternative implementation of some embodiments, the conversion unit 402 of the apparatus 400 for generating a two-dimensional code image matrix is further configured to: converting the target deformation matrix into an initial data stream; and performing error correction coding on the initial data stream to generate the data stream.
In an alternative implementation of some embodiments, the second generating unit 403 of the apparatus 400 for generating a two-dimensional code image matrix is further configured to: and adding the data stream into the color component of the first special-shaped two-dimensional code image matrix to obtain the second special-shaped two-dimensional code image matrix.
In an alternative implementation manner of some embodiments, the apparatus 400 for generating a two-dimensional code image matrix further includes: a color conversion unit configured to convert the first irregular two-dimensional code image matrix from a gray image matrix to a color image matrix; and adding the data stream into the color components of the color image matrix to generate the second special-shaped two-dimensional code image matrix.
In an alternative implementation manner of some embodiments, the apparatus 400 for generating a two-dimensional code image matrix further includes: a display unit configured to display a shape selection interface; in response to detecting a user selection operation for at least one target shape on the shape selection interface, a deformation matrix corresponding to the selected target shape is acquired as the target deformation matrix.
In an alternative implementation manner of some embodiments, the apparatus 400 for generating a two-dimensional code image matrix further includes: a target shape unit configured to acquire the target shape provided by the user; and generating a corresponding deformation matrix as a target deformation matrix according to the target shape.
In an alternative implementation manner of some embodiments, the apparatus 400 for generating a two-dimensional code image matrix further includes: a user-designated area acquisition unit configured to acquire an area designated by the user in the first target image matrix; and determining the target shape according to the specified area.
In an alternative implementation manner of some embodiments, the apparatus 400 for generating a two-dimensional code image matrix further includes: the adding unit is configured to add the second special-shaped two-dimensional code image matrix into the first target image matrix to obtain a second target image matrix containing the second special-shaped two-dimensional code image matrix; the second target image represented by the second target image matrix contains an area matched with the target shape, and the area contains a second special-shaped two-dimensional code image represented by the second special-shaped two-dimensional code image matrix.
According to the device for generating the two-dimensional code image matrix disclosed by some embodiments of the application, the target deformation matrix and the original two-dimensional code image matrix are utilized to generate the first special-shaped two-dimensional code image matrix, the target deformation matrix is converted into a data stream, and finally the second special-shaped two-dimensional code image matrix is generated. Therefore, the customized two-dimensional code image matrix can be generated for the user based on the requirement of the user, the difficult problems of information display and background fitting of the user are solved, because the second special-shaped two-dimensional code image matrix is matched with the target shape, the two-dimensional code image generated by each user is more personalized, and special-shaped two-dimensional codes of various contour patterns can be generated without independently designing each special-shaped two-dimensional code; in addition, the generated special-shaped two-dimensional code can be embedded into other images according to the needs, so that the fusion effect of the two-dimensional code image and the other images is more natural. The user does not read the two-dimensional code with the single shape any more, so that the user experience is improved, and the mode of displaying the two-dimensional code image is enriched.
With further reference to fig. 5, as an implementation of the method shown in the foregoing figures, the present disclosure provides some embodiments of an apparatus for transforming a two-dimensional code image matrix, where the apparatus embodiments correspond to those method embodiments shown in fig. 3, and the apparatus may be specifically applied to various electronic devices.
As shown in fig. 5, an apparatus 500 for transforming a two-dimensional code image matrix according to some embodiments includes: a first extraction unit 501, a processing unit 502, a second extraction unit 503, and a matrix operation unit 504. Wherein the first extraction unit 501 is configured to extract a data stream from the color components of the second irregular two-dimensional code image matrix. And a processing unit 502 configured to matrix the data stream to obtain a target deformation matrix. The second extraction unit 503 is configured to extract the gray component of the second irregular two-dimensional code image matrix, so as to obtain a first irregular two-dimensional code image matrix. The operation unit 504 is configured to perform a second matrix operation on the first abnormal two-dimensional code image matrix by using the target deformation matrix, so as to obtain an original two-dimensional code image matrix.
In an alternative implementation manner of some embodiments, the apparatus 500 for transforming a two-dimensional code image matrix further includes: and the analysis unit is configured to analyze the original two-dimensional code image matrix to obtain target information.
In an alternative implementation of some embodiments, the processing unit 502 of the apparatus 500 for transforming a two-dimensional code image matrix is further configured to: decoding the data stream to obtain an initial data stream; and matrixing the initial data stream to obtain the target deformation matrix.
In an optional implementation manner of some embodiments, the second special-shaped two-dimensional code image matrix is obtained by scanning a second target image.
In an alternative implementation manner of some embodiments, the second special-shaped two-dimensional code image matrix is generated according to some embodiments of the method for generating the two-dimensional code image matrix.
Referring now to fig. 6, a schematic diagram of an electronic device (e.g., server in fig. 1) 600 suitable for use in implementing some embodiments of the present disclosure is shown. The server illustrated in fig. 6 is merely an example, and should not be construed as limiting the functionality and scope of use of the embodiments of the present disclosure in any way.
As shown in fig. 6, the electronic device 600 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 601, which may perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 602 or a program loaded from a storage means 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data required for the operation of the electronic apparatus 600 are also stored. The processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
In general, the following devices may be connected to the I/O interface 605: input devices 606 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 607 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; and a communication device 609. The communication means 609 may allow the electronic device 600 to communicate with other devices wirelessly or by wire to exchange data. While fig. 6 shows an electronic device 600 having various means, it is to be understood that not all of the illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead. Each block shown in fig. 6 may represent one device or a plurality of devices as needed.
In particular, according to some embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, some embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via communications device 609, or from storage device 608, or from ROM 602. The above-described functions defined in the methods of some embodiments of the present disclosure are performed when the computer program is executed by the processing device 601.
It should be noted that, in some embodiments of the present disclosure, the computer readable medium may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In some embodiments of the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In some embodiments of the present disclosure, however, the computer-readable signal medium may comprise a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: performing first matrix operation by using a target deformation matrix corresponding to the target shape and an original two-dimensional code image matrix to generate a first special-shaped two-dimensional code image matrix; converting the target deformation matrix into a data stream, wherein the data stream can be restored into the target deformation matrix; and generating a second special-shaped two-dimensional code image matrix according to the data stream and the first special-shaped two-dimensional code image matrix, wherein the outline shape of the second special-shaped two-dimensional code image matrix when the second special-shaped two-dimensional code image matrix is displayed matches the target shape, and the second special-shaped two-dimensional code image matrix contains the data stream. Or when the one or more programs described above are executed by the electronic device, cause the electronic device to: extracting a data stream from the color components of the second special-shaped two-dimensional code image matrix; carrying out matrixing treatment on the data stream to obtain a target deformation matrix; extracting gray components of the second special-shaped two-dimensional code image matrix to obtain a first special-shaped two-dimensional code image matrix; and performing a second matrix operation on the first special-shaped two-dimensional code image matrix by using the target deformation matrix to obtain an original two-dimensional code image matrix.
Computer program code for carrying out operations for some embodiments of the present disclosure may be written in one or more programming languages, including an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in some embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. The described units may also be provided in a processor, for example, described as: a processor includes a first generation unit, a conversion unit, and a second generation unit. The names of the units are not limited to a specific case, for example, the first generating unit may be further described as a "unit that performs a first matrix operation with the original two-dimensional code image matrix by using the target deformation matrix corresponding to the target shape to generate the first special-shaped two-dimensional code image matrix".
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above technical features, but encompasses other technical features formed by any combination of the above technical features or their equivalents without departing from the spirit of the invention. Such as the above-described features, are mutually substituted with (but not limited to) the features having similar functions disclosed in the embodiments of the present disclosure.

Claims (15)

1. A method for transforming a two-dimensional code image matrix, comprising:
extracting a data stream from the color components of the second irregular two-dimensional code image matrix, wherein generating the second irregular two-dimensional code image matrix comprises: performing first matrix operation by using a target deformation matrix corresponding to the target shape and an original two-dimensional code image matrix to generate a first special-shaped two-dimensional code image matrix; converting the target deformation matrix into a data stream, wherein the data stream can be restored to the target deformation matrix; generating a second special-shaped two-dimensional code image matrix according to the data stream and the first special-shaped two-dimensional code image matrix, wherein the outline shape of the second special-shaped two-dimensional code image matrix when being presented is matched with the target shape, and the second special-shaped two-dimensional code image matrix contains the data stream;
performing matrixing treatment on the data stream to obtain a target deformation matrix;
extracting gray components of the second special-shaped two-dimensional code image matrix to obtain a first special-shaped two-dimensional code image matrix;
and performing a second matrix operation on the first special-shaped two-dimensional code image matrix by using the target deformation matrix to obtain an original two-dimensional code image matrix.
2. The method of claim 1, wherein the original two-dimensional code image matrix is obtained by encoding target information.
3. The method of claim 1, wherein the converting the target deformation matrix into a data stream comprises:
converting the target deformation matrix into an initial data stream;
and performing error correction coding on the initial data stream to generate the data stream.
4. The method according to one of claims 1-3, wherein the generating a second shaped two-dimensional code image matrix comprises:
and adding the data stream into the color component of the first special-shaped two-dimensional code image matrix to obtain the second special-shaped two-dimensional code image matrix.
5. The method of claim 4, wherein the generating the second shaped two-dimensional code image matrix comprises:
converting the first special-shaped two-dimensional code image matrix from a gray image matrix to a color image matrix;
and adding the data stream into the color component of the color image matrix to generate the second special-shaped two-dimensional code image matrix.
6. A method according to one of claims 1-3, wherein the method further comprises:
displaying a shape selection interface;
In response to detecting a user selection operation for at least one target shape on the shape selection interface, a deformation matrix corresponding to the selected target shape is acquired as the target deformation matrix.
7. A method according to one of claims 1-3, wherein the method further comprises:
acquiring the target shape provided by a user;
and generating a corresponding deformation matrix as a target deformation matrix according to the target shape.
8. The method of claim 7, wherein the obtaining the user-provided target shape comprises:
acquiring a region appointed by the user in a first target image matrix;
and determining the target shape according to the designated area.
9. A method according to one of claims 1-3, wherein the method further comprises:
adding the second special-shaped two-dimensional code image matrix into a first target image matrix to obtain a second target image matrix containing the second special-shaped two-dimensional code image matrix, wherein a second target image represented by the second target image matrix contains an area matched with the target shape, and the area contains a second special-shaped two-dimensional code image represented by the second special-shaped two-dimensional code image matrix.
10. The method of claim 1, wherein the method further comprises:
and analyzing the original two-dimensional code image matrix to obtain target information.
11. The method of claim 1, wherein the matrixing the data stream to obtain a target deformation matrix comprises:
decoding the data stream to obtain an initial data stream;
and matrixing the initial data stream to obtain the target deformation matrix.
12. The method of claim 11, wherein the second irregularly-shaped two-dimensional code image matrix is obtained by scanning a second target image.
13. An apparatus for transforming a two-dimensional code image matrix, comprising:
the first extraction unit is configured to extract a data stream from color components of a second special-shaped two-dimensional code image matrix, wherein generating the second special-shaped two-dimensional code image matrix comprises: performing first matrix operation by using a target deformation matrix corresponding to the target shape and an original two-dimensional code image matrix to generate a first special-shaped two-dimensional code image matrix; converting the target deformation matrix into a data stream, wherein the data stream can be restored to the target deformation matrix; generating a second special-shaped two-dimensional code image matrix according to the data stream and the first special-shaped two-dimensional code image matrix, wherein the outline shape of the second special-shaped two-dimensional code image matrix when being presented is matched with the target shape, and the second special-shaped two-dimensional code image matrix contains the data stream;
The processing unit is configured to matrix the data stream to obtain a target deformation matrix;
the second extraction unit is configured to extract gray components of the second special-shaped two-dimensional code image matrix to obtain a first special-shaped two-dimensional code image matrix;
the operation unit is configured to perform a second matrix operation on the first special-shaped two-dimensional code image matrix by using the target deformation matrix to obtain an original two-dimensional code image matrix.
14. An electronic device, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
when executed by the one or more processors, causes the one or more processors to implement the method of any of claims 1-12.
15. A computer readable storage medium having stored thereon a computer program which, when executed by a processor, implements the method of any of claims 1-12.
CN201910985270.5A 2019-10-16 2019-10-16 Method and device for generating and transforming two-dimensional code image matrix Active CN110751251B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910985270.5A CN110751251B (en) 2019-10-16 2019-10-16 Method and device for generating and transforming two-dimensional code image matrix

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910985270.5A CN110751251B (en) 2019-10-16 2019-10-16 Method and device for generating and transforming two-dimensional code image matrix

Publications (2)

Publication Number Publication Date
CN110751251A CN110751251A (en) 2020-02-04
CN110751251B true CN110751251B (en) 2023-10-24

Family

ID=69278649

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910985270.5A Active CN110751251B (en) 2019-10-16 2019-10-16 Method and device for generating and transforming two-dimensional code image matrix

Country Status (1)

Country Link
CN (1) CN110751251B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114021683B (en) * 2021-11-04 2022-10-14 广州市金库物联科技有限公司 Color fillet anti-counterfeiting two-dimensional code generation method and device
CN115230359A (en) * 2022-09-22 2022-10-25 江苏铨通印数字印刷有限公司 Intelligent digital printing anti-counterfeiting mark generation and use method

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003288558A (en) * 2002-03-27 2003-10-10 Denso Wave Inc Method and device for displaying two-dimensional code, and method and device for reading two-dimensional code
CN106599965A (en) * 2016-11-25 2017-04-26 北京矩石科技有限公司 Method and device for making image cartoony and fusing image with 2D code
CN106778995A (en) * 2016-11-25 2017-05-31 北京矩石科技有限公司 A kind of art up two-dimensional code generation method and device with image co-registration
CN108734250A (en) * 2018-05-29 2018-11-02 西安理工大学 Vision two-dimensional code generation method based on Sobel operators
CN109492735A (en) * 2018-11-23 2019-03-19 清华大学 Two-dimensional code generation method and computer readable storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105009146A (en) * 2012-06-26 2015-10-28 艾克尼特有限公司 Image mask providing a machine-readable data matrix code

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003288558A (en) * 2002-03-27 2003-10-10 Denso Wave Inc Method and device for displaying two-dimensional code, and method and device for reading two-dimensional code
CN106599965A (en) * 2016-11-25 2017-04-26 北京矩石科技有限公司 Method and device for making image cartoony and fusing image with 2D code
CN106778995A (en) * 2016-11-25 2017-05-31 北京矩石科技有限公司 A kind of art up two-dimensional code generation method and device with image co-registration
CN108734250A (en) * 2018-05-29 2018-11-02 西安理工大学 Vision two-dimensional code generation method based on Sobel operators
CN109492735A (en) * 2018-11-23 2019-03-19 清华大学 Two-dimensional code generation method and computer readable storage medium

Also Published As

Publication number Publication date
CN110751251A (en) 2020-02-04

Similar Documents

Publication Publication Date Title
CN107633218B (en) Method and apparatus for generating image
US11514263B2 (en) Method and apparatus for processing image
CN109255337B (en) Face key point detection method and device
CN110413812B (en) Neural network model training method and device, electronic equipment and storage medium
CN110021052B (en) Method and apparatus for generating fundus image generation model
CN111784712B (en) Image processing method, device, equipment and computer readable medium
CN109934142B (en) Method and apparatus for generating feature vectors of video
CN111459364B (en) Icon updating method and device and electronic equipment
CN110751251B (en) Method and device for generating and transforming two-dimensional code image matrix
CN115358911B (en) Screen watermark generation method, device, equipment and computer readable storage medium
CN112306793A (en) Method and device for monitoring webpage
CN112381717A (en) Image processing method, model training method, device, medium, and apparatus
CN112419179A (en) Method, device, equipment and computer readable medium for repairing image
CN112418249A (en) Mask image generation method and device, electronic equipment and computer readable medium
JP7261732B2 (en) Method and apparatus for determining character color
CN110310293B (en) Human body image segmentation method and device
US11068682B2 (en) QR code generation method and apparatus for terminal device
CN111669476B (en) Watermark processing method, device, electronic equipment and medium
CN117556394A (en) APP digital watermark generation method, decoding method, system, equipment and storage medium
CN110288523B (en) Image generation method and device
CN110765304A (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN115115836A (en) Image recognition method, image recognition device, storage medium and electronic equipment
CN112070888A (en) Image generation method, device, equipment and computer readable medium
CN110807114B (en) Method, device, terminal and storage medium for picture display
CN110033413B (en) Image processing method, device, equipment and computer readable medium of client

Legal Events

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