Target detection and positioning method based on image enhancement

Through image enhancement technology, adjust lighting and edge contrast, optimize feature point matching and assembly frame correction, solve the problem of object detection and positioning instability caused by light fluctuations and occlusion in the prior art, and achieve high-precision and high-stability target positioning.

CN120451502APending Publication Date: 2025-08-08AIR FORCE COMM SERGEANT SCHOOL OF PLA
View PDF 0 Cites 4 Cited by

Patent Information

Application Number
CN202510544380.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-28
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In complex environments such as light fluctuations, occlusions and morphological offsets, existing target detection and positioning technologies have problems such as light compensation inadequate, boundary information unstable, high error matching rate and assembly deviation accumulation, making it difficult to ensure high stability and accuracy.

Method used

Through image enhancement technology, adjust lighting equalization, enhance edge contrast, optimize feature point matching and assembly frame correction, combine the edge contour data of the target component and match feature point set, calculate component offset and alignment status, and output accurate positioning and adjustment results.

Benefits of technology

It improves the adaptability and accuracy of target detection and positioning, reduces environmental interference, enhances the contour integrity and assembly accuracy of the target area, and ensures high stability and consistency in complex environments.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120451502A_ABST
    Figure CN120451502A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of target detection and positioning, in particular to a target detection and positioning method based on image enhancement, and the method comprises the following steps: obtaining an RGB image, balancing illumination, enhancing a contour, adjusting the contrast ratio, extracting boundary points, matching a target region, analyzing a feature structure, optimizing a matching error, calculating an offset, detecting an alignment state, and adjusting a positioning parameter. And correcting the assembly position, and outputting detection and positioning information. According to the method, the consistency of the image under different illumination conditions is ensured through illumination equalization adjustment, environmental interference is reduced, the target boundary is defined through gradient enhancement, the edge contrast is optimized, mismatching is reduced through accurate matching of key boundary points and morphological structure analysis of feature points, the contour integrity of the target area is enhanced, and the image quality is improved. The assembly error is reduced and the assembly precision and consistency are improved by fine calculation of the assembly center point and boundary alignment state and combination of position correction in the assembly frame.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of target detection and positioning, and in particular to a target detection and positioning method based on image enhancement. Background Art

[0002] The field of object detection and localization technology encompasses the interdisciplinary application of computer vision, pattern recognition, image processing, and other disciplines. Its core task is to detect and determine the location, category, and other attributes of an object from image or video data. This technology primarily involves multiple steps, including feature extraction, object recognition, and spatial localization. Traditional object detection methods primarily rely on handcrafted features and rule-based approaches, such as edge detection, color histograms, and template matching. Modern object detection technologies, however, widely utilize deep learning, convolutional neural networks, and region proposal networks to improve detection accuracy and robustness. Furthermore, object localization typically employs regression models and geometric transformations to precisely locate the object by calculating its bounding box, center point coordinates, and pose information. Technologies in this field play a key role in numerous application scenarios, including autonomous driving, security monitoring, medical image analysis, and intelligent manufacturing.

[0003] Among them, the target detection and localization method based on image enhancement refers to the use of image enhancement technology to optimize the quality of input images to improve the accuracy of target detection and localization. This method covers technologies such as brightness adjustment, contrast optimization, noise removal, and super-resolution reconstruction of low-quality images to improve image clarity and target recognizability, and optimizes input data through specific image preprocessing operations such as histogram equalization, adaptive filtering, and wavelet transform. In addition, this method combines target detection algorithms to identify target areas through means such as feature extraction, scale transformation, and background segmentation, and combines target localization techniques such as multi-scale regression, geometric constraint matching, and feature point registration to obtain the precise position of the target in the image.

[0004] Existing technologies have deficiencies in adaptability and accuracy in the process of target detection and positioning. The fixed-parameter illumination compensation method fails to adapt to the illumination fluctuations in different assembly environments, resulting in overexposure or loss of details in certain areas, affecting the stability of boundary information. The extraction of gradient information relies on fixed filtering operations and cannot be adaptively adjusted according to the characteristics of the target area, resulting in insufficient expression of details in the boundary area and deviations in the distribution of feature points. Traditional target matching methods use global features or template matching, which have weak adaptability to changes in local details, resulting in a high mismatch rate. When components are occluded or morphologically offset, the stability of target recognition decreases. The boundary alignment method in the assembly process relies on fixed reference points, ignoring the relative position relationship of components in the assembly frame, resulting in the accumulation of assembly deviations of target components, affecting the final assembly accuracy. The lack of dynamic adjustment capabilities for the target position makes it difficult for existing methods to ensure highly stable target positioning in complex assembly environments. Summary of the Invention

[0005] The purpose of the present invention is to solve the shortcomings of the prior art and propose an object detection and positioning method based on image enhancement.

[0006] In order to achieve the above object, the present invention adopts the following technical solution: a target detection and positioning method based on image enhancement, comprising the following steps:

[0007] S1: Obtain the RGB image of the mobile phone assembly scene, extract brightness and contrast information, balance the light distribution, detect the gradient mutation area, enhance the target outline, call the optimized RGB image, and generate the optimized target detection area;

[0008] S2: Based on the optimized target detection area, extract channel information, adjust edge contrast, convert grayscale space, identify gradient change pixels, extract boundary points, match the target area boundary, and generate edge contour data of the target component;

[0009] S3: Calling the edge contour data of the target component, extracting key feature points, analyzing spatial distribution, calculating morphological structure, matching target boundary information, screening matching points with large errors, optimizing contour integrity, calling matching point sets, and generating matching feature point sets of the target component;

[0010] S4: calling the matching feature point set of the target component, analyzing the component offset, calculating the position in the assembly frame, detecting boundary alignment, filtering the area exceeding the threshold, and outputting the positioning adjustment result of the target component;

[0011] S5: Call the positioning adjustment result of the target component, calculate the assembly position, analyze the alignment status, identify the position relationship of the assembly frame, filter out-of-range components, and output detection and positioning information.

