CN116822549B - Positioning method and device for discrete DPM code region and image processing equipment - Google Patents

Positioning method and device for discrete DPM code region and image processing equipment Download PDF

Info

Publication number
CN116822549B
CN116822549B CN202311102181.4A CN202311102181A CN116822549B CN 116822549 B CN116822549 B CN 116822549B CN 202311102181 A CN202311102181 A CN 202311102181A CN 116822549 B CN116822549 B CN 116822549B
Authority
CN
China
Prior art keywords
data points
closed
image
discrete
closed data
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
CN202311102181.4A
Other languages
Chinese (zh)
Other versions
CN116822549A (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.)
Beijing Unigroup Tsingteng Microsystems Co Ltd
Original Assignee
Beijing Unigroup Tsingteng Microsystems 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 Beijing Unigroup Tsingteng Microsystems Co Ltd filed Critical Beijing Unigroup Tsingteng Microsystems Co Ltd
Priority to CN202311102181.4A priority Critical patent/CN116822549B/en
Publication of CN116822549A publication Critical patent/CN116822549A/en
Application granted granted Critical
Publication of CN116822549B publication Critical patent/CN116822549B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1408Methods for optical code recognition the method being specifically adapted for the type of code
    • G06K7/14172D bar codes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/1439Methods for optical code recognition including a method step for retrieval of the optical code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K7/00Methods or arrangements for sensing record carriers, e.g. for reading patterns
    • G06K7/10Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation
    • G06K7/14Methods or arrangements for sensing record carriers, e.g. for reading patterns by electromagnetic radiation, e.g. optical sensing; by corpuscular radiation using light without selection of wavelength, e.g. sensing reflected white light
    • G06K7/1404Methods for optical code recognition
    • G06K7/146Methods for optical code recognition the method including quality enhancement steps

Abstract

The application relates to the technical field of image processing, and discloses a positioning method for a discrete DPM code region, which comprises the following steps: searching a closed track in an image containing a discrete DPM code region by utilizing boundary tracking so as to obtain all closed data points in the image and centers of the closed data points; sliding the traversal image by utilizing the sliding window, and counting line segments among the closed data points under the condition that the number of the closed data points in the current sliding window area reaches a first number so as to obtain the size of the module; screening closed data points according to the size of the module, and counting the directions among the screened closed data points; and under the condition that the counted most numerous directions and the counted many times of multidirectional included angles meet the preset included angle range, determining the current sliding window area as an area containing the discrete DPM codes. The success rate of the discrete DPM code region positioning is improved. The application also discloses a positioning device and image processing equipment for the discrete DPM code region.

Description

