Mark hole positioning method and apparatus, assembly device, and storage medium
By generating multiple auxiliary circles at the contour points of the marked holes as the center of the auxiliary circles, and accumulating the number of intersections of pixel points, the problem of insufficient positioning accuracy and robustness of the marked holes is solved, and accurate positioning under irregular edge conditions is achieved.
Patent Information
- Application Number
- PCT/CN2023/095634
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2022-07-25
- Filing Date
- 2023-05-22
- Publication Date
- 2024-10-17
AI Technical Summary
Existing marking hole positioning methods have insufficient positioning accuracy and robustness when the marking holes have edge irregularities such as convex hulls and burrs or are partially blocked, and cannot simultaneously ensure positioning accuracy and improve robustness.
By taking the outline point of the marked hole as the center of the auxiliary circle, multiple auxiliary circles are generated on the target image, and the number of intersections between each pixel point and the auxiliary circle is accumulated to determine the sub-pixel positioning information of the marked hole, thereby achieving the positioning of the marked hole.
While ensuring the positioning accuracy of the marking holes, it also improves the robustness of the positioning of the marking holes. Especially when the edges are irregular, such as convex hulls, burrs, or partially blocked, the marking holes can be positioned more accurately.
Smart Images

Figure CN2023095634_17102024_PF_FP_ABST
Abstract
Description
Marking hole positioning method, device, assembly equipment and storage medium
[0001] This application claims priority to the Chinese patent application filed with the State Intellectual Property Office of China on July 25, 2022, with application number 202210873883.1 and application name “Positioning method, device, assembly equipment and storage medium for marking holes”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the field of machine vision technology, and in particular to a method, device, assembly equipment and storage medium for positioning a marking hole. Background Art
[0003] Machine vision is a technology that uses machines to replace the human eye for measurement and judgment. In smart manufacturing, machine vision is widely used to locate mark holes in mobile phone frames, printed circuit boards (PCBs), and sheet metal. Machine vision can achieve image positioning of mark holes, and then work with motion control systems to achieve mechanical coordinate positioning. This allows the robot to perform operations such as assembly of the mark holes based on the located mechanical coordinates.
[0004] In related technologies, image location of the mark hole can be performed based on the Hough transform or template matching. The Hough transform first clusters pixels in the mark hole image that have a certain relationship (e.g., a straight line relationship or a circle relationship), and then takes the pixel with the largest cumulative number of clusters as the detection result. Template matching typically fits a circle on the mark hole image using the least squares method, then calculates the error between the points on the contour to be fitted and the template circle equation, and reduces the error value by continuously adjusting the circle's center and radius parameters.
[0005] However, when positioning the mark hole using Hough transform or template matching, the positioning error is large when the mark hole has irregular edges such as convex hulls or burrs, or when the mark hole is partially obscured. Therefore, existing methods for positioning the mark hole cannot ensure the positioning accuracy while improving the robustness of the mark positioning.
[0006] Summary of the Invention
[0007] The present application provides a marking hole positioning method, device, assembly equipment and storage medium to ensure the positioning accuracy of the marking hole while improving the robustness of the marking hole positioning.
[0008] In a first aspect, the present application provides a method for positioning a marking hole, which is applied to assembly equipment. The method provided by the present application includes:
[0009] The assembly device first obtains a target image containing the marking hole to be located and extracts the outline points of the marking hole from the target image. Next, the assembly device uses the outline points as the centers of auxiliary circles and generates a set of auxiliary circle centers. These auxiliary circles are used to locate the center of the marking hole in the target image. Third, the assembly device iterates over each center point in the set of centers and each radius value in the set of auxiliary circle radii, generating multiple auxiliary circles in the target image. The assembly device then accumulates the number of intersections between each pixel in the target image and the multiple auxiliary circles at different radius values. Finally, the assembly device determines the sub-pixel positioning information of the marking hole based on the first pixel with the most intersections with the multiple auxiliary circles and the radius value of the auxiliary circle corresponding to the first pixel. The sub-pixel positioning information includes the pixel coordinates of the marking hole's center and the radius of the marking hole. The marking hole is then located based on the sub-pixel positioning information of the marking hole.
[0010] The positioning method for the marking hole provided by the present application generates multiple auxiliary circles on the target image by using the contour points of the marking hole as the centers of the auxiliary circles, thereby locating the marking hole by the number of intersections between the auxiliary circles and each pixel point in the target image. When the marking hole has irregular edges such as convex hulls or burrs, or when the marking hole is partially obscured, since most of the contour points of the marking hole are normally distributed, the impact on the number of intersections between the auxiliary circles and each pixel point in the target image is small, and thus the impact on the positioning accuracy of the marking hole is also small. Therefore, the positioning method for the marking hole provided by the present application improves the robustness of the positioning of the marking hole while ensuring the positioning accuracy of the marking hole.
[0011] In one possible embodiment, the assembly device acquiring a target image containing a marking hole to be positioned may include: the assembly device first acquiring an original image of the marking hole; and then acquiring the target image within the original image based on a preset first positioning circle and a second positioning circle. The radius of the first positioning circle is the maximum radius of the marking hole, and the radius of the second positioning circle is the minimum radius of the marking hole.
[0012] In this way, the target image can be acquired in the original image through the preset first positioning circle and the second positioning circle, so that the subsequent marking hole positioning is performed through the target image, thereby improving the positioning efficiency of the marking hole.
[0013] In a possible embodiment, the assembly device acquires the target image in the original image based on a preset first positioning circle and a second positioning circle, which may include: the assembly device first pre-locates the target area where the marking hole is located by including the marking hole in the first positioning circle. Subsequently, the assembly device uses the second positioning circle to verify whether the radius of the marking hole in the target area is greater than the minimum radius. If the radius of the marking hole in the target area is greater than the minimum radius, the image of the target area is intercepted in the original image to generate the target image. If the radius of the marking hole in the target area is less than the minimum radius, the marking hole in the target area is determined to be an invalid marking hole.
[0014] In this way, the target area containing the marking hole is determined by the preset first positioning circle, and the marking hole in the target area is ensured to meet the requirements by the preset second positioning circle, thereby ensuring that the target image obtained from the original image is an image containing the marking hole.
[0015] In a possible implementation, the target image is a square image, and the side length of the square image is equal to the diameter of the first positioning circle.
[0016] In a possible implementation, the radius values in the radius set are smaller than or equal to the radius of the first positioning circle and larger than or equal to the radius of the second positioning circle.
[0017] In a possible implementation, before extracting the contour points of the marked hole in the target image, the assembly device may further convert the target image into a grayscale image and perform Gaussian filtering on the converted target image to remove Gaussian noise in the converted target image.
[0018] In this way, the assembly equipment can perform grayscale conversion and noise filtering on the target image, thereby facilitating the subsequent rapid and accurate identification of the outline of the marked hole.
[0019] In one possible implementation, the assembly device extracts the contour points of the marked hole in the target image, including: first, using a gradient operator to calculate a pixel gradient change value for each pixel in the target image. Finally, the assembly device determines the pixel in the target image with the largest pixel gradient change value as the contour point.
[0020] In one possible implementation, the assembly device locates the marking hole based on a first pixel point among the pixels that intersects the plurality of auxiliary circles the most times and the radius of the auxiliary circle corresponding to the first pixel point, including: first, the assembly device converts the sub-pixel positioning information of the marking hole into mechanical positioning information of the marking hole. Then, the assembly device locates the marking hole based on the mechanical positioning information of the marking hole.
[0021] In a possible embodiment, the assembly device determines the sub-pixel positioning information of the marking hole based on the first pixel point among the pixels that intersects the multiple auxiliary circles the most times and the radius value of the auxiliary circle corresponding to the first pixel point, including: the assembly device first generates a first matrix corresponding to the first pixel point, the first matrix includes three-dimensional information, and the three-dimensional information includes the coordinates of the first pixel point in two directions and the radius value of the auxiliary circle corresponding to the first pixel point. Secondly, the assembly device determines the neighborhood matrix corresponding to each dimension of the three-dimensional information. Thirdly, the assembly device determines the sub-pixel positioning information corresponding to the three-dimensional information based on the neighborhood matrix corresponding to each dimension of the information and the first matrix. Finally, the assembly device determines the sub-pixel positioning information of the marking hole based on the sub-pixel positioning information corresponding to the three-dimensional information.
[0022] In a possible embodiment, the neighborhood matrix includes a first neighborhood matrix and a second neighborhood matrix, the target dimension information in the first neighborhood matrix is smaller than the target dimension information in the first matrix, the target dimension information in the second neighborhood matrix is larger than the target dimension information in the first matrix, and the target dimension information is the dimension information corresponding to the first neighborhood matrix and the second neighborhood matrix.
[0023] In one possible implementation, the assembly device determines the sub-pixel positioning information corresponding to the three-dimensional information based on the neighborhood matrix corresponding to each dimensional information and the first matrix, including: first, the assembly device determines a second matrix from the first neighborhood matrix corresponding to each dimensional information, and then determines a third matrix from the second neighborhood matrix corresponding to each dimensional information. Subsequently, the assembly device uses a Gaussian distribution model to fit the first matrix, the second matrix, and the third matrix corresponding to each dimensional information to determine the sub-pixel positioning information corresponding to the three-dimensional information.
[0024] In one possible implementation, the assembly device determines the sub-pixel positioning information of the marking hole based on the sub-pixel positioning information corresponding to the three-dimensional information, including: first, the assembly device determines the sub-pixel coordinates of the first pixel in two directions as the pixel coordinates of the center of the marking hole. Then, the assembly device determines the radius of the auxiliary circle corresponding to the first pixel as the radius of the marking hole.
[0025] In a second aspect, the present application further provides a positioning device for a marking hole, the device comprising:
[0026] An acquisition module, used for acquiring a target image containing a marked hole to be located;
[0027] An intersection module is configured to extract the contour points of the marked hole in the target image; generate a center set of the auxiliary circles with the contour points as the centers of the auxiliary circles, wherein the auxiliary circles are used to locate the centers of the marked holes in the target image; and traverse each center in the center set and each radius in the radius set of the auxiliary circles to generate multiple auxiliary circles in the target image;
[0028] A positioning module is configured to accumulate the number of intersections between each pixel in the target image and the multiple auxiliary circles at different radius values of the auxiliary circles; and locate the marking hole based on the first pixel among the pixels that intersects the most with the multiple auxiliary circles and the radius value of the auxiliary circle corresponding to the first pixel. In a third aspect, the present application also provides an assembly device comprising a processor and a memory, the memory being configured to store code instructions; the processor being configured to execute the code instructions so that the electronic device executes the marking hole positioning method described in the first aspect or any one of the implementations of the first aspect.
[0029] In a fourth aspect, the present application further provides a computer-readable storage medium storing instructions, which, when executed, enable the computer to execute the marking hole positioning method described in the first aspect or any one of the implementations of the first aspect.
[0030] It should be understood that the second to fourth aspects of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by each aspect and the corresponding feasible implementation methods are similar and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] FIG1 is a schematic diagram of positioning a marking hole provided in an embodiment of the present application;
[0032] FIG2 is a schematic diagram of positioning of another marking hole provided in an embodiment of the present application;
[0033] FIG3 is a schematic diagram of a mobile phone midframe provided in an embodiment of the present application;
[0034] FIG4 is a schematic structural diagram of an assembly device provided in an embodiment of the present application;
[0035] FIG5 is a schematic flow chart of a method for positioning a marking hole provided in an embodiment of the present application;
[0036] FIG6 is a schematic diagram of an original image provided in an embodiment of the present application;
[0037] FIG7 is a schematic diagram of a target image provided in an embodiment of the present application;
[0038] FIG8 is a schematic diagram of contour points of a marking hole provided by an embodiment of the present application;
[0039] FIG9 is a schematic diagram of an auxiliary circle provided in an embodiment of the present application;
[0040] FIG10 is a neighborhood diagram of a first matrix provided in an embodiment of the present application;
[0041] FIG11 is a schematic diagram of a Gaussian model distribution provided in an embodiment of the present application;
[0042] 12a-12d are schematic diagrams showing the positioning effect of the marking holes provided in an embodiment of the present application;
[0043] FIG13 is a schematic flow chart of another method for positioning a marking hole provided in an embodiment of the present application;
[0044] FIG14 is a schematic structural diagram of a positioning device for a marking hole provided in an embodiment of the present application;
[0045] FIG15 is a schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application;
[0046] FIG16 is a schematic diagram of the structure of a chip provided in an embodiment of the present application. DETAILED DESCRIPTION
[0047] In order to clearly describe the technical solutions of the embodiments of the present application, in the embodiments of the present application, words such as "first" and "second" are used to distinguish between identical or similar items with substantially the same functions and effects. For example, the first value and the second value are merely used to distinguish different values and do not limit their order. Those skilled in the art will understand that words such as "first" and "second" do not limit the quantity and execution order, and words such as "first" and "second" do not necessarily limit different values.
[0048] It should be noted that, in this application, words such as "exemplary" or "for example" are used to indicate examples, illustrations, or descriptions. Any embodiment or design described in this application as "exemplary" or "for example" should not be construed as being preferred or advantageous over other embodiments or designs. Rather, the use of words such as "exemplary" or "for example" is intended to present the relevant concepts in a concrete manner.
[0049] In this application, "at least one" means one or more, and "more" means two or more. "And / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone, where A and B can be singular or plural. The character " / " generally indicates that the previous and next associated objects are in an "or" relationship. "At least one of the following items" or similar expressions refers to any combination of these items, including any combination of single items or plural items. For example, at least one of a, b, or c can mean: a, b, c, ab, ac, bc, or abc, where a, b, c can be single or multiple.
[0050] Machine vision is a technology that uses machines to replace the human eye for measurement and judgment. In smart manufacturing, machine vision is widely used to locate mark holes in mobile phone frames, printed circuit boards (PCBs), and sheet metal. Machine vision can achieve image positioning of mark holes, and then work with motion control systems to achieve mechanical coordinate positioning. This allows the robot to perform operations such as assembly of the mark holes based on the located mechanical coordinates.
[0051] Since the positioning of the mark holes is a prerequisite for subsequent operations, the accuracy of the mark hole positioning affects the completion quality of subsequent operations. If the mark holes are positioned in a cross-sectional manner, the robot may encounter quality issues such as misalignment during screen assembly and scratching when performing subsequent mark hole assembly operations. In related technologies, image positioning of the mark holes can be performed based on Hough transform or template matching to ensure the positioning accuracy of the mark holes.
[0052] The Hough transform is a method that clusters pixels with certain relationships in the image of the mark hole. For example, pixels with linear or circular relationships can be clustered, and the pixel with the largest cumulative number of clusters is selected as the detection result. It should be noted that because the Hough transform uses the boundary contour information of the mark space, the boundary contour of the mark hole image must first be obtained during the recognition process.
[0053] Template matching is a pattern recognition method. It calculates the similarity between elements in the template and target image to obtain detection results. For example, template matching can be used to fit a circle in the image of the mark hole using the least squares method. The error between the points on the contour to be fitted and the template circle equation is calculated, and the error is minimized by continuously adjusting the center and radius parameters of the fitted circle.
[0054] However, the positioning accuracy and success rate of the mark hole positioning using Hough transform or template matching are high when the mark hole outline is clear. However, when the mark hole has irregular edges such as convex hulls or burrs, or when the mark hole is partially blocked, the positioning deviation is large.
[0055] For example, FIG1 is a schematic diagram of positioning of a marking hole provided in an embodiment of the present application, and FIG2 is a schematic diagram of positioning of another marking hole provided in an embodiment of the present application. There is a convex hull on the marking hole shown in FIG1 , and the marking hole shown in FIG2 is partially blocked. If the marking hole shown in FIG1 is positioned by fitting a circle using the least squares method, the center of the fitted circle will deviate from the actual center of the circle due to the convex hull on the edge, resulting in a large deviation in the positioning of the marking hole. If the marking hole shown in FIG2 is positioned by using the Hough transform method, the center of the circle is blocked, which can easily cause circle recognition errors, thereby affecting the positioning accuracy of the marking hole.
[0056] Therefore, the existing marking hole positioning method cannot ensure the positioning accuracy of the marking hole while improving the robustness of the marking hole positioning.
[0057] In view of this, the present application provides a method, device, assembly equipment and storage medium for positioning a marking hole. By using the contour points of the marking hole as the centers of the auxiliary circles, multiple auxiliary circles are generated on the target image, and the marking hole is positioned by the number of intersections between the auxiliary circles and each pixel point in the target image. When the marking hole has irregular edges such as convex hulls and burrs, or when the marking hole is partially blocked, since most of the contour points of the marking hole are normally distributed, the impact on the number of intersections between the auxiliary circles and each pixel point in the target image is small, and thus the impact on the positioning accuracy of the marking hole is also small. Therefore, the positioning method of the marking hole provided by the present application improves the robustness of the positioning of the marking hole while ensuring the positioning accuracy of the marking hole.
[0058] The following describes the application scenarios of the marking hole positioning method involved in this application.
[0059] Figure 3 is a schematic diagram of a mobile phone midframe provided in an embodiment of the present application. As shown in Figure 3, multiple marking holes can be set on the mobile phone midframe. When the mobile phone midframe is operated on the assembly equipment, the position of the mobile phone midframe can be determined by locating the marking holes on the mobile phone midframe.
[0060] Among them, assembly equipment is equipment used to assemble various parts.
[0061] It should be understood that the embodiments of the present application do not limit the operations of the assembly equipment after the Mark hole is positioned. For example, glue dispensing operations, screen assembly operations, and battery assembly operations can be performed after the Mark hole is positioned.
[0062] It should be noted that the application scenario of the above-mentioned marking hole positioning method does not constitute a limitation of the present application. The marking hole positioning method provided in the present application can be applied to any scenario where marking holes are required.
[0063] In order to make the description of the following embodiments clear and concise, the structure of the assembly equipment involved in the embodiments of the present application is explained below.
[0064] FIG4 is a schematic diagram of the structure of an assembly device provided in an embodiment of the present application. As shown in FIG4 , the assembly device includes an operating mechanism 11 , one or more cameras 12 , a vision processor 13 , a motion mechanism controller 14 , and a support platform 15 .
[0065] It should be understood that the structure of the assembly equipment illustrated in this embodiment does not constitute a specific limitation on the equipment. In other embodiments, the assembly equipment may include more or fewer components than shown, or some components may be combined or separated, or arranged differently. The components shown in the illustrations may be implemented in hardware, software, or a combination of software and hardware.
[0066] The operating mechanism 11 (or manipulator) is used to grab and move parts to be assembled, such as a mobile phone screen, a mobile phone middle frame, etc. The supporting platform 15 is used to support another part to be assembled.
[0067] In an exemplary embodiment, a positioning base for fixing the parts to be assembled is provided on the support platform 15. The support platform 15 can move horizontally and vertically so that the positioning base can move in the horizontal and vertical directions. Furthermore, the parts fixed on the positioning base move with the positioning base.
[0068] For example, if part A needs to be assembled onto part B, part B can be fixed on the support platform 15, part A can be clamped using the operating mechanism 11, and part A can be further assembled onto part B by moving the operating mechanism 11 and / or the support platform 15.
[0069] The camera 12 (or camera) is used to capture images of the parts to be assembled and obtain the positions of the components to be assembled.
[0070] It should be noted that image sensors are an important component of cameras. Depending on the type of components they use, image sensors can be divided into two categories: charge coupled devices (CCDs) and complementary metal oxide semiconductors (CMOSs). A camera composed of CCD components is called a CCD camera, while a camera composed of CMOS components is called a CMOS camera. Camera 12 can be either a CCD camera or a CMOS camera.
[0071] The camera 12 and the motion mechanism controller 14 are both connected to the vision processor 13 via a communication bus.
[0072] The camera 12 can receive a shooting instruction (ie, a first shooting instruction) sent by the visual processor 13; at the same time, the camera 12 can send the captured image to the visual processor 13 so that the visual processor 13 can perform further operations based on the image.
[0073] The visual processor 13 can obtain the position coordinates of the target object or an object on the target object based on the image captured by the camera 12, and further generate a motion control instruction (i.e., a first motion control instruction) for controlling the operating mechanism 11 or the support platform 15 based on the position coordinates and send it to the motion mechanism controller 14. The motion mechanism controller 14 controls the action of the operating mechanism 11 or the support platform 15 based on the motion control instruction, for example, controlling the operating mechanism 11 to grab an object and move, or controlling the support platform 15 to translate or lift, or performing the above-mentioned Mark hole related operations.
[0074] The position coordinates obtained by the camera 12 are based on the image, namely the xyz coordinate system in Figure 2. The motion mechanism (operating mechanism and support platform) is based on the mechanical motion coordinate system, namely the XYZ coordinate system in Figure 2. These two coordinate systems have different origins, positive directions, and unit lengths. Therefore, the positional relationship between the visual coordinate system and the mechanical motion coordinate system needs to be calibrated. This calibration process can be implemented by the vision processor 13 executing a corresponding calibration program.
[0075] The vision processor 13 may include one or more processing units. For example, the vision processor 13 may include a calibration processor and a motion control processor. The calibration processor is primarily used to run a calibration program to map the visual coordinate system to the mechanical motion coordinate system. The motion control processor is primarily used to control the operation of various motion mechanisms, such as the operating mechanism 11 and the support platform 15.
[0076] In one embodiment of the present application, the functions of the visual processor 13 and the motion mechanism controller 14 can be integrated into the same processor, which is not limited in the present application.
[0077] It can be understood that the above-mentioned marking hole positioning method can be implemented by the marking hole positioning device provided in the embodiment of the present disclosure, and the marking hole positioning device can be part or all of a certain device, such as the above-mentioned assembly device or the processor of the assembly device.
[0078] The following uses assembly equipment as an example and combines specific embodiments to explain in detail the technical solution of this application and how it solves the above-mentioned technical problems. The following specific embodiments can be implemented independently or in combination with each other. For some embodiments, the same or similar concepts or processes may not be described in detail.
[0079] FIG5 is a flow chart of a method for locating a marking hole provided in an embodiment of the present application. The method for locating a marking hole provided in this embodiment is applied to an assembly device to locate a marking hole on an object to be assembled. As shown in FIG5 , the method for locating a marking hole includes:
[0080] S201 , obtaining a target image including a marked hole to be located.
[0081] In the present application, when assembling, if it is necessary to locate a mark hole on a component to be assembled, a target image containing the mark hole to be located can be acquired.
[0082] The embodiment of the present application does not limit the shape of the Mark hole. The shape of the Mark hole can be a circle or other regular polygon, for example, a regular hexagon.
[0083] The target image may be an image of a region of interest (ROI) in the original image. In the present application, the ROI of the assembly device when positioning the marking hole is the region including the marking hole to be positioned.
[0084] It should be understood that the embodiments of the present application do not limit how to obtain the target image. In some embodiments, the assembly device may first obtain an original image of the marked hole. Subsequently, the assembly device may obtain the target image within the original image based on the preset first and second positioning circles.
[0085] It should be noted that the embodiments of the present application do not limit how the first and second positioning circles are set. In some embodiments, the radii of the first and second positioning circles can be set based on the radius of the marking hole. For example, the radius of the first positioning circle is the maximum radius of the marking hole, and the radius of the second positioning circle is the minimum radius of the marking hole.
[0086] In some embodiments, an image acquisition system is usually provided in the assembly equipment. If it is necessary to locate the marking hole of the component to be assembled, the original image of the marking hole can be captured by the CCD camera in the image acquisition system. Subsequently, the original image of the marking hole is processed to obtain a target image containing the marking hole to be located.
[0087] It should be understood that the preset first and second positioning circles are used to locate the target image from the original image. In some embodiments, the assembly equipment can first pre-locate the target area where the marking hole is located by enclosing the marking hole within the first positioning circle. Subsequently, the second positioning circle is used to verify whether the radius of the marking hole in the target area is greater than or equal to the minimum radius.
[0088] If the radius of the marking hole in the target area is greater than or equal to the minimum radius, the assembly device intercepts the image of the target area from the original image to generate a target image. If the radius of the marking hole in the target area is less than the minimum radius, the marking hole in the target area is determined to be an invalid marking hole. The marking hole in the target area is determined to be an invalid marking hole.
[0089] For example, Figure 6 is a schematic diagram of an original image provided by an embodiment of the present application, and Figure 7 is a schematic diagram of a target image provided by an embodiment of the present application. As shown in Figure 6, the original image captured by the image acquisition system contains two marking holes, and the assembly equipment can capture target images of the two marking holes one by one. During the target image positioning process, a first positioning circle and a second positioning circle can be used. As shown in Figure 7, the assembly equipment can first use the first positioning circle to determine whether the pre-positioned marking hole meets the upper radius limit. If the first positioning circle can include the pre-positioned marking hole, the pre-positioned marking hole is determined to meet the upper radius limit. Accordingly, as shown in Figure 7, the area located by the first positioning circle containing the pre-positioned marking hole can be the target area where the marking hole is located. Subsequently, the first positioning circle can be used to determine whether the pre-positioned marking hole meets the lower radius limit. If the radius of the marking hole in the target area is greater than or equal to the radius of the second positioning circle, the pre-positioned marking hole is determined to meet the lower radius limit. Accordingly, the pre-positioned marking hole has passed verification, and a screenshot of the target area can be used as the target image. If the radius of the marking hole in the target area is smaller than the radius of the second positioning circle, the pre-positioned marking hole is determined to be an invalid marking hole, and no subsequent positioning operation is required.
[0090] It should be understood that the embodiments of the present application do not limit how to capture the target image. In some embodiments, the target image can be a square image whose side length is equal to the diameter of the first positioning circle. For example, as shown in Figure 7, the target image can be a square image. By using the center of the first positioning circle as the center of the target image, the target image can be captured from the original image.
[0091] This application uses the above-mentioned target image positioning method to complete identification and positioning by simply ensuring that the center of the marking hole falls within the range of the first positioning circle. This allows the marking hole to be offset by the pixel equivalent of the radius of the first positioning circle due to equipment movement or material tolerance, thereby improving the dynamic range of the visual positioning of the marking hole. In addition, it will not be interfered with by the second positioning circle inside the marking hole, that is, there will be no situation where multiple circles are recognized, causing system alarms. By changing the radius of the first positioning circle and the second positioning circle, it is possible to recognize marking holes of different sizes.
[0092] In some embodiments, after acquiring the target image, the assembly device further converts the target image into a grayscale image and performs Gaussian filtering on the converted target image to remove Gaussian noise in the converted target image.
[0093] It should be understood that the embodiments of the present application do not limit how to perform Gaussian filtering on the target image. In some embodiments, the assembly device can perform Gaussian filtering with a 3*3 kernel to remove Gaussian noise on the target image.
[0094] It should be understood that the embodiments of the present application do not limit how to convert the target image into grayscale, and commonly used grayscale conversion methods can be used.
[0095] S202: Extract the contour points of the marked hole in the target image.
[0096] In this step, after the assembly equipment obtains the target image containing the marking hole to be located, the contour points of the marking hole can be extracted from the target image.
[0097] The contour points of the hole may be marked by marking pixel points on the edge line of the hole in the target image.
[0098] It should be understood that the embodiments of the present application do not limit how to extract the contour points of the marked holes. In some embodiments, the assembly equipment may first use a gradient operator to calculate the pixel gradient change value of each pixel in the target image. The assembly equipment may then determine the pixel with the largest pixel gradient change value in the target image as the contour point.
[0099] The above-mentioned gradient operator may be a gradient operator such as Canny, Sobel, or Laplace.
[0100] For example, Figure 8 is a schematic diagram of the contour points of a marking hole provided in an embodiment of the present application. The point in the white circular contour shown in Figure 8 is the pixel point with the largest pixel gradient change value in the target image, that is, the contour point of the marking hole.
[0101] S203 , using the contour point as the center of the auxiliary circle, generating a center set of the auxiliary circle.
[0102] The auxiliary circle is used to locate the center of the marked hole in the target image.
[0103] In some embodiments, each contour point can be represented by the pixel coordinates corresponding to the contour point. For example, the center set P of the auxiliary circle can be {(x1, y1), (x2, y2) ... (x i ,y i )…(x n ,y n )}. Each coordinate in the set P is the pixel coordinate of each contour point.
[0104] In some embodiments, the coordinates of the centers of the auxiliary circle in the center set P may be integer coordinates.
[0105] S204 , traverse each center in the circle center set and each radius value in the radius set to generate multiple auxiliary circles in the target image.
[0106] In this step, after the assembly equipment generates the center set of the auxiliary circle, the radius set of the auxiliary circle can be obtained accordingly, thereby traversing each center in the center set and each radius value in the radius set to generate multiple auxiliary circles in the target image.
[0107] The aforementioned radius set can be pre-set as a set of auxiliary circle radii, which can be specifically configured based on actual circumstances. In some embodiments, the radius values in the auxiliary circle radius set can range between the maximum and minimum radii of the marking hole, that is, the radius values in the radius set are less than or equal to the radius of the first positioning circle and greater than or equal to the radius of the second positioning circle. The difference between adjacent radii in the auxiliary circle radius set can be a fixed value, such as 1 pixel.
[0108] [Corrected 05.06.2023 according to Rule 26] For example, FIG9 is a schematic diagram of an auxiliary circle provided in an embodiment of the present application. As shown in FIG9, the assembly equipment can be assembled from the circle center set P: {(x1, y1), (x2, y2) ... (x i ,y i )…(x n ,y n)}. After extracting the first center of the auxiliary circle (x1, y1), with (x1, y1) as the center, we can traverse the radius in the radius set of the extracted auxiliary circle and draw auxiliary circles in the target image in turn. The company of the auxiliary circle can be shown as formula (1): (h-x1) 2 +(w-y1) 2 =z1 2 (1)
[0109] Where h is the first pixel coordinate in the target image (e.g., the coordinate in the horizontal direction), w is the second pixel coordinate in the target image (e.g., the coordinate in the vertical direction), Z1 is the radius of the auxiliary circle, R min is the minimum radius of the marking hole, R max is the maximum radius of the marking hole.
[0110] It should be noted that, by taking R min Start drawing an auxiliary circle on the target image, and after generating the auxiliary circle, add 1 to the value of Z1 and repeat drawing the auxiliary circle on the target image until the value of Z1 is greater than R max Correspondingly, after traversing the auxiliary circle with (x1, y1) as the center, each center can be extracted from the circle center set in turn, and the above operation can be repeated until all the centers in the circle center set are extracted.
[0111] S205 , accumulating the number of intersections between each pixel point in the target image and multiple auxiliary circles under different radius values of the auxiliary circles.
[0112] In this step, after the assembly device generates multiple auxiliary circles in the target image, the number of intersections between each pixel in the target image and the multiple auxiliary circles can be accumulated under different radius values of the auxiliary circles.
[0113] It should be noted that the above-mentioned cumulative number of intersections between each pixel point and multiple auxiliary circles can be understood as counting the number of auxiliary circles passing through the same pixel point at each radius value.
[0114] For example, the assembly device may establish a three-dimensional space matrix (h, w, r) with an initial value of 0, where h is the first pixel coordinate in the target image, w is the second pixel coordinate in the target image, and r is the corresponding radius value.
[0115] When counting the number of intersections, for the circle in formula (1), if r is R min , the three-dimensional space matrix corresponding to the intersection of the auxiliary circle and the pixel coordinates (h0, w0) is (h0, w0, R min ). When r is R maxEach time the auxiliary circle passes through (h0, w0), the three-dimensional space matrix (h0, w0, R min ) plus 1. Count(h0, w0, R min )=Count(h0,w0,R min )+1 (2)
[0116] in, Count(h0,w0,R min ) is a three-dimensional space matrix (h0, w0, R min ) count value.
[0117] It should be understood that in each auxiliary circle corresponding to the center of the circle, after counting the number of intersections between each pixel point and the auxiliary circle under a radius value, the radius value Z1 can be increased by 1, that is, Z 1= R min +1, repeat the above steps, count Count(h0, w0, R min +1) count value.
[0118] It should be understood that in the embodiment of the present application, the count value of the three-dimensional space matrix of each center point under different radius values can be counted to determine the number of intersections between each pixel point and multiple auxiliary circles.
[0119] For example, the count value of a three-dimensional space matrix can be expressed as formula (3):
[0120] Among them, (x i ,y i )∈P, Wherein, P is the above-mentioned circle center set.
[0121] S206 , determining sub-pixel positioning information of the marking hole according to the first pixel point that intersects the plurality of auxiliary circles the most times among the pixels and the radius values of the auxiliary circles corresponding to the first pixel point.
[0122] In some embodiments, the assembly equipment can first determine the sub-pixel positioning information of the marking hole based on the first pixel point that intersects the most number of auxiliary circles among the pixels and the radius of the auxiliary circle corresponding to the first pixel point. This sub-pixel positioning information includes the pixel coordinates of the center of the marking hole and the radius of the marking hole. The assembly equipment then converts the sub-pixel positioning information of the marking hole into mechanical positioning information for the marking hole.
[0123] The sub-pixel positioning information may be position information of the marking hole on the original image or the target image, and the sub-pixel positioning information includes the pixel coordinates of the center of the marking hole and the radius of the marking hole.
[0124] In some embodiments, when determining the sub-pixel positioning information of the marking hole, the assembly device can achieve it through the first matrix corresponding to the first pixel point and the neighborhood matrix of the first matrix. The assembly device can first generate a first matrix corresponding to the first pixel point, and the first matrix includes three-dimensional information, and the three-dimensional information includes the coordinates of the first pixel point in two directions and the radius value of the auxiliary circle corresponding to the first pixel point. Secondly, the assembly device can determine the neighborhood matrix corresponding to each dimension of the three-dimensional information. Thirdly, the assembly device can determine the sub-pixel positioning information corresponding to the three-dimensional information based on the neighborhood matrix and the first matrix corresponding to each dimension of information. Finally, the assembly device can determine the sub-pixel positioning information of the marking hole based on the sub-pixel positioning information corresponding to the three-dimensional information.
[0125] It should be understood that the embodiment of the present application does not limit the type of the above-mentioned first matrix, and it can include the coordinates of the first pixel point in two directions and the radius of the auxiliary circle corresponding to the first pixel point. In some embodiments, the first matrix can be the above-mentioned three-dimensional space matrix.
[0126] Among them, the neighborhood matrix includes a first neighborhood matrix and a second neighborhood matrix, the target dimension information in the first neighborhood matrix is smaller than the target dimension information in the first matrix, the target dimension information in the second neighborhood matrix is larger than the target dimension information in the first matrix, and the target dimension information is the dimension information corresponding to the first neighborhood matrix and the second neighborhood matrix.
[0127] Accordingly, the assembly device can determine the second matrix from the first neighborhood matrix corresponding to each dimension of information, and the third matrix from the second neighborhood matrix corresponding to each dimension of information. The assembly device can then use a Gaussian distribution model to fit the first, second, and third matrices corresponding to each dimension of information to determine the sub-pixel positioning information corresponding to the three-dimensional information.
[0128] In some embodiments, if the first matrix can be (h max , w max , r max ). Among them, (h max , w max ) is the integer coordinate of the center of the required fitting circle, r max is the integer radius of the center of the required fitting circle. FIG10 is a neighborhood diagram of a first matrix provided in an embodiment of the present application. As shown in FIG10 , the assembly equipment can extract the count value of the 9 neighborhoods of 3*3*3 on the left side of the first matrix as follows: (h max -1,w max -1, r max +1), (h max -1,w max , r max +1), (h max -1,wmax +1, r max +1), (h max -1,w max -1, r max ), (h max -1,w max , r max ), (h max -1,w max +1, r max ), (h max -1,w max -1, r max -1), (h max -1,w max , r max -1), (h max -1,w max +1, r max -1).
[0129] Then, taking the first dimension information h as an example, the assembly equipment can determine the left neighborhood h from the count values of the 9 left neighborhood matrices. l The maximum value Count(h l ). Accordingly, the assembly device can extract the count values of the 9 neighborhoods of 3*3*3 on the right side of the first matrix, and determine the right neighborhood h from the count values of the 9 right neighborhood matrices. r The maximum value Count(h r ).
[0130] Figure 11 is a schematic diagram of a Gaussian distribution model provided by an embodiment of the present application. As shown in Figure 11, the number of statistical points gradually decreases from the center of the circle to the periphery, and presents a Gaussian distribution model. Line A in Figure 11 is an ideal Gaussian distribution model μ = h max *Count(h l )=Count(h r ), however, the actual count value Count(h l ) and Count(h r ) may not be equal, in which case the parameter μ in the Gaussian model is shifted to the position of h*, i.e. line B. At this time, μ in the Gaussian model = h* (i.e., the sub-pixel coordinate of the circular h axis)
[0131] [Corrected 04.09.2024 according to Rule 26] [Corrected 04.07.2024 according to Rule 26] [Corrected 29.04.2024 according to Rule 26] l, Count(h l ))、(h max, Count(h max ))、(h r,Count(h r Substituting the values of the three points into formula (4), we can derive formula (5) to find the value of μ. By finding the value of μ, we can determine the sub-pixel coordinate h* corresponding to h.
[0132] It should be noted that the maximum value of the 9 neighborhoods can be replaced by the average value or the median value, which can be set according to actual conditions. The embodiment of the present application does not limit this.
[0133] It should be noted that the calculation method for the other two sub-pixel coordinates w* and r* can refer to the calculation method for h* and will not be repeated here. Table 1 is a schematic diagram of the sub-pixel detection data results. As shown in Table 1, the sub-pixel coordinates determined by the above Gaussian model distribution can improve the accuracy of the sub-pixel coordinates.
[0134] Table 1
[0135] It should be noted that the sub-element coordinates determined by the Gaussian distribution model fitting do not constitute a limitation of the present application. In some embodiments, the Gaussian distribution model fitting can be replaced by other methods, such as the center-of-circle interpolation method.
[0136] In some embodiments, the assembly equipment may determine the sub-pixel coordinates of the first pixel point in two directions as the pixel coordinates of the center of the marking hole, and determine the radius of the auxiliary circle corresponding to the first pixel point as the radius of the marking hole.
[0137] S207 , positioning the marking hole according to the sub-pixel positioning information of the marking hole.
[0138] The mechanical positioning information may be positioning information of the marking hole on the assembly equipment.
[0139] It should be understood that the embodiments of the present application do not limit how to convert sub-pixel positioning information into mechanical positioning information. In some real-time streams, the mapping relationship between sub-pixel positioning information and mechanical positioning information can be pre-set, and the sub-pixel positioning information can be converted into mechanical positioning information according to the mapping relationship.
[0140] The marking hole positioning method provided in the present application draws a circle with the contour point of the marking hole as the center, and counts the pixel point with the largest number of intersections as the center of the auxiliary circle. This can improve the robustness of the marking hole positioning while ensuring the positioning accuracy of the marking hole.
[0141] Figures 12a-12d are schematic diagrams of the positioning effect of the marking hole provided in the embodiment of the present application. As shown in Figures 12a-12d, even when the marking hole has irregular edges such as bulges or burrs, or when the marking hole is partially blocked, the marking hole can still be accurately positioned.
[0142] In the method for locating a marker hole provided by an embodiment of the present application, an assembly device first obtains a target image containing the marker hole to be located and extracts the marker hole's contour points from the target image. Next, the assembly device generates a set of auxiliary circle centers, using the contour points as the centers of the auxiliary circles. Third, the assembly device iterates through each center point in the center set and each radius value in the radius set, generating multiple auxiliary circles in the target image. The device then accumulates the number of intersections between each pixel in the target image and the multiple auxiliary circles at different auxiliary circle radius values. Finally, the marker hole is located based on the first pixel with the greatest number of intersections with the multiple auxiliary circles and the radius of the auxiliary circle corresponding to the first pixel. Because multiple auxiliary circles are generated on the target image using the marker hole's contour points as the centers of the auxiliary circles, the sub-pixel location information of the marker hole is determined based on the number of intersections between the auxiliary circles and each pixel in the target image. The sub-pixel location information includes the pixel coordinates of the marker hole's center and the radius of the marker hole. The marker hole is then located based on the sub-pixel location information of the marker hole. When the marking hole has irregular edges such as convex hulls or burrs, or when the marking hole is partially obscured, since most of the marking hole's contour points are normally distributed, the impact on the number of intersections between the auxiliary circle and each pixel in the target image is relatively small, and thus the positioning accuracy of the marking hole is also relatively small. Therefore, the marking hole positioning method provided by this application improves the robustness of marking hole positioning while ensuring the positioning accuracy of the marking hole.
[0143] FIG13 is a flow chart of another method for locating a marking hole provided in an embodiment of the present application. The method for locating a marking hole provided in this embodiment is applied to an assembly device to locate a marking hole on an object to be assembled. As shown in FIG13 , the method for locating a marking hole includes:
[0144] S301, obtaining an original image of the marked hole.
[0145] S302 : Acquire a target image from the original image according to a preset first positioning circle and a second positioning circle.
[0146] The radius of the first positioning circle is the maximum radius of the marking hole, and the radius of the second positioning circle is the minimum radius of the marking hole.
[0147] S303: Convert the target image into a grayscale image.
[0148] S304 : Perform Gaussian filtering on the converted target image to remove Gaussian noise in the converted target image.
[0149] S305: Extract the contour points of the marked hole in the target image.
[0150] S306 , using the contour point as the center of the auxiliary circle, generating a center set of the auxiliary circle, the auxiliary circle being used to locate the center of the marked hole in the target image.
[0151] S307 , traverse each center in the circle center set and each radius value in the radius set to generate multiple auxiliary circles in the target image.
[0152] S308 , accumulating the number of intersections between each pixel point in the target image and multiple auxiliary circles under different radius values of the auxiliary circles.
[0153] S309: Determine the radius values of the first pixel point that intersects the plurality of auxiliary circles the most times among the pixels and the auxiliary circles corresponding to the first pixel point.
[0154] S310. According to the first pixel point and the radius of the auxiliary circle corresponding to the first pixel point, a Gaussian distribution model is used to fit the sub-pixel positioning information of the marking hole. The sub-pixel positioning information includes the pixel coordinates of the center of the marking hole and the radius of the marking hole.
[0155] S311 , converting the sub-pixel positioning information of the marking hole into mechanical positioning information of the marking hole.
[0156] S312: Position the marking hole according to the mechanical positioning information of the marking hole.
[0157] The method for positioning the marking hole provided in the embodiment of the present application generates multiple auxiliary circles on the target image by taking the contour points of the marking hole as the centers of the auxiliary circles, thereby locating the marking hole by the number of intersections between the auxiliary circles and each pixel point in the target image. When the marking hole has irregular edges such as convex hulls and burrs, or when the marking hole is partially blocked, since most of the contour points of the marking hole are normally distributed, the impact on the number of intersections between the auxiliary circles and each pixel point in the target image is small, and thus the impact on the positioning accuracy of the marking hole is also small. Therefore, the method for positioning the marking hole provided in the present application improves the robustness of the positioning of the marking hole while ensuring the positioning accuracy of the marking hole.
[0158] Those skilled in the art will understand that all or part of the steps of implementing the above-mentioned method embodiment can be completed by hardware related to program instructions, and the aforementioned program can be stored in a computer-readable storage medium. When the program is executed, it executes the steps of the above-mentioned method embodiment; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk, etc. Various media that can store program codes.
[0159] Figure 14 is a schematic diagram of the structure of a marking hole positioning device provided in an embodiment of the present application. This marking hole positioning device can be implemented through software, hardware, or a combination of both. For example, it can be implemented using the assembly equipment or the processor of the assembly equipment described in the above embodiments to execute the marking hole positioning method described in the above embodiments. As shown in Figure 14, this marking hole positioning device 400 includes: an acquisition module 401, an intersection module 402, and a positioning module 403.
[0160] An acquisition module 401 is used to acquire a target image including a marked hole to be located;
[0161] The intersection module 402 is configured to extract the contour points of the marked hole in the target image; generate a set of auxiliary circle centers using the contour points as the centers of the auxiliary circles, the auxiliary circles being used to locate the centers of the marked holes in the target image; and traverse each center point in the center set and each radius value in the radius set to generate multiple auxiliary circles in the target image.
[0162] The positioning module 403 is used to accumulate the number of intersections between each pixel point in the target image and multiple auxiliary circles under different radius values of the auxiliary circles; determine the sub-pixel positioning information of the marking hole based on the first pixel point that intersects the multiple auxiliary circles the most times among the pixels and the radius values of the auxiliary circles corresponding to the first pixel point, where the sub-pixel positioning information includes the pixel coordinates of the center of the marking hole and the radius of the marking hole; and locate the marking hole based on the sub-pixel positioning information of the marking hole.
[0163] In an optional embodiment, the acquisition module 401 is specifically configured to acquire an original image of the marked hole; and acquire a target image in the original image according to a preset first positioning circle and a second positioning circle.
[0164] The radius of the first positioning circle is the maximum radius of the marking hole, and the radius of the second positioning circle is the minimum radius of the marking hole.
[0165] In an optional embodiment, the acquisition module 401 is specifically used to pre-locate the target area where the marking hole is located by including the marking hole in a first positioning circle; use the second positioning circle to verify whether the radius of the marking hole in the target area is greater than or equal to the minimum radius; if so, capture the image of the target area in the original image to generate a target image.
[0166] In an optional implementation, the acquisition module 401 is further configured to, if not, determine that the marked hole in the target area is an invalid marked hole.
[0167] In an optional implementation, the target image is a square image, and the side length of the square image is equal to the diameter of the first positioning circle.
[0168] In an optional implementation, the radius value in the radius set is less than or equal to the radius of the first positioning circle and greater than or equal to the radius of the second positioning circle.
[0169] In an optional implementation, the acquisition module 401 is further configured to convert the target image into a grayscale image; and perform Gaussian filtering on the converted target image to remove Gaussian noise in the converted target image.
[0170] In an optional implementation, the intersection module 402 is specifically configured to calculate a pixel gradient change value of each pixel point in the target image using a gradient operator; and determine a pixel point with a maximum pixel gradient change value in the target image as a contour point.
[0171] In an optional implementation, the positioning module 403 is specifically configured to convert the sub-pixel positioning information of the marking hole into mechanical positioning information of the marking hole; and position the marking hole according to the mechanical positioning information of the marking hole.
[0172] In an optional embodiment, the positioning module 403 is specifically used to generate a first matrix corresponding to a first pixel point, where the first matrix includes three-dimensional information, and the three-dimensional information includes the coordinates of the first pixel point in two directions and the radius value of the auxiliary circle corresponding to the first pixel point; determine a neighborhood matrix corresponding to each dimension of the three-dimensional information; determine sub-pixel positioning information corresponding to the three-dimensional information according to the neighborhood matrix and the first matrix corresponding to each dimension of the information; and determine the sub-pixel positioning information of the marked hole according to the sub-pixel positioning information corresponding to the three-dimensional information.
[0173] In an optional embodiment, the neighborhood matrix includes a first neighborhood matrix and a second neighborhood matrix, the target dimension information in the first neighborhood matrix is smaller than the target dimension information in the first matrix, the target dimension information in the second neighborhood matrix is larger than the target dimension information in the first matrix, and the target dimension information is the dimension information corresponding to the first neighborhood matrix and the second neighborhood matrix.
[0174] In an optional embodiment, the positioning module 403 is specifically used to determine the second matrix from the first neighborhood matrix corresponding to each dimensional information and to determine the third matrix from the second neighborhood matrix corresponding to each dimensional information; and to fit the first matrix, the second matrix and the third matrix corresponding to each dimensional information using a Gaussian distribution model to determine the sub-pixel positioning information corresponding to the three-dimensional information.
[0175] In an optional embodiment, the positioning module 403 is specifically used to determine the sub-pixel coordinates of the first pixel point in two directions as the pixel coordinates of the center of the marking hole; and determine the radius of the auxiliary circle corresponding to the first pixel point as the radius of the marking hole.
[0176] It should be noted that the positioning device for the marking hole provided in the embodiment shown in FIG14 can be used to execute the method provided in any of the above embodiments. The specific implementation method and technical effect are similar and will not be described in detail here.
[0177] Figure 15 is a schematic diagram of the hardware structure of a terminal device provided in an embodiment of the present application. As shown in Figure 15, the terminal device includes a processor 501, a communication line 504 and at least one communication interface (the communication interface 503 is exemplified in Figure 15). The terminal device can be the above-mentioned assembly device.
[0178] The processor 501 may be a general-purpose central processing unit (CPU), a microprocessor, an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application.
[0179] Communications link 504 may include circuitry that transmits information between the aforementioned components.
[0180] The communication interface 503 uses any transceiver or other device for communicating with other devices or communication networks, such as Ethernet, wireless local area networks (WLAN), etc.
[0181] Possibly, the terminal device may further include a memory 502 .
[0182] The memory 502 may be a read-only memory (ROM) or other type of static storage device that can store static information and instructions, a random access memory (RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, an optical disc storage (including a compact disc, laser disc, optical disc, digital versatile disc, Blu-ray disc, etc.), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and can be accessed by a computer, but is not limited thereto. The memory may be independent and connected to the processor via a communication line 504. The memory may also be integrated with the processor.
[0183] The memory 502 is used to store computer-executable instructions for executing the solution of the present application, and the execution is controlled by the processor 501. The processor 501 is used to execute the computer-executable instructions stored in the memory 502, thereby implementing the exposure control method provided in the embodiment of the present application.
[0184] Possibly, the computer-executable instructions in the embodiments of the present application may also be referred to as application code, and the embodiments of the present application do not specifically limit this.
[0185] In a specific implementation, as an embodiment, the processor 501 may include one or more CPUs, such as CPU0 and CPU1 in FIG. 5 .
[0186] In a specific implementation, as an embodiment, a terminal device may include multiple processors, such as processor 501 and processor 505 in Figure 5. Each of these processors may be a single-core (single-CPU) processor or a multi-core (multi-CPU) processor. The processor herein may refer to one or more devices, circuits, and / or processing cores for processing data (e.g., computer program instructions).
[0187] 16 is a schematic diagram of the structure of a chip provided in an embodiment of the present application. The chip 60 includes one or more (including two) processors 610 and a communication interface 630.
[0188] In some embodiments, the memory 640 stores the following elements: executable modules or data structures, or a subset thereof, or an extended set thereof.
[0189] In the embodiment of the present application, the memory 640 may include a read-only memory and a random access memory, and provides instructions and data to the processor 610. A portion of the memory 640 may also include a non-volatile random access memory (NVRAM).
[0190] In the embodiment of the present application, the memory 640, the communication interface 630, and the memory 640 are coupled together via a bus system 620. In addition to a data bus, the bus system 620 may also include a power bus, a control bus, and a status signal bus. For ease of description, each bus is labeled as the bus system 620 in FIG6 .
[0191] The method described in the above embodiment of the present application can be applied to the processor 610, or implemented by the processor 610. The processor 610 may be an integrated circuit chip with signal processing capabilities. During the implementation process, the steps of the above method can be completed by the hardware integrated logic circuit in the processor 610 or the instructions in the form of software. The above-mentioned processor 610 can be a general-purpose processor (for example, a microprocessor or a conventional processor), a digital signal processor (digital signal processing, DSP), an application specific integrated circuit (application specific integrated circuit, ASIC), a field-programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates, transistor logic devices or discrete hardware components. The processor 610 can implement or execute the various methods, steps and logic block diagrams disclosed in the embodiments of the present application.
[0192] The steps of the method disclosed in the embodiments of the present application can be directly implemented as being executed by a hardware decoding processor, or can be implemented by a combination of hardware and software modules in the decoding processor. The software module can be located in a storage medium mature in the art, such as a random access memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable read-only memory (EEPROM). The storage medium is located in the memory 640, and the processor 610 reads the information in the memory 640 and performs the steps of the above method in conjunction with its hardware.
[0193] In the above embodiment, the instructions stored in the memory for execution by the processor may be implemented in the form of a computer program product, wherein the computer program product may be pre-written in the memory or downloaded and installed in the memory in the form of software.
[0194] A computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function according to the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can store or a data storage device such as a server or data center that includes one or more available media integrated. For example, the available medium can include magnetic media (e.g., floppy disk, hard disk or tape), optical media (e.g., digital versatile disc (DVD)), or semiconductor media (e.g., solid state disk (SSD)).
[0195] The present application also provides a computer-readable storage medium. The methods described in the above embodiments can be implemented in whole or in part via software, hardware, firmware, or any combination thereof. Computer-readable media can include computer storage media and communication media, and can also include any medium that can transfer a computer program from one location to another. The storage medium can be any target medium that can be accessed by a computer.
[0196] As one possible design, computer-readable media may include compact disc read-only memory (CD-ROM), RAM, ROM, EEPROM or other optical disc storage; computer-readable media may include magnetic disk storage or other magnetic disk storage devices. Moreover, any connecting line may also be appropriately referred to as a computer-readable medium. For example, if the software is transmitted from a website, server or other remote source using a coaxial cable, fiber optic cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL or wireless technologies such as infrared, radio and microwave are included in the definition of medium. Disk and disc as used herein include compact disc (CD), laser disc, optical disc, digital versatile disc (DVD), floppy disk and Blu-ray disc, where disks usually reproduce data magnetically, while discs reproduce data optically using lasers.
[0197] The above combinations should also be included within the scope of computer-readable media. The above are only specific embodiments of this application, but the scope of protection of this application is not limited to them. Any changes or substitutions that can be easily conceived by any person skilled in the art within the technical scope disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be based on the scope of protection of the claims.
Claims
1. A method for positioning a marking hole, characterized in that: The method comprises: Acquire a target image including the marked hole to be located; Extracting contour points of the marked hole in the target image; Taking the contour point as the center of an auxiliary circle, generating a center set of the auxiliary circle, wherein the auxiliary circle is used to locate the center of the marked hole in the target image; Traversing each center point in the circle center set and each radius value in the radius set of the auxiliary circle to generate a plurality of auxiliary circles in the target image; Under different radius values of the auxiliary circles, accumulating the number of intersections between each pixel point in the target image and the multiple auxiliary circles; Determine the sub-pixel positioning information of the marking hole according to the first pixel point that intersects the plurality of auxiliary circles the most times among the pixels and the radius value of the auxiliary circle corresponding to the first pixel point, wherein the sub-pixel positioning information includes the pixel coordinates of the center of the marking hole and the radius of the marking hole; The marking hole is positioned according to the sub-pixel positioning information of the marking hole.
2. The method according to claim 1, characterized in that The step of acquiring a target image containing a marked hole to be located comprises: Acquire the original image of the marked hole; Acquire the target image in the original image according to a preset first positioning circle and a second positioning circle; The radius of the first positioning circle is the maximum radius of the marking hole, and the radius of the second positioning circle is the minimum radius of the marking hole.
3. The method according to claim 2, characterized in that The step of acquiring the target image in the original image according to the preset first positioning circle and the second positioning circle comprises: By including the marking hole in the first positioning circle, a target area where the marking hole is located is pre-positioned; Using the second positioning circle to verify whether the radius of the marking hole in the target area is greater than or equal to the minimum radius; If so, an image of the target area is intercepted from the original image to generate the target image.
4. The method according to claim 3, characterized in that After using the second positioning circle to verify whether the radius of the marking hole in the target area is greater than the minimum radius, the method further includes: If not, it is determined that the marked hole in the target area is an invalid marked hole.
5. The method according to any one of claims 2 to 4, characterized in that: The target image is a square image, and the side length of the square image is equal to the diameter of the first positioning circle.
6. The method according to claim 2, characterized in that The radius values in the radius set are less than or equal to the radius of the first positioning circle and greater than or equal to the radius of the second positioning circle.
7. The method according to claim 1, characterized in that Before extracting the contour points of the marked hole in the target image, the method further includes: Convert the target image into a grayscale image; Performing Gaussian filtering on the converted target image to remove Gaussian noise in the converted target image.
8. The method according to claim 7, characterized in that Extracting the contour points of the marked hole in the target image includes: Using a gradient operator to calculate the pixel gradient change value of each pixel in the target image; The pixel point with the largest pixel gradient change value in the target image is determined as the contour point.
9. The method according to claim 8, characterized in that Positioning the marking hole according to the sub-pixel positioning information of the marking hole includes: Converting the sub-pixel positioning information of the marking hole into mechanical positioning information of the marking hole; The marking hole is positioned according to the mechanical positioning information of the marking hole.
10. The method according to claim 9, characterized in that The determining of the sub-pixel positioning information of the marking hole according to the radius value of the first pixel point that intersects the plurality of auxiliary circles the most times among the pixels and the auxiliary circle corresponding to the first pixel point comprises: Generate a first matrix corresponding to the first pixel point, where the first matrix includes three-dimensional information, and the three-dimensional information includes coordinates of the first pixel point in two directions and a radius value of an auxiliary circle corresponding to the first pixel point; Determine a neighborhood matrix corresponding to each dimension of the three-dimensional information; Determine the sub-pixel positioning information corresponding to the three-dimensional information respectively according to the neighborhood matrix corresponding to each dimensional information and the first matrix; The sub-pixel positioning information of the marking hole is determined according to the sub-pixel positioning information corresponding to the three-dimensional information.
11. The method according to claim 10, characterized in that The neighborhood matrix includes a first neighborhood matrix and a second neighborhood matrix. The target dimension information in the first neighborhood matrix is smaller than the target dimension information in the first matrix. The target dimension information in the second neighborhood matrix is larger than the target dimension information in the first matrix. The target dimension information is the dimension information corresponding to the first neighborhood matrix and the second neighborhood matrix.
12. The method according to claim 11, characterized in that The determining, according to the neighborhood matrix corresponding to each dimensional information and the first matrix, the sub-pixel positioning information corresponding to the three-dimensional information includes: Determine a second matrix from the first neighborhood matrix corresponding to each dimensional information and determine a third matrix from the second neighborhood matrix corresponding to each dimensional information; The first matrix, the second matrix and the third matrix corresponding to each dimensional information are fitted using a Gaussian distribution model to respectively determine the sub-pixel positioning information corresponding to the three-dimensional information.
13. The method according to claim 10, characterized in that The determining the sub-pixel positioning information of the marking hole according to the sub-pixel positioning information corresponding to the three-dimensional information includes: Determine the sub-pixel coordinates of the first pixel point in two directions as the pixel coordinates of the center of the marking hole; The radius of the auxiliary circle corresponding to the first pixel point is taken as the radius of the marking hole.
14. A positioning device for marking holes, characterized in that: The device comprises: An acquisition module, used for acquiring a target image including a marked hole to be located; An intersection module is used to extract the contour points of the marked hole in the target image; take the contour points as the centers of the auxiliary circles to generate a center set of the auxiliary circles, wherein the auxiliary circles are used to locate the centers of the marked holes in the target image; traverse each center in the center set and each radius in the radius set of the auxiliary circles to generate multiple auxiliary circles in the target image; A positioning module is used to accumulate the number of intersections between each pixel in the target image and the multiple auxiliary circles under different radius values of the auxiliary circles; determine the sub-pixel positioning information of the marking hole according to the first pixel point that intersects the most times with the multiple auxiliary circles among the various pixels and the radius value of the auxiliary circle corresponding to the first pixel point, the sub-pixel positioning information including the pixel coordinates of the center of the marking hole and the radius of the marking hole; and locate the marking hole according to the sub-pixel positioning information of the marking hole.
15. An assembly device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the assembly device is caused to perform the method according to any one of claims 1 to 13.
16. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the computer is caused to perform the method according to any one of claims 1 to 13.