[0012] As a further solution of the present invention, the optimized target detection area includes balanced brightness distribution, enhanced edge contrast, and gradient mutation area marking; the edge contour data of the target component includes a key boundary point set, boundary point connection information, and a boundary area gradient change value; the matching feature point set of the target component includes matching-adjusted feature points, component contour matching information, and optimized feature point distribution; the positioning adjustment result of the target component includes the coordinates of the target component center point, assembly frame offset parameters, and boundary alignment information; the detection and positioning information includes the assembly position of the target component, the coordinates of the assembly reference point, and the spatial adjustment status of the target component.

[0013] As a further solution of the present invention, the specific steps of S1 are:

[0014] S101: Obtain an original RGB image of a mobile phone assembly scene, extract brightness and contrast information of the image, calculate grayscale brightness deviation eigenvalues, obtain brightness and contrast coefficients, and calculate a brightness distribution index by analyzing image distribution;

[0015] S102: performing equalization processing on the image according to the brightness distribution index, adjusting the brightness and contrast of the image, reducing the illumination difference, adjusting the brightness of the illumination variation area to be balanced, and generating a balanced image;

[0016] S103: Based on the equalized image, analyze the boundary area of the target component, detect the mutation area through grayscale gradient calculation, enhance the contour information, and generate an optimized target detection area.

[0017] As a further solution of the present invention, the grayscale brightness deviation characteristic value calculation formula is specifically:

[0018]

[0019] in, Represents the grayscale brightness deviation characteristic value of the i-th pixel, R i , G i 、B i Respectively represent the values of the red, green, and blue color channels of the pixel point, Represents the average grayscale sum of all pixel color channel values, N represents the total number of pixels in the entire image, Represents the average grayscale value of all pixels.

[0020] As a further solution of the present invention, the specific steps of S2 are:

[0021] S201: extracting channel information of an image based on the optimized target detection area, analyzing distribution characteristics of pixel values in the image, and generating pixel value distribution characteristics by statistically analyzing brightness distribution of pixels;

[0022] S202: performing linear adjustment optimization on the target area according to the pixel value distribution characteristics, improving the edge contrast of the target area, converting the image into a grayscale space, and analyzing the grayscale gradient distribution of the edge area to generate edge gradient distribution information;

[0023] S203: Based on the edge gradient distribution information, identify pixel points with grayscale gradient mutations, extract key boundary points, screen the connection relationship between boundary points, and match the boundary features of the target area to generate edge contour data of the target component.

[0024] As a further solution of the present invention, the specific steps of S3 are:

[0025] S301: Calling the edge contour data of the target component, extracting key feature points within the target area, analyzing the distribution relationship between the feature points, and generating feature point distribution features through statistical distribution;

[0026] S302: Based on the distribution characteristics of the feature points, calculate the morphological structure index of the feature point set, analyze the geometric relationship of the feature points, identify the region boundary of the component, and generate component region identification information;

[0027] S303: Based on the component area identification information, call the boundary matching information, filter the feature point set with a large matching error, correct the contour morphology of the error area, adjust the integrity of the feature point target area, and generate a matching feature point set of the target component.

[0028] As a further solution of the present invention, the calculation formula of the morphological structure stability index of the feature point set is specifically:

[0029]

[0030] Among them, S shape Represents the morphological structure stability index of the feature point set, n represents the total number of feature points, x i Indicates the horizontal coordinate of the i-th feature point, y i represents the ordinate of the i-th feature point, Represents the arithmetic mean of the horizontal coordinates of all feature points, Represents the arithmetic mean of the ordinates of all feature points, x i+1 、y i+1 Represents the coordinate value of the i+1th feature point. Adding 1 to the denominator is used to avoid division by zero and enhance the smoothing penalty effect when the distance between points is small.

[0031] As a further solution of the present invention, the specific steps of S4 are:

[0032] S401: calling the matching feature point set of the target component, analyzing the center point offset of the target component, calculating the position of the target component in the assembly frame, and generating the component position offset by comparing the component position with the frame position;

[0033] S402: Based on the component position offset, detecting the boundary alignment state of the target area, identifying the component's angular error, screening the target area whose offset exceeds a threshold, and generating boundary alignment state information;

[0034] S403: Based on the boundary alignment state information, call the boundary information for comparison, adjust the positioning parameters of the target, and generate a positioning adjustment result of the target component by correcting the offset of the target area.

[0035] As a further solution of the present invention, the specific steps of S5 are:

[0036] S501: calling the positioning adjustment result of the target component, calculating the actual assembly position index of the component, analyzing the alignment state of the target component in the assembly area, and generating the component assembly position deviation by measuring the difference between the component position and the target area;

[0037] S502: Based on the component assembly position deviation, detecting the deviation between the target and the assembly reference point, identifying the positional relationship in the assembly frame, screening areas where the deviation exceeds a set range, and generating deviation-exceeding area information;

[0038] S503: Performing position adjustment according to the information of the offset exceeding the area, and outputting detection and positioning information by adjusting the position of the target component in the assembly area.

[0039] As a further solution of the present invention, the calculation formula for the actual assembly position index of the component is specifically:

[0040]

[0041] Among them, P pos Indicates the actual assembly position index of the component, X ck Indicates the horizontal coordinate value of the kth corner point of the component boundary, which is extracted from the component contour point set identified in the image. ck Indicates the ordinate value of the kth corner point of the component boundary, X tk Indicates the horizontal coordinate value of the kth corner point of the assembly reference frame, which is obtained by setting the reference standard of the assembly equipment. tk Indicates the ordinate value of the kth corner point of the assembly reference frame, is the average value of the geometric center position and the component corner points, is the average of the center positions and corner points of the target assembly area.

[0042] Compared with the prior art, the advantages and positive effects of the present invention are:

[0043] In the present invention, the consistency of the image under different lighting conditions is ensured through illumination balance adjustment, environmental interference is reduced, gradient enhancement clarifies the target boundary, optimizes edge contrast, precise matching of key boundary points and morphological structure analysis of feature points reduce mismatching, enhance the contour integrity of the target area, and precise calculation of the component center point and boundary alignment status, combined with position correction in the assembly framework, reduces assembly errors and improves assembly accuracy and consistency. BRIEF DESCRIPTION OF THE DRAWINGS

[0044] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0045] Figure 1 It is a schematic diagram of the steps of the present invention. DETAILED DESCRIPTION