Positioning method and device for discrete DPM code region and image processing equipment
Technical Field
The present invention relates to the field of image processing technologies, and for example, to a positioning method and apparatus for discrete DPM code regions, and an image processing device.
Background
Currently, DPM (Direct Part Mark) codes are widely used in many industries, and the demands for marking on objects such as circuit boards, metal parts and the like are increasing. The DPM code uses marking technologies such as laser engraving, mechanical spot engraving, code spraying printing and the like, so that the service life and the anti-interference performance of the code can be ensured. However, due to the high density and small volume of the metal, the code has the problems of low definition and contrast, light reflection, easy fouling and the like, and the two-dimensional code identification is challenged.
In the related art, the discrete DPM code positioning technique includes: and (3) carrying out full-image binarization on the image, searching the outline of the positioning graph, obtaining the positioning graph, and then roughly determining a two-dimensional code area and the like according to the position of the positioning graph.
In the process of implementing the embodiments of the present disclosure, it is found that at least the following problems exist in the related art:
in the related art, the positioning graph needs to be searched to determine the code graph alternative area, which has high requirement on image quality. When the problems of offset, reflection, poor definition and the like exist in the positioning graph area, the positioning failure of the DPM code can be caused.
It should be noted that the information disclosed in the foregoing background section is only for enhancing understanding of the background of the present application and thus may include information that does not form the prior art that is already known to those of ordinary skill in the art.
Disclosure of Invention
The following presents a simplified summary in order to provide a basic understanding of some aspects of the disclosed embodiments. This summary is not an extensive overview, and is intended to neither identify key/critical elements nor delineate the scope of such embodiments, but is intended as a prelude to the more detailed description that follows.
The embodiment of the disclosure provides a positioning method and device for a discrete DPM code region and image processing equipment, and DPM code positioning graphics do not need to be searched, so that the success rate of positioning the discrete DPM code region is improved.
In some embodiments, the method comprises:
searching a closed track in an image containing a discrete DPM code region by utilizing a boundary tracking mode so as to obtain all closed data points in the image and centers of the closed data points; sliding the traversal image by utilizing the sliding window, and under the condition that the closed data points in the sliding window area reach the first quantity, counting the line segments among the closed data points to obtain the module size; screening closed data points according to the size of the module, and counting the directions among the screened closed data points; under the condition that the included angles of the most counted directions and the secondary directions meet the preset included angle range, determining the sliding window area as an area containing the discrete DPM code
In some embodiments, the apparatus comprises: a processor and a memory storing program instructions, the processor being configured to perform a positioning method for discrete DPM code regions as described previously, when the program instructions are executed.
In some embodiments, the image processing apparatus includes: an equipment body; and a positioning device for discrete DPM code areas as described above is mounted to the apparatus body.
In some embodiments, the storage medium stores program instructions that, when executed, perform a positioning method for discrete DPM code regions as previously described.
The positioning method and device for the discrete DPM code region and the image processing device provided by the embodiment of the disclosure can realize the following technical effects:
in the disclosed embodiment, a boundary tracking method is used to search for a closed track in an image to determine closed data points and their centers. And traversing the image by using a sliding window, and carrying out histogram statistics on line segments among the data points when the data points in the window area reach a first number so as to screen closed data points based on a statistical result. And then counting the directions among the screened closed data points, and when the included angles of the maximum and the secondary directions meet a first angle, considering that the window area meets the DPM code characteristics, namely realizing positioning of the DPM code area. In the positioning process, the DPM code positioning graph is not required to be searched, so that the problem that the DPM code positioning fails due to the fact that the positioning graph area is stained, light-reflecting, poor in definition and the like is solved, and the positioning success rate is improved.
The foregoing general description and the following description are exemplary and explanatory only and are not restrictive of the application.
Drawings
One or more embodiments are illustrated by way of example and not limitation in the figures of the accompanying drawings, in which like references indicate similar elements, and in which like reference numerals refer to similar elements, and in which:
FIG. 1 is a schematic diagram of a positioning method for discrete DPM code regions provided by an embodiment of the present disclosure;
FIG. 2 is a schematic diagram of a method for obtaining closed data points provided by an embodiment of the present disclosure;
FIG. 3 is a schematic diagram of another positioning method for discrete DPM code regions provided by an embodiment of the present disclosure;
FIG. 4 is a schematic diagram of screening closed data points in a method of an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of the direction of the shortest line segment of a Dotcode code in a method of embodiments of the present disclosure;
FIG. 6 is a schematic diagram of locating a block containing a Maxicode in a method provided by an embodiment of the present disclosure;
FIG. 7 is a schematic diagram of a method for locating a block containing a DM code according to an embodiment of the disclosure;
fig. 8 is a schematic diagram of another positioning method for discrete DPM code regions provided by an embodiment of the present disclosure;
fig. 9 is a schematic diagram of another positioning method for discrete DPM code regions provided by an embodiment of the present disclosure;
fig. 10 is a schematic diagram of a positioning device for discrete DPM code regions provided by an embodiment of the present disclosure.
Detailed Description
So that the manner in which the features and techniques of the disclosed embodiments can be understood in more detail, a more particular description of the embodiments of the disclosure, briefly summarized below, may be had by reference to the appended drawings, which are not intended to be limiting of the embodiments of the disclosure. In the following description of the technology, for purposes of explanation, numerous details are set forth in order to provide a thorough understanding of the disclosed embodiments. However, one or more embodiments may still be practiced without these details. In other instances, well-known structures and devices may be shown simplified in order to simplify the drawing.
The terms first, second and the like in the description and in the claims of the embodiments of the disclosure and in the above-described figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate in order to describe embodiments of the present disclosure. Furthermore, the terms "comprise" and "have," as well as any variations thereof, are intended to cover a non-exclusive inclusion.
The term "plurality" means two or more, unless otherwise indicated.
In the embodiment of the present disclosure, the character "/" indicates that the front and rear objects are an or relationship. For example, A/B represents: a or B.
The term "and/or" is an associative relationship that describes an object, meaning that there may be three relationships. For example, a and/or B, represent: a or B, or, A and B.
The term "corresponding" may refer to an association or binding relationship, and the correspondence between a and B refers to an association or binding relationship between a and B.
As shown in conjunction with fig. 1, an embodiment of the present disclosure provides a positioning method for discrete DPM code regions, including:
s101 the processor searches for a closed trajectory in the image containing the discrete DPM code regions using boundary tracking to obtain all closed data points in the image and the center of the closed data points.
S102, the processor slides through the image by utilizing the sliding window, and performs histogram statistics on line segments between closed data points under the condition that the closed data points in the current sliding window area reach a first number so as to obtain the module size.
And S103, the processor screens closed data points according to the size of the module and counts the directions among the screened closed data points.
And S104, determining the current sliding window area as an area containing the discrete DPM code by the processor under the condition that the counted most-directional and the counted multi-directional included angles meet the preset included angle range.
Closed data points, also referred to herein as independent points, refer to a collection of a portion of the active pixel points in a discrete DPM code that can be considered as an independent, closed, discrete point having a shape approximating a regular geometric figure. For DPM codes generated by mechanical stippling, the independent points are mostly circular. The closed data points have closed trajectories, so the closed trajectories are searched in the image of the discrete DPM code region using boundary tracking to obtain closed point data. Meanwhile, in boundary tracking, the center of the closed data point may be determined based on the coordinates of the tracked boundary point. In this way, all closed data points and corresponding centers in the image can be obtained.
The image is then traversed using the sliding window. It will be appreciated that the sliding window has a size and that the number of closed data points within the region of the sliding window varies as the sliding window is positioned in different locations of the image during traversal of the image. If the number of closed data points reaches a first number (the first number being a set point that depends on the sliding window size and the characteristics of the discrete DPM code), the region may be a region containing the discrete DPM code. Therefore, counting the line segments between each closed data point in the region (the line segments refer to the connecting lines between the centers of each closed data point), mainly refers to counting the number of line segments with each length so as to obtain the module size. The module size refers to the size of the effective closed data point center point spacing of two adjacent and nearest neighbors in a DPM code. Wherein false points, i.e. invalid closed data points, exist in the image due to contamination and the like. The line segments of the closing point data are counted here so that the length of the shortest line segment is taken as the module size.
And then screening closed data points by using the module size, so that false points which do not meet the module size can be screened out. And counting the direction of the connecting line between the screened closed data points, and indicating that the positioning is successful when the direction included angle with the largest occurrence number and the largest occurrence number meets the first angle, wherein the current sliding window comprises a region of discrete DMP codes. According to the independent point distribution characteristic of the DPM code, the connecting lines of the shortest distance between the closed data points are approximately distributed in two directions, and the included angles of the directions are close to a certain fixed angle. Therefore, the most and the next most included angles are counted. Note that, when the directions of statistics are different, but the number of directions corresponding to the different directions is the same (the maximum number of directions are two directions), the included angles of the two directions with the maximum number are counted. Wherein, the first angle region may be different in the type of the discrete DPM codes and different types of DPM codes.
By adopting the positioning method for the discrete DPM code region provided by the embodiment of the disclosure, the closed track in the image is searched by utilizing the boundary tracking method so as to determine the closed data point and the center thereof. And traversing the image by using a sliding window, and carrying out histogram statistics on line segments among the data points when the data points in the window area reach a first number so as to screen closed data points based on a statistical result. And then counting the directions among the screened closed data points, and when the included angles of the maximum and the secondary directions meet a first angle, considering that the window area meets the DPM code characteristics, namely realizing positioning of the DPM code area. In the positioning process, the DPM code positioning graph is not required to be searched, so that the problem that the DPM code positioning fails due to the fact that the positioning graph area is stained, light-reflecting, poor in definition and the like is solved, and the positioning success rate is improved.
In addition, the embodiment of the disclosure can locate a certain block of area containing the discrete DPM code without searching the DPM code locating graph, and further perform subsequent outward pushing decoding, so that the operation speed is greatly improved, and the function of locating the code graph alternative area rapidly and efficiently is realized.
In conjunction with fig. 2, optionally, in step S101, the processor searches for a closed track in the image containing the discrete DPM code regions using a boundary tracking manner to obtain all closed data points in the image, including:
s111, the processor sends out horizontal scanning lines to two ends by taking the center of the image as a starting point to determine potential boundary points.
And S112, the processor performs boundary tracking from the potential boundary points, and determines that the closed region is a closed data point when the closed track is tracked and the closed region formed by the closed track meets the preset condition.
S113, the processor calculates the average value of all boundary tracking point coordinates of the closed data point, and takes the average value as the center of the corresponding closed data point.
Here, potential boundary points are determined prior to searching for a closed trajectory. And then carrying out boundary tracking by taking the potential boundary points as starting points so as to obtain a closed track. Specifically, with the center of the image as a starting point, horizontal scanning lines are emitted to both ends. The scanning may be performed at both ends, i.e., at the center, or at both ends, i.e., at the top and bottom. Alternatively, horizontal scan lines may be issued every L rows. The L rows may be 3-5 rows. It will be appreciated that the closed data point color and the image ground color in each discrete DPM code region image are different. Thus the position where the scan line passes from one color to another is used as a potential boundary point. I.e., the boundary points of the potential closed data points.
Further, boundary tracking is performed based on the determined potential boundary points, and if the tracked track is a closed track and the area formed by the closed track meets the preset condition, the closed area is indicated to be a closed data point. As previously described, a closed data point is a collection of discrete points, so its closed region must meet the size of an area. The preset condition means that the area of the closed region meets the preset area size. The closed trajectory of each closed data point is made up of a plurality of boundary tracking points. And recording coordinates of the boundary tracking points, and obtaining an average value to obtain a closed data point center corresponding to the closed track.
In addition, it should be noted that, when determining the potential boundary points, the starting point and the scanning direction of the scan line may be sent out in a customized manner. If a certain boundary point of the image is taken as a starting point, scanning is performed in the horizontal direction or the vertical direction where the boundary point is located. Since the search rate is faster by scanning from the center of the image to both sides, embodiments of the present disclosure send out horizontal scan lines to both ends with the center of the image as the starting point.
Optionally, the preset conditions in S112 include:
the width of the closed area in a certain direction is smaller than or equal to the first pixel and larger than or equal to the second pixel; and, the closed region is a centrosymmetric pattern or an approximately centrosymmetric pattern.
Here, the size of the closed region is defined. Wherein the sizes of the first pixel and the second pixel may be determined based on the type of DPM code. As an example, the first pixel may take on a value of 20 pixels and the second pixel may take on a value of 2 pixels. Furthermore, the closed area is typically a regular image, such as a circular, hexagonal, etc. centrosymmetric pattern. For some types of DPM codes, the contour shape of its closed data points is not a strictly central symmetrical image, but an approximate central symmetrical image. Thus, when the size of a closed region in a certain direction meets the requirements (not limited to a certain fixed direction, only one direction meets the requirements), and the closed region is an approximately centrosymmetric image or a centrosymmetric pattern, the data point of the closed region is determined to be a closed data point.
Optionally, in the case that the image is a binary image, determining the potential boundary point in S111 includes:
the position from black to white or from white to black when the horizontal scan line passes is determined as a potential boundary point.
It will be appreciated that only black and white two colors exist in the binary image. The potential boundary points may be black to white or white to black positions when the horizontal scan element is scanning. More specifically, when the discrete DMP code is a white background black dot, a combination of a white-to-black boundary and a black-to-white boundary represents the boundary of a closed data point; when the discrete DMP code is a black matrix white point, a combination of a black-to-white boundary and a white-to-black boundary represents a closed data point boundary.
Optionally, the processor in S112 determines the occlusion region by:
in the case where the DMP code is a white background black dot, the closed area is black.
In the case where the DMP code is a black matrix white dot, the closed area is white.
As described above, when the discrete DMP codes are white-to-black dots, a closed region formed by a white-to-black boundary and a black-to-white boundary is black, i.e., the closed data points are a collection of black discrete dots. When the discrete DMP code is a black matrix white point, a closed region of a black-to-white boundary and a white-to-black boundary is white, i.e., the closed data point is a collection of white discrete points.
Optionally, in step S102, the processor slides through the image using a sliding window, including:
the processor slides across the entire image from the center of the image with N pixels as intervals using a sliding window of M x M pixel size.
Wherein N is less than or equal to M.
Here, a sliding window of m×m pixels is created, starting from the center of the image, sliding through the entire image at intervals of pixels N. The sliding window of M x M pixels is a block of alternate regions containing discrete DPM codes. And when the number of closed data points in the sliding window reaches the first number, carrying out subsequent statistics, otherwise, continuing sliding the window. The distance between adjacent windows is pixel N, and N is less than or equal to M. Therefore, the sliding window is ensured to traverse the whole picture, and omission is avoided.
As shown in conjunction with fig. 3, an embodiment of the present disclosure provides another positioning method for discrete DPM code regions, including:
s101 the processor searches for a closed trajectory in the image containing the discrete DPM code regions using boundary tracking to obtain all closed data points in the image and the center of the closed data points.
S121, the processor slides through the image by utilizing the sliding window, and counts the number of the shortest line segments in the line segments formed between the closed data points by utilizing the histogram under the condition that the closed data points in the current sliding window area reach the first number.
And S122, in the case that the number of the shortest line segments is greater than or equal to the second number, the processor takes the length of the shortest line segments as the module size.
And S103, the processor screens closed data points according to the size of the module and counts the directions among the screened closed data points.
And S104, determining the current sliding window area as an area containing the discrete DPM code by the processor under the condition that the counted most-directional and the counted multi-directional included angles meet the preset included angle range.
Here, after the number of closed data points within the current sliding window area is greater than or equal to the first number, the center of each closed data point and the centers of adjacent closed data points are connected to form a line segment. And counting the line segment distance by using the histogram, and determining the length of the shortest line segment as the module size according to the independent point distribution characteristic of the DPM code when the number of the shortest line segment reaches the second number. Specifically, the first left-to-right abscissa d in the histogram that exceeds the threshold (i.e., the second number) is taken as the shortest distance between the DMP code closure data points, this distance d being referred to as the module size.
Wherein, in order to exclude a few false points between closed data points, the second number is set to avoid the false points affecting the judgment of the shortest distance. The module size is determined when the number of shortest line segments is sufficiently large. In the histogram, the abscissa is the length of a line segment, that is, the distance between adjacent closed data points, and the ordinate is the number of line segments at that distance.
Optionally, in step S103, the processor screens the closed data points according to the module size, including:
the processor determines a screening error according to the module size to determine a length range of the target line segment.
The processor screens out closure data points corresponding to line segments that do not fit the length range to obtain valid closure data points.
Wherein, the larger the module size, the larger the screening error.
Here, the closed data points are screened by using the module size, the closed data points with the line segment length being near the module size are reserved, and the closed data points with the line segment length being too long or too short are screened out. Different screening errors can be selectively set for different module sizes. Wherein, the larger the module size, the larger the screening error. As an example, when the module size is 5 pixels and below, the screening error may take on a value less than 1 pixel, such as 0.5 pixel. At this time, the length range of the target line segment=the module size±screening error. When the module size is 5 pixels to 10 pixels, the screening error can take a value of 1 pixel. When the module size is more than 10 pixels, the screening error can be less than or equal to 2 pixels and more than 1 pixel. Referring to FIG. 4, the box marks the point of screening, and the remaining line after screening is the line near the shortest distance
Optionally, in step S103, the processor counts the direction between the screened closed data points, including:
the processor traverses the direction gradient histogram in the image multiple times with a preset data length according to a set direction to count the direction between the valid closed data points. The abscissa of the direction gradient histogram is the direction, and the ordinate is the number of line segments.
And under the condition that the traversing direction histogram continuously appears a plurality of maximum values, the processor takes the middle direction as the direction with the largest current appearance frequency.
Here, the lines closing the shortest distance between data points should be approximately distributed in two directions according to the independent point distribution characteristics of the DPM code. Therefore, the direction histogram is traversed according to the set direction by the preset data length, and two obvious peaks are reflected on the direction histogram. Specifically, the position of the peak maximum value, which is the place where the number of occurrences is the largest, is found. Traversing the histogram again, one can find places where the number of occurrences is many. The abscissa of the direction histogram is the direction of the shortest line segment, and the ordinate is the number of line segments counted by the direction. Referring to fig. 5, taking discrete Dotcode in DPM code as an example, the directions of the shortest line segments are approximately distributed in the 0-degree direction and the 90-degree direction, so that the directions of 0-degree and 90-degree directions of the code pattern can be obtained only by obtaining the direction distribution of all the shortest line segments.
In addition, when traversing the direction histogram, a plurality of continuous maximum values may occur, the middle direction is taken as the direction with the largest current occurrence number. The middle direction refers to an average value of a plurality of directions. As an example, in traversing the direction histogram, the shortest line segment directions are approximately distributed in the 0 degree direction. Specifically, the directions of the partial line segments are distributed in the-1 degree direction, the directions of the partial line segments are distributed in the 0 degree direction, and the directions of the partial line segments are distributed in the 1 degree direction, and the numbers of the line segments in the three directions are the same. In this case, the direction of 0 ° which is the average of three directions is selected as the direction in which the number of current occurrences is the largest. As another example, if the number of line segments in the-1 ° direction, the 0 ° direction, the 1 ° direction, and the 2 ° direction is the same, the direction with the average value of 0.5 ° in the four directions is selected as the direction with the largest number of current occurrences. The preset data length and the setting direction can be customized. The preset data length refers to the size of another window to be constructed, such as traversing the direction histogram in a left-to-right direction through a window having a width equal to the size of the pixel S.
Optionally, in step S104, the processor determines the preset angle range by:
the processor determines the type of DPM code.
And the processor determines the included angle of the distribution direction of the shortest line segment according to the corresponding relation between the type and the included angle.
And the processor determines a preset included angle range according to the included angle and the angle threshold value.
Here, the included angle between the most number of line segments and the sub-multi-direction is the code pattern direction included angle. The code pattern direction included angle refers to an included angle formed by connecting the central positions of adjacent effective closed data points in the discrete DPM codes. Different DPM codes, different code pattern direction included angles are determined, and a mapping relation exists between the DPM codes and the determined code pattern direction included angles. As an example, the code pattern direction included angle of the Dotcode is 90 degrees; the code pattern direction included angle of the Maxicode code is 60 degrees. The angle threshold may be set based on demand, such as setting 10 ° or 5 °. Thus, the preset angle range=the code pattern direction angle ±angle threshold.
In addition, when the counted most numerous directions and the counted many times of multidirectional included angles meet the preset included angle range, the successful positioning is indicated, and the current sliding window contains the area of the discrete DMP codes. Otherwise, steps S102-S104 are repeated. Referring to fig. 6, 7, the gray box region is a region oriented to contain discrete DPM codes, where the longer two intersecting straight lines are the code pattern directions.
As shown in conjunction with fig. 8, an embodiment of the present disclosure provides another positioning method for discrete DPM code regions, including:
s205, the processor performs binarization processing on the image to obtain a processed binary image.
S206, when the image noise of the binary image is larger than the noise threshold value, the processor performs smoothing filter processing on the binary image.
S101 the processor searches for a closed trajectory in the image containing the discrete DPM code regions using boundary tracking to obtain all closed data points in the image and the center of the closed data points.
S102, the processor slides through the image by utilizing the sliding window, and under the condition that the closed data points in the current sliding window area reach the first number, the processor counts the line segments among the closed data points to obtain the module size.
And S103, the processor screens closed data points according to the size of the module and counts the directions among the screened closed data points.
And S104, determining the current sliding window area as an area containing the discrete DPM code by the processor under the condition that the counted most-directional and the counted multi-directional included angles meet the preset included angle range.
Here, the image is binarized before the DPM code region is located. Specifically, binarization methods such as an average value method, a double peak method, and OTSU (oxford method) can be used. And in the binarization process, if the image noise level is too high, the whole image can be optionally smoothed by smoothing filtering so as to reduce the image noise. The binarized image only has two sides of black and white, so that the calculation efficiency of boundary tracking can be improved.
As shown in conjunction with fig. 9, an embodiment of the present disclosure provides another positioning method for discrete DPM code regions, including:
s501, start.
S502, performing binarization processing on the original image to obtain a binarized image.
S503, emitting horizontal scanning lines from the center of the binarized image to the upper end and the lower end to determine potential boundary points.
S504, conducting boundary tracking from each potential boundary point as a starting point, searching for a closed data point meeting the condition of the closed region and calculating the center of the closed data point.
S505, using a sliding window of m×m pixels, the entire image is slid from the center of the image with the pixel N as an interval.
S506, judging whether the number of closed data points in the current sliding window area is larger than or equal to the first number, and if so, executing S507; if not, S505 is performed.
S507, counting the number of shortest line segments in line segments formed between closed data points by using the histogram so as to obtain the module size.
S508, screening closed data points according to the size of the module, and counting the directions among the screened closed data points.
S509, judging whether the counted included angles of the most number of directions and the next most number of directions meet the preset included angle range, and if so, executing S510; if not, S505 is performed.
S510, determining the current sliding window area as an area containing discrete DPM codes.
S511, end.
As shown in connection with fig. 10, an embodiment of the present disclosure provides a positioning device 200 for discrete DPM code regions, comprising a processor (processor) 100 and a memory (memory) 101. Optionally, the apparatus may further comprise a communication interface (Communication Interface) 102 and a bus 103. The processor 100, the communication interface 102, and the memory 101 may communicate with each other via the bus 103. The communication interface 102 may be used for information transfer. Processor 100 may invoke logic instructions in memory 101 to perform the positioning method for discrete DPM code regions of the above-described embodiments.
Further, the logic instructions in the memory 101 described above may be implemented in the form of software functional units and may be stored in a computer readable storage medium when sold or used as a stand alone product.
The memory 101 is a computer readable storage medium that can be used to store a software program, a computer executable program, such as program instructions/modules corresponding to the methods in the embodiments of the present disclosure. The processor 100 executes functional applications and data processing by running program instructions/modules stored in the memory 101, i.e. implements the positioning method for discrete DPM code regions in the above-described embodiments.
The memory 101 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, at least one application program required for a function; the storage data area may store data created according to the use of the terminal device, etc. Further, the memory 101 may include a high-speed random access memory, and may also include a nonvolatile memory.
An embodiment of the present disclosure provides an image processing apparatus including: the device body, and the positioning apparatus 200 for discrete DPM code regions described above. The positioning device 200 for discrete DPM code areas is mounted to the apparatus body. The mounting relationships described herein are not limited to placement within a product, but include mounting connections to other components of a product, including but not limited to physical, electrical, or signal transmission connections, etc. Those skilled in the art will appreciate that the positioning device 200 for discrete DPM code regions may be adapted to a viable product body to achieve other viable embodiments.
Embodiments of the present disclosure provide a computer readable storage medium storing computer executable instructions configured to perform the above-described positioning method for discrete DPM code regions.
The computer readable storage medium may be a transitory computer readable storage medium or a non-transitory computer readable storage medium.
Embodiments of the present disclosure may be embodied in a software product stored on a storage medium, including one or more instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of a method according to embodiments of the present disclosure. And the aforementioned storage medium may be a non-transitory storage medium including: a plurality of media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or a transitory storage medium.
The above description and the drawings illustrate embodiments of the disclosure sufficiently to enable those skilled in the art to practice them. Other embodiments may involve structural, logical, electrical, process, and other changes. The embodiments represent only possible variations. Individual components and functions are optional unless explicitly required, and the sequence of operations may vary. Portions and features of some embodiments may be included in, or substituted for, those of others. Moreover, the terminology used in the present application is for the purpose of describing embodiments only and is not intended to limit the claims. As used in the description of the embodiments and the claims, the singular forms "a," "an," and "the" (the) are intended to include the plural forms as well, unless the context clearly indicates otherwise. Similarly, the term "and/or" as used in this application is meant to encompass any and all possible combinations of one or more of the associated listed. Furthermore, when used in this application, the terms "comprises," "comprising," and/or "includes," and variations thereof, mean that the stated features, integers, steps, operations, elements, and/or components are present, but that the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof is not precluded. Without further limitation, an element defined by the phrase "comprising one …" does not exclude the presence of other like elements in a process, method or apparatus comprising such elements. In this context, each embodiment may be described with emphasis on the differences from the other embodiments, and the same similar parts between the various embodiments may be referred to each other. For the methods, products, etc. disclosed in the embodiments, if they correspond to the method sections disclosed in the embodiments, the description of the method sections may be referred to for relevance.
Those of skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. The skilled artisan may use different methods for each particular application to achieve the described functionality, but such implementation should not be considered to be beyond the scope of the embodiments of the present disclosure. It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the embodiments disclosed herein, the disclosed methods, articles of manufacture (including but not limited to devices, apparatuses, etc.) may be practiced in other ways. For example, the apparatus embodiments described above are merely illustrative, and for example, the division of the units may be merely a logical function division, and there may be additional divisions when actually implemented, for example, multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. In addition, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interface, device or unit indirect coupling or communication connection, which may be in electrical, mechanical or other form. The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to implement the present embodiment. In addition, each functional unit in the embodiments of the present disclosure may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. In the description corresponding to the flowcharts and block diagrams in the figures, operations or steps corresponding to different blocks may also occur in different orders than that disclosed in the description, and sometimes no specific order exists between different operations or steps. For example, two consecutive operations or steps may actually be performed substantially in parallel, they may sometimes be performed in reverse order, which may be dependent on the functions involved. Each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.

