Search

CN-121366154-B - Component identification positioning method and system based on image segmentation

CN121366154BCN 121366154 BCN121366154 BCN 121366154BCN-121366154-B

Abstract

The invention relates to the technical field of image recognition, in particular to a part recognition positioning method and system based on image segmentation. The method comprises the steps of obtaining a gray image, constructing a local neighborhood window, weighting and summing pixel difference values by using a Gaussian weight function to generate a structural energy feature map, carrying out binarization and morphological closing operation on the feature map to extract a foreground region, carrying out self-adaptive iterative erosion by taking a geometric centroid as a starting point, recording a geometric centroid evolution track until a termination condition is met, carrying out linear regression fitting on a track sequence to determine an attitude angle, and determining positioning coordinates according to a distance from the end point to the boundary. According to the invention, the noise immunity is enhanced through the structural energy characteristic diagram, the shape direction of the part is accurately represented by utilizing the track generated by self-adaptive iterative corrosion, and the accuracy and the robustness of identification and positioning are remarkably improved.

Inventors

  • ZENG FANGMING
  • SHEN XIAOWEI
  • LIU FUTANG
  • HUANG YUNRONG

Assignees

  • 东莞市华茂电子集团有限公司

Dates

Publication Date
20260505
Application Date
20251205

Claims (10)

  1. 1. The component identification and positioning method based on image segmentation is characterized by comprising the following steps of: Calculating the absolute difference value of gray values of a central pixel point and neighbor pixel points, and carrying out weighted summation on the difference value by adopting a Gaussian weight function to generate a structural energy feature map; Calculating a geometric centroid of the foreground region as a starting point, recording an initial area, initializing a track sequence, executing self-adaptive iterative corrosion on the foreground region, adding an updated geometric centroid to the track sequence after each corrosion until a termination condition is met, stopping iteration and marking an evolution track termination point, and adjusting the size of a corrosion core according to the attenuation degree of the residual foreground area relative to the initial area; And respectively calculating the shortest distance from the starting point and the ending point to the boundary of the foreground region, and outputting the coordinates of the endpoint corresponding to the maximum shortest distance and the attitude angle as positioning information.
  2. 2. The method for identifying and positioning components based on image segmentation according to claim 1, wherein the calculating process of the structural energy feature map comprises the following steps: determining a plurality of neighborhood pixel points in the local neighborhood window for each central pixel point in the gray level image; determining a weight coefficient according to the space Euclidean distance between the neighborhood pixel point and the center pixel point, wherein the numerical distribution of the weight coefficient accords with Gaussian distribution characteristics, and the weight coefficient and the space Euclidean distance form a negative correlation mapping relation; Multiplying the absolute difference value with the corresponding weight coefficient to obtain a weighted difference value, accumulating the weighted difference values of all neighborhood pixel points in the local neighborhood window, and assigning the accumulated result to the pixel value of the corresponding coordinate position of the structural energy feature map.
  3. 3. The method for identifying and positioning components based on image segmentation according to claim 1, wherein the foreground region extraction process comprises: Counting gray distribution characteristics of the structural energy feature map, and calculating a global binarization threshold value based on an Ojin method; Dividing the structural energy feature map into a foreground pixel set and a background pixel set by utilizing the global binarization threshold; Performing morphological dilation operation on the foreground pixel set to fill the internal cavity, and then performing morphological erosion operation to restore the boundary contour to generate a closed operation area; and detecting the connected domain in the closed operation area, and marking the connected domain with the pixel number larger than a preset noise threshold value as the foreground area.
  4. 4. The method for identifying and positioning components based on image segmentation according to claim 1, wherein the calculation process of the geometric centroid comprises: traversing the foreground region to obtain the abscissa value and the ordinate value of all foreground pixel points in the region, counting the number of all foreground pixel points in the foreground region, and taking the number as the initial area; Calculating the arithmetic average value of the ordinate values of all foreground pixel points to obtain the ordinate of the geometric centroid; and taking a coordinate point formed by the abscissa and the ordinate of the geometric centroid as the starting point, and taking the starting point as the first element of the track sequence.
  5. 5. The method for identifying and positioning components based on image segmentation according to claim 1, wherein the adaptive iterative corrosion process comprises: In the current self-adaptive iterative corrosion step, calculating the ratio of the current residual foreground area to the initial area, and defining the ratio as the area retention rate, wherein the current residual foreground area is the number of pixels in the current foreground area; establishing a positive correlation mapping relation between the size of the corrosion core and the area retention rate, and matching the corresponding size of the corrosion core from the positive correlation mapping relation according to the current area retention rate; And constructing structural elements by using the size of the matched corrosion kernel, performing corrosion operation on the current foreground region, and stripping boundary pixels.
  6. 6. The method for identifying and positioning components based on image segmentation according to claim 5, wherein the establishing a positive correlation mapping relationship between the corrosion kernel size and the area retention rate comprises: setting a preset upper limit value and a preset lower limit value of the size of the corrosion core; constructing mapping logic such that the erosion kernel size tends to the preset upper limit when the area retention tends to a first value; when the area retention rate tends to a second value, the corrosion core size tends to the preset lower limit value; Wherein the first value is greater than the second value and the mapping logic ensures that the erosion kernel size monotonically decreases as the area retention decreases and is always no less than the preset lower limit.
  7. 7. The method for identifying and positioning components based on image segmentation according to claim 1, wherein the termination condition of the adaptive iterative corrosion comprises: After each self-adaptive iterative corrosion, monitoring the current residual foreground area in real time; Judging whether the termination condition is met, wherein the termination condition comprises that the current residual foreground area is smaller than a preset area lower limit threshold value or the number of connected domains is larger than 1 due to the fact that the current foreground area is broken; and if the termination condition is judged to be met, stopping adaptive iterative corrosion, and marking the geometric centroid obtained by the last calculation before the condition is met as the evolution track termination point.
  8. 8. The component recognition positioning method based on image segmentation according to claim 1, wherein the calculation process of the attitude angle comprises: Extracting coordinate data of all geometric centroids in the track sequence, and constructing a coordinate point set; performing linear regression fitting on the coordinate point set based on a least square method, and calculating a straight line parameter which enables the distance residual error square sum of the coordinate point set to a fitting straight line to be minimum; and calculating the inclination angle of the fitting straight line according to the straight line parameter to obtain the attitude angle of the part to be identified.
  9. 9. The method for identifying and positioning components based on image segmentation according to claim 1, wherein the positioning information comprises: extracting edge contour pixels of the foreground region, and constructing a contour point set; traversing the contour point set, calculating Euclidean distance from the starting point to each point in the contour point set, and selecting the minimum value as the boundary distance of the starting point; Traversing the contour point set, calculating Euclidean distance from the termination point to each point in the contour point set, and selecting the minimum value as the boundary distance of the termination point; comparing the value of the boundary distance of the starting point with the value of the boundary distance of the ending point, and outputting the coordinate of the starting point or the ending point corresponding to the maximum value as a positioning coordinate; and combining and outputting the positioning coordinates and the attitude angle as the positioning information.
  10. 10. An image segmentation-based component identification positioning system, comprising: A processor; a memory in which a computer program is stored; Wherein the processor is configured to implement an image segmentation based component identification positioning method as claimed in any one of claims 1 to 9 when executing the computer program.

