PCB probe positioning method and device, graphic processor and storage medium

文档序号:9264 发布日期:2021-09-17 浏览:29次 中文

1. A PCB probe positioning method is characterized by comprising the following steps:

acquiring an initial image of the PCB through the constructed camera model;

acquiring imaging parameters of the PCB, and correcting the initial image according to the imaging parameters to obtain a target image;

selecting at least two characteristic areas on the PCB as eyepoints, and acquiring eyepoint images;

calculating a deviation value according to the eyepoint image and the target image, inputting the deviation value into a shader for processing, and positioning the PCB probe according to the deviation value.

2. The method of claim 1, further comprising:

acquiring camera internal parameters and camera external parameters;

calibrating the camera according to the camera internal parameters and the camera external parameters to obtain a camera calibration result;

and constructing the camera model according to the camera calibration result.

3. The method of claim 1, wherein the capturing an initial image of the PCB circuit board through the built camera model comprises:

collecting the size data of the PCB circuit board through a constructed camera model;

calculating an image mapping proportion according to the size data;

and mapping and converting the size data according to the image mapping proportion to obtain an initial image of the PCB.

4. The method of claim 1, wherein said rectifying the initial image according to the imaging parameters to obtain a target image comprises:

extracting initial imaging parameters in the initial image;

correcting the initial imaging parameters according to the imaging parameters to obtain corrected target imaging parameters;

and processing the initial image according to the target imaging parameters to obtain a target image.

5. The method of claim 1, wherein calculating a deviation value from the eyepoint image and the target image comprises:

acquiring eyepoint position information of eyepoints in the eyepoint image;

calculating target position information at a position corresponding to the eyepoint in the target image according to the eyepoint position information;

and calculating a deviation value according to the eyepoint position information and the target position information.

6. The method of claim 5, wherein calculating an offset value based on the eyepoint location information and the target location information comprises:

calculating translation deviation and corner deviation according to the eyepoint position information and the target position information;

and calculating a deviation value according to the translation deviation and the rotation angle deviation.

7. A PCB probe positioning device, the device comprising:

the initial image acquisition module is used for acquiring an initial image of the PCB through the constructed camera model;

the target image acquisition module is used for acquiring imaging parameters of the PCB and correcting the initial image according to the imaging parameters to obtain a target image;

the eyepoint image acquisition module is used for selecting at least two characteristic areas on the PCB as eyepoints and acquiring eyepoint images;

and the deviation value calculating module is used for calculating a deviation value according to the eyepoint image and the target image, inputting the deviation value into a shader for processing, and positioning the PCB probe according to the deviation value.

8. The apparatus of claim 7, wherein the initial image acquisition module is further configured to acquire camera internal parameters and camera external parameters; calibrating the camera according to the camera internal parameters and the camera external parameters to obtain a camera calibration result; and constructing the camera model according to the camera calibration result.

9. A graphics processor comprising a memory and a processor, the memory storing a computer program, wherein the processor implements the steps of the method of any one of claims 1 to 6 when executing the computer program.

10. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 6.

Background

The PCB is named as a printed circuit board, also called a printed circuit board, is an important electronic component, is a support body of an electronic component, and is a carrier for electrical interconnection of the electronic component. The PCB image positioning is to identify the rotation angle and the area coordinate of the PCB from the picture which is collected on the PCB production line and contains the PCB and the background. Accurate positioning is an important step in a PCB defect detection process, and the positioning precision and speed greatly influence the PCB detection effect. Currently, two modes of inputting design drawing coordinates in advance and visually positioning are generally adopted for automatically positioning the PCB probe. The probe station positioning detection system for positioning according to the design drawing is mainly used for positioning according to the specific PCB coordinate position designed by the design drawing and mainly comprises a positioning calculation system and a motion control system. The automatic probe positioning and detecting system mainly comprises a machine vision system, and is mainly used for realizing real-time monitoring of the position of a PCB in the detection process of the PCB, calculating the deviation between the actual position of the PCB and the position of a detection probe, and correcting the deviation by combining with a motion control system so as to achieve accurate positioning.

In a probe station positioning detection system for positioning a design drawing, positioning deviation can be caused due to errors introduced by a manufacturing process, test data is unstable due to poor contact between a probe and a test point, and other non-test points of a PCB (printed circuit board) can be damaged; the probe automatic positioning detection system mainly comprises a machine vision system, the positioning precision depends on a machine vision algorithm, a simple model matching algorithm is high in execution efficiency but high in requirements on structural design and errors, 1:1 matching is needed, and the model matching algorithm compatible with image rotation and transformation is large in calculation amount, so that the testing time of the testing system is prolonged, and the testing efficiency is reduced.