[0046] The technical solution of the present invention is described below in conjunction with the accompanying drawings.

[0047] In the embodiments of the present invention, words such as "exemplarily" and "for example" are used to indicate examples, illustrations, or explanations. Any embodiment or design described as an "exemplary" in the present invention should not be interpreted as being preferred or advantageous over other embodiments or designs. Rather, the use of the word "exemplary" is intended to present concepts in a concrete manner. Furthermore, in the embodiments of the present invention, "and / or" can mean both or either of the two.

[0048] In the embodiments of the present invention, the terms "image" and "picture" may be used interchangeably. It should be noted that, when the distinction between them is not emphasized, their intended meanings are the same. The terms "of," "corresponding," and "corresponding" may be used interchangeably. It should be noted that, when the distinction between them is not emphasized, their intended meanings are the same.

[0049] In the embodiments of the present invention, sometimes a subscript such as W1 may be written as a non-subscript such as W1. When the difference is not emphasized, the meanings to be expressed are the same.

[0050] In order to make the technical problems, technical solutions and advantages to be solved by the present invention clearer, a detailed description will be given below with reference to the accompanying drawings and specific embodiments.

[0051] See also Figure 1 ,The target detection and positioning method based on image enhancement, comprises the following steps:

[0052] S1: Obtain the original RGB image of the mobile phone assembly scene, extract brightness and contrast information, calculate the distribution of high and low brightness areas, perform equalization adjustment to balance the brightness of the illumination variation area, analyze the boundary area of the target component, detect the sudden change area of the grayscale gradient, enhance the target contour information, call the optimized RGB image, input it into the target detection information, and generate the optimized target detection area;

[0053] S2: Based on the optimized target detection area, extract channel information, analyze the distribution characteristics of pixel values, perform linear adjustment to optimize the edge contrast of the target area, convert to grayscale space, analyze the gradient distribution of the edge area, identify the pixel points with gradient changes, extract key boundary points, screen the connection relationship between boundary points, match the boundary features of the target area, call the boundary information, and generate the edge contour data of the target component;

[0054] S3: Call the edge contour data of the target component, extract the key feature points in the target area, analyze the distribution between the feature points, calculate the morphological structure of the feature point set, identify the component area, call the boundary matching information, filter the feature point set with matching errors, correct the contour morphology of the matching area, adjust the integrity of the target area of the feature point matching errors, and generate the matching feature point set of the target component;

[0055] S4: Call the matching feature point set of the target component, analyze the center point offset of the target component, calculate the position of the component in the assembly frame, detect the boundary alignment status of the target area, identify the angular error of the component, filter the target area with an offset exceeding the threshold, call the boundary information for comparison, adjust the target positioning parameters, and output the positioning adjustment result of the target component;

[0056] S5: Call the positioning adjustment result of the target component, calculate the actual assembly position of the component, analyze the alignment status of the target component in the assembly area, detect the deviation between the target and the assembly reference point, identify the positional relationship in the assembly frame, filter the area where the component offset exceeds the set range, perform position adjustment, adjust the position of the target component in the assembly area, and output detection and positioning information.

[0057] The optimized target detection area includes balanced brightness distribution, enhanced edge contrast, and gradient mutation area marking; the edge contour data of the target component includes the key boundary point set, boundary point connection information, and boundary area gradient change value; the matching feature point set of the target component includes the feature points after matching adjustment, component contour matching information, and optimized feature point distribution; the positioning adjustment results of the target component include the coordinates of the center point of the target component, the assembly frame offset parameters, and the boundary alignment information; the detection and positioning information includes the assembly position of the target component, the coordinates of the assembly reference point, and the spatial adjustment status of the target component.

[0058] The specific steps of S1 are:

[0059] S101: Obtain an original RGB image of a mobile phone assembly scene, extract brightness and contrast information of the image, calculate grayscale brightness deviation eigenvalues, obtain brightness and contrast coefficients, and calculate a brightness distribution index by analyzing image distribution;

[0060] The grayscale brightness deviation characteristic value calculation formula is as follows:

[0061]

[0062] in, Represents the grayscale brightness deviation characteristic value of the i-th pixel, R i , G i 、B i Respectively represent the values of the red, green, and blue color channels of the pixel point, Represents the average grayscale sum of all pixel color channel values, N represents the total number of pixels in the entire image, Represents the average grayscale value of all pixels;

[0063] This formula is used to calculate the normalized brightness deviation of each pixel relative to the average brightness of the image. This helps to further analyze the brightness distribution characteristics of the image. The following is an example to illustrate:

[0064] Assume that an image has N=100 pixels. Assume R i , G i , and B i The red, green, and blue color channel values of a pixel are obtained directly from the image data. For example, the color value of a particular pixel is R i =120, G i =150, B i =130.

[0065] First, calculate the grayscale value of the pixel using weighted average:

[0066] Gray value = 0.299·Ri +0.587·G i +0.114·B i

[0067] =0.299·120+0.587·150+0.114·130≈141.93

[0068] Calculate the average grayscale of the entire image: Assume that the R j , G j , B j The average values are 100, 130, and 110, and the average grayscale is calculated as:

[0069]

[0070] Calculate the sum of squared deviations between the grayscale value and the average grayscale:

[0071]

[0072] Since all pixels in this example have the same average grayscale, the sum of squared deviations is 0, which is an ideal situation. In reality, this value is usually not 0 and needs to be obtained from actual data. Assuming the sum of squared deviations is 400, the standard deviation is:

[0073]

[0074] Therefore, the grayscale brightness deviation characteristic value of this specific pixel is:

[0075]

[0076] The result shows that the brightness of this pixel is 1.43 standard deviation units higher than the average brightness, indicating that its brightness is relatively high. Distribution can obtain more information about the image brightness distribution, and further calculation of the brightness distribution index helps to evaluate the brightness uniformity and contrast of the image.

[0077] S102: performing equalization processing on the image according to the brightness distribution index, adjusting the brightness and contrast of the image, reducing the illumination difference, adjusting the brightness of the illumination-varying area to be balanced, and generating a balanced image;

