CN117314951B - Two-dimensional code recognition preprocessing method and system - Google Patents

Two-dimensional code recognition preprocessing method and system Download PDF

Info

Publication number
CN117314951B
CN117314951B CN202311543355.0A CN202311543355A CN117314951B CN 117314951 B CN117314951 B CN 117314951B CN 202311543355 A CN202311543355 A CN 202311543355A CN 117314951 B CN117314951 B CN 117314951B
Authority
CN
China
Prior art keywords
image
frame
dimensional code
processed
processing
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
CN202311543355.0A
Other languages
Chinese (zh)
Other versions
CN117314951A (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.)
Sichuan Shudun Technology Co ltd
Original Assignee
Sichuan Shudun 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 Sichuan Shudun Technology Co ltd filed Critical Sichuan Shudun Technology Co ltd
Priority to CN202311543355.0A priority Critical patent/CN117314951B/en
Publication of CN117314951A publication Critical patent/CN117314951A/en
Application granted granted Critical
Publication of CN117314951B publication Critical patent/CN117314951B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/155Segmentation; Edge detection involving morphological operators
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/20Image enhancement or restoration using local operators
    • G06T5/30Erosion or dilatation, e.g. thinning
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/60Analysis of geometric attributes
    • G06T7/62Analysis of geometric attributes of area, perimeter, diameter or volume
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10004Still image; Photographic image

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Geometry (AREA)
  • Character Input (AREA)

Abstract

The invention discloses a two-dimensional code identification preprocessing method and a system, relates to the technical field of two-dimensional code identification preprocessing, and solves the problem that pixels of interest points are accidentally lost in the traditional two-dimensional code identification preprocessing method, wherein the method comprises the following steps: s1, acquiring an image to be processed, wherein the image comprises at least one two-dimensional code picture, and the two-dimensional code picture comprises a rectangular discrete frame and a bare code; s2, carrying out gray level processing, self-adaptive binarization processing, corner detection and perspective transformation processing on the image to be processed to obtain a standard binary image; s3, carrying out morphological transformation, contour searching, contour screening and merging on the standard binary image to obtain a target detection document area; s4, performing closed frame screening on the target detection document area, and transferring to a blank image to obtain an initial target area; and S5, carrying out fine morphology processing and closed frame merging processing on the initial target area, extracting a near rectangular frame, further extracting a bare code from the image to be processed, and ensuring the accuracy and the reduction degree of two-dimensional code extraction.

Description