Therefore, the traditional PCB probe positioning method has the problem of inaccurate positioning.

Disclosure of Invention

Based on this, in order to solve the above technical problem, a PCB probe positioning method, apparatus, graphic processor and storage medium are provided, which can improve the accuracy of PCB probe positioning.

A PCB probe positioning method, the method comprising:

acquiring an initial image of the PCB through the constructed camera model;

acquiring imaging parameters of the PCB, and correcting the initial image according to the imaging parameters to obtain a target image;

selecting at least two characteristic areas on the PCB as eyepoints, and acquiring eyepoint images;

calculating a deviation value according to the eyepoint image and the target image, inputting the deviation value into a shader for processing, and positioning the PCB probe according to the deviation value.

In one embodiment, the method further comprises:

acquiring camera internal parameters and camera external parameters;

calibrating the camera according to the camera internal parameters and the camera external parameters to obtain a camera calibration result;

and constructing the camera model according to the camera calibration result.

In one embodiment, the acquiring an initial image of the PCB by the constructed camera model includes:

collecting the size data of the PCB circuit board through a constructed camera model;

calculating an image mapping proportion according to the size data;

and mapping and converting the size data according to the image mapping proportion to obtain an initial image of the PCB.

In one embodiment, the rectifying the initial image according to the imaging parameters to obtain a target image includes:

extracting initial imaging parameters in the initial image;

correcting the initial imaging parameters according to the imaging parameters to obtain corrected target imaging parameters;

and processing the initial image according to the target imaging parameters to obtain a target image.

In one embodiment, the calculating a deviation value according to the eyepoint image and the target image includes:

acquiring eyepoint position information of eyepoints in the eyepoint image;

calculating target position information at a position corresponding to the eyepoint in the target image according to the eyepoint position information;

and calculating a deviation value according to the eyepoint position information and the target position information.

In one embodiment, the calculating an offset value according to the eyepoint position information and the target position information includes:

calculating translation deviation and corner deviation according to the eyepoint position information and the target position information;

and calculating a deviation value according to the translation deviation and the rotation angle deviation.

A PCB probe positioning apparatus, the apparatus comprising:

the initial image acquisition module is used for acquiring an initial image of the PCB through the constructed camera model;

the target image acquisition module is used for acquiring imaging parameters of the PCB and correcting the initial image according to the imaging parameters to obtain a target image;

the eyepoint image acquisition module is used for selecting at least two characteristic areas on the PCB as eyepoints and acquiring eyepoint images;

and the deviation value calculating module is used for calculating a deviation value according to the eyepoint image and the target image, inputting the deviation value into a shader for processing, and positioning the PCB probe according to the deviation value.

A graphics processor comprising a memory and a processor, the memory storing a computer program, the processor when executing the computer program implementing the steps of:

acquiring an initial image of the PCB through the constructed camera model;

acquiring imaging parameters of the PCB, and correcting the initial image according to the imaging parameters to obtain a target image;

selecting at least two characteristic areas on the PCB as eyepoints, and acquiring eyepoint images;

calculating a deviation value according to the eyepoint image and the target image, inputting the deviation value into a shader for processing, and positioning the PCB probe according to the deviation value.

A computer-readable storage medium, on which a computer program is stored which, when executed by a processor, carries out the steps of:

acquiring an initial image of the PCB through the constructed camera model;

acquiring imaging parameters of the PCB, and correcting the initial image according to the imaging parameters to obtain a target image;

selecting at least two characteristic areas on the PCB as eyepoints, and acquiring eyepoint images;

calculating a deviation value according to the eyepoint image and the target image, inputting the deviation value into a shader for processing, and positioning the PCB probe according to the deviation value.

According to the PCB probe positioning method, the PCB probe positioning device, the graphic processor and the storage medium, the initial image of the PCB is acquired through the constructed camera model; acquiring imaging parameters of the PCB, and correcting the initial image according to the imaging parameters to obtain a target image; selecting at least two characteristic areas on the PCB as eyepoints, and acquiring eyepoint images; calculating a deviation value according to the eyepoint image and the target image, inputting the deviation value into a shader for processing, and positioning the PCB probe according to the deviation value. Acquiring an initial image based on the existing PCB, and acquiring imaging parameters so as to correct the initial image, thereby facilitating the realization of accurate positioning of a PCB probe; by inputting the deviation value into the shader for processing, the processing speed can be increased, and the probe testing efficiency can be improved.

Drawings

FIG. 1 is a diagram of an exemplary environment in which a PCB probe positioning method may be implemented;

