Search

CN-121982052-A - Workpiece contour detection method and related device

CN121982052ACN 121982052 ACN121982052 ACN 121982052ACN-121982052-A

Abstract

The application discloses a method and a related device for detecting workpiece contours. The method comprises the steps of obtaining a pre-dispensing image and a post-dispensing image of a target workpiece, performing shape matching on the pre-dispensing image according to a profile feature point distribution template to obtain pre-dispensing matching data, obtaining a grid matching range according to the pre-dispensing matching data, performing segmentation processing on the post-dispensing image to obtain a current profile region and a current glue path region, performing shape matching on the current profile region and the current glue path region in the grid matching range according to the grid feature point distribution template, and obtaining current profile data of the target workpiece in the post-dispensing image. According to the application, the pre-dispensing image and the post-dispensing image of the target workpiece are respectively acquired, the target workpiece is subjected to primary positioning according to the pre-dispensing image, the post-dispensing image is subjected to secondary positioning according to the primary positioning result, and the positioning error caused by small offset in the dispensing process is compensated by carrying out secondary positioning on the target workpiece.

Inventors

  • WANG WEICHAO
  • LI HE
  • ZHANG JIXING
  • ZHANG HONGWEI
  • WU ZHENTING
  • CHEN WENQIN

Assignees

  • 富联精密电子(郑州)有限公司

Dates

Publication Date
20260505
Application Date
20251204

Claims (10)

  1. 1. A method of detecting a contour of a workpiece, the method comprising: acquiring a pre-dispensing image and a post-dispensing image of a target workpiece; Performing shape matching on the pre-dispensing image according to a profile feature point distribution template to obtain pre-dispensing matching data of the target workpiece in the pre-dispensing image, wherein the pre-dispensing matching data comprises one or more of pre-dispensing scaling, pre-dispensing rotation angle and pre-dispensing position offset of the target workpiece; According to the matching data before dispensing, a grid matching range is obtained; dividing the image after dispensing to obtain a current contour area and a current glue path area; and performing shape matching on the current contour area and the current glue path area within the grid matching range according to a grid characteristic point distribution template to obtain current contour data of the target workpiece in the image after glue dispensing, wherein characteristic points in the grid characteristic point distribution template are distributed in a grid mode based on the size and the shape of the target workpiece.
  2. 2. The method of claim 1, wherein prior to the acquiring the pre-dispensing image and the post-dispensing image of the target workpiece, the method further comprises: acquiring a template image of a template workpiece before dispensing; And carrying out feature matching on the template image based on a scale space pyramid algorithm to obtain the profile feature point distribution template and the grid feature point distribution template.
  3. 3. The method according to claim 2, wherein the feature matching the template image based on the scale space pyramid algorithm to obtain the profile feature point distribution template and the grid feature point distribution template includes: extracting contour lines of the template image to obtain template contour data of the template workpiece in the template image; dividing the template image according to the template contour data to obtain a region of interest range; and in the range of the attention area, performing feature matching on the template image by utilizing the scale space pyramid algorithm to acquire the profile feature point distribution template and the grid feature point distribution template.
  4. 4. The method of claim 1, wherein the obtaining the grid matching range according to the pre-dispensing matching data comprises: obtaining a scaling matching range of the target workpiece according to the scaling before dispensing; acquiring a rotation angle matching range of the target workpiece according to the rotation angle before dispensing; Acquiring a displacement offset matching range of the target workpiece according to the position offset before dispensing; And acquiring the grid matching range according to the scaling matching range, the rotation angle matching range and/or the displacement offset matching range.
  5. 5. The method according to claim 1, wherein the step of performing shape matching on the current contour region and the current glue path region in the grid matching range according to the grid feature point distribution template to obtain the current contour data of the target workpiece in the post-glue-dispensing image includes: Configuring the matching weight of the current contour area and the current glue path area, wherein the matching weight of the current contour area is larger than the matching weight of the current glue path area; Performing feature matching on the post-dispensing image according to the grid feature point distribution template in the grid matching range based on a scale space pyramid algorithm, the matching weight of the current contour area and the matching weight of the current glue path area to obtain post-dispensing matching data of the target workpiece in the post-dispensing image, wherein the post-dispensing matching data comprises one or more of post-dispensing scaling, post-dispensing rotation angle and post-dispensing position offset of the target workpiece; and acquiring current contour data of the target workpiece in the image after dispensing according to the matching data after dispensing.
  6. 6. A method according to claim 3, wherein the segmenting the template image according to the template profile data to obtain the region of interest comprises: Determining a gradient value of each feature point in the template profile data; taking the characteristic points with gradient values larger than a preset gradient value as candidate characteristic points; And carrying out segmentation processing on the template image according to the candidate feature points to obtain the attention area range.
  7. 7. A method according to claim 3, wherein the scale space pyramid algorithm comprises a plurality of computation levels, each computation level is provided with a corresponding profile feature distribution template set, each profile feature distribution template set comprises a plurality of profile feature distribution templates, the feature matching is performed on the template image by using the scale space pyramid algorithm, and the profile feature point distribution templates are obtained, and the method comprises: starting from a profile feature distribution template set corresponding to the top layer of the scale space pyramid algorithm, sequentially executing a first flow until the bottom layer of the scale space pyramid algorithm completes the first flow; Performing non-maximum suppression processing on a target profile feature distribution template obtained by executing a first process for the last time to obtain the profile feature distribution template; Wherein the first process comprises: determining whether the current layer is a top layer; If not, determining a moving area according to the position information of the last contour feature distribution template and a first preset moving range aiming at each contour feature distribution template in the contour feature distribution template set of the current layer; moving the profile feature distribution template in the moving area of the last profile feature distribution template to obtain similarity scores of the profile feature distribution template and the last profile feature distribution template after each movement; Determining whether the current layer is a bottom layer; If not, taking the profile characteristic distribution template with the highest similarity score as a first profile characteristic distribution template, and recording the position information of the first profile characteristic distribution template; If yes, a first profile feature distribution template with similarity score larger than a first preset similarity score is used as a target profile feature distribution template, and position information of each target profile feature distribution template is recorded.
  8. 8. A device for detecting a contour of a workpiece, the device comprising: The image acquisition module is used for acquiring a pre-dispensing image and a post-dispensing image of the target workpiece; the pre-dispensing matching module is used for carrying out shape matching on the pre-dispensing image according to a profile characteristic point distribution template to obtain pre-dispensing matching data of the target workpiece in the pre-dispensing image, wherein the pre-dispensing matching data comprises one or more of pre-dispensing scaling, pre-dispensing rotation angle and pre-dispensing position offset of the target workpiece; the matching range determining module is used for obtaining a grid matching range according to the matching data before dispensing; The image segmentation module is used for carrying out segmentation processing on the images after the dispensing to obtain a current contour area and a current glue path area; And the post-dispensing matching module is used for carrying out shape matching on the current contour area and the current glue path area within the grid matching range according to a grid characteristic point distribution template to obtain the current contour data of the target workpiece in the post-dispensing image, wherein the characteristic points in the grid characteristic point distribution template are distributed in a grid mode based on the size and the shape of the target workpiece.
  9. 9. An electronic device comprising a memory for storing computer program instructions and a processor for executing the program instructions, wherein the computer program instructions, when executed by the processor, trigger the electronic device to perform the method of any one of claims 1-7.
  10. 10. A computer readable storage medium, characterized in that the computer readable storage medium comprises a stored program, wherein the program, when run, controls a device in which the computer readable storage medium is located to perform the method of any one of claims 1-7.