Two-dimensional code recognition preprocessing method and system
Technical Field
The invention relates to the technical field of two-dimensional code recognition preprocessing, in particular to a two-dimensional code recognition preprocessing method and system.
Background
In the preprocessing stage of two-dimensional code identification, a two-dimensional code picture is generally obtained based on a two-dimensional code positioning frame, morphological transformation preprocessing is adopted, namely, tiny noise points are covered through a convolution kernel expansion image, and then the two-dimensional code is extracted by reducing back the convolution kernel with the same size. However, when the two-dimensional code positioning frame is damaged or missing, the method cannot be implemented, and frequent processing based on morphology may cause accidental processing or missing of pixels of interest points in the two-dimensional code, so that the accuracy of the finally extracted two-dimensional code pattern is reduced.
In view of the above, the present invention provides a two-dimensional code recognition preprocessing method and system, which solve the above problems.
Disclosure of Invention
The purpose of the application is to provide a two-dimensional code recognition preprocessing method and system, and solve the problem that pixels of interest points possibly caused by a traditional two-dimensional code recognition preprocessing method are accidentally lost. And the closed contour search is combined with a single contour area, most of interference is removed, and the interference is transferred to a blank image for refinement treatment, and finally, the original image is returned for extraction, so that the accuracy and the reduction degree of two-dimensional code extraction are ensured.
The application firstly provides a two-dimensional code recognition preprocessing method, which comprises the following steps: s1, acquiring an image to be processed, wherein the image to be processed comprises at least one two-dimensional code picture, and the two-dimensional code picture comprises an external rectangular discrete frame and an internal bare code; s2, preprocessing the image to be processed, wherein the preprocessing comprises gray level processing, self-adaptive binarization processing, corner detection and perspective transformation processing, and a standard binary image is obtained; s3, carrying out morphological transformation, contour searching and contour screening combination on the standard binary image to obtain a target detection document area; s4, performing closed frame selection on the target detection document area, extracting a closed frame containing target information, and transferring the closed frame to a blank image to obtain an initial target area; and S5, carrying out fine morphology processing and closed frame merging processing on the initial target area, extracting a near rectangular frame, wherein the near rectangular frame corresponds to the rectangular discrete frame, and extracting a bare code from the image to be processed according to the position information of the near rectangular frame.
By adopting the technical scheme, the closed contour search is carried out on the basis of preliminary morphological transformation through the morphological processing mode, the area value of a single contour is judged, the part with large interference is removed, the rest contour is covered and transferred to a blank image, the interference of characters and patterns is eliminated, the morphological processing is carried out on the basis, the near-rectangular frame corresponding to the rectangular discrete frame is obtained, and the original image is returned to extract the bare code for identification, so that the accuracy and the reduction degree of the final extraction result are ensured.
In a possible implementation manner, step S4, performing a closed frame selection on the target detection document area, extracting a closed frame containing target information, and transferring the closed frame to a blank image to obtain an initial target area; comprising the following steps: and extracting a closed frame of the target detection document area through an opening and closing algorithm, calculating the area of a single closed frame, reserving the closed frame with the area between a small interference threshold value and a large interference threshold value, and transferring the closed frame to a blank image set with the image to be processed 1:1 to obtain an initial target image.
In a possible implementation manner, step S5, performing fine morphology processing and closed frame merging processing on the initial target area, and extracting a near rectangular frame, where the near rectangular frame corresponds to the rectangular discrete frame; comprising the following steps: morphological processing is carried out on the initial target image, and interference information is removed; performing closed frame overlapping test on the initial target image, and merging closed frames with overlapping; screening a near rectangular frame from the initial target image, wherein the near rectangular frame corresponds to the rectangular discrete frame.
In one possible implementation manner, step S5, extracting a bare code from the image to be processed according to the position information of the near rectangular frame; comprising the following steps: and acquiring the position information of the four corners of the near-rectangular frame, and extracting the internal bare code from the image to be processed according to the position information of the four corners.
In one possible implementation manner, the small interference threshold is a threshold corresponding to a noise portion in the image, and the large interference threshold is a threshold corresponding to a Chinese portion in the image.
The application also provides a two-dimensional code recognition preprocessing system, which comprises:
the device comprises a to-be-processed image acquisition module, a processing module and a processing module, wherein the to-be-processed image is used for acquiring to-be-processed images, the to-be-processed images comprise at least one two-dimensional code picture, and the two-dimensional code picture comprises an external rectangular discrete frame and an internal bare code;
the image preprocessing module is used for preprocessing the image to be processed, wherein the preprocessing comprises gray level processing, self-adaptive binarization processing, corner detection and perspective transformation processing, and a standard binary image is obtained;
the target detection document region extraction module is used for carrying out morphological transformation, contour searching and contour screening combination on the standard binary image to obtain a target detection document region;
the initial target area extraction module is used for carrying out closed frame selection on the target detection document area, extracting a closed frame containing target information and transferring the closed frame to a blank image to obtain an initial target area;
and the two-dimensional code picture extraction module is used for carrying out fine morphology processing and closed frame merging processing on the initial target area, extracting a near rectangular frame, wherein the near rectangular frame corresponds to the rectangular discrete frame, and extracting a bare code from the image to be processed according to the position information of the near rectangular frame.
In a possible implementation manner, the initial target area extracting module is further configured to extract a closed frame of the target detection document area through an opening and closing algorithm, calculate an area of a single closed frame, reserve the closed frame with an area between a small interference threshold and a large interference threshold, and transfer the closed frame to a blank image set with the image to be processed 1:1, so as to obtain an initial target image.
In a possible implementation manner, the two-dimensional code picture extraction module further includes: the extraction frame generation module is used for carrying out morphological processing on the initial target image and removing interference information; performing closed frame overlapping test on the initial target image, and merging closed frames with overlapping; screening a near rectangular frame from the initial target image, wherein the near rectangular frame corresponds to the rectangular discrete frame.
In one possible implementation manner, the two-dimensional code picture extraction module further includes: and the extraction frame extraction module is used for acquiring the position information of the four corners of the near-rectangular frame and extracting the internal bare code from the image to be processed according to the position information of the four corners.
In one possible implementation manner, the small interference threshold is a threshold corresponding to a noise portion in the image, and the large interference threshold is a threshold corresponding to a Chinese portion in the image.
Compared with the prior art, the application has the following beneficial effects: according to the scheme, the internal bare code is extracted based on the external rectangular discrete frame, the bare code can be directly used for identification, a two-dimensional code positioning frame is not needed, and the situation that the bare code cannot be extracted and identified due to the fact that the positioning frame is damaged and missing can be effectively treated; by means of closed contour retrieval and single contour area value, large and small interference noise and target information can be distinguished, the large and small interference noise is effectively removed, the problem of accidental loss of interest point pixels caused by morphological processing is avoided, and two-dimensional code information on an image to be processed is reserved to the greatest extent; and returning the acquired near rectangular frame to the original image to extract the bare code for subsequent identification, so that the accuracy and the reduction degree of extraction are ensured.
Drawings
The accompanying drawings, which are included to provide a further understanding of embodiments of the invention and are incorporated in and constitute a part of this application, illustrate embodiments of the invention. In the drawings:
fig. 1 (a) is a two-dimensional code picture without a discrete frame provided by the invention;
fig. 1 (b) is a two-dimensional code picture with discrete frames provided by the invention;
FIG. 2 is a skewed two-dimensional code encrypted document picture provided by the invention;
FIG. 3 is a flow chart of a two-dimensional code recognition preprocessing method provided by the invention;
FIG. 4 is a standard binary image provided by the present invention;
FIG. 5 is an image of a region of a target detection document provided by the present invention;
FIG. 6 is a partial image of an extracted bare code provided by the present invention;
fig. 7 is a schematic structural diagram of a two-dimensional code recognition preprocessing system provided by the invention.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the examples and the accompanying drawings, and the exemplary embodiments of the present application and the descriptions thereof are only for explaining the present application and are not limiting the present application.
Firstly, an application scene of the scheme is described, and the scheme is suitable for extracting and identifying the two-dimension code in the two-dimension code encrypted document. The two-dimensional code encrypted document is obtained through the following steps.
A1, encrypting a target character string: the method is characterized in that a character string composed of English and special characters provided by a user is encrypted by using a QR two-dimensional code-based mathematical error correction coding logic reedsosol encryption algorithm, and the aim is to enable a target information stream to resist certain information loss in the process of hiding and extracting. For example, the original string 'shaudun_test 001' is converted into a bare code:
‘0111001101101000011101010110010001110101011011100101111101110100011001010111001101110100001100000011000000110001100101111011111000011011000011010011000111011011001100011010000110100101111011011001001011001111101000111001001011101100101100111111100010101111’。
a2, encrypting the data stream image: the character strings 0 and 1 are truncated according to a certain length and tiled in a certain format, and are converted into naked codes which are formed by black and white pixels and are easy to read by human eyes. On the basis of cutting off tiling, add the discrete frame that is used for keeping apart, location, form the two-dimensional code that this scheme used. Referring to fig. 1, fig. 1 is a two-dimensional code picture. In the figure, (a) is a two-dimensional code picture without a discrete frame, and (b) is a two-dimensional code picture with a discrete frame.
A3, generating a two-dimensional code encrypted document: and spreading the two-dimensional code picture on the pdf document bottom layer in a self-adaptive manner, and merging and superposing to generate the two-dimensional code encrypted document. For example, the most suitable size of the centrally paved two-dimensional code picture is calculated by automatically selecting the length and width of the pdf file, and tiling is performed to obtain the two-dimensional code encrypted document, and fig. 2 is a skewed two-dimensional code encrypted document picture, as shown in fig. 2.
The scheme is applied to a preprocessing stage before two-dimension code recognition, and aims to extract two-dimension code pictures from the two-dimension code encrypted document for subsequent recognition. The following detailed description is made with reference to the examples and the accompanying drawings.
Embodiment 1 provides a two-dimensional code recognition preprocessing method, which includes, as shown in fig. 3: s1, acquiring an image to be processed, wherein the image to be processed comprises at least one two-dimensional code picture, and the two-dimensional code picture comprises an external rectangular discrete frame and an internal bare code; s2, preprocessing the image to be processed, wherein the preprocessing comprises gray level processing, self-adaptive binarization processing, corner detection and perspective transformation processing, and a standard binary image is obtained; s3, carrying out morphological transformation, contour searching and contour screening combination on the standard binary image to obtain a target detection document area; s4, performing closed frame selection on the target detection document area, extracting a closed frame containing target information, and transferring the closed frame to a blank image to obtain an initial target area; and S5, carrying out fine morphology processing and closed frame merging processing on the initial target area, extracting a near rectangular frame, wherein the near rectangular frame corresponds to the rectangular discrete frame, and extracting a bare code from the image to be processed according to the position information of the near rectangular frame.
Specifically, the scheme is characterized in that on the basis of preliminary morphological transformation, closed contour (closed frame) retrieval is carried out, and the area value of a single closed contour is judged to remove the part with large interference; covering and transferring the residual closed contour to a blank image, so that the interferences of characters, patterns and the like are eliminated; on the basis, more refined morphological processing is carried out, a near-rectangular frame corresponding to the rectangular discrete frame is obtained, and the original image to be processed is returned to extract the bare code according to the near-rectangular frame, so that the accuracy and the reduction degree of an extraction result are ensured.
The principle of extracting the two-dimensional code area from the image to be processed in the scheme is as follows: the two-dimensional code part, the document part and the noise part in the image are different in the area of the closed frame extracted by the two-dimensional code part, the document part and the noise part, so that the two-dimensional code part can be extracted according to the set threshold value. In addition, since the two-dimensional code of the scheme has unique rectangular discrete frames, the bare code part for identification can be extracted from the original image by extracting the near rectangular frames corresponding to the rectangular discrete frame positioning.
In step S1, an image to be processed is shown in fig. 2. Noise information and two-dimensional code information are contained. The noise information can be a document, a clutter background, a noise point and the like; two-dimensional code information is embedded in a document, which contains an external rectangular discrete frame and an internal bare code.
In step S2, the image to be processed contains too much information, which is not needed by us, and the image is converted into black and white to effectively filter much unnecessary information without losing the needed information, so that gray processing is performed on the image to be processed, and adaptive binarization image accurate processing is performed by combining an Oxford (OUT) thresholding method and a local thresholding method.
In an actual application scene, the image to be processed is often not placed in a standard manner, but is rotated or distorted, so that hough straight line detection is needed for the image to be processed, rotation angle calculation is performed after interference straight lines are removed, and rotation transformation and perspective transformation are performed on the basis to obtain a standard binary image. The standard binary image is shown in fig. 4.
In step S3, the image to be processed often differs greatly from the image that can be processed by the actual algorithm. As shown in fig. 2, the document part is the required target detection document area, and the cluttered background needs to be deleted. Therefore, morphological transformation is also needed to be carried out on the standard binary image, then contour searching is carried out, the obtained profiles are screened and combined, and the required target detection document area is extracted. The target detection document area image is shown in fig. 5.
It should be noted that steps S1-S3 may be implemented by using various existing algorithms, and the focus of this solution is on the following steps S4-S5.
In step S4, performing closed frame selection on the target detection document area, extracting a closed frame containing target information, and transferring the closed frame to a blank image to obtain an initial target area; comprising the following steps: and extracting a closed frame of the target detection document area through an opening and closing algorithm, calculating the area of a single closed frame, reserving the closed frame with the area between a small interference threshold value and a large interference threshold value, and transferring the closed frame to a blank image set with the image to be processed 1:1 to obtain an initial target image. The small interference threshold is a threshold corresponding to a noise part in the image, and the large interference threshold is a threshold corresponding to a Chinese part in the image.
Specifically, the two-dimensional code picture which is required to be proposed and identified does not need the existence of a document part and a noise part, but the extraction of the document part and the noise part to the two-dimensional code part is an interference. For more accurate extraction, it is necessary to keep the embedded two-dimensional code portion as much as possible while removing interference as much as possible. Therefore, the method comprises the steps of selecting and extracting a closed frame from a binarized target detection document area, specifically, extracting a closed contour in an image by adopting an opening and closing algorithm, calculating the area of a single closed frame, removing the closed frame of a text part and a noise part through a threshold value obtained by manual iteration, reserving the closed frame of a two-dimensional code part, and finally, transferring the reserved closed frame onto a blank image to obtain an initial target image, so that the subsequent processing is convenient. The size of the blank image and the size of the image to be processed are set to be 1:1, and when in transfer, transfer is carried out according to the original position information of the closed frame, so that the position information of the closed frame on the image before and after transfer is unchanged.
It should be noted that, the principle of screening the two-dimensional code partial closed frame according to the area of the closed frame is as follows: the two-dimensional code part, the text part and the noise part are provided with a large number of closed frames after binarization processing, and the areas of the three closed frames are different. The noise part refers to random noise existing in the image or meaningless points generated after morphological processing, and the corresponding closed frame area is usually smaller; after morphological treatment, the text part is generally larger in corresponding area of the closed frame due to continuity of characters and patterns; the two-dimensional code part is composed of a plurality of adjacent or discrete square points, and the area of the corresponding closed frame is usually arranged between the document part and the noise part. Therefore, the information of the two-dimensional code part can be reserved by setting the area threshold of the closed frame, and the document part and the noise part are removed.
It can be understood that the scheme realizes the preliminary extraction of the two-dimensional code part by extracting the closed frame and comparing the area of the closed frame, and can effectively avoid the damage caused by expansion and corrosion treatment of the two-dimensional code information compared with the traditional pure morphological treatment. And, this scheme is transferred the closed frame that two-dimensional code part corresponds to and is set up on 1:1's blank image, when keeping position information, eliminates other interference to carry out more meticulous processing.
In step S5, performing fine morphology processing and closed frame merging processing on the initial target area, and extracting a near rectangular frame, where the near rectangular frame corresponds to the rectangular discrete frame; comprising the following steps: morphological processing is carried out on the initial target image, and interference information is removed; performing closed frame overlapping test on the initial target image, and merging closed frames with overlapping; screening a near rectangular frame from the initial target image, wherein the near rectangular frame corresponds to the rectangular discrete frame.
Specifically, the initial target area is only a preliminary large identification area, and theoretically, the area must contain two-dimensional code information required by people, but in order to identify the two-dimensional code information more accurately, people need to cut and extract the two-dimensional code information from the graph, fine morphological processing is performed on the initial target area to eliminate fine interference, closure frame overlapping detection is performed on the basis, overlapping closure frames are combined, and a near rectangular frame is screened out from a plurality of closure frames. And eliminating interference frames with too large or too small proportion in the image. The shape of the near-rectangular discrete frame is consistent with that of the rectangle, or perspective transformation with a certain angle is carried out on the basis of the rectangle, and the angle value can be set according to the actual algorithm operation effect. The near rectangular frame can be used for extracting a two-dimensional code part, particularly a bare code part of a two-dimensional code, for subsequent identification.
It should be noted that, the principle that the near rectangular frame can be used for extracting the two-dimensional code part is as follows: the two-dimensional code picture in the scheme comprises rectangular discrete frames which are reserved in the initial target area after being processed in the steps S1-S4. Thus, the location of the rectangular discrete frame may be located by identifying a near rectangular frame in the initial target area.
S5, extracting a bare code from the image to be processed according to the position information of the near rectangular frame; comprising the following steps: and acquiring the position information of the four corners of the near-rectangular frame, and extracting the internal bare code from the image to be processed according to the position information of the four corners.
Specifically, since the bare code part is required to be extracted for recognition subsequently, the scheme brings the position information of the four corners of the nearly rectangular frame back to the original image to be processed, and the required bare code part is grabbed in the original image to be processed for subsequent recognition processing. The extracted partial image of the bare code is shown in fig. 6.
It should be noted that there are three improvements of this solution compared to the prior art. Firstly, extracting an internal bare code based on an external rectangular discrete frame, wherein the bare code can be directly used for identification without a two-dimensional code positioning frame, and the situation that the bare code cannot be extracted and identified due to the damage and the deletion of the positioning frame can be effectively treated; secondly, by means of closed contour retrieval and single contour area value extraction of the two-dimensional code part, large noise information (text part) and small noise information (noise part) can be removed, target information is reserved, the problem that interest point pixels are processed or accidentally lost due to traditional morphological processing is avoided, and the two-dimensional code information on an image to be processed is reserved to the greatest extent; thirdly, the bare code is extracted based on the obtained near rectangular frame and returned to the original image directly, so that the accuracy and the reduction degree of extraction are ensured, and a good basis is provided for subsequent identification.
Embodiment 2 provides a two-dimensional code recognition preprocessing system for implementing the two-dimensional code recognition preprocessing method, please refer to fig. 7. The system comprises: the device comprises a to-be-processed image acquisition module, a processing module and a processing module, wherein the to-be-processed image is used for acquiring to-be-processed images, the to-be-processed images comprise at least one two-dimensional code picture, and the two-dimensional code picture comprises an external rectangular discrete frame and an internal bare code; the image preprocessing module is used for preprocessing the image to be processed, wherein the preprocessing comprises gray level processing, self-adaptive binarization processing, corner detection and perspective transformation processing, and a standard binary image is obtained; the target detection document region extraction module is used for carrying out morphological transformation, contour searching and contour screening combination on the standard binary image to obtain a target detection document region; the initial target area extraction module is used for carrying out closed frame selection on the target detection document area, extracting a closed frame containing target information and transferring the closed frame to a blank image to obtain an initial target area; and the two-dimensional code picture extraction module is used for carrying out fine morphology processing and closed frame merging processing on the initial target area, extracting a near rectangular frame, wherein the near rectangular frame corresponds to the rectangular discrete frame, and extracting a bare code from the image to be processed according to the position information of the near rectangular frame.
In a possible implementation manner, the initial target area extracting module is further configured to extract a closed frame of the target detection document area through an opening and closing algorithm, calculate an area of a single closed frame, reserve the closed frame with an area between a small interference threshold and a large interference threshold, and transfer the closed frame to a blank image set with the image to be processed 1:1, so as to obtain an initial target image.
In a possible implementation manner, the two-dimensional code picture extraction module further includes: the extraction frame generation module is used for carrying out morphological processing on the initial target image and removing interference information; performing closed frame overlapping test on the initial target image, and merging closed frames with overlapping; screening a near rectangular frame from the initial target image, wherein the near rectangular frame corresponds to the rectangular discrete frame.
In one possible implementation manner, the two-dimensional code picture extraction module further includes: and the extraction frame extraction module is used for acquiring the position information of the four corners of the near-rectangular frame and extracting the internal bare code from the image to be processed according to the position information of the four corners.
In one possible implementation manner, the small interference threshold is a threshold corresponding to a noise portion in the image, and the large interference threshold is a threshold corresponding to a Chinese portion in the image.
The foregoing description of the embodiments has been provided for the purpose of illustrating the general principles of the invention, and is not meant to limit the scope of the invention, but to limit the invention to the particular embodiments, and any modifications, equivalents, improvements, etc. that fall within the spirit and principles of the invention are intended to be included within the scope of the invention.

