Disclosure of Invention
The application provides a code identification and analysis method and system based on one-dimensional punching, which can ensure the robustness of the code identification and ensure that the usability and the identifiability of articles can be kept in the processes of production, transportation and use.
In a first aspect, the present application provides a one-dimensional punching-based code identification method, wherein a preposed positioning hole and a postpositional positioning hole are formed on an object through punching; according to the required code value, punching the corresponding number and/or position of the coding holes in the coding space between the front positioning hole and the rear positioning hole to identify the number and/or position of the coding holes as the code value, thereby forming the code based on one-dimensional punching.
In some preferred embodiments, said punching a corresponding number and/or position of said code holes between said prepositioned and postpositioned positioning holes comprises:
punching a set number of coding holes at different positions on an object;
or, forming a group of coding holes as a first group of coding holes, identifying the first group of coding holes as a first bit of the code, forming a second group of coding holes as a second bit of the code at positions apart from the first group of coding holes by a first number of hole sites, and so on, forming a Yth group of coding holes as a Yth bit of the code at positions apart from the Y-1 th group of coding holes by a Y-1 th number of hole sites, wherein code values from the first bit to the Yth bit all have multiple values; the values of the first number to the Y-1 number are different or at least partially the same, the numbers of the first group of coding holes to the Y group of coding holes are different or at least partially the same, the value ranges of the code values of the first bit to the Y bit are different or at least partially the same, and Y is a positive integer greater than 2.
In some preferred embodiments, the size of each code hole is consistent, and the centers of the code holes are on a straight line, the distance between each code hole and the front positioning hole is consistent, and the distance between the first code hole and the last code hole and the rear positioning hole is equal.
In a second aspect, the present application provides a method for analyzing codes based on one-dimensional punching, where the codes include prepositioned positioning holes, postpositioned positioning holes, and a code space, and the code space has code holes therein, so as to form codes based on one-dimensional punching;
the method comprises the following steps:
processing the encoded image to sharpen the contours of the holes in the encoded image;
finding the prepositioning hole, the postpositioning hole and the coding space in the processed coding image;
searching each coding hole in the coding space;
detecting abnormal features to exclude noise interference;
the code is parsed based on the number and/or location of the code holes.
In some preferred embodiments, said processing said encoded image comprises:
carrying out image stabilization processing;
carrying out contrast enhancement processing on each color and brightness of the image;
changing the original image from a color image to a gray image;
the contours in the image are enhanced.
In some preferred embodiments, the parsing the code based on the number and/or position of the code holes comprises:
identifying the combination of the number and the position of the coding holes, and analyzing different combinations of the number and the position into different code values;
or identifying a group of coding holes as a first group of coding holes, identifying the first group of coding holes as the first bits of the code, identifying a second group of coding holes with a first number of hole sites away from the first group of coding holes as the second bits of the code, and so on, identifying a Yth group of coding holes with a Y-1 number of hole sites away from a Y-1 group of coding holes as the Yth bits of the code, wherein code values from the first bits to the Yth bits have various values, and analyzing code values from the first bits to the Yth bits, thereby completing analysis of the code; the values of the first number to the Y-1 number are different or at least partially the same, the numbers of the first group of coding holes to the Y group of coding holes are different or at least partially the same, the value ranges of the code values of the first bit to the Y bit are different or at least partially the same, and Y is a positive integer greater than 2.
In some preferred embodiments, the first group of code holes is a group of code holes closest to the prepositioned position hole, the number of the first group of code holes to the Y group of code holes is the same, and the values of the first number to the Y-1 number are all 1.
In some preferred embodiments, each of the code holes in the code space has a uniform size and a uniform center, the code holes have a uniform pitch, and the distance between the first code hole and the front positioning hole is equal to the distance between the last code hole and the rear positioning hole.
In some preferred embodiments, the performing image stabilization processing includes: exposure, brightness adjustment, or sharpening.
In some preferred embodiments, the detecting the abnormal feature to exclude the noise interference is specifically: values having a set difference from the normal value are excluded by an abnormal value detection algorithm.
In a third aspect, the present application provides a coding system based on one-dimensional puncturing, comprising puncturing means and visual recognition means; the punching device is used for punching the object to form a code; the visual recognition device is used for executing the instructions of the method.
In a fourth aspect, the present application further provides a one-dimensional puncturing-based encoding system, comprising:
one or more processors;
a memory for storing one or more programs;
the one or more programs may be executable by the one or more processors to implement the above-described methods.
In a fifth aspect, the present application provides a computer-readable storage medium characterized by: the computer-readable storage medium has stored therein program instructions that, when executed by a processor of a computer, cause the processor to perform the above-described method.
Compared with the prior art, the beneficial effect of this application has:
the method has the advantages that the outline of the hole is clearly processed on the image of the code based on the one-dimensional punching, each code hole in the code space is found, noise interference is eliminated by detecting abnormal features, the code is analyzed based on the number and/or the positions of the code holes, the code can be analyzed at a high accuracy rate, and the robustness of the code identification can be guaranteed.
Detailed Description
In order to make the technical problems, technical solutions and advantageous effects to be solved by the embodiments of the present application more clearly apparent, the present application is further described in detail below with reference to fig. 1 to 8 and the embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
It will be understood that the terms "length," "width," "upper," "lower," "front," "rear," "left," "right," "vertical," "horizontal," "top," "bottom," "inner," "outer," and the like, refer to an orientation or positional relationship indicated in the drawings that is solely for the purpose of facilitating the description of the embodiments and simplifying the description, and do not indicate or imply that the referenced device or element must have a particular orientation, be constructed and operated in a particular orientation, and thus should not be considered as limiting the application.
First embodiment
Referring to fig. 1, the present embodiment provides a coding system based on one-dimensional punching, which includes a punching apparatus 1 and a visual recognition apparatus 2.
The punching device 1 is used for punching an object to form a code. In this embodiment, the punching apparatus 1 is a common punching device, and may be a drilling device, and the physical characteristics of the punching device can be determined according to the object to be punched. The material of the object to be perforated includes, but is not limited to, metal, plate, plastic, resin, paper, etc. In the present embodiment, the perforation diameter is constant, and can be determined according to the size of the production object, the moving distance, the distance between the camera and the identification object, and the like, and can be determined to be all the hole diameter sizes which can be used in the actual production, such as 500 micrometers, 1 millimeter, 1 centimeter, 1 decimeter, and the like. Each punching is controlled by the coding identification method based on one-dimensional punching of the embodiment, and the method comprises the number of the punching and the punching position, wherein the diameter of each hole is consistent.
In the present embodiment, referring to fig. 4, codes are formed by punching holes in an object, one code corresponding to onecode area 100. The encodedregion 100 includes a row of holes of fixed hole size, thereby forming a one-dimensional hole code. The shape of the holes includes, but is not limited to, circular, oval, square, rectangular, diamond, etc. The encodedarea 100 may be present at a board edge (e.g., a PCB board), a package surface, a housing edge, etc., depending on actual production requirements. Theentire code area 100 includes two locating holes and acode space 110 between the two locating holes; referring to fig. 4, the two positioning holes are afront positioning hole 101 and arear positioning hole 102, respectively; thecoding space 110 is a reserved potential punching position and is located between thepreposed positioning hole 101 and thepostpositioned positioning hole 102. For the completed coding, there are codingholes 111 in thecoding space 110.
A corresponding number and/or position of the code holes 111 are punched between theprepositioning hole 101 and thepostpositioning hole 102 according to a desired code value to identify the number and/or position of the code holes 111 as a code value, thereby forming a one-dimensional punching-based code.
The visual recognition device 2 recognizes and analyzes the code on the object through the image data shot by the camera. The core components of the visual recognition device 2 are a camera and an attached camera system and lighting system. In the present embodiment, the visual recognition apparatus 2 is used to execute the instruction of the one-dimensional puncturing-based code parsing method of the present embodiment.
Referring to fig. 2, the present embodiment provides a one-dimensional puncturing-based encoding parsing method, which includes steps S1 to S5.
Step S1, the encoded image is processed to clarify the outline of the hole in the encoded image.
Before step S1 is executed, the encoded image may be obtained, and specifically, the encoded image may be obtained by capturing an image with a camera.
Referring to fig. 3, step S1 specifically includes steps S11 through S14.
Step S11, image stabilization processing is performed. Specifically, the image is subjected to exposure, brightness adjustment, sharpening, and the like to remove environmental noise including but not limited to jitter, uneven illumination, insufficient brightness, background interference, and the like.
Step S12 is to perform contrast enhancement processing for each color and brightness of the image.
Step S13 is to change the original image from a color image to a grayscale image.
And step S14, enhancing the outline in the image. In particular, the outline edge of the hole is enhanced by means of, but not limited to, erosion, expansion and the like, so as to eliminate interference or noise caused by hole change in the production process.
Step S2, find theprepositioning hole 101, thepostpositioning hole 102 and thecode space 110 in the processed code image. The method is realized by a characteristic extraction mode.
In step S3, eachcode hole 111 in thecode space 110 is searched. Specifically, the center of the hole, such as the center of the circle, may be searched and located, and then each code hole may be found.
And step S4, detecting abnormal features to eliminate noise interference. Specifically, a value with a set difference from a normal value is eliminated through a commonly used abnormal value detection algorithm, so that errors in coding hole identification caused by noise interference such as matrix material shape change, high-temperature expansion, circular hole filling and the like are prevented.
Step S5, the code is parsed based on the number and/or positions of the code holes 111. This step includes calculation and location of the distance.
Assuming that the number of hole positions in the
coding space 110 is N, the number of actual coding holes 111 is M, wherein the actual number of punched holes M in the
coding space 110 is M<N, M and N are positive integers. Then, each code actually finds M positions out of N code positions for puncturing. Total code number of
For example: ginseng radix (Panax ginseng C.A. Meyer)Referring to fig. 6, if N is 24 and M is 15, the total number of codes is 1.7 × 10
18(ii) a Each hole code will correspond to a string of numeric characters or a character string, which is stored in a computer database system. If the number of digits of the numeric string or the character string can be determined as a code with a fixed length or a variable length according to the total code quantity, each digit can be any number or character from 0 to 9, such as English characters a-z or Latin characters; for example: if the code length is 10 bits, either 0000000000 or aaaaaaaaaa may be one of the identifier code values.
The size of eachcoding hole 111 in thecoding space 110 is consistent, the centers of the coding holes are on the same straight line, the distance between eachcoding hole 111 is consistent, and the distance between the first coding hole and thefront positioning hole 101 is equal to the distance between the last coding hole and therear positioning hole 102.
Referring to fig. 5, the hole pitch is proportional to the hole size, such as diameter. This ratio is defined as R, for example: if R is 1.5, the distance between the centers of two adjacent holes is 3 times the distance of the circle radius for the circular hole. The pore size and the R value can be determined according to the characteristics of available space size, matrix material and the like in the actual production situation. The hole size can be set to different values for different production practical requirements.
Thus, one-dimensional puncturing-based encoding can be realized.
Based on the above, the method for parsing or identifying the code in the present embodiment includes, but is not limited to, the following four ways.
The first way is to identify or parse the code based on the number of code holes. Calculating the number of the coding holes, and analyzing different numbers of the coding holes into different code values; for example, one code hole is analyzed as code value one, two code holes are analyzed as code value two, three code holes are analyzed as code value three, and so on. Correspondingly, the coding identification method used in puncturing is as follows: and punching a corresponding number of holes on the object according to the required code value.
The second way is to identify or parse the code based on the position of the code holes. Calculating the positions of the coding holes with the set number, and analyzing different positions into different code values; for example, the number of the code holes is three, and the three code holes are located at different positions and are analyzed into different code values; for example, three code holes correspond to one code value when located at the first, second, and third bits, respectively, and three code holes correspond to another code value when located at the last first, second, and third bits, respectively. Correspondingly, the coding identification method used in puncturing is as follows: according to the required code value, a set number of code holes are punched at different positions on the object.
The third way is to identify or parse the code based on the number and position of the code holes. Identifying the combination of the number and the position of the coding holes, and analyzing the combination of different numbers and positions into different code values; for example, a total of N potential puncture locations in the coding space are used to resolve a code having M code holes into a single code hole
Or
Correspondingly, the coding identification method used in puncturing is as follows: randomly fetching M (M) from N punch positions<N) punching at several positions, expressing each case by a number corresponding to a code value in the range of
Or
The fourth way is also to identify or parse the code based on the position of the code holes. Identifying a group of coding holes as a first group of coding holes, identifying the first group of coding holes as a first bit of a code, identifying a second group of coding holes which are a first number of bit positions away from the first group of coding holes as a second bit of the code, and identifying a Yth group of coding holes which are a Y-1 number of bit positions away from a Y-1 group of coding holes as a Y-bit of the code by analogy; the code values of the first bit to the Y bit have various values; analyzing the code values of the first bit to the Y bit so as to complete the analysis of the codes; the values of the first number to the Y-1 number are different or at least partially the same, the numbers of the first group of coding holes to the Y group of coding holes are different or at least partially the same, the value ranges of the code values of the first bit to the Y bit are different or at least partially the same, and Y is a positive integer greater than 2. Correspondingly, the coding identification method used in puncturing is as follows: forming a group of coding holes as a first group of coding holes, identifying the first group of coding holes as a first bit of a code, forming a second group of coding holes as a second bit of the code at positions with a first number of hole sites away from the first group of coding holes, and so on, forming a Y-th group of coding holes as a Y-th bit of the code at positions with a Y-1-th number of hole sites away from the Y-1-th group of coding holes.
A case of the fourth mode will be described. Referring to fig. 7, a first group of X code holes closest to the prepositioned holes is identified as a first group of code holes of the code, i.e. as a first bit of the code, where X is a positive integer; the number of the first group of coding holes to the number of the Y group of coding holes are the same, and the number of the coding holes is X; identifying a second set of X code holes one hole location from the first set of X code holes as a second bit of the code; by analogy, identifying the Y-th group of X coding holes which are one hole site away from the Y-1-th group of X coding holes as the Y-th bit of the code; the code values of the first bit to the Y bit have X values, and can be realized by coding holes with different shapes; parsing a code into XYOne of the code values. Defining the 10 hole positions closest to the prepositioned hole as the first bit of the code in the coding space, wherein the 10 hole positions are called a potential code box (PB), and the value of the first bit can be any number from 0 to 9 or any symbol in a certain symbol set (such as a-j); then moving one hole position backwards to obtain a second group of 10 hole Positions (PB), defining the second group of 10 hole positions as a second bit of the code; the value of the second bit may likewise be any number from 0 to 9 or any symbol in a set of symbols (e.g., a-j); by analogy, moving Y-1 times to obtain the Y-th bit, each code is a code value with fixed Y length, each bit code value has 10 possible values, and the total code number is 10Y. In other cases, the number of holes of several sets of code holesAll are the same, and the rest are different; the distances among a plurality of groups of coding holes are the same, and the rest are different; the code values of a plurality of bits have the same value range, and the rest are different.
In PCB production, the board needs to go through many production processes, and is mostly chemical process, and the condition is harsh. The materials used in the traditional two-dimensional code, RFID and the like can be damaged and can not be identified, for example, the copper plating process can cover the materials, and even the materials cannot be added to avoid affecting the product quality. For the punching mode, although the holes may be deformed and blocked in the production process, the embodiment performs clear outline processing on the image based on the one-dimensional punched codes, finds each code hole in the code space, eliminates noise interference through detecting abnormal features, further analyzes the codes based on the number and/or the positions of the code holes, can identify and analyze the codes with higher accuracy, can ensure the robustness of code identification, and can realize identification of each piece of PCB due to large code value range, thereby helping factories and even whole industries to realize identification and tracking of each piece of products from raw materials to finished products, assisting in realizing quality tracking and analysis, and helping enterprises to control the product and service quality.
The embodiment can be used for realizing unique identification and tracking of industrial products in the production process, the transportation process or the trial process. A row of one-dimensional hole codes are formed by punching the objects (the punching positions can be arranged at proper positions according to the characteristics of products and production requirements), the codes can be identified by a camera in each production process or in the later transportation, circulation and use links so as to determine the unique identity of the objects and track the objects, and the cost is low.
In the embodiment, through the punching mode, extra materials do not need to be added to each object to be identified, so that the cost cannot be increased due to the increase of the number of the objects to be identified; the code is slightly influenced by the environment in the production process, for example, the code can be subjected to high temperature, soaking, vibration, beating, even main body deformation and the like, and the code has high robustness; the sizes or positions of the coding holes with different sizes can be designed according to the size, the material characteristics and the like of the object to be marked, and the one-dimensional coding space is easy to adapt to different application environments and can be positioned at the edges of various objects; in addition, the coding range is large, and the unique identification of the types of industrial products and each product can be realized.
Second embodiment
Referring to fig. 8, the present embodiment provides a one-dimensional puncturing-based encoding system, including:
one or more processors 5;
a memory 6 for storing one or more programs;
the one or more programs may be executable by the one or more processors 5 to implement the above-described methods.
Those skilled in the art will appreciate that all or part of the processes of the embodiments methods may be performed by a computer program, which may be stored in a computer-readable storage medium and executed to perform the processes of the embodiments methods. And the aforementioned storage medium includes: various media capable of storing program codes, such as ROM or RAM, magnetic or optical disks, etc.
The foregoing is a further detailed description of the present application in connection with specific/preferred embodiments and is not intended to limit the present application to that particular description. For a person skilled in the art to which the present application pertains, several alternatives or modifications to the described embodiments may be made without departing from the concept of the present application, and these alternatives or modifications should be considered as falling within the scope of the present application.