[0078] According to the brightness distribution index, if the value is lower than 4.0, it is determined that the image brightness distribution is concentrated and needs to be equalized. First, according to the grayscale distribution of the image, a grayscale mapping table is established to expand the grayscale interval with dense grayscale value frequency distribution in the original image to the remaining low-frequency grayscale intervals. For example, when the frequency of grayscale values 80 to 100 reaches 60%, the grayscale of this interval is mapped to a wider grayscale value segment such as 40 to 140, so that the image brightness tends to be average as a whole. In the mapping process, the new distribution position corresponding to each grayscale value is counted, and after constructing a complete mapping table, each pixel in the image is reassigned to complete the grayscale reconstruction process. Then, the new brightness values of all pixels are recalculated and the new average brightness and contrast values are counted to determine whether the equalization process is completed. If the image is The average brightness of the image is increased from 84 to 125, and the contrast is increased from 417 to 575, indicating that the brightness and contrast levels have been adjusted. Further analysis is performed on the area with illumination changes, and the entire image is divided into multiple equally divided blocks. The brightness mean and standard deviation are calculated for each block. When the brightness standard deviation of a certain area is significantly higher than that of other areas, for example, when the brightness standard deviation of the overall image area is within 150, and the brightness standard deviation of a local area reaches 290, it is determined that there is strong illumination interference in the area, and the pixel grayscale in the area needs to be further refined. By adjusting the grayscale mapping range in the area, its grayscale is brought closer to the center value, reducing the proportion of extremely dark or extremely bright pixels, and completing the local balanced adjustment of the illumination difference area, a new image with balanced brightness and contrast is generated.

[0079] S103: Based on the equalized image, analyze the boundary area of the target component, detect the mutation area through grayscale gradient calculation, enhance the contour information, and generate an optimized target detection area;

[0080] The area where the target component may exist in the mobile phone assembly image is selected for analysis. The image as a whole has a balanced brightness basis and the edge information is clearer. First, the image area is traversed by sliding the window. The window size can be set to 64×64 pixels. In each window, the grayscale value of the pixel is read and the grayscale difference of adjacent pixels is scanned. If the grayscale difference of consecutive pixels is greater than 30, it is determined to be a boundary mutation point. The grayscale change gradient direction and change intensity are counted at the mutation point. The pixel points whose change intensity exceeds the specified threshold value are marked as possible edge points. For example, in a certain window, there are 50 pixels with a grayscale change amplitude greater than 30, of which 20 are If the point change amplitude is above 50, the central area of the window is marked as the edge candidate area, and the edge mutation points of the entire image are further connected to form a closed contour line to form a preliminary target area boundary map. The boundary area is then subjected to grayscale enhancement processing. The enhancement process is achieved by increasing the grayscale difference between the boundary pixel and its surrounding pixels. If the grayscale of a boundary pixel is 180 and the grayscale of its adjacent pixels is 150, the grayscale of the boundary pixel is increased to 200 and the adjacent pixels are reduced to 140 after enhancement processing, so that the grayscale difference is further expanded to enhance the contour expression, and finally a target detection area image with mutation contour enhancement is generated for subsequent structure recognition.

[0081] The specific steps of S2 are:

[0082] S201: Based on the optimized target detection area, extract the channel information of the image, analyze the distribution characteristics of the pixel values in the image, and generate the pixel value distribution characteristics by counting the brightness distribution of the pixels;

[0083] First, the image is separated into three channels, and the pixel matrices of the red channel, green channel and blue channel are extracted respectively. The numerical values of each pixel in each channel are statistically analyzed and classified. Taking the target area with an image resolution of 1024×768 as an example, each channel matrix contains 786432 pixel values after channel separation. Then, the frequency distribution of the pixel values in each channel is counted, and the pixel values 0 to 255 are divided into 256 integer intervals. The number of occurrences of each grayscale value is calculated respectively, and then converted into frequency values for subsequent distribution feature calculations. The brightness calculation operation is further performed on the above channel matrix. The R, G, and B channel values of each pixel are combined in a proportional weighted manner to generate a brightness value matrix. The general weights R=0.299, G=0.587, and B=0.114 are used. The generated brightness matrix is then statistically analyzed for the brightness value frequency in the same way to construct a brightness histogram distribution. On this basis The probability of occurrence of each brightness level is calculated, and the brightness concentration area is determined by comparing the proportion of each brightness level. If the pixels in a brightness interval such as [100,120] account for more than 42% of the total number of pixels, the image is judged to have a brightness concentration distribution feature. The distribution feature is then divided into intervals, and the brightness value interval is divided into steps of 10. The number of pixels in each divided sub-interval is evaluated. If the proportion of pixels in any interval exceeds 30%, it is classified as a concentrated area. If the proportion of pixels in a certain interval is less than 5%, it is classified as a sparse area. The pixel value distribution structure of the entire image is finally output through the above division. In the actual image, there is a situation where the frequency of the red channel pixel value in [200,255] is as high as 60%, and the brightness is concentrated in the grayscale interval [110,130], with a corresponding frequency of 38%. Combined with the above statistical information, the pixel value distribution feature data for subsequent image adjustment is finally generated.

[0084] S202: performing linear adjustment optimization on the target area according to the pixel value distribution characteristics, improving the edge contrast of the target area, converting the image to grayscale space, and analyzing the grayscale gradient distribution of the edge area to generate edge gradient distribution information;

[0085] First, determine whether the brightness distribution is too concentrated. When the image brightness is concentrated in the middle grayscale interval and the pixel proportion in this area exceeds 40%, perform a linear stretching operation. By setting the corresponding mapping relationship between the input grayscale range and the output grayscale range, remap the brightness value in the original image. For example, when the image brightness value is mainly concentrated between [100,150], map this interval to the [50,200] interval to achieve a larger grayscale value coverage for the overall image after stretching. Then reconvert the target area to the grayscale space. During the conversion process, the RGB value of each pixel is converted to a single-channel grayscale value according to a fixed ratio. After the conversion is completed, a grayscale image is obtained, and the grayscale gradient analysis is performed on the edge area of the image. The image is scanned for each pixel and the grayscale gradient. The difference in grayscale values between adjacent pixels in the horizontal and vertical directions is marked as a gradient mutation point if the absolute value of the difference is greater than 20, and the direction of the grayscale change is recorded. For example, in the edge area of an image, if the grayscale value of a pixel is 180 and the grayscale value of the pixel to its right is 130, and the difference is 50, it is considered a horizontal gradient mutation. The change amplitude values of all edge points in the image are counted and classified to generate grayscale gradient distribution information. The grayscale change amplitude is divided into three intervals: [0-20], [21-50], and [51-100]. The proportion of edge points in each interval is counted accordingly. If the proportion of the [51-100] interval exceeds 25%, it means that the image edge contrast has been enhanced after optimization. Through this process, the image edge grayscale gradient distribution information is output.