Claims (10)

1. The two-dimensional code recognition preprocessing method is characterized by comprising the following steps of:
s1, acquiring an image to be processed, wherein the image to be processed comprises at least one two-dimensional code picture, and the two-dimensional code picture comprises an external rectangular discrete frame and an internal bare code;
s2, preprocessing the image to be processed, wherein the preprocessing comprises gray level processing, self-adaptive binarization processing, corner detection and perspective transformation processing, and a standard binary image is obtained;
s3, carrying out morphological transformation, contour searching and contour screening combination on the standard binary image to obtain a target detection document area;
s4, performing closed frame selection on the target detection document area, extracting a closed frame containing target information, and transferring the closed frame to a blank image to obtain an initial target area;
and S5, carrying out fine morphology processing and closed frame merging processing on the initial target area, extracting a near rectangular frame, wherein the near rectangular frame corresponds to the rectangular discrete frame, and extracting a bare code from the image to be processed according to the position information of the near rectangular frame.
2. The two-dimensional code recognition preprocessing method according to claim 1 is characterized by comprising the following steps of S4, performing closed frame selection on the target detection document area, extracting a closed frame containing target information, and transferring the closed frame to a blank image to obtain an initial target area; comprising the following steps: and extracting a closed frame of the target detection document region through an opening and closing algorithm, calculating the area of a single closed frame, reserving the closed frame with the area between a small interference threshold value and a large interference threshold value, and transferring the closed frame to a blank image set with the image to be processed 1:1 to obtain an initial target region.
3. The two-dimensional code recognition preprocessing method according to claim 1, wherein step S5, performing fine morphology processing and closed frame merging processing on the initial target area, and extracting a near rectangular frame, wherein the near rectangular frame corresponds to the rectangular discrete frame; comprising the following steps:
morphological processing is carried out on the initial target area, and interference information is removed;
performing closed frame overlapping test on the initial target area, and merging closed frames with overlapping;
screening a near rectangular frame from the initial target area, wherein the near rectangular frame corresponds to the rectangular discrete frame.
4. The two-dimensional code recognition preprocessing method according to claim 1, wherein step S5 is performed to extract a bare code from an image to be processed according to the position information of the near rectangular frame; comprising the following steps: and acquiring the position information of the four corners of the near-rectangular frame, and extracting the internal bare code from the image to be processed according to the position information of the four corners.
5. The two-dimensional code recognition preprocessing method according to claim 2, wherein the small interference threshold is a threshold corresponding to a noise part in an image, and the large interference threshold is a threshold corresponding to a Chinese part in the image.
6. A two-dimensional code recognition preprocessing system is characterized by comprising:
the device comprises a to-be-processed image acquisition module, a processing module and a processing module, wherein the to-be-processed image is used for acquiring to-be-processed images, the to-be-processed images comprise at least one two-dimensional code picture, and the two-dimensional code picture comprises an external rectangular discrete frame and an internal bare code;
the image preprocessing module is used for preprocessing the image to be processed, wherein the preprocessing comprises gray level processing, self-adaptive binarization processing, corner detection and perspective transformation processing, and a standard binary image is obtained;
the target detection document region extraction module is used for carrying out morphological transformation, contour searching and contour screening combination on the standard binary image to obtain a target detection document region;
the initial target area extraction module is used for carrying out closed frame selection on the target detection document area, extracting a closed frame containing target information and transferring the closed frame to a blank image to obtain an initial target area;
and the two-dimensional code picture extraction module is used for carrying out fine morphology processing and closed frame merging processing on the initial target area, extracting a near rectangular frame, wherein the near rectangular frame corresponds to the rectangular discrete frame, and extracting a bare code from the image to be processed according to the position information of the near rectangular frame.
7. The two-dimensional code recognition preprocessing system according to claim 6, wherein the initial target area extraction module is further configured to extract a closed frame of a target detection document area through an opening and closing algorithm, calculate an area of a single closed frame, reserve the closed frame with an area between a small interference threshold and a large interference threshold, and transfer the closed frame to a blank image set with the image to be processed 1:1, so as to obtain an initial target area.
8. The two-dimensional code recognition preprocessing system according to claim 6, wherein the two-dimensional code picture extraction module further comprises:
the extraction frame generation module is used for carrying out morphological processing on the initial target area and removing interference information; performing closed frame overlapping test on the initial target area, and merging closed frames with overlapping; screening a near rectangular frame from the initial target area, wherein the near rectangular frame corresponds to the rectangular discrete frame.
9. The two-dimensional code recognition preprocessing system according to claim 6, wherein the two-dimensional code picture extraction module further comprises:
and the extraction frame extraction module is used for acquiring the position information of the four corners of the near-rectangular frame and extracting the internal bare code from the image to be processed according to the position information of the four corners.
10. The two-dimensional code recognition preprocessing system according to claim 7, wherein the small interference threshold is a threshold corresponding to a noise part in an image, and the large interference threshold is a threshold corresponding to a Chinese part in the image.
CN202311543355.0A 2023-11-20 2023-11-20 Two-dimensional code recognition preprocessing method and system Active CN117314951B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311543355.0A CN117314951B (en) 2023-11-20 2023-11-20 Two-dimensional code recognition preprocessing method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311543355.0A CN117314951B (en) 2023-11-20 2023-11-20 Two-dimensional code recognition preprocessing method and system