FIG. 2 is a schematic flow chart illustrating a method for positioning PCB probes in one embodiment;

FIG. 3 is a schematic diagram of coordinates for camera calibration in one embodiment;

FIG. 4 is a diagram illustrating coordinates for calculating a deviation value in one embodiment;

FIG. 5 is a block diagram of the PCB probe positioning device in one embodiment.

Detailed Description

In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and 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.

The PCB probe positioning method provided by the embodiment of the application can be applied to the application environment shown in FIG. 1. As shown in fig. 1, the application environment includes a graphics processor 110, a CCD camera 120, and a PCB circuit board 130, wherein the graphics processor 110 may be communicatively connected to the CCD camera 120 and the PCB circuit board 130, respectively. The graphic processor 110 may acquire an initial image of the PCB 130 through a camera model constructed by the CCD camera 120; the CCD camera 120 may acquire an initial image of the PCB 130 under the illumination of the ring light source 140; the graphic processor 110 may obtain imaging parameters of the PCB 130, and correct the initial image according to the imaging parameters to obtain a target image; the graphic processor 110 may select at least two feature areas on the PCB 130 as eyepoints to obtain eyepoint images; the graphic processor 110 may calculate a deviation value according to the eyepoint image and the target image, input the deviation value into the shader for processing, and perform PCB probe positioning according to the deviation value.

In one embodiment, as shown in fig. 2, there is provided a PCB probe positioning method including the steps of:

and 202, acquiring an initial image of the PCB through the constructed camera model.

The camera model may be pre-constructed, and the CCD camera may be a calibrated camera. The graphic processor may acquire an initial image of the PCB through the constructed camera model. The graphic Processing unit (cpu) is a microprocessor dedicated to image and graphic related operations on personal computers, workstations, game machines and mobile devices.

And 204, acquiring imaging parameters of the PCB, and correcting the initial image according to the imaging parameters to obtain a target image.

The image processor can acquire imaging parameters of the PCB through visual calibration and correct an initial image according to the imaging parameters. Specifically, the graphics processor may use the rectified initial image, i.e., the target image, as the image matching template.

And step 206, selecting at least two characteristic areas on the PCB as eyepoints, and acquiring eyepoint images.

The graphics processor may select at least two feature areas on the PCB as eyepoints, thereby obtaining an eyepoint image on the PCB according to the location of the selected eyepoint.

And 208, calculating a deviation value according to the eyepoint image and the target image, inputting the deviation value into a shader for processing, and positioning the PCB probe according to the deviation value.

In the embodiment, the graphics processor acquires an initial image of the PCB through the constructed camera model; acquiring imaging parameters of the PCB, and correcting an initial image according to the imaging parameters to obtain a target image; selecting at least two characteristic areas on the PCB as eyepoints, and acquiring eyepoint images; and calculating a deviation value according to the eyepoint image and the target image, inputting the deviation value into a shader for processing, and positioning the PCB probe according to the deviation value. Acquiring an initial image based on the existing PCB, and acquiring imaging parameters so as to correct the initial image, thereby facilitating the realization of accurate positioning of a PCB probe; by inputting the deviation value into the shader for processing, the processing speed can be increased, and the probe testing efficiency can be improved.

In one embodiment, the provided PCB probe positioning method may further include a process of calibrating the camera, and the specific process includes: acquiring camera internal parameters and camera external parameters; calibrating the camera according to the internal parameters and the external parameters of the camera to obtain a camera calibration result; and constructing a camera model according to the camera calibration result.

In a machine vision system, in order to establish a relationship between an actual position of a real target and a coordinate position of a pixel point corresponding to an obtained image, a basic model of camera imaging needs to be established, and basic parameters of the model are camera parameters of the vision system. The camera calibration is to determine a coordinate conversion relationship among a world coordinate system, a camera coordinate system, an image coordinate system and a pixel coordinate system, calculate external parameters and internal parameters of a camera and establish a basic model of camera imaging according to an optical imaging principle, wherein as shown in fig. 3, OS-rc is the image coordinate system and the unit is a pixel; of-uv is the imaging plane coordinate system; Oc-XcYcZc is the camera coordinate system; Ow-XwYwZw is the world coordinate system. The imaging plane is generally at the back end of the CCD camera, and an imaging plane is added to the front end of the camera in fig. 3, and the imaging plane is a virtual imaging plane in order to reduce the amount of calculation for solving the camera model parameters.