[0086] S203: Based on the edge gradient distribution information, identify the pixel points with grayscale gradient mutation, extract key boundary points, screen the connection relationship between the boundary points, and match the boundary features of the target area to generate edge contour data of the target component;

[0087] Identify and process the pixels with sudden grayscale gradient changes in the image. By traversing the image pixels, perform a difference operation on the grayscale values of each pixel and its upper, lower, left, and right adjacent pixels. If the difference is greater than the preset mutation threshold of 30, the pixel is marked as a key boundary point. Then, the coordinate information of all key boundary points is counted, and a boundary point connection diagram is constructed based on the distance and direction relationship between adjacent boundary points. When connecting, the Euclidean distance between adjacent boundary points is determined point by point. If the distance is less than or equal to 3 pixels and the difference in the direction of the connecting line is within ±20 degrees, it is determined to be a connectable point pair. For example, in a certain area, The distance between boundary points A and B is 2.8 pixels, and the connection direction difference is 12 degrees. Therefore, A and B are regarded as continuous boundary points. After completing the screening of all connection relationships, the boundary points are combined in the connected area manner to generate a closed curve. Then, by analyzing the shape and aspect ratio of the boundary curve, the boundary set that meets the morphological characteristics of the target component is extracted. If the width of a closed boundary contour is 60 pixels, the height is 120 pixels, and the edge smoothness is greater than 80%, it is judged to be a candidate area for the target component. Finally, the coordinate data of all boundary points in the area are extracted and arranged in order, and output as the edge contour data of the target component.

[0088] The specific steps of S3 are:

[0089] S301: Calling the edge contour data of the target component, extracting key feature points in the target area, analyzing the distribution relationship between the feature points, and generating feature point distribution features through statistical distribution;

[0090] First, the sequence of boundary points on the contour curve is traversed, and the key feature points with structural change characteristics on the curve are extracted at fixed step intervals. Each key point must meet the condition that the boundary direction mutation angle exceeds 20 degrees, or the distance between consecutive points changes by more than 3 pixels. Taking a set of component contour points in an image as an example, if the angle formed by three adjacent points in the coordinate space is 45 degrees, and the distance from the current point to the previous key point exceeds 5 pixels, then the point is extracted as a key feature point. Subsequently, the coordinates of all feature points are normalized, and their positions are uniformly mapped to the normalized coordinate system of the component contour circumscribed rectangle so that subsequent statistics are not affected by the image size. After normalization, all feature points are spatially distributed. Analysis is performed, and the density and position center of the feature points in the X-axis and Y-axis directions are counted respectively. If a certain area has more than 10 feature points concentrated within the range of 5×5 pixels, it is defined as a high-density area. At the same time, the number distribution and symmetry information of the feature points in the four quadrants are recorded. Then, the distance between the feature points is counted, and the distance intervals are set as [0-5], [6-15], [16-30], and [31 or more]. The number of feature point pairs in each interval is counted. If it is found that the feature points are mainly concentrated in the [6-15] interval, accounting for 62% of the number, it can be inferred that the distribution between the feature points is relatively uniform. Combining the above distance statistics, direction angle and dense distribution, the feature point distribution characteristics of the target component in the detection area are finally generated.

[0091] S302: Based on the distribution characteristics of the feature points, calculate the morphological structure index of the feature point set, analyze the geometric relationship of the feature points, identify the region boundary of the component, and generate component region identification information;

[0092] The calculation formula of the morphological structure stability index of the feature point set is as follows:

[0093]

[0094] Among them, S shape Represents the morphological structure stability index of the feature point set, n represents the total number of feature points, x i Indicates the horizontal coordinate of the i-th feature point, y i represents the ordinate of the i-th feature point, Represents the arithmetic mean of the horizontal coordinates of all feature points, Represents the arithmetic mean of the ordinates of all feature points, x i+1 、y i+1 Represents the coordinate value of the i+1th feature point. Adding 1 to the denominator is used to avoid division by zero and enhance the smoothing penalty effect for small distances between points.

[0095] This formula aims to identify shape stability and region boundaries by measuring the geometric structure of a set of feature points. By comparing the offset of each point from the set's mean position and considering the distance between adjacent points, the contribution of each point to shape stability can be determined.

[0096] Consider a set of actual data, assuming there are 5 feature points, their coordinates are: -Point 1: (10, 20) -Point 2: (20, 35) -Point 3: (30, 40) -Point 4: (40, 30) -Point 5: (50, 20)

[0097] First, calculate the average coordinates of all points and

[0098]

[0099] Next, calculate the contribution of each point one by one: -For point 1, i=1, x i+1 =20,y i+1 =35:

[0100]

[0101] -For point 2, i=2,x i+1 =30,y i+1 =40:

[0102]

[0103] -For point 3, i=3,x i+1 =40,y i+1 =30:

[0104]

[0105] -For point 4, i=4,x i+1 =50,y i+1 =20:

[0106]

[0107] -For point 5, i=5, loop to point 1:

[0108]

[0109] Sum and average all the values to get S shape :

[0110]

[0111] The results show that the geometric stability index of the feature points relative to the overall shape is 16.472. A lower value indicates a higher geometric stability, which means that the feature points are more evenly distributed and the shape structure is stable, which helps to accurately identify the regional boundaries of the component.

[0112] S303: Based on the component area identification information, call the boundary matching information, filter the feature point set with large matching errors, correct the contour morphology of the error area, adjust the integrity of the feature point target area, and generate the matching feature point set of the target component;

