A method and system for tracing QR code recognition based on cloud computing
Through the cloud-based traceability QR code recognition method, using scaling and contour processing technology, only comparing areas outside the second contour in the QR code reference picture, the problem of large amount of QR code recognition calculation is solved, significantly improving the Recognition efficiency.
Patent Information
- Application Number
- CN202411017286.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-29
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-07-29
AI Technical Summary
When identifying QR codes, it is necessary to compare the identified QR codes with known QR codes, resulting in huge calculations and limiting the recognition speed.
Using the cloud-based traceability QR code recognition method, the scaling ratio is determined by obtaining the QR code reference picture and the positioning black and white frame of the QR code image to be identified, and the scaling ratio is determined to the same size as the reference picture. , only the areas outside the second contour in the reference picture are compared, and the black pixel dots collection is obtained to extract the QR code information.
The identification workload is reduced by at least half, which improves identification efficiency and reduces identification time.
Smart Images

Figure CN118551788B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of two-dimensional code information reading, and in particular to a cloud computing-based traceability two-dimensional code recognition method and system. Background Art
[0002] A QR code is a black and white graphic that records data symbol information using certain specific geometric shapes distributed in a plane according to a certain pattern. The code is compiled by cleverly utilizing the concept of "0" and "1" bit streams that form the basis of the computer's internal logic, using several geometric shapes corresponding to binary to represent textual numerical information, which is automatically recognized by image input devices or photoelectric scanning devices to realize automatic information processing.
[0003] When recognizing a QR code, a morphological comparison is required. Therefore, the QR code to be recognized needs to be compared with a known QR code, and a known QR code that is consistent with the QR code to be recognized needs to be obtained and its information extracted. However, the pixel points of all parts of the QR code need to be compared to complete the recognition. The amount of calculation involved is huge, which limits the recognition speed to a certain extent. Summary of the invention
[0004] In order to solve the above technical problems, a cloud computing-based traceability QR code recognition method and system are provided. This technical solution solves the problem that morphological comparison is needed when recognizing a QR code proposed in the above background technology. Therefore, it is necessary to compare the QR code to be recognized with a known QR code, obtain a known QR code that is consistent with the QR code to be recognized, and extract its information. However, it is necessary to compare the pixels of all parts of the QR code to complete the recognition. The amount of calculation involved is huge, which limits the recognition speed to a certain extent.
[0005] In order to achieve the above purpose, the technical solution adopted by the present invention is:
[0006] A cloud computing-based traceability QR code recognition method, comprising:
[0007] Acquire at least one two-dimensional code reference image and its corresponding two-dimensional code information, and aggregate them to form a two-dimensional code database, wherein the sizes of the two-dimensional code reference images are all consistent;
[0008] Identify the positioning black and white frames at the upper left corner, lower left corner, and upper right corner of the QR code reference image as reference positioning black and white frames;
[0009] Obtain a QR code image to be identified, and identify the positioning black and white frames at the upper left corner, lower left corner, and upper right corner of the QR code image to be identified as the positioning black and white frames to be identified;
[0010] Determine the scaling ratio of the to-be-recognized QR code image based on the to-be-recognized positioning black and white frame and the reference positioning black and white frame;
[0011] The two-dimensional code image to be identified is scaled according to the scaling ratio to obtain a pre-processed two-dimensional code image, wherein the pre-processed two-dimensional code image has the same size as the two-dimensional code reference image;
[0012] In the pre-processed two-dimensional code image, an outline of a black portion is obtained as a first outline;
[0013] In the two-dimensional code reference image, a second contour is generated, wherein the second contour is consistent with the first contour in shape, and the position of the first contour in the preprocessed two-dimensional code image is the same as the position of the second contour in the two-dimensional code reference image;
[0014] In the area outside the second contour of the two-dimensional code reference image, black pixel points are acquired and summarized to obtain a black pixel point set;
[0015] Get a black pixel point set that is an empty set as the target black pixel point set;
[0016] The two-dimensional code information of the two-dimensional code reference image corresponding to the target black pixel point set is obtained as the two-dimensional code information of the two-dimensional code image to be identified.
[0017] Preferably, the identifying the positioning black and white frames at the upper left corner, the lower left corner and the upper right corner of the QR code reference image as the reference positioning black and white frames comprises the following steps:
[0018] The black parts are identified at the upper left corner, the lower left corner and the upper right corner of the QR code reference image to obtain a reference black frame and a reference black square;
[0019] The white parts are identified at the upper left corner, lower left corner and upper right corner of the QR code reference image to obtain a reference white frame;
[0020] The reference black frame, the reference black square and the reference white frame at the upper left corner, the lower left corner and the upper right corner are respectively combined to obtain the reference positioning black and white frame.
[0021] Preferably, the step of identifying the positioning black and white frames at the upper left corner, the lower left corner and the upper right corner of the two-dimensional code image to be identified as the positioning black and white frames to be identified comprises the following steps:
[0022] The black part is identified at the upper left corner, lower left corner and upper right corner of the QR code image to be identified, and a black frame to be identified and a black square to be identified are obtained;
[0023] The white parts are identified at the upper left corner, lower left corner and upper right corner of the QR code image to be identified, and the white frame to be identified is obtained;
[0024] The black frames to be identified, the black squares to be identified and the white frames to be identified in the upper left corner, the lower left corner and the upper right corner are combined respectively to obtain the black and white frames to be identified and located.
[0025] Preferably, the step of determining the scaling ratio of the to-be-identified two-dimensional code image based on the to-be-identified positioning black-and-white frame and the reference positioning black-and-white frame comprises the following steps:
[0026] Count the number of pixels in the black and white frame to be identified and positioned as the first number;
[0027] Count the number of pixels in the black and white frame of the benchmark positioning as the second number;
[0028] Take the square root of the result of dividing the second number by the first number to obtain the scaling ratio of the QR code image to be recognized.
[0029] Preferably, scaling the two-dimensional code image to be identified to obtain a pre-processed two-dimensional code image comprises the following steps:
[0030] Generate a preprocessed blank image;
[0031] A coordinate system is established with the lower left corner of the two-dimensional code image to be identified, and a coordinate system is established with the lower left corner of the pre-processed blank image;
[0032] Obtain the coordinates of the pixel points in the preprocessed blank image as the first coordinates;
[0033] The first coordinate is multiplied by the scaling ratio to obtain the second coordinate;
[0034] Pairing a pixel point at a first coordinate in the preprocessed blank image with a pixel point at a second coordinate in the two-dimensional code image to be identified;
[0035] The pixel value of the pixel point at the second coordinate in the two-dimensional code image to be identified is assigned to the corresponding pixel point in the preprocessed blank image, and the pixel value is assigned to the completed preprocessed blank image as the preprocessed two-dimensional code image.
[0036] Preferably, the step of obtaining the outline of the black portion as the first outline comprises the following steps:
[0037] Determine whether the difference between the pixel values of adjacent pixels in the preprocessed two-dimensional code image is greater than a preset value. If so, the pixel on the left side of the adjacent pixel is used as a contour point. If not, no processing is performed.
[0038] Summarize the contour points into the first contour.
[0039] Preferably, generating the second profile in the two-dimensional code reference image comprises the following steps:
[0040] Establish a coordinate system based on the lower left corner of the QR code reference image;
[0041] Uniformly select at least one sampling point on the first contour, and obtain a first fitting function based on coordinate fitting of the at least one sampling point;
[0042] An image of the first fitting function is made in the coordinate system of the two-dimensional code reference image as the second contour.
[0043] Preferably, acquiring black pixels in the area outside the second contour in the two-dimensional code reference image comprises the following steps:
[0044] Obtaining the size of a minimum identification frame in the two-dimensional code reference image, wherein the minimum identification frame is the smallest constituent unit of a black or white area in the two-dimensional code reference image;
[0045] Segment the area outside the second outline in the QR code reference image according to the size of the minimum recognition frame to obtain at least one frame to be recognized;
[0046] Get the center of the frame to be identified as the point to be identified;
[0047] Identify the color of at least one point to be identified, and the color in the frame to be identified is consistent with the color corresponding to the point to be identified;
[0048] Get the black points in the box to be identified and summarize them into a set of black pixel points.
[0049] A cloud computing-based traceability QR code recognition system, used to implement the cloud computing-based traceability QR code recognition method, comprising:
[0050] An image acquisition module, wherein the image acquisition module acquires at least one two-dimensional code reference image and its corresponding two-dimensional code information, and aggregates them to form a two-dimensional code database, wherein the sizes of the two-dimensional code reference images are all consistent;
[0051] A mark recognition module, wherein the mark recognition module recognizes the positioning black and white frames at the upper left corner, the lower left corner and the upper right corner of the two-dimensional code reference image as the reference positioning black and white frames, obtains the two-dimensional code image to be recognized, and recognizes the positioning black and white frames at the upper left corner, the lower left corner and the upper right corner of the two-dimensional code image to be recognized as the positioning black and white frames to be recognized;
[0052] A ratio acquisition module, wherein the ratio acquisition module determines the scaling ratio of the to-be-identified two-dimensional code image based on the to-be-identified positioning black and white frame and the reference positioning black and white frame;
[0053] An image scaling module, wherein the image scaling module scales the two-dimensional code image to be identified according to a scaling ratio to obtain a pre-processed two-dimensional code image, wherein the pre-processed two-dimensional code image has the same size as the two-dimensional code reference image;
[0054] A contour processing module, wherein the contour processing module obtains the contour of the black part in the pre-processed two-dimensional code image as the first contour, and generates a second contour in the two-dimensional code reference image;
[0055] A pixel recognition module, which acquires black pixel points in an area outside the second contour in the two-dimensional code reference image and aggregates them to obtain a set of black pixel points;
[0056] An information acquisition module is provided, wherein the information acquisition module acquires a black pixel point set which is an empty set as a target black pixel point set, and acquires the two-dimensional code information of a two-dimensional code reference image corresponding to the target black pixel point set as the two-dimensional code information of the two-dimensional code image to be identified.
[0057] Compared with the prior art, the present invention has the following beneficial effects:
[0058] By setting a mark recognition module, a ratio acquisition module, an image scaling module, a contour processing module and a pixel recognition module, the two-dimensional code to be recognized can be scaled to a size consistent with the size of the two-dimensional code reference image according to the parts that appear commonly in all the two-dimensional codes, and then a comparison can be performed under the same conditions. During the comparison, only the area outside the second contour in the two-dimensional code reference image is compared, thereby avoiding the recognition of all pixel points of the two-dimensional code reference image, and can reduce the recognition workload by at least half, thereby effectively reducing the recognition time and improving the recognition efficiency. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] Figure 1 It is a schematic diagram of the process of the cloud computing-based traceability two-dimensional code recognition method of the present invention;
[0060] Figure 2 The present invention is a schematic diagram of a process of identifying the positioning black and white frames at the upper left corner, the lower left corner and the upper right corner of a two-dimensional code reference image as a reference positioning black and white frame;
[0061] Figure 3 The present invention is a flowchart of identifying the positioning black and white frames at the upper left corner, lower left corner and upper right corner of the two-dimensional code image to be identified as the positioning black and white frames to be identified;
[0062] Figure 4 It is a flow chart of determining the scaling ratio of the to-be-identified two-dimensional code image based on the to-be-identified positioning black-and-white frame and the reference positioning black-and-white frame of the present invention;
[0063] Figure 5 This is a schematic diagram of the process of scaling a two-dimensional code image to be identified to obtain a pre-processed two-dimensional code image according to the present invention;
[0064] Figure 6 A schematic diagram of a process of obtaining the outline of a black portion as a first outline of the present invention;
[0065] Figure 7 A schematic diagram of a process of generating a second contour in a two-dimensional code reference image according to the present invention;
[0066] Figure 8 It is a schematic diagram of the process of acquiring black pixels in the area outside the second outline in the two-dimensional code reference image of the present invention. DETAILED DESCRIPTION
[0067] The following description is used to disclose the present invention so that those skilled in the art can implement the present invention. The preferred embodiments described below are only examples, and those skilled in the art may think of other obvious variations.
[0068] Reference Figure 1 As shown, a traceability QR code recognition method based on cloud computing includes:
[0069] Acquire at least one two-dimensional code reference image and its corresponding two-dimensional code information, and aggregate them to form a two-dimensional code database, wherein the sizes of the two-dimensional code reference images are all consistent;
[0070] Identify the positioning black and white frames at the upper left corner, lower left corner, and upper right corner of the QR code reference image as reference positioning black and white frames;
[0071] Obtain a QR code image to be identified, and identify the positioning black and white frames at the upper left corner, lower left corner, and upper right corner of the QR code image to be identified as the positioning black and white frames to be identified;
[0072] Determine the scaling ratio of the to-be-recognized QR code image based on the to-be-recognized positioning black and white frame and the reference positioning black and white frame;
[0073] The two-dimensional code image to be identified is scaled according to the scaling ratio to obtain a pre-processed two-dimensional code image, wherein the pre-processed two-dimensional code image has the same size as the two-dimensional code reference image;
[0074] In the pre-processed two-dimensional code image, an outline of a black portion is obtained as a first outline;
[0075] In the two-dimensional code reference image, a second contour is generated, wherein the second contour is consistent with the first contour in shape, and the position of the first contour in the preprocessed two-dimensional code image is the same as the position of the second contour in the two-dimensional code reference image;
[0076] In the area outside the second contour of the two-dimensional code reference image, black pixel points are acquired and summarized to obtain a black pixel point set;
[0077] Get a black pixel point set that is an empty set as the target black pixel point set;
[0078] The two-dimensional code information of the two-dimensional code reference image corresponding to the target black pixel point set is obtained as the two-dimensional code information of the two-dimensional code image to be identified.
[0079] During normal recognition, in order to obtain a two-dimensional code reference picture that is consistent with the two-dimensional code image to be recognized, it is necessary to compare the two-dimensional code image to be recognized with all positions in the two-dimensional code reference picture to determine whether the two are consistent, and then call the information of the two-dimensional code reference picture that is consistent with the two-dimensional code image to be recognized, but its retrieval area is the entire area of the two-dimensional code image to be recognized and the two-dimensional code reference picture;
[0080] In this solution, since the image of the QR code is composed of white blocks and black blocks, the size of these white blocks and black blocks is the size of the minimum recognition frame. Therefore, when the area of the black part is determined, the rest is automatically determined as the white part. Based on this, the black part of the preprocessed QR code image that is scaled to obtain the same size as the QR code reference image can be contour recognized to obtain a first contour, and a second contour consistent with the first contour is generated in the QR code reference image. If the QR code reference image is consistent with the preprocessed QR code image, all the black parts in the QR code reference image must be included in the second contour. Therefore, the black part cannot be recognized in the second contour. Once the black part is recognized, it means that the QR code reference image is inconsistent with the preprocessed QR code image. Using this method for recognition, the recognized area can be reduced by at least half compared to the area of full-domain recognition, thereby greatly improving the recognition efficiency.
[0081] Reference Figure 2 As shown, identifying the positioning black and white frames at the upper left corner, lower left corner and upper right corner of the QR code reference image as the reference positioning black and white frames includes the following steps:
[0082] The black parts are identified at the upper left corner, the lower left corner and the upper right corner of the QR code reference image to obtain a reference black frame and a reference black square;
[0083] The white parts are identified at the upper left corner, lower left corner and upper right corner of the QR code reference image to obtain a reference white frame;
[0084] The reference black frame, the reference black square and the reference white frame at the upper left corner, the lower left corner and the upper right corner are respectively combined to obtain the reference positioning black and white frame.
[0085] Any QR code image can be searched on the Internet. Generally speaking, there will be black and white frames in the upper left corner, lower left corner and upper right corner. This part is usually similar, that is, the shape is the same, but it changes with the size of the QR code image. Its proportion in the QR code is consistent. Its purpose is to be a reference for identification and to be used for positioning.
[0086] Reference Figure 3 As shown, identifying the positioning black and white frames at the upper left corner, lower left corner and upper right corner of the two-dimensional code image to be identified as the positioning black and white frames to be identified includes the following steps:
[0087] The black part is identified at the upper left corner, lower left corner and upper right corner of the QR code image to be identified, and a black frame to be identified and a black square to be identified are obtained;
[0088] The white parts are identified at the upper left corner, lower left corner and upper right corner of the QR code image to be identified, and the white frame to be identified is obtained;
[0089] The black frames to be identified, the black squares to be identified and the white frames to be identified in the upper left corner, the lower left corner and the upper right corner are combined respectively to obtain the black and white frames to be identified and positioned.
[0090] Reference Figure 4 As shown, based on the black and white frame to be identified and the reference black and white frame, determining the scaling ratio of the two-dimensional code image to be identified includes the following steps:
[0091] Count the number of pixels in the black and white frame to be identified and positioned as the first number;
[0092] Count the number of pixels in the black and white frame of the benchmark positioning as the second number;
[0093] Take the square root of the result of dividing the second number by the first number to obtain the scaling ratio of the QR code image to be recognized.
[0094] Since the shooting distance is different when the QR code image to be identified is obtained, the QR code image to be identified cannot be directly compared with the QR code reference image and needs to be scaled. Since the black and white frame to be identified and the reference positioning black and white frame are corresponding parts, when the number of pixels in the black and white frame to be identified and the reference positioning black and white frame are used for proportional calculation, since the scaling is performed on the side, and the number of pixels is proportional to the area, it is necessary to take the square root of the result of dividing the second number by the first number to obtain the scaling ratio of the side length, and then scale the QR code image to be identified according to the ratio, and a picture with the same size as the QR code reference image can be obtained.
[0095] Reference Figure 5 As shown in the figure, scaling the two-dimensional code image to be identified to obtain a pre-processed two-dimensional code image includes the following steps:
[0096] Generate a preprocessed blank image;
[0097] A coordinate system is established with the lower left corner of the two-dimensional code image to be identified, and a coordinate system is established with the lower left corner of the pre-processed blank image;
[0098] Obtain the coordinates of the pixel points in the preprocessed blank image as the first coordinates;
[0099] The first coordinate is multiplied by the scaling ratio to obtain the second coordinate;
[0100] Pairing a pixel point at a first coordinate in the preprocessed blank image with a pixel point at a second coordinate in the two-dimensional code image to be identified;
[0101] The pixel value of the pixel point at the second coordinate in the two-dimensional code image to be identified is assigned to the corresponding pixel point in the preprocessed blank image, and the pixel value is assigned to the completed preprocessed blank image as the preprocessed two-dimensional code image.
[0102] Reference Figure 6 As shown, obtaining the outline of the black part as the first outline includes the following steps:
[0103] Determine whether the difference between the pixel values of adjacent pixels in the preprocessed two-dimensional code image is greater than a preset value. If so, the pixel on the left side of the adjacent pixel is used as a contour point. If not, no processing is performed.
[0104] Summarize the contour points into the first contour.
[0105] Since there are only white pixels and black pixels in the pre-processed two-dimensional code image, the adjacent positions of black and white are contour positions, thereby obtaining the first contour.
[0106] Reference Figure 7 As shown, in the two-dimensional code reference image, generating the second profile includes the following steps:
[0107] Establish a coordinate system based on the lower left corner of the QR code reference image;
[0108] Uniformly select at least one sampling point on the first contour, and obtain a first fitting function based on coordinate fitting of the at least one sampling point;
[0109] An image of the first fitting function is made in the coordinate system of the two-dimensional code reference image as the second contour.
[0110] The second contour is consistent with the shape of the first contour and has the same relative position in the QR code reference image and the preprocessed QR code image. Therefore, when the QR code reference image and the preprocessed QR code image are consistent, the second contour must include all the black parts in the QR code reference image, and no black pixels can be recognized outside it. Therefore, this can be used as a basis for identification.
[0111] Reference Figure 8 As shown, in the area outside the second contour in the two-dimensional code reference image, obtaining black pixels includes the following steps:
[0112] Obtaining the size of a minimum identification frame in the two-dimensional code reference image, wherein the minimum identification frame is the smallest constituent unit of a black or white area in the two-dimensional code reference image;
[0113] Segment the area outside the second outline in the QR code reference image according to the size of the minimum recognition frame to obtain at least one frame to be recognized;
[0114] Get the center of the frame to be identified as the point to be identified;
[0115] Identify the color of at least one point to be identified, and the color in the frame to be identified is consistent with the color corresponding to the point to be identified;
[0116] Get the black points in the box to be identified and summarize them into a set of black pixel points.
[0117] Since the QR code is composed of basic white squares and black squares, the size of the basic white squares and black squares is obtained as the size of the minimum recognition frame. Therefore, the area outside the second outline in the QR code reference image is segmented based on the reference positioning black and white frame. Since the color in the frame to be recognized is consistent, which is all white or all black, it is only necessary to recognize one point in the frame to be recognized to determine the color in the frame to be recognized. In this solution, the center of the frame to be recognized is selected. During recognition, only the center of the frame to be recognized needs to be recognized, which further reduces the workload of recognition, but will not affect the recognition result.
[0118] A cloud computing-based traceability QR code recognition system, used to implement the cloud computing-based traceability QR code recognition method, comprising:
[0119] An image acquisition module, wherein the image acquisition module acquires at least one two-dimensional code reference image and its corresponding two-dimensional code information, and aggregates them to form a two-dimensional code database, wherein the sizes of the two-dimensional code reference images are all consistent;
[0120] A mark recognition module, wherein the mark recognition module recognizes the positioning black and white frames at the upper left corner, the lower left corner and the upper right corner of the two-dimensional code reference image as the reference positioning black and white frames, obtains the two-dimensional code image to be recognized, and recognizes the positioning black and white frames at the upper left corner, the lower left corner and the upper right corner of the two-dimensional code image to be recognized as the positioning black and white frames to be recognized;
[0121] A ratio acquisition module, wherein the ratio acquisition module determines the scaling ratio of the to-be-identified two-dimensional code image based on the to-be-identified positioning black and white frame and the reference positioning black and white frame;
[0122] An image scaling module, wherein the image scaling module scales the two-dimensional code image to be identified according to a scaling ratio to obtain a pre-processed two-dimensional code image, wherein the pre-processed two-dimensional code image has the same size as the two-dimensional code reference image;
[0123] A contour processing module, wherein the contour processing module obtains the contour of the black part in the pre-processed two-dimensional code image as the first contour, and generates a second contour in the two-dimensional code reference image;
[0124] A pixel recognition module, which acquires black pixel points in an area outside the second contour in the two-dimensional code reference image and aggregates them to obtain a set of black pixel points;
[0125] An information acquisition module is provided, wherein the information acquisition module acquires a black pixel point set which is an empty set as a target black pixel point set, and acquires the two-dimensional code information of a two-dimensional code reference image corresponding to the target black pixel point set as the two-dimensional code information of the two-dimensional code image to be identified.
[0126] Furthermore, the present solution also proposes a storage medium on which a computer-readable program is stored, and when the computer-readable program is called, the above-mentioned cloud computing-based traceability QR code recognition method is executed.
[0127] It is understandable that the storage medium may be a magnetic medium, such as a floppy disk, a hard disk, or a magnetic tape; an optical medium, such as a DVD; or a semiconductor medium, such as a solid state drive (SSD).
[0128] In summary, the advantages of the present invention are: by setting a mark recognition module, a ratio acquisition module, an image scaling module, a contour processing module and a pixel recognition module, the two-dimensional code to be identified can be scaled to a size consistent with the two-dimensional code reference image according to the parts that appear commonly in all two-dimensional codes, and then a comparison can be performed under the same conditions. During the comparison, only the area outside the second contour in the two-dimensional code reference image is compared, thereby avoiding the identification of all pixel points of the two-dimensional code reference image, and can reduce the recognition workload by at least half, thereby effectively reducing the recognition time and improving the recognition efficiency.
[0129] The above shows and describes the basic principles, main features and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The above embodiments and descriptions only describe the principles of the present invention. The present invention may be subject to various changes and improvements without departing from the spirit and scope of the present invention. These changes and improvements fall within the scope of the present invention. The scope of protection claimed by the present invention is defined by the attached claims and their equivalents.
Claims
1. A traceability QR code recognition method based on cloud computing, It is characterized in that include: Acquire at least one two-dimensional code reference image and its corresponding two-dimensional code information, and aggregate them to form a two-dimensional code database, wherein the sizes of the two-dimensional code reference images are all consistent; Identify the positioning black and white frames at the upper left corner, lower left corner, and upper right corner of the QR code reference image as reference positioning black and white frames; Obtain a QR code image to be identified, and identify the positioning black and white frames at the upper left corner, lower left corner, and upper right corner of the QR code image to be identified as the positioning black and white frames to be identified; Determine the scaling ratio of the to-be-recognized QR code image based on the to-be-recognized positioning black and white frame and the reference positioning black and white frame; The two-dimensional code image to be identified is scaled according to the scaling ratio to obtain a pre-processed two-dimensional code image, wherein the pre-processed two-dimensional code image has the same size as the two-dimensional code reference image; In the pre-processed two-dimensional code image, an outline of a black portion is obtained as a first outline; In the two-dimensional code reference image, a second contour is generated, wherein the second contour is consistent with the first contour in shape, and the position of the first contour in the preprocessed two-dimensional code image is the same as the position of the second contour in the two-dimensional code reference image; In the area outside the second contour of the two-dimensional code reference image, black pixel points are acquired and summarized to obtain a black pixel point set; Get a black pixel point set that is an empty set as the target black pixel point set; Obtain the two-dimensional code information of the two-dimensional code reference image corresponding to the target black pixel point set as the two-dimensional code information of the two-dimensional code image to be identified; The step of obtaining the outline of the black part as the first outline comprises the following steps: Determine whether the difference between the pixel values of adjacent pixels in the preprocessed two-dimensional code image is greater than a preset value. If so, the pixel on the left side of the adjacent pixel is used as a contour point. If not, no processing is performed. Summarize the contour points into the first contour; In the two-dimensional code reference picture, generating the second profile comprises the following steps: Establish a coordinate system based on the lower left corner of the QR code reference image; Uniformly select at least one sampling point on the first contour, and obtain a first fitting function based on coordinate fitting of the at least one sampling point; Making an image of the first fitting function in the coordinate system of the two-dimensional code reference image as the second contour; The acquisition of black pixels in the area outside the second contour in the two-dimensional code reference image comprises the following steps: Obtaining the size of a minimum identification frame in the two-dimensional code reference image, wherein the minimum identification frame is the smallest constituent unit of a black or white area in the two-dimensional code reference image; Segment the area outside the second outline in the QR code reference image according to the size of the minimum recognition frame to obtain at least one frame to be recognized; Get the center of the frame to be identified as the point to be identified; Identify the color of at least one point to be identified, and the color in the frame to be identified is consistent with the color corresponding to the point to be identified; Get the black points in the box to be identified and summarize them into a set of black pixel points.
2. According to the cloud computing-based traceability QR code recognition method of claim 1, It is characterized in that The identification of the positioning black and white frames at the upper left corner, lower left corner and upper right corner of the two-dimensional code reference image as the reference positioning black and white frames comprises the following steps: The black parts are identified at the upper left corner, the lower left corner and the upper right corner of the QR code reference image to obtain a reference black frame and a reference black square; The white parts are identified at the upper left corner, lower left corner and upper right corner of the QR code reference image to obtain a reference white frame; The reference black frame, the reference black square and the reference white frame at the upper left corner, the lower left corner and the upper right corner are respectively combined to obtain the reference positioning black and white frame.
3. According to the cloud computing-based traceability QR code recognition method of claim 2, It is characterized in that The method of identifying the positioning black and white frames at the upper left corner, the lower left corner and the upper right corner of the two-dimensional code image to be identified as the positioning black and white frames to be identified comprises the following steps: The black part is identified at the upper left corner, lower left corner and upper right corner of the QR code image to be identified, and a black frame to be identified and a black square to be identified are obtained; The white parts are identified at the upper left corner, lower left corner and upper right corner of the QR code image to be identified, and the white frame to be identified is obtained; The black frames to be identified, the black squares to be identified and the white frames to be identified in the upper left corner, the lower left corner and the upper right corner are combined respectively to obtain the black and white frames to be identified and positioned.
4. According to the cloud computing-based traceability QR code recognition method of claim 3, It is characterized in that Determining the scaling ratio of the to-be-identified two-dimensional code image based on the to-be-identified positioning black-and-white frame and the reference positioning black-and-white frame comprises the following steps: Count the number of pixels in the black and white frame to be identified and positioned as the first number; Count the number of pixels in the black and white frame of the benchmark positioning as the second number; Take the square root of the result of dividing the second number by the first number to obtain the scaling ratio of the QR code image to be recognized.
5. According to the cloud computing-based traceability QR code recognition method of claim 4, It is characterized in that The method of scaling the two-dimensional code image to be identified to obtain a pre-processed two-dimensional code image comprises the following steps: Generate a preprocessed blank image; A coordinate system is established with the lower left corner of the two-dimensional code image to be identified, and a coordinate system is established with the lower left corner of the pre-processed blank image; Obtain the coordinates of the pixel points in the preprocessed blank image as the first coordinates; The first coordinate is multiplied by the scaling ratio to obtain the second coordinate; Pairing a pixel point at a first coordinate in the preprocessed blank image with a pixel point at a second coordinate in the two-dimensional code image to be identified; The pixel value of the pixel point at the second coordinate in the two-dimensional code image to be identified is assigned to the corresponding pixel point in the preprocessed blank image, and the pixel value is assigned to the completed preprocessed blank image as the preprocessed two-dimensional code image.
6. A cloud computing-based traceability QR code recognition system, used to implement the cloud computing-based traceability QR code recognition method according to any one of claims 1 to 5, It is characterized in that include: An image acquisition module, wherein the image acquisition module acquires at least one two-dimensional code reference image and its corresponding two-dimensional code information, and aggregates them to form a two-dimensional code database, wherein the sizes of the two-dimensional code reference images are all consistent; A mark recognition module, wherein the mark recognition module recognizes the positioning black and white frames at the upper left corner, the lower left corner and the upper right corner of the two-dimensional code reference image as the reference positioning black and white frames, obtains the two-dimensional code image to be recognized, and recognizes the positioning black and white frames at the upper left corner, the lower left corner and the upper right corner of the two-dimensional code image to be recognized as the positioning black and white frames to be recognized; A ratio acquisition module, wherein the ratio acquisition module determines the scaling ratio of the to-be-identified two-dimensional code image based on the to-be-identified positioning black and white frame and the reference positioning black and white frame; An image scaling module, wherein the image scaling module scales the two-dimensional code image to be identified according to a scaling ratio to obtain a pre-processed two-dimensional code image, wherein the pre-processed two-dimensional code image has the same size as the two-dimensional code reference image; A contour processing module, wherein the contour processing module obtains the contour of the black part in the pre-processed two-dimensional code image as the first contour, and generates a second contour in the two-dimensional code reference image; A pixel recognition module, which acquires black pixel points in an area outside the second contour in the two-dimensional code reference image and aggregates them to obtain a set of black pixel points; An information acquisition module is provided, wherein the information acquisition module acquires a black pixel point set which is an empty set as a target black pixel point set, and acquires the two-dimensional code information of a two-dimensional code reference image corresponding to the target black pixel point set as the two-dimensional code information of the two-dimensional code image to be identified.