Description

Workpiece contour detection method and related device Technical Field The invention relates to the technical field of image detection, in particular to a method and a related device for detecting workpiece contours. Background In the product assembly process of the fields of 3C products (such as smart phones and notebook computers), automobiles (such as vehicle-mounted electronic modules and vehicle body sealing components), toys (such as plastic assembly structural members), steel structures (such as precise connection nodes) and the like in the modern industrial manufacturing system, glue path workpiece positioning is a core link for guaranteeing the structural stability, sealing performance, electrical insulation and overall functional reliability of the products. The accurate positioning of the glue path workpiece has irreplaceable significance for the performance stability, the use safety and the market competitiveness of the product. In the related art, the initial position of the workpiece before dispensing is usually defaulted to be completely consistent with the actual position of the workpiece after dispensing, so that the workpiece position information collected before dispensing is directly used as the positioning basis of the workpiece on the dispensing path after dispensing, and the possible micro-offset of the workpiece in the dispensing process is not considered. In actual production scenes, the micro offset of the workpiece after dispensing relative to the initial position before dispensing can be caused by the factors of the dispensing operation (such as slight thrust during the coating of the colloid, fluidity before the solidification of the colloid), the micro deformation of the workpiece clamping mechanism, environmental vibration and the like, and the offset is small, but the offset is far beyond the allowable positioning error range for the scenes of 3C product micro-glue paths, high-precision sealing glue paths of automobiles and the like. The method has the advantages that the related technology directly uses the position data before dispensing to position the glue path workpiece, so that the deviation between the positioning result and the actual position of the workpiece is necessarily caused, if the follow-up procedures (such as workpiece assembly and glue path detection) are performed based on the inaccurate positioning data, the problems of assembly dislocation, detection misjudgment and the like are easy to occur, the reworking rate and the production cost are increased, and on the other hand, the potential risk of glue path failure of batch products can be caused by long-term dependence on the positioning mode. Disclosure of Invention In view of the above, the present application provides a method and related apparatus for detecting a workpiece profile, so as to facilitate improving the yield of products. In a first aspect, an embodiment of the present application provides a method for detecting a workpiece contour, where the method includes: acquiring a pre-dispensing image and a post-dispensing image of a target workpiece; Performing shape matching on the pre-dispensing image according to a profile feature point distribution template to obtain pre-dispensing matching data of the target workpiece in the pre-dispensing image, wherein the pre-dispensing matching data comprises one or more of pre-dispensing scaling, pre-dispensing rotation angle and pre-dispensing position offset of the target workpiece; According to the matching data before dispensing, a grid matching range is obtained; dividing the image after dispensing to obtain a current contour area and a current glue path area; and performing shape matching on the current contour area and the current glue path area within the grid matching range according to a grid characteristic point distribution template to obtain current contour data of the target workpiece in the image after glue dispensing, wherein characteristic points in the grid characteristic point distribution template are distributed in a grid mode based on the size and the shape of the target workpiece. In the embodiment of the application, the images before and after dispensing of the target workpiece are respectively acquired, the target workpiece is positioned for the first time according to the images before dispensing, the images after dispensing are positioned for the second time according to the result of the first positioning, and the positioning error caused by tiny offset in the dispensing process is compensated by the positioning of the target workpiece for the second time, so that the accuracy of positioning the target workpiece is improved. In some possible embodiments, before the acquiring the pre-dispensing image and the post-dispensing image of the target workpiece, the method further includes: acquiring a template image of a template workpiece before dispensing; And carrying out feature matching on the template image based on a scale space