[0113] First, the matching relationship between the existing boundary points and feature points is called, and the coordinate error of the corresponding positions of each set of feature points and the identified contour is calculated. The error is measured using the Euclidean distance. When the coordinate error between a feature point and the corresponding contour point exceeds the set error threshold of 5 pixels, it is determined to be a matching error point. After collecting all the error point sets, the distribution range of the error points in the image is analyzed. If the number of error points in a certain area exceeds 30% of the total number of feature points in the area, it is defined as an error-intensive area. The boundary segment where the error point is located is further screened, and the original contour shape of the segment is extracted and compared with the ideal boundary shape. If the boundary length is shortened by more than 10%, or the curvature change is greater than 45 If the error is greater than 0, the segment will perform contour correction. The correction process repositions the central axis by fitting the circumscribed boundary curve of the current error point, regenerates the fitting boundary points and replaces the original abnormal segment. At the same time, the integrity of the feature points in the correction area is adjusted. The adjustment method is to remove the original error points and insert new points based on the coordinate mean and angle trend of the adjacent feature points to maintain the continuity of the point set structure. For example, there are 4 error points concentrated in the corner area of a component, and the curvature of the boundary points is abnormal. After correction, 3 new points are generated to replace the original error points. The adjusted feature point target area has no sudden breakpoints in the coordinate space, and the overall boundary is continuous and smooth, eventually forming a target component matching feature point set with a complete structure.

[0114] The specific steps of S4 are:

[0115] S401: calling the matching feature point set of the target component, analyzing the center point offset of the target component, calculating the position of the target component in the assembly frame, and generating the component position offset by comparing the component position with the frame position;

[0116] First, all the point coordinates in the feature point set are extracted, and the mean values in the X and Y directions are calculated based on their two-dimensional coordinates to determine the center point position of the target component. For example, a component feature point set contains 50 key points. If the sum of the X-direction coordinate values is 5400 and the Y-direction sum is 7800, the center point coordinate is (108, 156). Then, the reference coordinate of the assembly frame is called. The coordinate is usually from the preset reference point in the assembly equipment, and the center point position is set to (100, 150). The coordinate difference between the center point of the target component and the center point of the frame is compared, and the offset result is calculated as +8 pixels in the X direction and +6 pixels in the Y direction. The shift value is recorded as the current offset of the component in the assembly frame. The positional relationship between the center point of the component's outline circumscribed rectangle and the center point of the assembly frame is then analyzed. The position difference is calculated in the horizontal and vertical directions respectively, and it is determined whether the offset exceeds the allowable range. The allowable offset range can be determined according to the component size. For example, when the component size is 60×90 pixels, the allowable center offset range is set to ±10 pixels. If the offset is +12 pixels in the X direction and +9 pixels in the Y direction respectively, the X direction offset has exceeded the limit and is recorded as a horizontal offset abnormality. Finally, the offsets in the X and Y directions are output separately as the position offset of the component in the assembly frame.

[0117] S402: Based on the component position offset, detecting the boundary alignment status of the target area, identifying the component's angular error, screening the target area whose offset exceeds the threshold, and generating boundary alignment status information;

[0118] First, determine the alignment status between the boundary points in the target area and the assembly frame boundary line, and compare the spacing and angle difference between the corresponding boundary line segments of the two. In the X-direction boundary, extract all vertical corresponding points of the left boundary of the component and the left boundary of the assembly frame, calculate the horizontal spacing between each pair of points, and record it as an alignment abnormality when it exceeds the set threshold. The threshold is set to ±5 pixels. If the vertical spacing reaches 7 pixels, it is marked as an alignment deviation. Then, by analyzing the position distribution of these deviation points, if the deviation points are concentrated in the upper half of the boundary and the number accounts for more than 40% of the total boundary points, it is determined to be an upper boundary alignment abnormality, and then identify the component. The angular error between the component boundary and the assembly frame is calculated, and the rotation angle difference between the component bounding rectangle and the frame bounding rectangle is calculated. If the component boundary is not parallel to the frame boundary, the angle difference is within ±1 degree, then it is determined to be angle aligned. If the angle difference is 3 degrees, which exceeds the set angle error threshold of ±2 degrees, it is recorded as an angle alignment abnormality. Then, based on the position offset and angle error results, it is jointly determined whether to filter it as an offset exceeding limit area. If any of the following conditions is met: the X-direction offset exceeds 10 pixels, the Y-direction offset exceeds 10 pixels, or the angle error exceeds 2 degrees, then the area is defined as a target area with an offset exceeding the threshold, and the boundary alignment status information of the area is finally output.

[0119] S403: Based on the boundary alignment status information, call the boundary information for comparison, adjust the positioning parameters of the target, and generate the positioning adjustment result of the target component by correcting the offset of the target area;

[0120] Determine the boundary position segment corresponding to the offset position and angle error, determine the number of the abnormal area in the boundary alignment state, locate the specific area coordinates that need to be adjusted, read the current center point coordinates and rotation angle of the target area that has been identified as abnormal, reset the adjustment target value, and use the center point of the assembly frame as the reference to generate the center point position of the target component after adjustment, and reassign the rotation angle parameters of the component according to the reference angle of the angle alignment. For example, if the current center point of the component is (108,156) and the center of the assembly frame is (100,150), it should be adjusted 8 pixels and 6 pixels to the lower left, and the current component The angle is 3 degrees and should be adjusted to 0 degrees. After recording the above difference, the positioning parameters are corrected. The X and Y coordinates in the component position parameters are subtracted by the offset value, and the angle parameter is subtracted by the angle deviation value. After completing the correction, the boundary under the new positioning parameters is tested for affine transformation to detect whether the adjusted component outline is completely covered in the assembly frame area. If the minimum distance between the corrected component circumscribed rectangle and the frame boundary is less than or equal to 2 pixels and the angle error is less than 0.5 degrees, it is judged that the adjustment is successful. Finally, the coordinates, angles, and boundary information of the adjusted component are uniformly updated to the new positioning parameters as the positioning adjustment result of the target component.

[0121] The specific steps of S5 are:

[0122] S501: Calling the positioning adjustment result of the target component, calculating the actual assembly position index of the component, analyzing the alignment status of the target component in the assembly area, and generating the component assembly position deviation by measuring the difference between the component position and the target area;