In this embodiment, before the camera calibration is performed, a system coordinate transformation needs to be performed, first, from the world coordinate system to the camera coordinate system, as shown in fig. 3, Pw is a point in the world coordinate system, and first, it needs to be converted into the camera coordinate system, where the conversion includes two operations of translation and rotation. The transformation relationship between the point Pw ═ T (Xw, Yw, Zw) and the point Pc ═ T (Xc, Yc, Zc) can be expressed as: Pc-RPw + T; where R is a rotation matrix and is an identity orthogonal matrix and T is a translation matrix. The matrix may be specified directly in the OpenGL function library. Secondly, converting from the camera coordinate system to the imaging coordinate system, the projection of the point Pc ═ Xc, Yc, Zc) T in the camera coordinate system onto the point P ═ u, v in the imaging coordinate system is a parallel projection, and the projection relationship between the two points is:wherein m is a magnification. Due to the influence of lens distortion factors, the post-imaging point P ═ T changes.

In one embodiment, the provided PCB probe positioning method may further include a process of acquiring an initial image of the PCB circuit board, and the specific process includes: collecting the size data of the PCB circuit board through the constructed camera model; calculating an image mapping proportion according to the size data; and mapping and converting the size data according to the image mapping proportion to obtain an initial image of the PCB.

The graphic processor can measure the size based on the existing hardware structure, namely a PCB circuit board, so that the image mapping proportion is calculated according to the existing structure size, software mapping conversion is carried out, and the aim of realizing accurate positioning by using a simple logic model matching algorithm is fulfilled.

In one embodiment, the provided PCB probe positioning method may further include a process of correcting the imaging parameter, where the specific process includes: extracting initial imaging parameters in an initial image; correcting the initial imaging parameters according to the imaging parameters to obtain corrected target imaging parameters; and processing the initial image through the target imaging parameters to obtain a target image.

The image processor can extract initial imaging parameters in the initial image, correct the initial image through the imaging parameters obtained by the calibration of the vision system, and use the corrected image as an image matching template, namely a target image.

In one embodiment, the PCB probe positioning method further includes a process of calculating a deviation value, where the process includes: acquiring eyepoint position information of eyepoints in the eyepoint image; calculating target position information at a position corresponding to the eyepoint in the target image according to the eyepoint position information; and calculating a deviation value according to the eyepoint position information and the target position information.

The graphics processor may obtain the eyepoint position information in the eyepoint image, and thereby calculate the target position information of the eyepoint in the target image according to the eyepoint position information, and further calculate the deviation value.

As shown in fig. 4, in one embodiment, the graphics processor may calculate a translation deviation and a rotation angle deviation according to the eyepoint position information and the target position information; and calculating a deviation value according to the translation deviation and the rotation angle deviation.

Taking the number of the eyepoints as an example, when the graphics processor performs the translation deviation calculation, the average value of the two eyepoint deviations is the translation deviation in the X direction and the Y direction of the whole PCB, and the calculation formula may be:when the graphic processor calculates the deviation of the corner, a straight line l is set1And l2The slopes of the two oblique lines are k1 and k2 respectively, the included angle of the two oblique lines is the corner deviation theta, the corner deviation can be obtained through the change of the slope of the straight line, and the calculation formula can be as follows:then θ is arctan k.

It should be understood that, although the steps in the above-described flowcharts are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least a portion of the steps in the above-described flowcharts may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of performing the sub-steps or the stages is not necessarily sequential, but may be performed alternately or alternatingly with other steps or at least a portion of the sub-steps or stages of other steps.

In one embodiment, as shown in fig. 5, there is provided a PCB probe positioning apparatus including an initial image acquisition module 510, a target image acquisition module 520, an eyepoint image acquisition module 530, and a deviation value calculation module 540, wherein:

an initial image acquisition module 510, configured to acquire an initial image of the PCB through the constructed camera model;

a target image obtaining module 520, configured to obtain imaging parameters of the PCB, and correct the initial image according to the imaging parameters to obtain a target image;

an eyepoint image obtaining module 530, configured to select at least two feature areas on the PCB as eyepoints, and obtain an eyepoint image;

and the deviation value calculating module 540 is used for calculating a deviation value according to the eyepoint image and the target image, inputting the deviation value into the shader for processing, and positioning the PCB probe according to the deviation value.

In one embodiment, the initial image acquisition module 510 is further configured to acquire camera intrinsic parameters and camera extrinsic parameters; calibrating the camera according to the internal parameters and the external parameters of the camera to obtain a camera calibration result; and constructing a camera model according to the camera calibration result.

In one embodiment, the initial image acquisition module 510 is further configured to acquire dimensional data of the PCB circuit board through the constructed camera model; calculating an image mapping proportion according to the size data; and mapping and converting the size data according to the image mapping proportion to obtain an initial image of the PCB.