Claims (10)

1. A positioning method for discrete DPM code regions, comprising:
searching a closed track in an image containing a discrete DPM code region by utilizing boundary tracking so as to obtain all closed data points in the image and centers of the closed data points;
sliding the traversal image by utilizing the sliding window, and counting line segments among the closed data points under the condition that the number of the closed data points in the current sliding window area reaches a first number so as to obtain the size of the module; the module size refers to the size of the distance between two adjacent and nearest effective closed data point center points in the DPM code;
screening closed data points according to the size of the module, and counting the directions among the screened closed data points;
and under the condition that the counted most numerous directions and the counted many times of multidirectional included angles meet the preset included angle range, determining the current sliding window area as an area containing the discrete DPM codes.
2. The method of claim 1, wherein searching for closed tracks in an image containing discrete DPM code regions using boundary tracking to obtain all closed data points in the image and a center of closed data points comprises:
sending out horizontal scanning lines to two ends by taking the center of the image as a starting point so as to determine potential boundary points;
boundary tracking is carried out from potential boundary points, and under the condition that a closed track is tracked and a closed area formed by the closed track meets a preset condition, data points in the closed area are determined to be closed data points;
the average value of all the boundary tracking point coordinates of the closed data point is calculated, and the average value is taken as the center of the corresponding closed data point.
3. Method according to claim 2, characterized in that in case the image is a binary image, potential boundary points are determined and/or the occlusion region is determined by:
determining the position from black to white or from white to black when the horizontal scanning line passes through as a potential boundary point; and/or the number of the groups of groups,
determining that the closed area is black under the condition that the DMP code is white background and black dot; in the case where the DMP code is a black matrix white dot, the closed area is determined to be white.
4. The method of claim 1, wherein the counting line segments between closed data points to obtain a module size comprises:
counting the number of shortest line segments in line segments formed between closed data points by using a histogram;
in the case where the number of the shortest line segments is greater than or equal to the second number, the length of the shortest line segment is taken as the module size.
5. The method of claim 4, wherein the screening closed data points based on module size comprises:
according to the size of the module, determining a screening error to determine the length range of the target line segment;
screening closed data points corresponding to line segments which do not accord with the length range to obtain effective closed data points;
wherein, the larger the length of the module size, the larger the screening error.
6. The method of claim 5, wherein the statistically screened directions between closed data points comprises:
traversing the direction gradient histogram in the image for a plurality of times according to a preset data length and a set direction so as to count the directions among the effective closed data points; wherein the abscissa of the direction gradient histogram is the direction, and the ordinate is the number of line segments;
when the traversing direction histogram continuously appears a plurality of maximum values, the middle direction is taken as the direction with the largest current appearance frequency.
7. The method of claim 1, wherein the predetermined range of angles is determined by:
determining the type of the DPM code;
determining the included angle of the distribution direction of the shortest line segment according to the corresponding relation between the type and the included angle;
and determining a preset included angle range according to the included angle and the angle threshold value.
8. The method according to any of claims 1 to 7, characterized in that before searching for a closed trajectory in an image containing discrete DPM code areas using boundary tracking means, the method further comprises:
performing binarization processing on the image to obtain a processed binary image;
and when the image noise of the binary image is larger than the noise threshold value, performing smoothing filtering processing on the binary image.
9. A positioning device for discrete DPM code areas, comprising a processor and a memory storing program instructions, characterized in that the processor is configured to perform the positioning method for discrete DPM code areas of any one of claims 1 to 8 when executing the program instructions.
10. An image processing apparatus, characterized by comprising:
an equipment body;
the positioning device for discrete DPM code areas of claim 9, mounted to the apparatus body.
CN202311102181.4A 2023-08-30 2023-08-30 Positioning method and device for discrete DPM code region and image processing equipment Active CN116822549B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311102181.4A CN116822549B (en) 2023-08-30 2023-08-30 Positioning method and device for discrete DPM code region and image processing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311102181.4A CN116822549B (en) 2023-08-30 2023-08-30 Positioning method and device for discrete DPM code region and image processing equipment