Publications (2)

Publication Number Publication Date
CN117314951A CN117314951A (en) 2023-12-29
CN117314951B true CN117314951B (en) 2024-01-26

Family

ID=89288633

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311543355.0A Active CN117314951B (en) 2023-11-20 2023-11-20 Two-dimensional code recognition preprocessing method and system

Country Status (1)

Country Link
CN (1) CN117314951B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101765861A (en) * 2007-03-08 2010-06-30 微扫描系统公司 Detection and segmentation of a two-dimensional code
CN111860027A (en) * 2020-06-11 2020-10-30 贝壳技术有限公司 Two-dimensional code identification method and device
CN111931538A (en) * 2020-07-07 2020-11-13 广东奥普特科技股份有限公司 Positioning method of Micro QR two-dimensional code
CN114693908A (en) * 2022-03-08 2022-07-01 东莞理工学院 Industrial two-dimensional code positioning method based on YOLOv5
CN115017931A (en) * 2022-06-14 2022-09-06 广东技术师范大学 Method and system for extracting QR codes in batches in real time

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100511271C (en) * 2006-11-16 2009-07-08 深圳市天朗时代科技有限公司 Two-dimensional decoding method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101765861A (en) * 2007-03-08 2010-06-30 微扫描系统公司 Detection and segmentation of a two-dimensional code
CN111860027A (en) * 2020-06-11 2020-10-30 贝壳技术有限公司 Two-dimensional code identification method and device
CN111931538A (en) * 2020-07-07 2020-11-13 广东奥普特科技股份有限公司 Positioning method of Micro QR two-dimensional code
CN114693908A (en) * 2022-03-08 2022-07-01 东莞理工学院 Industrial two-dimensional code positioning method based on YOLOv5
CN115017931A (en) * 2022-06-14 2022-09-06 广东技术师范大学 Method and system for extracting QR codes in batches in real time

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
Interactive two-stage framework for blur QR code location with complex background;Wupeng Deng 等;《Tenth International Conference on Digital Image Processing》;1-8 *
QR Code Positioning Algorithm;Lei Liu 等;《CONF-CDS 2021》;1-6 *
基于DM642的手机QR码检测与识别;陈存弟;刘金清;施文灶;邓淑敏;周晓童;吴庆祥;;计算机系统应用;第27卷(第06期);202-208 *