[0123] The calculation formula for the actual assembly position index of the component is as follows:

[0124]

[0125] Among them, P pos Indicates the actual assembly position index of the component, X ck Indicates the horizontal coordinate value of the kth corner point of the component boundary, which is extracted from the component contour point set identified in the image. ck Indicates the ordinate value of the kth corner point of the component boundary, X tk Indicates the horizontal coordinate value of the kth corner point of the assembly reference frame, which is obtained by setting the reference standard of the assembly equipment. tk Indicates the ordinate value of the kth corner point of the assembly reference frame, is the average value of the geometric center position and the component corner points, is the average value of the center position and the corner points of the target assembly area;

[0126] This formula is used to calculate the actual assembly position index P of the target component. pos , which combines the Euclidean distance between the corner points of the component and the corner points of the target assembly area and the difference in the center point coordinates to evaluate the assembly accuracy of the component.

[0127] Set a specific example, assuming that the four corner coordinates of the target component are X ck and Y ck As follows: Corner point 1:X c1 =100,Y c1 =200 Corner point 2:X c2 =150,Y c2 =200 Corner point 3:X c3 =150,Y c3 =250 Corner point 4:X c4 =100,Y c4 =250

[0128] Assume that the target area corner coordinates X tk and Y tk For: Corner 1:X t1 =102,Y t1 =202 Corner point 2:X t2 =152,Y t2 =202 Corner point 3:X t3 =152,Y t3 =252 Corner point 4:X t4 =102,Y t4 =252

[0129] First calculate the distance between each corner point: For corner point 1:

[0130]

[0131] For corner 2:

[0132]

[0133] For corner 3:

[0134]

[0135] For corner point 4:

[0136]

[0137] Calculate the center point coordinate difference:

[0138]

[0139] Summarizing the results:

[0140]

[0141] The results show that the average Euclidean distance between the component and the target area, as well as the center point coordinate difference, results in an assembly position deviation of 6.32. This value indicates the deviation of the component from the intended target within the overall assembly, further helping to assess and adjust assembly accuracy.

[0142] S502: Based on the component assembly position deviation, the deviation between the target and the assembly reference point is detected, the positional relationship in the assembly frame is identified, the area where the deviation exceeds the set range is screened, and the deviation exceeding area information is generated;

[0143] Call the assembly reference point parameters as the reference control value. The assembly reference point is provided by the calibration mark on the assembly equipment, usually including the precise coordinates of the upper left, upper right, lower left and lower right points. For example, the upper left corner reference point is (50,50) and the lower right corner is (150,250). Compare the coordinate difference between the corner point coordinates of the component and these reference points, and calculate the difference in the X and Y directions for each pair of points. If the difference of a corner point is +6 pixels in the X direction and +4 pixels in the Y direction, and the allowable range is ±3 pixels, then the point is judged to be the reference deviation point. After performing the same calculation operation on all corner points, the total number of deviation points and their distribution area are counted. When the deviation The difference points are concentrated in a certain quadrant. For example, if the deviation points in the lower right corner account for more than 50% of the total points, the quadrant is identified as the main area of position offset. The spatial judgment of the relationship between the component boundary and the assembly frame in the area is continued. The length of the boundary of the area is extracted and the difference between the length of the boundary of the assembly area is taken. If the length of the component boundary segment is 92 pixels and the corresponding assembly boundary is 100 pixels, and the difference exceeds the set boundary error threshold of 5 pixels, it is recorded as a boundary deformation area. By combining and evaluating all the above-mentioned offset points and boundary deformation segments, the areas beyond the set range are screened out, and finally the offset excess area information marked with a specific coordinate range is output.

[0144] S503: performing position adjustment based on the information of the offset exceeding the area, and outputting detection and positioning information by adjusting the position of the target component in the assembly area;

[0145] Locate the center point and boundary range of the offset anomaly area. Call the component's current coordinate parameters in the area to compare with the target coordinate parameters, calculate the offset value required for adjustment, and perform coordinate difference operations in the X and Y directions respectively. For example, if the current area center is (110, 160) and the target area center is (100, 150), the adjustment value is -10 pixels in the X direction and -10 pixels in the Y direction. Then read the rotation angle of the area. If the component's current angle is 3 degrees and the target alignment angle is 0 degrees, the angle adjustment value is -3 degrees. Integrate the position and angle adjustment parameters to generate a new positioning compensation parameter set, which is then applied to the component's overall position data. The component position is updated by translating the coordinates and resetting the angle. Perform the contour boundary fitting operation again, and perform a distance test between the adjusted boundary and the target area boundary. If the distance between all boundary points does not exceed 2 pixels and the boundary angle difference is less than 0.5 degrees, the adjustment is considered complete. The final output includes detection and positioning information including the updated coordinates, angles, and boundary position.

[0146] The above description is merely a specific embodiment of the present invention, but the scope of protection of the present invention is not limited thereto. Any modifications or substitutions that can be easily conceived by a person skilled in the art within the technical scope disclosed in the present invention should be included in the scope of protection of the present invention. Therefore, the scope of protection of the present invention should be based on the scope of protection of the claims.

Claims

1. A target detection and positioning method based on image enhancement, characterized in that: The following steps are involved: S1: Acquire an RGB image of the mobile phone assembly scene, extract brightness and contrast information, balance the light distribution, detect gradient mutation areas, enhance the target outline, call the optimized RGB image, and generate the optimized target detection area; S2: Based on the optimized target detection area, extract channel information, adjust edge contrast, convert grayscale space, identify gradient change pixels, extract boundary points, match the target area boundary, and generate edge contour data of the target component; S3: Calling the edge contour data of the target component, extracting key feature points, analyzing spatial distribution, calculating morphological structure, matching target boundary information, screening matching points with large errors, optimizing contour integrity, calling matching point sets, and generating matching feature point sets of the target component; S4: calling the matching feature point set of the target component, analyzing the component offset, calculating the position in the assembly frame, detecting boundary alignment, filtering the area exceeding the threshold, and outputting the positioning adjustment result of the target component; S5: Call the positioning adjustment result of the target component, calculate the assembly position, analyze the alignment status, identify the position relationship of the assembly frame, filter out-of-range components, and output detection and positioning information.