Publications (2)

Publication Number Publication Date
CN116822549A CN116822549A (en) 2023-09-29
CN116822549B true CN116822549B (en) 2023-12-22

Family

ID=88117033

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311102181.4A Active CN116822549B (en) 2023-08-30 2023-08-30 Positioning method and device for discrete DPM code region and image processing equipment

Country Status (1)

Country Link
CN (1) CN116822549B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102708351A (en) * 2012-05-24 2012-10-03 江南大学 Method for fast identifying Data Matrix two-dimensional bar code under complicated working condition background
CN104463067A (en) * 2014-12-04 2015-03-25 四川大学 Method for extracting macro blocks of Grid Matrix two-dimensional bar code
CN115880362A (en) * 2022-12-22 2023-03-31 深圳思谋信息科技有限公司 Code region positioning method and device, computer equipment and computer readable storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006078359A1 (en) * 2004-12-03 2006-07-27 Symbol Technologies, Inc. Bar code scanner decoding
CN1885311A (en) * 2006-05-29 2006-12-27 深圳矽感科技有限公司 Two-dimensional code, encoding and decoding method thereof
JP6505732B2 (en) * 2013-11-07 2019-04-24 スキャントラスト・エスエイScanTrust SA Two-dimensional barcode and authentication method of such barcode
WO2016103285A1 (en) * 2014-12-24 2016-06-30 Datalogic Ip Tech S.R.L. System and method for reading direct part marking (dpm) codes on objects

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102708351A (en) * 2012-05-24 2012-10-03 江南大学 Method for fast identifying Data Matrix two-dimensional bar code under complicated working condition background
CN104463067A (en) * 2014-12-04 2015-03-25 四川大学 Method for extracting macro blocks of Grid Matrix two-dimensional bar code
CN115880362A (en) * 2022-12-22 2023-03-31 深圳思谋信息科技有限公司 Code region positioning method and device, computer equipment and computer readable storage medium

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
DPM码快速定位关键技术研究;刘志 等;浙江工业大学学报;28-33 *
基于自适应超像素分割的点刻式DPM区域定位算法研究;王娟 等;自动化学报;991-1003 *
复杂条件下DPM条码的角点检测;王萍 等;计算机工程与应用;154-159 *

