Disclosure of Invention
Accordingly, the present invention provides a method, apparatus, and device for image recognition of a PCB circuit board in an attempt to solve or at least alleviate at least one of the above problems.
According to one aspect of the present invention, there is provided an image recognition method of a PCB, including:
Acquiring a molding image of the PCB, wherein the molding image of the PCB comprises an identification through hole area of the PCB, and the identification through hole area comprises a positioning through hole area and a sequence through hole area;
Acquiring a first processing forming image formed by the forming image of the PCB after first processing according to the forming image of the PCB, wherein the first processing comprises a filtering algorithm;
Acquiring a second processing forming image formed by the first processing forming image after second processing according to the first processing forming image, wherein the second processing forming image comprises an image binarization algorithm;
Acquiring a search area of the second processing forming image according to the second processing forming image and the position information of the identification through hole area in the second processing forming image;
Obtaining a plurality of discrete sequence through hole areas scattered by the screened identification through hole areas and circle center coordinates of a fitting circle of the discrete sequence through hole areas according to the search area of the second processed and formed image and the screening rule of the identification through hole areas;
and according to the circle center coordinates of the fit-into circles of the discrete sequence through hole areas, generating the serial number of the PCB, and completing the image identification of the PCB.
In another embodiment of the present application, the obtaining the molded image of the PCB, where the molded image of the PCB includes the identification through hole area of the PCB, includes:
Arranging the PCB above the mapping light source, wherein the identification through hole of the PCB is aligned with the mapping light source;
setting an industrial camera above the PCB, and collecting all areas where the identification through holes of the PCB are located by the industrial camera;
and the industrial camera shoots the identification through hole area of the PCB when the mapping light source projects the light source to the PCB, and obtains the molding image of the PCB.
In another embodiment of the present application, the obtaining a first processed molded image formed by the first processing of the molded image of the PCB according to the molded image of the PCB includes:
detecting image noise points of the formed image of the PCB, and acquiring image noise point information in the formed image of the PCB;
And carrying out first processing on the image noise point in the formed image of the PCB according to the image noise point information in the formed image of the PCB, and obtaining a first processed formed image, wherein the first processing comprises filtering processing, and the first processed formed image is the formed image of the PCB after the image noise point is eliminated.
In another embodiment of the present application, the obtaining, according to the first processed and formed image, a second processed and formed image formed by subjecting the first processed and formed image to a second process includes:
Acquiring image color information of the first processed and formed image;
gray scale processing is carried out on the first processing forming image according to the image color information of the first processing forming image, and a gray scale image of the first processing forming image is obtained;
Acquiring a gray value of the gray image according to the gray image of the first processed and formed image;
and carrying out second processing on the gray level image according to the gray level value of the gray level image to obtain a second processed forming image, wherein the second processing comprises an image binarization algorithm.
In another embodiment of the present application, the gray value of the pixel point of the second processed and formed image is 0 or 255.
In another embodiment of the present application, the acquiring the search area of the second processed and formed image according to the position information of the second processed and formed image and the identified through hole area in the second processed and formed image includes:
Acquiring position information of the identification through hole area in the second processing forming image, wherein the identification through hole area comprises a sequence through hole area and a positioning through hole area;
Matching the positioning through hole areas in the identification through hole areas with a plurality of positioning templates, and obtaining a plurality of positioning through hole areas matched and identified in the second processing molding image;
acquiring a determined coordinate system and an offset angle of each positioning through hole region in the second processing forming image according to a plurality of positioning through hole regions which are matched and identified in the second processing forming image;
and acquiring a search area of the second processing forming image according to the determined coordinate system and the offset angle of each positioning through hole area in the second processing forming image.
In another embodiment of the present application, the obtaining, according to the search area of the second processed and formed image and the screening rule of the identified through hole area, a plurality of discrete sequence through hole areas scattered by the identified through hole area after screening, and the center coordinates of the fitted circles of the plurality of discrete sequence through hole areas includes:
screening the identification through hole area with the brightness of 255 in the search area of the second processing forming image;
Acquiring a sequence through hole region of the screened identification through hole region according to the screening result;
Performing discrete processing on the sequence through hole areas according to the sequence through hole areas to obtain a plurality of discrete sequence through hole areas subjected to discrete processing;
acquiring a plurality of discrete sequence through hole areas which are not smaller than the identification through hole area according to the plurality of discrete sequence through hole areas and the identification through hole area;
and performing fitting circle processing on the discrete sequence through hole areas according to the discrete sequence through hole areas which are not smaller than the identification through hole areas, and obtaining a plurality of fitting circles and circle center coordinates of the fitting circles.
In another embodiment of the present application, the generating the serial number of the PCB according to the center coordinates of the fitted circles of the plurality of discrete sequence through hole areas, to complete the image recognition of the PCB, includes:
The circle center coordinates of the fit-into circles are arranged in the discrete sequence through hole areas, and decoding numbers corresponding to the decoded circle center coordinates are obtained;
According to the corresponding decoding numbers after each circle center coordinate is decoded, sequencing the decoding numbers according to the arrangement sequence of the circle center coordinates, and obtaining the serial numbers of the PCB generated according to the decoding numbers;
and completing the image identification of the PCB according to the serial number of the PCB generated by the decoding number.
According to still another aspect of the present invention, there is disclosed an image recognition apparatus of a PCB circuit board, the apparatus including:
The image acquisition module is used for acquiring a molding image of the PCB, wherein the molding image of the PCB comprises an identification through hole area of the PCB, and the identification through hole area comprises a positioning through hole area and a sequence through hole area;
The image processing module is used for acquiring a first processing forming image formed by the forming image of the PCB after first processing according to the forming image of the PCB, wherein the first processing comprises a filtering algorithm; acquiring a second processing forming image formed by the first processing forming image after second processing according to the first processing forming image, wherein the second processing forming image comprises an image binarization algorithm; acquiring a search area of the second processing forming image according to the second processing forming image and the position information of the identification through hole area in the second processing forming image; obtaining a plurality of discrete sequence through hole areas scattered by the screened identification through hole areas and circle center coordinates of a fitting circle of the discrete sequence through hole areas according to the search area of the second processed and formed image and the screening rule of the identification through hole areas;
and the image recognition module is used for generating the serial number of the PCB according to the circle center coordinates of the fitting circles of the discrete sequence through hole areas to finish the image recognition of the PCB.
According to a further aspect of the present invention there is provided an apparatus comprising:
Industrial cameras, PCB circuit boards, and mapped light sources;
The industrial camera is used for acquiring a molding image of the PCB, wherein the molding image of the PCB comprises an identification through hole area of the PCB, and the identification through hole area comprises a positioning through hole area and a sequence through hole area; setting a plurality of identification through holes on a PCB according to a rule, placing the PCB between the industrial camera and the mapping light source, and aligning the identification through holes to be placed right above the mapping light source, so that the mapping light source, the identification through holes and the industrial camera are positioned on the same straight line, the mapping light source projects light source to the bottom end surface of the PCB, and the industrial camera shoots the PCB through the opening of the identification through holes to obtain a molded image;
One or more processors; and a memory; one or more programs, wherein the one or more programs are stored in memory and configured to be executed by the one or more processors, the one or more programs comprising instructions for performing any of the methods of image recognition of PCB circuit boards as described above.
According to the image recognition scheme of the PCB, the formed image of the PCB is obtained; a first processing forming image formed after the forming image of the PCB is subjected to first processing; a second processed molded image formed after the second processing is performed on the first processed molded image; acquiring a search area of the second processing forming image according to the second processing forming image and the position information of the identification through hole area; according to screening rules of the identification through hole areas, obtaining a plurality of discrete sequence through hole areas scattered by the identification through hole areas after screening, and performing fitting on the plurality of discrete sequence through hole areas to form circle center coordinates of a circle; and according to the circle center coordinates of the fit-into circles of the discrete sequence through hole areas, generating the serial number of the PCB, and completing the image identification of the PCB. According to the method, the formed image containing the identification through holes in the PCB is obtained, so that the influence that the two-dimensional codes cannot be identified due to the type, the material and the color of the PCB is avoided; the information of the identification through holes and the arrangement information are obtained through the formed image, the hole site information of the identification through holes is decoded through the positioning template and arranged into corresponding serial numbers, the formed image containing the identification through holes in the PCB is decoded, the manual sampling inspection is not needed, and the identification efficiency of the PCB is improved.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
Fig. 1 is a block diagram of an example device 100. In a basic configuration, the device 100 of the present application typically comprises: industrial cameras, PCB circuit boards, and mapped light sources;
The industrial camera is used for acquiring a molding image of the PCB, wherein the molding image of the PCB comprises an identification through hole area of the PCB, and the identification through hole area comprises a positioning through hole area and a sequence through hole area; through set up one according to the rule on the PCB circuit board and set up a plurality of discernment through-holes, discernment through-hole runs through the top face and the bottom face of PCB circuit board, and the mapping light source sets up in the below of PCB circuit board, and the mapping light source carries out perpendicular projection light source to discernment through-hole one side, place the PCB circuit board industry camera with between the mapping light source, and will discernment through-hole is aimed at and is placed directly over the mapping light source, industry camera sets up in PCB circuit board top for the mapping light source, discernment through-hole and industry camera are located on same straight line, the mapping light source carries out the light source projection to the bottom face of PCB circuit board, industry camera passes through the trompil department of discernment through-hole is shot to the PCB circuit board, obtains the shaping image.
Further comprises: a system memory 106, and one or more processors 104. The memory bus 108 may be used for communication between the processor 104 and the system memory 106.
Depending on the desired configuration, the processor 104 may be any type of processing including, but not limited to: a microprocessor (μp), a microcontroller (μc), a digital information processor (DSP), or any combination thereof. The processor 104 may include one or more levels of caches, such as a first level cache 110 and a second level cache 112, a processor core 114, and registers 116. The example processor core 114 may include an Arithmetic Logic Unit (ALU), a Floating Point Unit (FPU), a digital signal processing core (DSP core), or any combination thereof. The example memory controller 118 may be used with the processor 104, or in some implementations, the memory controller 118 may be an internal part of the processor 104.
Depending on the desired configuration, system memory 106 may be any type of memory including, but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. The system memory 106 may include an operating system 120, one or more applications 122, and program data 124. In some implementations, the application 122 may be arranged to operate on an operating system with program data 124. In some embodiments, the apparatus 100 is configured to perform a method 200 for identifying an image of a PCB, the method 200 being capable of forming a software product test case by setting a software product test environment, slicing by functional modules of the software product, marking expected results, and performing a result comparison verification based on the software product test case upon post PCB image identification, the program data 124 including instructions for performing the method 200.
Device 100 may also include an interface bus 140 that facilitates communication from various interface devices (e.g., an output device 142, a peripheral interface 144, and a communication device 146) to the basic configuration 102 via bus/interface controller 130. The example output device 142 includes a graphics processing unit 148 and an audio processing unit 150. They may be configured to facilitate communication with various external devices such as a display or speakers via one or more a/V ports 152. Example peripheral interfaces 144 may include a serial interface controller 154 and a parallel interface controller 156, which may be configured to facilitate communication with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 158. An example communication device 146 may include a network controller 160, which may be arranged to facilitate communication with one or more other devices 162 via one or more communication ports 164 over a network communication link.
The network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media in a modulated data signal, such as a carrier wave or other transport mechanism. A "modulated data signal" may be a signal that has one or more of its data set or changed in such a manner as to encode information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or special purpose network, and wireless media such as acoustic, radio Frequency (RF), microwave, infrared (IR) or other wireless media. The term computer readable media as used herein may include both storage media and communication media. In some embodiments, the computer readable medium stores one or more programs including instructions for performing methods by which the apparatus 100 performs the image recognition method 200 of a PCB circuit board, such as in accordance with embodiments of the present invention.
Device 100 may be implemented as part of a small-sized portable (or mobile) electronic device such as a cellular telephone, a Personal Digital Assistant (PDA), a personal media player device, a wireless web-watch device, a personal headset device, an application specific device, or a hybrid device that may include any of the above functions. Device 100 may also be implemented as a personal computer including desktop and notebook computer configurations.
Fig. 2 shows a flowchart of a method 200 for image recognition of a PCB circuit board according to an embodiment of the present invention. As shown in fig. 2, the method 200 begins with step S210 of acquiring a molded image of the PCB circuit board, the molded image of the PCB circuit board including an identified via area, the identified via area including a locating via area and a sequence via area.
Specifically, through setting up a plurality of discernment through-holes according to the rule on the PCB circuit board, discernment through-hole runs through the top face and the bottom face of PCB circuit board, and the mapping light source sets up in the below of PCB circuit board, and the mapping light source carries out perpendicular projection light source to discernment through-hole one side, place the PCB circuit board industry camera with between the mapping light source, and will discernment through-hole is aimed at and is placed directly over the mapping light source, industry camera sets up in PCB circuit board top for the mapping light source, discernment through-hole and industry camera are located same straight line, the mapping light source carries out the light source projection to the bottom face of PCB circuit board, industry camera passes through the trompil department of discernment through-hole is shot to the PCB circuit board, obtains the shaping image.
Specifically, in one embodiment of the present application, the obtaining a molded image of the PCB, where the molded image of the PCB includes an identification through hole area of the PCB, where the identification through hole area includes a positioning through hole area and a sequential through hole area, includes:
arranging the PCB above the mapping light source, wherein the identification through hole of the PCB is aligned with the mapping light source; the identification through holes of the PCB circuit board are through holes with special rules, which are arranged on the PCB circuit board and are used for representing unique number information of the PCB circuit board, the identification through holes can be used for uniquely determining coding information of one PCB circuit board, in the embodiment of the application, the identification through holes comprise a plurality of positioning through holes used for determining a coordinate system and a plurality of serial through holes used for identifying models, the positioning through holes are used for judging positions of the through holes so as to determine coordinates and offset angles of the through holes, the serial through holes are used for identifying the coding information of the PCB circuit board, a mapping light source is arranged below the PCB circuit board, and the mapping light source vertically projects the light source to one side of the identification through holes, the PCB circuit board is arranged between the industrial camera and the mapping light source, and the identification through holes are aligned and arranged right above the mapping light source, and the industrial camera is arranged above the PCB circuit board, so that the mapping light source, the identification through holes and the industrial camera are positioned on the same straight line.
Setting an industrial camera above the PCB, and collecting all areas where the identification through holes of the PCB are located by the industrial camera; specifically, the industrial camera is aligned to the identification through hole, and meanwhile, the mapping light source projects the light source to the bottom end face of the PCB, and the mapping light projects the positioning through hole and the sequence through hole to the industrial camera through the identification through hole, so that the positioning through hole and the sequence through hole are white bright spots in the formed image, and the position information of the positioning through hole and the sequence through hole is reflected in the formed image;
The industrial camera shoots the identification through hole area of the PCB circuit board when the mapping light source projects the light source to the PCB circuit board, and the molding image of the PCB circuit board is obtained.
Through step S220, a first processed molded image formed after the first processing of the molded image of the PCB is obtained according to the molded image of the PCB, where the first processing includes a filtering algorithm.
Specifically, after the molded image of the PCB is shot, due to the influence of the industrial camera and the uneven projected light of the mapping light source, there are many noise points in the molded image, which affect the quality of the molded image and the determination of the positions of the positioning through holes and the sequence through holes in the molded image, the molded image needs to be first processed, that is, the noise points of the image in the molded image are eliminated by a filtering algorithm.
Specifically, in one embodiment of the present application, the obtaining, according to the molded image of the PCB, a first processed molded image formed after the molded image of the PCB is subjected to a first process includes:
Detecting image noise points of the formed image of the PCB, and acquiring image noise point information in the formed image of the PCB; specifically, noise information in an image is detected through image noise detection software, and image noise parameters and image noise distribution in a formed image are obtained.
And carrying out first processing on the image noise point in the formed image of the PCB according to the image noise point information in the formed image of the PCB, and obtaining a first processed formed image, wherein the first processing comprises filtering processing, and the first processed formed image is the formed image of the PCB after the image noise point is eliminated. Specifically, by performing the first processing on the molded image, noise information in the molded image is removed, so that a first processed molded image is formed, and the first processed molded image will not have image noise, so that the image quality will be more reliable.
According to the first processed forming image, a second processed forming image formed by the first processed forming image after the second processing is obtained in step S230, wherein the second processed forming image comprises an image binarization algorithm.
Specifically, after the formed image of the PCB is first coming out, the obtained first processed formed image eliminates the image noise, the image quality is higher, after the second processing, the first processed formed image is subjected to image binarization, that is, the first processed formed image is changed into a black and whitened image, because the position of the identification through hole in the formed image of the PCB photographed by the industrial camera is projected onto the camera of the industrial camera through the mapping light source, the position of the identification through hole will be a white bright point after the formed image is photographed, therefore, after the image binarization processing, the image of the position of the identification through hole in the first processed formed image will be white, and the rest positions will be black, so that the identification of the position of the identification through hole can be more convenient.
Specifically, in one embodiment of the present application, the obtaining, according to the first processed and formed image, a second processed and formed image formed by subjecting the first processed and formed image to a second process includes:
acquiring image color information of the first processed and formed image; specifically, the color value of each pixel point in the image can be obtained by obtaining the image color information of the first processing forming image, so that the corresponding parameters are convenient to set to change the color image into a gray image;
Gray scale processing is carried out on the first processing forming image according to the image color information of the first processing forming image, and a gray scale image of the first processing forming image is obtained; specifically, the color image is changed into a gray image through gray processing, so that parameters are set in the next step, and the gray image with the set parameters is changed into a black-and-white image;
Acquiring a gray value of the gray image according to the gray image of the first processed and formed image; specifically, after the gray image is acquired, the gray parameter may be set according to the gray value of the pixel by acquiring the image gray value of each pixel, so that the pixel exceeding the set gray parameter is turned white, and the pixel lower than the set gray parameter is turned black.
And carrying out second processing on the gray level image according to the gray level value of the gray level image to obtain a second processed forming image, wherein the second processing comprises an image binarization algorithm. Specifically, the first process is to convert a gradation image into a black-and-white image, which is an image that converts a gradation image into a color image containing only a gradation value of 0 or 255, in accordance with a set parameter. In an embodiment of the present application, a gray value of a pixel of the second processed and formed image is 0 or 255.
Through step S240, a search area of the second processing molded image is obtained according to the second processing molded image and the position information of the identification through hole area in the second processing molded image.
Specifically, after the binarization processing is performed on the first processed molding image, the molding image is changed from a color image into a black-and-white image, at this time, the color and the color on the image are only two colors of black and white, white is the area where the recognition through hole is located, and black is the remaining area after the recognition through hole is removed, so that the position information of the recognition through hole can be obtained through the position information of white in the image, and since the recognition through hole is used for determining the coordinate position and the recognition model, the position of the recognition through hole is determined, and the search area is also determined.
Specifically, in one embodiment of the present application, the obtaining the search area of the second processing molded image according to the position information of the second processing molded image and the identified through hole area in the second processing molded image includes:
Acquiring position information of the identification through hole area in the second processing forming image, wherein the identification through hole area comprises a sequence through hole area and a positioning through hole area; specifically, the acquiring of the position information of the identification through hole area in the second processing forming image takes the area where the identification through hole is located as a search area, and the identification through hole area may be connected together and become larger after the first processing and the second processing, so that the acquired identification through hole area needs to be processed. The recognition through hole area comprises a sequence through hole area and a positioning through hole area, wherein the sequence through hole area is used for recognizing the model of the PCB, and the positioning through hole area is used for determining position coordinates.
Matching the positioning through hole areas in the identification through hole areas with a plurality of positioning templates, and obtaining a plurality of positioning through hole areas matched and identified in the second processing molding image; specifically, the positioning template is used for judging the position of each positioning through hole in the positioning through hole area, the position parameter of the positioning through hole in each positioning through hole area is identified through the positioning template, and the center coordinates and the offset angle of the positioning through holes are obtained according to the position parameter of the positioning through holes, so that the sequence parameters of the positioning through holes in the positioning through hole area are obtained.
Acquiring a determined coordinate system and an offset angle of each positioning through hole region in the second processing forming image according to a plurality of positioning through hole regions which are matched and identified in the second processing forming image; specifically, each positioning through hole is formed in the second processing forming image, and the positioning through hole area is an image area formed on the forming image after the positioning through holes are shot by the industrial camera and subjected to the first processing and the second processing, and because the PCB circuit board is provided with a plurality of positioning through holes, the second processing forming image is also provided with a plurality of positioning through hole areas, after the positioning through hole areas are identified through positioning template matching, a coordinate system determined by the plurality of positioning through hole areas can be obtained through the sequence of the positioning template, and the offset angle of each positioning through hole area can be accurately calculated through the determination of the coordinate system and the calculation of the offset angle, so that the sequence position of each sequence through hole area can be calculated.
And acquiring a search area of the second processing forming image according to the determined coordinate system and the offset angle of each positioning through hole area in the second processing forming image. Specifically, after the search area of the second processing forming image is the area on the second processing forming image for generating the serial number of the PCB by matching the positioning through hole area, the corresponding positioning through hole area and the serial through hole area are obtained, and since the coordinate system and the offset angle are determined by the positioning through hole area, the coordinate system and the offset angle of the serial through hole area can be searched by the determined coordinate system and the offset angle, so that the positioning through hole area and the corresponding serial through hole area are obtained as the search area, and the search area is used for obtaining the correct ordering of the serial through hole area according to the coordinate system and the offset angle.
Through step S250, a plurality of discrete sequence through hole areas scattered by the identified through hole areas after screening and circle center coordinates of a circle formed by fitting the plurality of discrete sequence through hole areas are obtained according to the search area of the second processed and formed image and the screening rule of the identified through hole areas.
Specifically, due to the reasons of photographing parameters of an industrial camera, or the reason that the recognition through holes are arranged closely, or the reason of the processing effect of the formed image after the first processing and the second processing, the problem that a plurality of recognition through holes are connected into a whole may be caused, the image of the non-recognition through hole area can be removed by screening the recognition through holes, the plurality of recognition through holes connected into a whole can be dispersed into independent recognition through holes by performing discrete processing on the recognition through hole area, and then the circle center coordinates of circles formed by combining each recognition through hole area can be accurately generated by positioning the coordinate system and the offset angle generated by the through hole area, so that especially for the sequence through holes in the recognition through holes, the serial number of the PCB circuit board can be accurately generated by the sequence through holes.
Specifically, in one embodiment of the present application, the obtaining, according to the search area of the second processed and formed image and the screening rule of the identified through hole area, a plurality of discrete sequence through hole areas scattered by the identified through hole area after screening and the center coordinates of the fitted circle of the plurality of discrete sequence through hole areas includes:
Screening the identification through hole area with the brightness of 255 in the search area of the second processing forming image; specifically, in the embodiment of the present application, all the recognition through-hole regions are binarized to become an image having a gray value of 255, and therefore, a region having a brightness of 255 is searched for in the search region, that is, the position where all the recognition through-hole regions are located is searched for.
Acquiring a sequence through hole region of the screened identification through hole region according to the screening result; specifically, the positioning through hole area is used for completing the determination of the coordinate system and the offset angle of all the recognition through holes, and the sequence through hole area is used for generating the serial number of the PCB, so that after the screening of all the recognition through hole areas is completed, the positioning through hole area can be deleted, and only the sequence through hole area is reserved for obtaining the serial number of the PCB in the next step.
Performing discrete processing on the sequence through hole areas according to the sequence through hole areas to obtain a plurality of discrete sequence through hole areas subjected to discrete processing; specifically, after the sequence through hole areas are subjected to discrete processing, a plurality of sequence through hole areas which are possibly communicated with each other are subjected to discretization, so that a plurality of mutually independent discrete sequence through hole areas are obtained, and it can be known that after the sequence through hole areas are subjected to discretization processing, the center coordinates and the offset angles of each discrete sequence through hole area are consistent relative to the identification through holes arranged on the PCB.
Acquiring a plurality of discrete sequence through hole areas which are not smaller than the identification through hole area according to the plurality of discrete sequence through hole areas and the identification through hole area; specifically, because the parameters of the identification through holes of the PCB are consistent when the industrial camera shoots the identification through holes, and the identification through holes are projected to the camera of the industrial camera through the identification through holes under the identification through holes as mapping light sources, the projection area of the images of the identification through holes is larger than the area of the identification through holes, namely the area of the identification through hole area on the formed image is larger than the area of the identification through holes, therefore, if the area of the screened identification through hole area is smaller than the area of the identification through holes, the identification through hole area is necessarily generated by some interference signals, and the identification through hole area smaller than the area of the identification through holes is required to be deleted.
And performing fitting circle processing on the discrete sequence through hole areas according to the discrete sequence through hole areas which are not smaller than the identification through hole areas, and obtaining a plurality of fitting circles and circle center coordinates of the fitting circles. Specifically, after each independent discrete sequence through hole area is determined, each independent discrete sequence through hole area is fitted into a circle through a fitting circle algorithm, and the circle center coordinate of the fitting circle is necessarily consistent with the circle center position of the corresponding identification through hole on the PCB.
Through step S260, the circle center coordinates of the fitting circle are generated according to the plurality of discrete sequence through hole areas, so as to generate the serial number of the PCB, and complete the image recognition of the PCB.
Specifically, according to the setting rule of the identification through holes of the PCB, the circle center coordinates of the discrete sequence through hole areas are ordered, then the circle center coordinates are decoded into corresponding numbers, corresponding serial numbers can be generated, then the identified serial numbers are compared with the originally set serial numbers, and the image identification of the PCB can be completed, so that manual detection is not needed, all the steps are automatically completed, and the identification efficiency of the PCB is improved.
Specifically, in one embodiment of the present application, a plurality of discrete sequence through hole regions are arranged to fit the center coordinates of a circle, and a decoding number corresponding to each decoded center coordinate is obtained;
According to the corresponding decoding numbers after each circle center coordinate is decoded, sequencing the decoding numbers according to the arrangement sequence of the circle center coordinates, and obtaining the serial numbers of the PCB generated according to the decoding numbers;
and completing the image identification of the PCB according to the serial number of the PCB generated by the decoding number.
According to the image recognition scheme of the PCB, the formed image of the PCB is obtained; a first processing forming image formed after the forming image of the PCB is subjected to first processing; a second processed molded image formed after the second processing is performed on the first processed molded image; acquiring a search area of the second processing forming image according to the second processing forming image and the position information of the identification through hole area; according to screening rules of the identification through hole areas, obtaining a plurality of discrete sequence through hole areas scattered by the identification through hole areas after screening, and performing fitting on the plurality of discrete sequence through hole areas to form circle center coordinates of a circle; and according to the circle center coordinates of the fit-into circles of the discrete sequence through hole areas, generating the serial number of the PCB, and completing the image identification of the PCB. According to the method, the formed image containing the identification through holes in the PCB is obtained, so that the influence that the two-dimensional codes cannot be identified due to the type, the material and the color of the PCB is avoided; the information of the identification through holes and the arrangement information are obtained through the formed image, the hole site information of the identification through holes is decoded through the positioning template and arranged into corresponding serial numbers, the formed image containing the identification through holes in the PCB is decoded, the manual sampling inspection is not needed, and the identification efficiency of the PCB is improved.
It should be understood that, although the steps in the flowchart of fig. 2 are shown in sequence as indicated by the arrows, the steps are not necessarily performed in sequence as indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in fig. 2 may include multiple sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, nor do the order in which the sub-steps or stages are performed necessarily performed in sequence, but may be performed alternately or alternately with at least a portion of the sub-steps or stages of other steps or other steps.
In one embodiment, as shown in fig. 3, there is provided an image recognition apparatus 300 of a PCB circuit board, the apparatus 300 including: the device comprises an image acquisition module, an image processing module and an image recognition module.
The image acquisition module is used for acquiring a molding image of the PCB, wherein the molding image of the PCB comprises an identification through hole area of the PCB, and the identification through hole area comprises a positioning through hole area and a sequence through hole area;
The image processing module is used for acquiring a first processing forming image formed by the forming image of the PCB after first processing according to the forming image of the PCB, wherein the first processing comprises a filtering algorithm; acquiring a second processing forming image formed by the first processing forming image after second processing according to the first processing forming image, wherein the second processing forming image comprises an image binarization algorithm; acquiring a search area of the second processing forming image according to the second processing forming image and the position information of the identification through hole area in the second processing forming image; obtaining a plurality of discrete sequence through hole areas scattered by the screened identification through hole areas and circle center coordinates of a fitting circle of the discrete sequence through hole areas according to the search area of the second processed and formed image and the screening rule of the identification through hole areas;
and the image recognition module is used for generating the serial number of the PCB according to the circle center coordinates of the fitting circles of the discrete sequence through hole areas to finish the image recognition of the PCB.
Specifically, in another embodiment of the present application, the image acquisition module is configured to set the PCB above a mapping light source, and the recognition through hole of the PCB is aligned with the mapping light source; setting an industrial camera above the PCB, and collecting all areas where the identification through holes of the PCB are located by the industrial camera; and the industrial camera shoots the identification through hole area of the PCB when the mapping light source projects the light source to the PCB, and obtains the molding image of the PCB.
Specifically, in another embodiment of the present application, the image processing module is configured to perform image noise detection on a formed image of the PCB to obtain image noise information in the formed image of the PCB; and carrying out first processing on the image noise point in the formed image of the PCB according to the image noise point information in the formed image of the PCB, and obtaining a first processed formed image, wherein the first processing comprises filtering processing, and the first processed formed image is the formed image of the PCB after the image noise point is eliminated.
Specifically, in another embodiment of the present application, the image processing module is configured to obtain image color information of the first processed and formed image; gray scale processing is carried out on the first processing forming image according to the image color information of the first processing forming image, and a gray scale image of the first processing forming image is obtained; acquiring a gray value of the gray image according to the gray image of the first processed and formed image; and carrying out second processing on the gray level image according to the gray level value of the gray level image to obtain a second processed forming image, wherein the second processing comprises an image binarization algorithm.
Specifically, in another embodiment of the present application, the image processing module is configured to obtain location information of the identification through hole area in the second processed and formed image, where the identification through hole area includes a sequential through hole area and a positioning through hole area; matching the positioning through hole areas in the identification through hole areas with a plurality of positioning templates, and obtaining a plurality of positioning through hole areas matched and identified in the second processing molding image; acquiring a determined coordinate system and an offset angle of each positioning through hole region in the second processing forming image according to a plurality of positioning through hole regions which are matched and identified in the second processing forming image; and acquiring a search area of the second processing forming image according to the determined coordinate system and the offset angle of each positioning through hole area in the second processing forming image.
Specifically, in another embodiment of the present application, the image processing module is configured to screen the identified through hole area with brightness of 255 in the search area of the second processed and formed image; acquiring a sequence through hole region of the screened identification through hole region according to the screening result; performing discrete processing on the sequence through hole areas according to the sequence through hole areas to obtain a plurality of discrete sequence through hole areas subjected to discrete processing; acquiring a plurality of discrete sequence through hole areas which are not smaller than the identification through hole area according to the plurality of discrete sequence through hole areas and the identification through hole area; and performing fitting circle processing on the discrete sequence through hole areas according to the discrete sequence through hole areas which are not smaller than the identification through hole areas, and obtaining a plurality of fitting circles and circle center coordinates of the fitting circles.
Specifically, in another embodiment of the present application, the image recognition module is configured to arrange center coordinates of a circle formed by fitting a plurality of discrete sequence through-hole areas, and obtain a corresponding decoding number after decoding each center coordinate; according to the corresponding decoding numbers after each circle center coordinate is decoded, sequencing the decoding numbers according to the arrangement sequence of the circle center coordinates, and obtaining the serial numbers of the PCB generated according to the decoding numbers; and completing the image identification of the PCB according to the serial number of the PCB generated by the decoding number.
According to the image recognition scheme of the PCB, the image acquisition module acquires the forming image of the PCB; the image processing module is used for forming a first processed molded image after the molded image of the PCB is subjected to first processing; a second processed molded image formed after the second processing is performed on the first processed molded image; acquiring a search area of the second processing forming image according to the second processing forming image and the position information of the identification through hole area; according to screening rules of the identification through hole areas, obtaining a plurality of discrete sequence through hole areas scattered by the identification through hole areas after screening, and performing fitting on the plurality of discrete sequence through hole areas to form circle center coordinates of a circle; and the image recognition module performs fitting to circle center coordinates of a circle according to the discrete sequence through hole areas, generates serial numbers of the PCB, and completes image recognition of the PCB. According to the method, the formed image containing the identification through holes in the PCB is obtained, so that the influence that the two-dimensional codes cannot be identified due to the type, the material and the color of the PCB is avoided; the information and the arrangement information of the identification through holes are obtained through the formed image, the hole site information of the identification through holes is decoded through the positioning template and arranged into corresponding serial numbers, the formed image containing the identification through holes in the PCB is decoded, the manual sampling inspection is not needed, and the identification efficiency of the PCB is improved
It should be appreciated that in the above description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be construed as reflecting the intention that: i.e., the claimed invention requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment, or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into a plurality of sub-modules.
Those skilled in the art will appreciate that the modules in the apparatus of the embodiments may be adaptively changed and disposed in one or more apparatuses different from the embodiments. The modules or units or components of the embodiments may be combined into one module or unit or component and, furthermore, they may be divided into a plurality of sub-modules or sub-units or sub-components. Any combination of all features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or units of any method or apparatus so disclosed, may be used in combination, except insofar as at least some of such features and/or processes or units are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings), may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features but not others included in other embodiments, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments can be used in any combination.
Furthermore, some of the embodiments are described herein as methods or combinations of method elements that may be implemented by a processor of a computer system or by other means of performing the functions. Thus, a processor with the necessary instructions for implementing the described method or method element forms a means for implementing the method or method element. Furthermore, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is for carrying out the functions performed by the elements for carrying out the objects of the invention.
As used herein, unless otherwise specified the use of the ordinal terms "first," "second," "third," etc., to describe a general object merely denote different instances of like objects, and are not intended to imply that the objects so described must have a given order, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of the above description, will appreciate that other embodiments are contemplated within the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The disclosure of the present invention is intended to be illustrative, but not limiting, of the scope of the invention, which is defined by the appended claims.