2. The target detection and positioning method based on image enhancement according to claim 1, characterized in that: The optimized target detection area includes balanced brightness distribution, enhanced edge contrast, and gradient mutation area marking; the edge contour data of the target component includes a key boundary point set, boundary point connection information, and a boundary area gradient change value; the matching feature point set of the target component includes matching-adjusted feature points, component contour matching information, and optimized feature point distribution; the positioning adjustment result of the target component includes the coordinates of the target component center point, assembly frame offset parameters, and boundary alignment information; the detection and positioning information includes the assembly position of the target component, the coordinates of the assembly reference point, and the spatial adjustment status of the target component.

3. The target detection and positioning method based on image enhancement according to claim 1, characterized in that: The specific steps of S1 are: S101: Obtain an original RGB image of a mobile phone assembly scene, extract brightness and contrast information of the image, calculate grayscale brightness deviation eigenvalues, obtain brightness and contrast coefficients, and calculate a brightness distribution index by analyzing image distribution; S102: performing equalization processing on the image according to the brightness distribution index, adjusting the brightness and contrast of the image, reducing the illumination difference, adjusting the brightness of the illumination variation area to be balanced, and generating a balanced image; S103: Based on the equalized image, analyze the boundary area of the target component, detect the mutation area through grayscale gradient calculation, enhance the contour information, and generate an optimized target detection area.

4. The target detection and positioning method based on image enhancement according to claim 3, characterized in that: The grayscale brightness deviation characteristic value calculation formula is specifically: in, Represents the grayscale brightness deviation characteristic value of the i-th pixel, R i , G i 、B i Respectively represent the values of the red, green, and blue color channels of the pixel point, Represents the average grayscale sum of all pixel color channel values, N represents the total number of pixels in the entire image, Represents the average grayscale value of all pixels.

5. The target detection and positioning method based on image enhancement according to claim 3, characterized in that: The specific steps of S2 are: S201: extracting channel information of an image based on the optimized target detection area, analyzing distribution characteristics of pixel values in the image, and generating pixel value distribution characteristics by statistically analyzing brightness distribution of pixels; S202: performing linear adjustment optimization on the target area according to the pixel value distribution characteristics, improving the edge contrast of the target area, converting the image into a grayscale space, and analyzing the grayscale gradient distribution of the edge area to generate edge gradient distribution information; S203: Based on the edge gradient distribution information, identify pixel points with grayscale gradient mutations, extract key boundary points, screen the connection relationship between boundary points, and match the boundary features of the target area to generate edge contour data of the target component.

6. The target detection and positioning method based on image enhancement according to claim 5, characterized in that: The specific steps of S3 are: S301: Calling the edge contour data of the target component, extracting key feature points within the target area, analyzing the distribution relationship between the feature points, and generating feature point distribution features through statistical distribution; S302: Based on the distribution characteristics of the feature points, calculate the morphological structure index of the feature point set, analyze the geometric relationship of the feature points, identify the region boundary of the component, and generate component region identification information; S303: Based on the component area identification information, call the boundary matching information, filter the feature point set with a large matching error, correct the contour morphology of the error area, adjust the integrity of the feature point target area, and generate a matching feature point set of the target component.

7. The target detection and positioning method based on image enhancement according to claim 6, characterized in that: The calculation formula of the morphological structure stability index of the feature point set is specifically: Among them, S shape Represents the morphological structure stability index of the feature point set, n represents the total number of feature points, x i Indicates the horizontal coordinate of the i-th feature point, y i represents the ordinate of the i-th feature point, Represents the arithmetic mean of the horizontal coordinates of all feature points, Represents the arithmetic mean of the ordinates of all feature points, x i+1 、y i+1 Represents the coordinate value of the i+1th feature point. Adding 1 to the denominator is used to avoid division by zero and enhance the smoothing penalty effect when the distance between points is small.

8. The target detection and positioning method based on image enhancement according to claim 6, characterized in that: The specific steps of S4 are: S401: calling the matching feature point set of the target component, analyzing the center point offset of the target component, calculating the position of the target component in the assembly frame, and generating the component position offset by comparing the component position with the frame position; S402: Based on the component position offset, detecting the boundary alignment state of the target area, identifying the component's angular error, screening the target area whose offset exceeds a threshold, and generating boundary alignment state information; S403: Based on the boundary alignment state information, call the boundary information for comparison, adjust the positioning parameters of the target, and generate a positioning adjustment result of the target component by correcting the offset of the target area.

9. The target detection and positioning method based on image enhancement according to claim 8, characterized in that: The specific steps of S5 are: S501: calling the positioning adjustment result of the target component, calculating the actual assembly position index of the component, analyzing the alignment state of the target component in the assembly area, and generating the component assembly position deviation by measuring the difference between the component position and the target area; S502: Based on the component assembly position deviation, detecting the deviation between the target and the assembly reference point, identifying the positional relationship in the assembly frame, screening areas where the deviation exceeds a set range, and generating deviation-exceeding area information; S503: Performing position adjustment according to the information of the offset exceeding the area, and outputting detection and positioning information by adjusting the position of the target component in the assembly area.

10. The method for target detection and positioning based on image enhancement according to claim 9, characterized in that: The actual assembly position index calculation formula of the component is specifically as follows: Among them, P pos Indicates the actual assembly position index of the component, X ck Indicates the horizontal coordinate value of the kth corner point of the component boundary, which is extracted from the component contour point set identified in the image. ck Indicates the ordinate value of the kth corner point of the component boundary, X tk Indicates the horizontal coordinate value of the kth corner point of the assembly reference frame, which is obtained by setting the reference standard of the assembly equipment. tk Indicates the ordinate value of the kth corner point of the assembly reference frame, is the average value of the geometric center position and the component corner points, is the average of the center positions and corner points of the target assembly area.

Citation Information

Cited By

  • Intelligent exposure lamp control method for exposure machine

    CN121050191A

  • A Smart Control Method for Exposure Lamps in an Exposure Machine

    CN121050191B

  • Display panel defect spot detection method

    CN121304571A

  • Screw fixing method and device based on visual inspection

    CN121459077A