Also Published As

Publication number Publication date
CN116822549A (en) 2023-09-29

Similar Documents

Publication Publication Date Title
US5814801A (en) Maxicode data extraction using spatial domain features exclusive of fourier type domain transfer processing
CN109059922B (en) Mobile robot positioning method, device and system
GB2350462A (en) A method for reading a two-dimensional barcode
EP0961218A1 (en) Method of binarization in an optical character recognition system
CN113177959B (en) QR code real-time extraction method in rapid movement process
KR102226845B1 (en) System and method for object recognition using local binarization
CN115131351B (en) Engine oil radiator detection method based on infrared image
CN101865859A (en) Detection method and device for image scratch
CN1198238C (en) Image processor and method for producing binary image by multi-stage image
CN108229232A (en) The method of batch scanning Quick Response Code and the device of batch scanning Quick Response Code
CN111311497B (en) Bar code image angle correction method and device
CN116822549B (en) Positioning method and device for discrete DPM code region and image processing equipment
Bodnár et al. A novel method for barcode localization in image domain
CN107423653B (en) Two-dimensional code preprocessing method, system and decoding method
CN111242051B (en) Vehicle identification optimization method, device and storage medium
CN112507751A (en) QR code positioning method and system
CN110135382B (en) Human body detection method and device
CN111860498A (en) Method and device for generating antagonism sample of license plate and storage medium
CN110059695B (en) Character segmentation method based on vertical projection and terminal
CN111815725A (en) QR code region positioning method
CN111598104A (en) License plate character recognition method and system
JP4224328B2 (en) Car number recognition device
CN115880362A (en) Code region positioning method and device, computer equipment and computer readable storage medium
CN112052859B (en) License plate accurate positioning method and device in free scene
CN113971803A (en) Segmentation method of conglutinated characters in image and related equipment

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