Also Published As

Publication number Publication date
CN117314951A (en) 2023-12-29

Similar Documents

Publication Publication Date Title
Cornelis et al. Crack detection and inpainting for virtual restoration of paintings: The case of the Ghent Altarpiece
JP6080259B2 (en) Character cutting device and character cutting method
US8335402B1 (en) Method and system for detecting and recognizing text in images
US7437002B2 (en) Image recognition system utilizing an edge image and a binary image
KR100902491B1 (en) System for processing digit image, and method thereof
JP4904330B2 (en) Method and apparatus for extracting text from an image
Shah et al. An iterative approach for shadow removal in document images
CN112686265A (en) Hierarchic contour extraction-based pictograph segmentation method
US8130419B2 (en) Embedding authentication data to create a secure identity document using combined identity-linked images
Bhuvaneswari et al. Automatic Detection and Inpainting of Text Images
CN113076952B (en) Text automatic recognition and enhancement method and device
CN117314951B (en) Two-dimensional code recognition preprocessing method and system
JP4049560B2 (en) Halftone dot removal method and system
CN111445402B (en) Image denoising method and device
CN114445814B (en) Character region extraction method and computer-readable storage medium
CN111986176B (en) Crack image identification method, system, terminal and readable storage medium
CN114529570A (en) Image segmentation method, image identification method, user certificate subsidizing method and system
CN112580594A (en) Document identification method and device, computer equipment and storage medium
JP2871590B2 (en) Image extraction method
JP2008225654A (en) Image processing method, image processor, program, and program storage medium
KR101437286B1 (en) Method and apparatus for identifying digital contents
Back et al. The slope extraction and compensation based on adaptive edge enhancement to extract scene text region
CN117291208B (en) Two-dimensional code extraction method and system
Lee et al. A restoration method for distorted comics to improve comic contents identification
US11778122B2 (en) Apparatus, method, and storage medium for removing shading dots

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