In one embodiment, the initial image acquisition module 510 is further configured to extract initial imaging parameters in the initial image; correcting the initial imaging parameters according to the imaging parameters to obtain corrected target imaging parameters; and processing the initial image through the target imaging parameters to obtain a target image.

In one embodiment, the deviation value calculating module 540 is further configured to obtain eyepoint position information of an eyepoint in the eyepoint image; calculating target position information at a position corresponding to the eyepoint in the target image according to the eyepoint position information; and calculating a deviation value according to the eyepoint position information and the target position information.

In one embodiment, the deviation value calculating module 540 is further configured to calculate a translation deviation and a rotation angle deviation according to the eyepoint position information and the target position information; and calculating a deviation value according to the translation deviation and the rotation angle deviation.

In one embodiment, a graphics processor is provided for providing computing and control capabilities.

In one embodiment, a computer device is provided, comprising a memory and a processor, the memory having a computer program stored therein, the processor implementing the following steps when executing the computer program:

acquiring an initial image of the PCB through the constructed camera model;

acquiring imaging parameters of the PCB, and correcting an initial image according to the imaging parameters to obtain a target image;

selecting at least two characteristic areas on the PCB as eyepoints, and acquiring eyepoint images;

and calculating a deviation value according to the eyepoint image and the target image, inputting the deviation value into a shader for processing, and positioning the PCB probe according to the deviation value.

In one embodiment, the processor, when executing the computer program, further performs the steps of: acquiring camera internal parameters and camera external parameters; calibrating the camera according to the internal parameters and the external parameters of the camera to obtain a camera calibration result; and constructing a camera model according to the camera calibration result.

In one embodiment, the processor, when executing the computer program, further performs the steps of: collecting the size data of the PCB circuit board through the constructed camera model; calculating an image mapping proportion according to the size data; and mapping and converting the size data according to the image mapping proportion to obtain an initial image of the PCB.

In one embodiment, the processor, when executing the computer program, further performs the steps of: extracting initial imaging parameters in an initial image; correcting the initial imaging parameters according to the imaging parameters to obtain corrected target imaging parameters; and processing the initial image through the target imaging parameters to obtain a target image.

In one embodiment, the processor, when executing the computer program, further performs the steps of: acquiring eyepoint position information of eyepoints in the eyepoint image; calculating target position information at a position corresponding to the eyepoint in the target image according to the eyepoint position information; and calculating a deviation value according to the eyepoint position information and the target position information.

In one embodiment, the processor, when executing the computer program, further performs the steps of: calculating translation deviation and corner deviation according to the eyepoint position information and the target position information; and calculating a deviation value according to the translation deviation and the rotation angle deviation.

In one embodiment, a computer-readable storage medium is provided, having a computer program stored thereon, which when executed by a processor, performs the steps of:

acquiring an initial image of the PCB through the constructed camera model;

acquiring imaging parameters of the PCB, and correcting an initial image according to the imaging parameters to obtain a target image;

selecting at least two characteristic areas on the PCB as eyepoints, and acquiring eyepoint images;

and calculating a deviation value according to the eyepoint image and the target image, inputting the deviation value into a shader for processing, and positioning the PCB probe according to the deviation value.

In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring camera internal parameters and camera external parameters; calibrating the camera according to the internal parameters and the external parameters of the camera to obtain a camera calibration result; and constructing a camera model according to the camera calibration result.

In one embodiment, the computer program when executed by the processor further performs the steps of: collecting the size data of the PCB circuit board through the constructed camera model; calculating an image mapping proportion according to the size data; and mapping and converting the size data according to the image mapping proportion to obtain an initial image of the PCB.

In one embodiment, the computer program when executed by the processor further performs the steps of: extracting initial imaging parameters in an initial image; correcting the initial imaging parameters according to the imaging parameters to obtain corrected target imaging parameters; and processing the initial image through the target imaging parameters to obtain a target image.

In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring eyepoint position information of eyepoints in the eyepoint image; calculating target position information at a position corresponding to the eyepoint in the target image according to the eyepoint position information; and calculating a deviation value according to the eyepoint position information and the target position information.

In one embodiment, the computer program when executed by the processor further performs the steps of: calculating translation deviation and corner deviation according to the eyepoint position information and the target position information; and calculating a deviation value according to the translation deviation and the rotation angle deviation.

It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).

The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.

The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

完整详细技术资料下载
上一篇:石墨接头机器人自动装卡簧、装栓机
下一篇:基于人工智能的垃圾储存池处理进度检测方法及系统

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!