Description

Component identification positioning method and system based on image segmentation Technical Field The invention relates to the technical field of image recognition. More particularly, the invention relates to a part identification and positioning method and system based on image segmentation. Background With the rapid development of industrial automation technology, machine vision plays an increasingly important role in the automatic identification and positioning of parts. Conventional image recognition techniques typically rely on edge detection, thresholding, or template matching methods to extract features of the parts. In an actual industrial scene, image acquisition is often affected by factors such as uneven illumination, interference of background noise, complex surface textures of parts and the like. The existing part positioning method mostly adopts geometric feature extraction based on contours or moment feature calculation based on areas. For example, the centroid and the principal axis direction of the component are determined by calculating the geometric moment of the binarized image, or the basic geometric shapes such as a straight line and a circle are detected by using hough transform. The traditional methods are established on the basis that the parts have regular geometric structures or central symmetry, and when the parts with standard geometric shapes such as circles, squares or rectangles are processed, the symmetrical characteristics of the parts can be utilized to realize quick and stable positioning, so that the conventional production requirements are met. However, the prior art presents significant limitations in the face of irregularly shaped, non-centrosymmetric or shaped parts with complex extension patterns, which are present in large numbers in industrial production. For such irregular parts, the simple geometric centroid often cannot represent the physical center of gravity or the functional center of the irregular parts, and due to the lack of a regular symmetry axis, deviation is easily generated in attitude angle calculation only by circumscribed rectangle or principal axis analysis, and even errors of head-to-tail inversion occur. In addition, the morphological operation of fixed parameters is difficult to adapt to the changeable width and detail characteristics of the special-shaped parts, and the key morphological structure of the parts is easily damaged while denoising. Therefore, a method for performing high-precision morphological characterization and identification positioning on irregular and asymmetric parts is needed. Disclosure of Invention The invention aims to provide a part identification positioning method and system based on image segmentation, which are used for solving the problems of insufficient positioning accuracy and robustness of parts in the prior art. In a first aspect, the component identification positioning method based on image segmentation includes the steps of obtaining a gray level image of a component to be identified, constructing a local neighborhood window of each pixel point, calculating an absolute difference value of gray level values of a central pixel point and the neighborhood pixel point, carrying out weighted summation on the difference value by adopting a Gaussian weight function to generate a structural energy feature map, carrying out binarization and morphological closing operation on the structural energy feature map, extracting a foreground region, calculating a geometric centroid of the foreground region as a starting point, recording an initial area, initializing a track sequence, carrying out adaptive iterative corrosion on the foreground region, and after each corrosion, adding the updated geometric centroid to the track sequence until the end point of an evolution track is marked, stopping iteration when a termination condition is met, regulating corrosion intensity according to attenuation degree of the residual foreground area relative to the initial area, carrying out linear regression on the track sequence, taking a shortest distance inclination angle as a gesture angle, respectively calculating a shortest distance inclination angle from the starting point and the end point to the boundary of the foreground region, and outputting the coordinate corresponding to the maximum gesture angle as positioning information. The invention realizes high-precision identification and positioning of parts by constructing the structural energy characteristic diagram and combining the self-adaptive iterative corrosion algorithm. The structural energy feature map generated by the Gaussian weight function can effectively inhibit high-frequency noise interference and enhance the edge structural information of the parts, and the geometric centroid evolution track generated by self-adaptive iterative corrosion can more stably represent the overall shape distribution and the extending direction of the parts compared with the single ce