Optimized vision inspection system for rocker arm material surface observation based on profile enhancement
By using a contour enhancement detection system that adaptively adjusts the light source illuminance and focal length, and combining phase consistency amplitude maps with optimized resampled images, the system solves the detection difficulties caused by differences in the surface texture direction of the rocker arm material, and achieves accurate identification of minute defects and enhanced contrast.
Patent Information
- Application Number
- CN202611111478.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-24
- Publication Date
- 2026-11-10
AI Technical Summary
Existing technologies struggle to address local texture direction distribution differences in rocker arm material surface defect detection, resulting in insufficient local contrast and missing weak contours, making it impossible to accurately identify minute defects. Furthermore, fusion methods fail to effectively distinguish between textures and defects.
A contour-enhanced detection system is adopted, which adaptively adjusts the light source illuminance and lens focal length, and combines a phase consistency amplitude map with an optimized resampled image fusion mechanism to achieve adaptive observation and defect identification of the rocker arm material surface.
It improves the recognition accuracy and robustness of minute defects on the surface of rocker arm materials, effectively compresses interference from texture pseudo-defects, enhances contrast and defect detection capabilities, and reduces the risk of misjudgment.
Smart Images

Figure CN123071237A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine vision inspection technology, specifically to a contour-enhanced rocker arm material surface observation optimization visual inspection system. Background Technology
[0002] Surface defect detection in rocker arm materials largely relies on machine vision systems. These systems acquire images using high-resolution cameras and fixed light sources, then combine edge detection or texture analysis algorithms to identify anomalies such as scratches and cracks. A common production line inspection method involves uniform illumination and a fixed focal length to photograph the entire workpiece surface, followed by the extraction of contour features using global thresholding or gradient operators for defect determination. This type of approach can achieve preliminary automated inspection when the material surface texture is simple and the illumination is uniform.
[0003] During the machining process, metal rocker arms generate microscopic textures with varying directions, such as turning marks and grinding marks. The direction of these textures varies significantly across different regions. Under globally fixed parameter acquisition methods, the texture contours in some areas will exhibit directional aliasing, leading to a decrease in local contrast and the masking of minor defects by the background texture. Conventional frequency-domain-based phase consistency methods can stably extract texture edges without being affected by overall lighting changes. However, relying solely on the phase consistency amplitude map extracted from a single frame image cannot reflect the uneven distribution of texture directions, making it difficult to support the need for differentiated observation of different sub-regions. If the detection system cannot perceive and compensate for this local directional difference, it will lose effective contour information in areas with disordered textures, resulting in missed detections.
[0004] Surface defects in the rocker arm material manifest as localized abrupt changes in grayscale. When segmenting defects directly from optimized single-frame images, the lack of a measure of contour structural stability can easily lead to misjudging directional fluctuations in the texture itself as anomalies, or failing to fully reconstruct weak edges in the region adjacent to the defect. Existing methods typically employ simple superposition or fixed weights when fusing original grayscale and phase information, neglecting the confidence differences caused by variations in image quality across different regions. This results in artifact residues or weakened true defect contours in the fusion result, making it difficult to balance the structural integrity of the contour with the significance of grayscale abrupt changes. The solution lies in how to adaptively reconstruct image acquisition parameters to address localized differences in texture direction distribution, and how to utilize directional consistency information to guide the fusion of phase features and grayscale images, thereby accurately locating surface defects in the rocker arm material. Summary of the Invention
[0005] To address the issue that complex surface textures of rocker arm materials are prone to insufficient local contrast and missing weak contours under fixed acquisition parameters, this invention aims to provide a detection system capable of sensing differences in the contour direction distribution of sub-regions and adaptively adjusting local illumination and focal length accordingly. Simultaneously, a fusion mechanism combining phase consistency amplitude maps and optimized re-acquisition images is established to achieve reliable identification of minute defects on the surface of rocker arm materials.
[0006] To achieve the above objectives, the present invention provides the following technical solution: The present invention provides a visual inspection system for surface observation optimization of rocker arm materials based on contour enhancement, including an image acquisition module, a phase contour enhancement module, a gradient direction optimization module, an adaptive observation control module, and a defect identification and analysis module.
[0007] The image acquisition module is used to acquire the original grayscale image of the rocker arm material surface and record the light source angle and focal length parameters during acquisition.
[0008] The phase contour enhancement module is used to extract contours from the original grayscale image based on local phase consistency in the frequency domain, generate a phase consistency amplitude map, and select pixels with local maximum response to form an initial contour set. This module utilizes the characteristic that frequency domain phase information is insensitive to low contrast and illumination changes, and can stably extract weak contour features of the material surface to avoid missed detections.
[0009] The gradient direction optimization module receives the initial contour set, divides the original grayscale image into multiple sub-blocks, counts the gradient direction distribution of contour pixels within each sub-block and calculates the direction consistency entropy value, and generates the observation compensation coefficient for each sub-block based on the direction consistency entropy value; the lower the direction consistency entropy value of the sub-block, the more concentrated its contour direction and the clearer its structure, and thus a larger observation compensation coefficient is assigned to it, so as to concentrate resources to strengthen potential defect areas.
[0010] The adaptive observation control module adjusts the light source illuminance and lens focal length of the corresponding sub-block during re-acquisition according to the observation compensation coefficient to obtain an optimized re-acquisition image; through partitioned differential compensation, areas that were originally blurry or lacked contrast receive better illumination and focus, thus improving image quality.
[0011] The defect identification and analysis module performs pixel-level fusion of the optimized resampled image and the phase consistency amplitude map to generate a fused feature map, and identifies the defect area on the rocker arm material surface based on the local gray-scale abrupt change in the fused feature map; by utilizing the complementarity of contour enhancement information and optimized resampled information, the contrast between defects and background and the detection capability of minor defects are effectively improved.
[0012] In a preferred embodiment, the image acquisition module includes an adjustable color temperature multi-channel light source array and a motorized zoom lens unit. The adjustable color temperature multi-channel light source array consists of multiple independently controlled LED beads, with each LED bead corresponding to the illumination of a sub-region. The motorized zoom lens unit changes the focal length by driving the lens group to move via a stepper motor according to the focal length adjustment command output by the adaptive observation control module. During the initial acquisition, the image acquisition module uses a preset uniform illuminance and initial focal length, and transmits the acquired original grayscale image along with the corresponding light source angle and focal length parameters to the phase contour enhancement module, providing a reference for multi-parameter adaptive control.
[0013] As a technical solution of the present invention, when the phase contour enhancement module extracts contours, it constructs a set of Log-Gabor filters with equally distributed directional angles and logarithmically distributed scales. The original grayscale image is convolved with each Log-Gabor filter at each direction and scale to obtain a set of complex responses. For each pixel, the ratio of the sum of the magnitudes of the complex responses at all directions and scales to the sum of their absolute magnitudes is calculated as the phase consistency feature value of that pixel. Non-maximum suppression is applied to the phase consistency feature value, retaining local maxima pixels, and the coordinates and corresponding directional angles of the local maxima pixels are stored in the initial contour set. Phase consistency is highly sensitive to the local phase arrangement of the image and can effectively distinguish between true contours and false responses caused by changes in illumination.
[0014] Furthermore, when the gradient direction optimization module calculates the gradient direction distribution of contour pixels within each sub-block and calculates the direction consistency entropy value, it extracts the direction angles of all pixels falling within the initial contour set for each sub-block, divides the direction angles into multiple angle intervals at equal intervals, and counts the number of pixels in each angle interval to form a histogram; it calculates the normalized probability distribution of the histogram, and then calculates the information entropy of the normalized probability distribution as the direction consistency entropy value; it maps the direction consistency entropy value to a first observation compensation coefficient, the lower the entropy value, the larger the compensation coefficient, thereby applying stronger observation compensation to contour regions with strong directionality.
[0015] Based on this, the adaptive observation control module multiplies the first observation compensation coefficient by the base illuminance value to obtain a corrected illuminance value, and outputs the corrected illuminance value to the light source controller. Simultaneously, according to the threshold range of the directional consistency entropy value, it obtains the focal length adjustment step size by querying a preset focal length offset table, superimposes the focal length adjustment step size onto the current focal length value to form a new focal length parameter, and sends it to the lens drive unit. During resampling, the light source controller and the lens drive unit execute according to the corrected illuminance value and the new focal length parameter, respectively, to obtain the optimized resampling image. The joint synchronous adjustment of illuminance and focal length can effectively compensate for local imaging degradation caused by microscopic undulations or differences in texture on the surface of the rocker arm material.
[0016] In terms of pixel-level fusion, the defect identification and analysis module aligns the optimized resampled image and the phase consistency amplitude map in size and fuses them using a weighted superposition strategy. The weights are selected based on the local contrast of each pixel in the optimized resampled image. Pixels with high local contrast are given higher phase consistency amplitude weights to highlight the contour information of strong edge regions while suppressing noise in flat regions. The gray values of the fused pixels are normalized to a preset range to obtain the fused feature map. The defect identification process of the fused feature map is as follows: the fused feature map is divided into blocks, and the gray values of the pixels in each block are arranged in descending order. The average of the gray values of the first specified number of pixels is taken as the highlight reference value, and the average of the gray values of the last specified number of pixels is taken as the dark area reference value. The absolute value of the difference between the gray value of each pixel and the gray value of its neighboring pixels is calculated. If the absolute value exceeds half of the difference between the highlight reference value and the dark area reference value, the corresponding pixel is marked as a gray-level abrupt change pixel. The adjacent connected regions of all pixels marked as gray-level abrupt change pixels are identified as the defect regions. Preferably, the size of each block is the same as the size of the sub-block, and the specified number before and the specified number after are both 10% of the total number of pixels in the block, thereby enabling the decision threshold to adapt to the grayscale distribution of the region and accurately capture defects of different scales and contrasts.
[0017] As a preferred embodiment of the present invention, it further includes a contour integrity verification module, used to perform connectivity judgment and closure repair on contour segments in the initial contour set after the initial contour set is generated, generate a repaired contour set, and feed it back to the gradient direction optimization module to replace the initial contour set; the contour integrity verification module extracts contour segments from the initial contour set, searches for the endpoints of other contour segments in the neighborhood of the endpoints of each contour segment, and if the Euclidean distance between the two endpoints is less than a preset connection threshold and the directional angle is less than a preset angle threshold, then a straight line interpolation method is used to connect the two segments into a single contour; for the missing opening part of the closed contour, the directional angle of the first and last endpoints of the contour segment is used to fit a circular arc segment to complete it, generating the repaired contour set. This repairs contour breaks caused by local phase response interruptions, improves contour continuity, and thus improves the accuracy and stability of directional consistency entropy value calculation, avoiding misleading observation compensation due to contour fragmentation.
[0018] Furthermore, the gradient direction optimization module is also used to receive the repaired contour set, recalculate the directional consistency entropy value of the contour pixels in each sub-block, and perform a secondary correction on the first observation compensation coefficient. The secondary correction method is as follows: if the directional consistency entropy value in a certain sub-block decreases by more than a specified proportion after repair compared to before repair, then the first observation compensation coefficient is multiplied by an amplification factor greater than 1; if the directional consistency entropy value increases after repair, then the first observation compensation coefficient is multiplied by a reduction factor less than 1. The secondary correction observation compensation coefficient is output as the final compensation coefficient to the adaptive observation control module. This closed-loop correction mechanism can dynamically strengthen or weaken the observation compensation for specific sub-blocks according to the contour repair situation, so that the resampling parameter settings more realistically reflect the contour distribution state of the material surface, further improving the defect identification accuracy and system robustness.
[0019] The technical effects and advantages provided by the present invention in the above technical solution are as follows: By dividing the original grayscale image into multiple sub-blocks, the orientation angles of the initial contour pixels within each sub-block are extracted, a gradient orientation histogram is constructed, and the orientation consistency entropy value is calculated to obtain a quantitative index reflecting the degree of local contour orientation disorder. Based on this entropy value, a first observation compensation coefficient is generated; the lower the entropy value, the more concentrated the orientation, and a larger compensation coefficient is assigned accordingly. During re-acquisition, the adaptive observation control module adjusts the light source illuminance and lens focal length corresponding to the sub-block in real time according to this compensation coefficient. This enhances illumination and provides more precise focusing for texture areas with strong orientation, while appropriately adjusting the focal length in areas with disordered orientation to suppress aliasing and improve local contrast. This dynamic adjustment of sub-block-level parameters driven by orientation consistency entropy values changes the insufficient adaptability to complex textures under the global fixed acquisition mode. It can clearly present subtle scratches, micro-cracks, and other defects that were originally submerged in texture noise in the optimized re-acquisition image, greatly compressing the interference space of texture pseudo-defects.
[0020] The defect identification and analysis module performs pixel-level fusion of the optimized resampled image and the phase consistency amplitude map. The weights are selected based on the local contrast of each pixel in the resampled image. Higher fusion weights are assigned to the phase consistency amplitude map in high-contrast regions, while grayscale details are relatively preserved in low-contrast regions. The phase consistency amplitude map exhibits stable edge markings, unaffected by changes in illumination intensity and absolute contrast. The optimized resampled image provides enhanced subtle grayscale transitions through adaptive compensation. The weighted superposition of these two complementary information sources, guided by local contrast, ensures that the fused feature map retains the complete outline of the texture while amplifying the true grayscale abrupt changes in defect areas. Subsequently, the fused feature map is used to statistically analyze highlight and dark area baseline values by sub-block, calculate grayscale changes, and compare them with dynamic thresholds to mark pixels with abrupt grayscale changes. After connectivity, defect areas are identified, effectively distinguishing between structural texture edges and grayscale jumps caused by defects. This reduces the risk of misclassifying normal textures as defects and enhances the ability to capture low-contrast defects, achieving substantial improvements in both defect integrity and positioning accuracy on complex surfaces of rocker arm materials. Attached Figure Description
[0021] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this invention. For those skilled in the art, other drawings can be obtained based on these drawings.
[0022] Figure 1 This is a schematic diagram of the module structure of a contour-enhanced rocker arm material surface observation optimization visual inspection system. Figure 2 This is a schematic diagram of the image acquisition module structure; Figure 3 This is a flowchart of the phase profile enhancement module processing; Figure 4 This is a schematic diagram showing the corrected illuminance and focal length adjustment step size corresponding to the directional consistency entropy value. Detailed Implementation
[0023] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0024] See Figure 1 This invention provides a visual inspection system for optimizing the observation of rocker arm material surfaces based on contour enhancement, comprising an image acquisition module, a phase contour enhancement module, a gradient direction optimization module, an adaptive observation control module, and a defect identification and analysis module. The image acquisition module acquires the original grayscale image of the rocker arm material surface and records the light source angle and focal length parameters during acquisition. The phase contour enhancement module extracts contours from the original grayscale image based on local phase consistency in the frequency domain, generates a phase consistency amplitude map, and selects pixels with local maximum response to form an initial contour set. The gradient direction optimization module receives the initial contour set, divides the original grayscale image into multiple sub-blocks, statistically analyzes the gradient direction distribution of contour pixels within each sub-block, calculates the direction consistency entropy value, and generates observation compensation coefficients for each sub-block based on the direction consistency entropy value. The adaptive observation control module adjusts the light source illuminance and lens focal length of the corresponding sub-block during re-acquisition based on the observation compensation coefficients to obtain an optimized re-acquisition image. The defect identification and analysis module is used to perform pixel-level fusion of the optimized resampled image and the phase consistency amplitude map to generate a fused feature map, and to identify the defect area on the surface of the rocker arm material based on the local gray-level abrupt change in the fused feature map.
[0025] Example 1: In specific implementation, please refer to Figure 2The image acquisition module includes an adjustable color temperature multi-channel light source array and a motorized zoom lens unit. The adjustable color temperature multi-channel light source array consists of multiple independently controlled LED beads, each corresponding to the illumination of a sub-region. To reduce illuminance crosstalk between adjacent sub-regions, light-shielding partitions are placed between adjacent LED beads in the adjustable color temperature multi-channel light source array, and a focusing lens is installed on the light-emitting surface of each LED bead to constrain the illumination range of the beam to the boundary of its corresponding sub-region. After the system is built, the illuminance distribution of each LED bead is calibrated using a standard white board, and the illuminance value generated in each sub-region when each LED bead is turned on individually is measured to form an illuminance crosstalk matrix. During re-acquisition, the light source controller performs crosstalk compensation calculations on the corrected illuminance value based on the illuminance crosstalk matrix, multiplying the target illuminance vector by the inverse of the crosstalk matrix to obtain the actual driven illuminance value of each LED bead, ensuring that the actual illuminance received by each sub-region is consistent with the corrected illuminance value. In the adjustable color temperature multi-channel light source array, all LED beads are driven by a light source controller. The light source controller can receive the corrected illuminance value sent by the adaptive observation control module and independently adjust the luminous intensity of each LED bead according to the corrected illuminance value. The motorized zoom lens unit includes a stepper motor, a set of movable lens groups, and a lens controller. The lens controller receives the focal length adjustment command output by the adaptive observation control module, converts the focal length adjustment command into the number of drive pulses for the stepper motor, and the stepper motor drives the movable lens group to translate along the optical axis through a transmission mechanism, thereby changing the focal length of the motorized zoom lens unit.
[0026] During the initial acquisition by the image acquisition module, the light source controller sets the illuminance of all LEDs in the adjustable color temperature multi-channel light source array to a preset uniform illuminance, and sets the focal length of the motorized zoom lens unit to the initial focal length. The adjustable color temperature multi-channel light source array illuminates the surface of the rocker arm material with uniform illuminance, and the motorized zoom lens unit captures an image of the rocker arm material surface at the initial focal length, obtaining a raw grayscale image. Simultaneously, the image acquisition module records the light source angle parameters and focal length parameters at the time of acquiring the raw grayscale image. The light source angle parameters include the angle of incidence of each LED relative to the normal of the rocker arm material surface, and the focal length parameter is the actual focal length of the lens group at the time of shooting by the motorized zoom lens unit. The image acquisition module transmits the acquired raw grayscale image, the recorded light source angle parameters, and the focal length parameters to the phase contour enhancement module.
[0027] During subsequent re-acquisition of sub-blocks, the light source controller in the image acquisition module receives the corrected illuminance values corresponding to each sub-block from the adaptive observation control module, while the lens controller in the motorized zoom lens unit receives the new focal length parameters corresponding to each sub-block from the adaptive observation control module. The light source controller adjusts the illuminance of the LED beads in the corresponding sub-region based on the corrected illuminance values, and the motorized zoom lens unit adjusts the focal length via a stepper motor based on the new focal length parameters. This adaptively adjusts the lighting conditions and imaging sharpness of the corresponding area of the sub-block during re-acquisition, resulting in an optimized re-acquisition image.
[0028] Example 2: In specific implementation, please refer to Figure 3 The phase contour enhancement module extracts contours from the original grayscale image based on local phase consistency in the frequency domain. The module first constructs a set of Log-Gabor filters with equally distributed directional angles and logarithmically distributed scales. The Log-Gabor filter set is defined in the frequency domain, with each filter determined by both directional angle parameters and scale parameters. The directional angle parameters are selected at equal intervals from 0 to π according to a preset number of directions, with the number of directions set to 6, and the difference between adjacent directional angles being π / 6. The scale parameters are distributed at equal logarithmic intervals according to the center frequency, with the number of scales set to 4, the minimum center frequency set to 0.05, and the maximum center frequency set to 0.4. The center frequencies corresponding to the four scales are uniformly distributed in logarithmic coordinates. The expression for each Log-Gabor filter in the frequency domain consists of the product of a radial component and an angular component. The radial component is a bandpass function at the logarithmic scale, and the angular component is a cosine function controlling directional selectivity.
[0029] The phase contour enhancement module convolves the original grayscale image with Log-Gabor filters corresponding to each directional angle parameter and each scale parameter, respectively, to obtain a set of complex responses. The convolution operation between the original grayscale image and a Log-Gabor filter is implemented in the frequency domain using a Fast Fourier Transform (FFT). The original grayscale image, after Fourier transform, is multiplied by the frequency response of the Log-Gabor filter, and then subjected to an inverse Fourier transform to obtain the complex response map. The value at each pixel position in the complex response map is a complex number, with its real part representing the even-symmetric filter response and its imaginary part representing the odd-symmetric filter response. The complex response maps for all directions and scales together constitute the complex response set.
[0030] For each pixel in the original grayscale image, the phase contour enhancement module calculates the ratio of the sum of the magnitudes of the complex responses at all directions and scales to the sum of the absolute magnitudes. This ratio is used as the phase consistency feature value of the pixel. The magnitude is defined as the absolute value of the real part of the complex response, and the absolute magnitude is defined as the modulus of the complex response. The phase consistency feature value is calculated as follows: Iterate through all directional angle parameters and all scale parameters, accumulating the absolute values of the real parts of the complex responses corresponding to each pixel at each direction and scale to obtain the sum of magnitudes; accumulate the modulus of the complex responses corresponding to each pixel at each direction and scale to obtain the sum of absolute magnitudes; divide the sum of magnitudes by the sum of the absolute magnitudes and a small constant, where the value of the small constant is set to 0.0001 to prevent the denominator from being zero. The small constant is set to 0.0001 because when the grayscale level distribution of the original grayscale image is in the range of 0 to 255, this value only affects pixels with a denominator that is essentially zero, and will not change the relative magnitude of the phase consistency feature values of other pixels.
[0031] The phase contour enhancement module performs non-maximum suppression on the phase consistency feature values, preserving pixels with local maxima. The non-maximum suppression process is as follows: For each pixel, determine its two adjacent pixels along the gradient direction in the original grayscale image. The gradient direction is determined by the orientation angle of the Log-Gabor filter that maximizes the complex response modulus of the pixel across all directions and scales. Compare the phase consistency feature value of the pixel with the phase consistency feature values of its two adjacent pixels. If the pixel's phase consistency feature value is greater than that of its two adjacent pixels, the pixel is marked as a local maximum pixel. Store the coordinates and corresponding orientation angle of each local maximum pixel in the initial contour set. The orientation angle is the orientation angle parameter value of the Log-Gabor filter that maximizes the complex response modulus of the pixel.
[0032] Example 3: In practice, the gradient direction optimization module receives the initial contour set and divides the original grayscale image into multiple sub-blocks. The original grayscale image is divided into non-overlapping rectangular regions according to a preset sub-block side length, with each rectangular region serving as a sub-block. The sub-block side length is set based on the resolution of the original grayscale image. When the original grayscale image resolution is 2048×2048 pixels, the sub-block side length is set to 128 pixels, resulting in 256 sub-blocks. The sub-block side length is set to ensure that each sub-block contains a sufficient number of contour pixels for reliable gradient direction statistics, while also ensuring that the spatial resolution of the sub-blocks is sufficient to reflect the texture differences in different areas of the rocker arm material surface. For each contour pixel in the initial contour set, the direction angle corresponding to the Log-Gabor filter with the largest complex response modulus at its location is taken as the coarse direction angle of that pixel. Then, within a π / 12 range adjacent to this coarse direction angle, quadratic polynomial interpolation is performed on the complex response modulus of the Log-Gabor filter in each direction at the pixel point, and the peak position of the interpolated value is taken as the fine direction angle of that pixel. Specifically, the quadratic polynomial interpolation uses a three-point interpolation method, with the response modulus corresponding to the coarse direction angle as the midpoint, and the response modulus corresponding to the two adjacent directions as the other two points, fitting a quadratic curve. The angle corresponding to the maximum point of this quadratic curve is taken as the fine direction angle. After this refinement process, the direction angle of each contour pixel is expanded from 6 discrete values to a continuous value within the range of 0 to π, thus truly reflecting the continuous distribution of the actual texture direction. After the quadratic polynomial interpolation refinement process, the fine direction angle of each contour pixel is a continuous estimate of the actual texture direction at sub-filter direction resolution, and its value space is a continuous real number interval within [0, π). Although the original Log-Gabor filter bank only provides six discrete sampling directions, the interpolation operation constructs a quadratic curve using the response magnitudes of adjacent directions for extremum localization. This is equivalent to continuously reconstructing the filter response with sub-directional resolution near the coarse direction angle, so that the final obtained direction angle is no longer limited to the original six discrete values, but can be continuously distributed across the entire range from 0 to π. Based on this, when the fine direction angle is statistically analyzed using a histogram across eight equally spaced intervals, the fine direction angle of each contour pixel may fall into any of the eight intervals. Which interval it falls into depends entirely on the continuous value of the pixel's actual texture direction. Since the fine direction angle is a continuous value, the number of pixels in each interval is determined by the statistical distribution of the actual texture direction within the sub-block. The counting ratio between different intervals can truly reflect the concentration or dispersion of texture directions, avoiding the systematic problem of some intervals having a count that is always zero due to the limited space of direction angle values.
[0033] The gradient orientation optimization module calculates the orientation consistency entropy for each sub-block. For a single sub-block, the gradient orientation optimization module extracts the orientation angles of all pixels falling within the sub-block from the initial contour set. The extraction operation involves traversing each record in the initial contour set and determining whether the coordinates in the record are within the rectangular region boundary of the sub-block. If the coordinates are within the sub-block boundary, the orientation angle corresponding to that record is added to the sub-block's contour pixel orientation angle set.
[0034] The gradient orientation optimization module divides the orientation angles in the contour pixel orientation angle set into multiple angle intervals at equal intervals, and counts the number of pixels in each angle interval to form a histogram. The orientation angle values range from 0 to π, the number of angle intervals is set to 8, and the interval between each angle interval is π / 8. The angle intervals are divided as follows: the first angle interval is [0, π / 8), the second angle interval is [π / 8, π / 4), and so on, with the eighth angle interval being [7π / 8, π). For each orientation angle value in the contour pixel orientation angle set, it is determined which angle interval the orientation angle value falls into, and the pixel count of the corresponding angle interval is incremented by one. After traversing all intervals, a histogram consisting of 8 count values is obtained.
[0035] The gradient direction optimization module calculates the normalized probability distribution of the histogram. The normalized probability distribution is calculated by dividing the pixel count value corresponding to each angle interval in the histogram by the total number of direction angles in the contour pixel direction angle set, thus obtaining the probability value corresponding to each angle interval.
[0036] The gradient direction optimization module calculates the information entropy of the normalized probability distribution, which serves as the directional consistency entropy value. The formula for calculating information entropy is: in, This represents the directional consistency entropy value of the sub-block; This represents the total number of angle intervals. The value of is 8; Indicates the index of the angle interval. The value of is an integer ranging from 1 to 8; Indicates the first Normalized probability values corresponding to each angle interval The method of obtaining is to take the first The pixel count value within each angular interval is divided by the total number of directional angles in the contour pixel directional angle set; It is a tiny positive number. The value is set to 0.0001 to avoid the argument being zero during logarithmic operations. The basis for setting it to 0.0001 is that when the normalized probability value of a certain angle interval is zero, The value is approximately -13.29. This item contributes almost zero to the overall information entropy and does not change the accuracy of the directional consistency entropy calculation.
[0037] The gradient orientation optimization module maps the orientation consistency entropy value to the first observation compensation coefficient. The mapping rule is that the lower the orientation consistency entropy value, the larger the first observation compensation coefficient. A linear mapping function is used. The first observation compensation coefficient is calculated by setting the theoretical minimum and maximum values of the orientation consistency entropy value. The theoretical minimum value of the orientation consistency entropy value is 0, and the theoretical maximum value is... ,when The theoretical maximum value is 3. The directional consistency entropy value is linearly transformed between the theoretical minimum and the theoretical maximum value. The first observation compensation coefficient is equal to 1.0 plus an adjustable gain multiplied by the ratio of (theoretical maximum value minus actual directional consistency entropy value) to (theoretical maximum value minus theoretical minimum value). The adjustable gain is set to 1.0, so that the value of the first observation compensation coefficient is between 1.0 and 2.0.
[0038] In some implementations, the gradient orientation optimization module also receives the repaired contour set generated by the contour integrity verification module and recalculates the orientation consistency entropy value of the contour pixels within each sub-block based on the repaired contour set. The method for recalculating the orientation consistency entropy value is the same as the method for calculating the orientation consistency entropy value based on the initial contour set, except that the initial contour set is replaced with the repaired contour set.
[0039] The gradient orientation optimization module performs a secondary correction on the first observation compensation coefficient. This secondary correction involves comparing the orientation consistency entropy value calculated after repair with that calculated before repair. For the same sub-block, if the orientation consistency entropy value after repair decreases by more than a specified proportion (set to 20%), the first observation compensation coefficient is multiplied by a magnification factor of 1.3. The magnification factor of 1.3 is based on the fact that the contour orientation distribution tends to be more uniform after contour repair, indicating a significant linear structural defect within the sub-block, requiring further enhancement of the observation compensation intensity. Testing shows that a 1.3x magnification can effectively improve the local contrast of subsequent resampled images without over-compensation. For the same sub-block, if the orientation consistency entropy value after repair increases compared to before repair, the first observation compensation coefficient is multiplied by a reduction factor of 0.8. The reduction factor of 0.8 is based on the fact that an increase in orientation consistency entropy indicates that the orientation distribution of the contour tends to be more random after repair, the original contour structure is not significant, and appropriately reducing compensation can avoid introducing unnecessary imaging noise. The observation compensation coefficients after secondary correction are output as the final compensation coefficients to the adaptive observation control module.
[0040] Example 4: In practice, the adaptive observation control module receives the observation compensation coefficients from the gradient direction optimization module and generates the light source illuminance parameters and lens focal length parameters required for reacquisition for each sub-block.
[0041] For each sub-block, the adaptive observation control module multiplies the first observation compensation coefficient by the base illuminance value to obtain the corrected illuminance value. The base illuminance value is the uniform illuminance value preset during the initial acquisition. The first observation compensation coefficient is generated by the gradient direction optimization module based on the directional consistency entropy value of the sub-block and may undergo secondary correction. The corrected illuminance value is calculated by multiplying the base illuminance value by the first observation compensation coefficient, and the product is used as the corrected illuminance value. The adaptive observation control module outputs the calculated corrected illuminance value for each sub-block to the light source controller one by one. The light source controller adjusts the luminous intensity of the LED beads in the corresponding sub-region of the adjustable color temperature multi-channel light source array according to the corrected illuminance value, so that the illuminance of the light source covering the sub-block reaches the corrected illuminance value during re-acquisition.
[0042] Simultaneously, the adaptive observation and control module determines the focal length adjustment step size by querying a preset focal length offset table based on the threshold range of the directional consistency entropy value. The preset focal length offset table is a pre-constructed mapping table that defines the mapping relationship between multiple directional consistency entropy value threshold ranges and focal length adjustment step sizes. The directional consistency entropy value ranges from 0 to 3, divided into three threshold ranges: the first threshold range is for directional consistency entropy values greater than or equal to 0 and less than 1, corresponding to a positive focal length adjustment step size of 30 micrometers; the second threshold range is for directional consistency entropy values greater than or equal to 1 and less than or equal to 2, corresponding to a positive focal length adjustment step size of 10 micrometers; and the third threshold range is for directional consistency entropy values greater than 2 and less than or equal to 3, corresponding to a negative focal length adjustment step size of 10 micrometers. A positive focal length adjustment step size indicates that the focal length of the motorized zoom lens unit shifts towards the telephoto direction from the initial focal length, while a negative focal length adjustment step size indicates that the focal length of the motorized zoom lens unit shifts towards the short focal length from the initial focal length. The focal length adjustment step size is set based on the following: when the orientation consistency entropy value is low, the inner contour direction of the sub-block tends to be consistent, indicating that the sub-block has obvious directional texture structure. Increasing the focal length positively can improve the local imaging resolution. When the orientation consistency entropy value is high, the inner contour direction of the sub-block is randomly distributed, indicating that the surface texture features of the sub-block are not significant. Decreasing the focal length negatively can expand the imaging depth of field to cover more potential depth changes.
[0043] The adaptive observation control module adds the focal length adjustment step size to the current focal length value to form a new focal length parameter. The current focal length value is the focal length parameter recorded and transmitted by the image acquisition module during the initial acquisition. The new focal length parameter is calculated by summing the current focal length value and the focal length adjustment step size; this sum is used as the new focal length parameter value. The adaptive observation control module sends the new focal length parameter corresponding to each sub-block to the lens drive unit of the motorized zoom lens unit. The lens drive unit controls the stepper motor to adjust the position of the movable lens group according to the new focal length parameter, so that the focal length of the motorized zoom lens unit reaches the new focal length parameter during reacquisition.
[0044] During the re-acquisition process, the light source controller controls the illuminance of the corresponding sub-region LED beads in the adjustable color temperature multi-light source array according to the corrected illuminance value, the motorized zoom lens unit adjusts the focal length according to the new focal length parameters, and the image acquisition module takes a second picture of the rocker arm material surface to obtain the optimized re-acquisition image.
[0045] After obtaining the optimized resampled image, the defect identification and analysis module performs pixel-level fusion with the phase consistency amplitude map. The phase consistency amplitude map is generated concurrently by the phase contour enhancement module during the generation of phase consistency feature values. The grayscale value of each pixel in the phase consistency amplitude map is the corresponding phase consistency feature value, linearly normalized to the range of 0 to 255. Before pixel-level fusion, the defect identification and analysis module aligns the optimized resampled image and the phase consistency amplitude map. If the resolution of the optimized resampled image differs from that of the phase consistency amplitude map, bilinear interpolation is used to resample the optimized resampled image to the same resolution as the phase consistency amplitude map.
[0046] The defect identification and analysis module employs a weighted overlay strategy to fuse the optimized resampled image and the phase consistency amplitude map. The weighted overlay fusion calculation method is as follows: for each pixel location, the product of the grayscale value of that pixel location in the optimized resampled image and a fusion weight is added to the product of the grayscale value of that pixel location in the phase consistency amplitude map and the difference between the grayscale value and the fusion weight. This product is the fused pixel grayscale value. The fusion weight is selected based on the local contrast of each pixel in the optimized resampled image; pixels with higher local contrast are assigned a higher phase consistency amplitude weight. The local contrast is calculated as follows: for each pixel in the optimized resampled image, a local window centered on the pixel is taken, with the window size set to 5×5 pixels. The standard deviation of all pixel grayscale values within the local window is calculated, and this standard deviation is used as the local contrast value of the pixel.
[0047] The defect identification and analysis module determines the fusion weight for each pixel based on its local contrast value. The fusion weight is determined as follows: an upper contrast threshold and a lower contrast threshold are set, with the upper threshold set to 50 and the lower threshold set to 10. For pixels with a local contrast value greater than or equal to the upper contrast threshold, the fusion weight is set to 0.7, meaning the weight of the phase consistency amplitude map is 0.7 and the weight of the optimized resampled image is 0.3. For pixels with a local contrast value less than or equal to the lower contrast threshold, the fusion weight is set to 0.3, meaning the weight of the phase consistency amplitude map is 0.3 and the weight of the optimized resampled image is 0.7. For pixels with a local contrast value between the lower and upper contrast thresholds, the fusion weight is calculated using linear interpolation, increasing linearly from 0.3 to 0.7 as the local contrast value increases from the lower to the upper contrast threshold. The upper limit of contrast threshold is set to 50 because areas with a grayscale standard deviation of 50 or higher in the optimized resampled image usually correspond to strong edges or areas with rich textures, and the phase consistency amplitude map has higher contour expression accuracy in these areas; the lower limit of contrast threshold is set to 10 because areas with a grayscale standard deviation of less than 10 are usually uniform and flat areas, and the information content of the optimized resampled image itself is sufficient to reflect the surface condition.
[0048] The defect identification and analysis module normalizes the fused pixel grayscale values to a preset range, which is set to 0 to 255. The normalization method is to linearly stretch the fused pixel grayscale values so that the minimum value of the fused pixel grayscale values is mapped to 0 and the maximum value is mapped to 255, thus obtaining a fused feature map.
[0049] The defect identification and analysis module identifies defect areas on the rocker arm material surface based on local gray-level abrupt changes in the fused feature map. The module divides the fused feature map into blocks, each block being the same size as the sub-block in the gradient direction optimization module; that is, when the original grayscale image resolution is 2048×2048 pixels, each block has a side length of 128 pixels. For each block, the module sorts the grayscale values of all pixels within the block in descending order. It then takes the first specified number of pixels from the descending order and calculates the average of these grayscale values as the highlight reference value; similarly, it takes the last specified number of pixels from the descending order and calculates the average of these grayscale values as the dark area reference value. Both the first and last specified numbers are 10% of the total number of pixels in the block. For a square block with a side length of 128 pixels, the total number of pixels in the block is 16384, and both the first and last specified numbers are 1638. The basis for choosing 10% as the specified number is that a 10% ratio can eliminate the interference of a few extreme bright and dark noise pixels within the block, while retaining a sufficient number of sample pixels to obtain the high-brightness reference value and dark area reference value that reflect the normal grayscale dynamic range within the block.
[0050] The defect identification and analysis module calculates the absolute value of the difference between the grayscale value of each pixel within a block and the grayscale values of its neighboring pixels. Neighboring pixels include the four pixels directly adjacent to the current pixel in the four directions (up, down, left, and right). The absolute value of each difference is taken by subtracting the grayscale value of the current pixel from the grayscale values of its four neighboring pixels, and the maximum value among these four absolute values is selected as the calculated grayscale abrupt change value for that pixel. For each pixel, if the calculated grayscale abrupt change value exceeds half the difference between the highlight reference value and the dark area reference value, the corresponding pixel is marked as a pixel with a significant grayscale abrupt change. The threshold of half the difference between the highlight reference value and the dark area reference value reflects half of the normal grayscale fluctuation range within the block. A grayscale abrupt change exceeding this half-range indicates that the pixel has experienced a significant and non-gradual grayscale change in a local area, consistent with the grayscale jump characteristics of a defect edge.
[0051] The defect identification and analysis module identifies all adjacent connected regions marked as pixels with gray-level abrupt changes as defect regions. The extraction of adjacent connected regions employs an eight-connected neighborhood search method. Starting from each pixel marked as a gray-level abrupt change, it searches for pixels also marked as gray-level abrupt changes in eight adjacent directions, aggregating interconnected pixels to form a connected pixel set. Each connected pixel set constitutes a defect region.
[0052] See Figure 4The figure illustrates the relationship between the corrected illuminance and the focal length adjustment step size calculated by the adaptive observation control module based on the directional consistency entropy value H in Example 4. The horizontal axis represents the directional consistency entropy value H, which ranges from 0 to 3. The figure is divided into three threshold intervals by vertical dashed lines: interval 1 is [0,1), interval 2 is [1,2], and interval 3 is (2,3). The left vertical axis corresponds to the corrected illuminance in lux (lx), and the right vertical axis corresponds to the focal length adjustment step size in micrometers (μm).
[0053] The corrected illuminance curve exhibits a linear decreasing trend, decreasing linearly from a maximum corrected illuminance of 200 lx when the directional consistency entropy value H=0 to a minimum corrected illuminance of 100 lx when H=3, reflecting the product relationship between the first observation compensation coefficient and the base illuminance value. This curve indicates that when the directional consistency entropy value is low (i.e., the contour orientation within the sub-block is relatively consistent), the system improves the imaging quality of the sub-block by increasing the light source illuminance; as the directional consistency entropy value increases, the corrected illuminance gradually decreases, indicating that the system reduces the light source illuminance to adapt to a more random texture distribution.
[0054] The focal length adjustment step size curve exhibits a stepped change, corresponding to three threshold intervals: in interval one [0,1), the focal length adjustment step size remains positive at 30μm; in interval two [1,2], it decreases to positive 10μm; and in interval three [2,3], it becomes negative 10μm. This stepped change reflects the preset offset strategy for focal length adjustment. When the directional consistency entropy value is low, the focal length is offset by 30μm towards the telephoto direction to improve local resolution; in the middle interval, the offset towards the telephoto direction decreases to 10μm; and when the directional consistency entropy value is high, the focal length is offset by 10μm towards the focal length direction to expand the depth of field and cover more depth variations.
[0055] Example 5: In practical implementation, the contour integrity verification module intervenes after the phase contour enhancement module generates the initial contour set. The contour integrity verification module extracts contour segments from the initial contour set. The extraction method involves performing connected component analysis on the coordinates of all local maxima pixels in the initial contour set, and using the eight-neighbor connectivity rule to aggregate spatially adjacent local maxima pixels into a contour segment. Each contour segment consists of a set of ordered pixel coordinates and the corresponding orientation angle for each pixel. For each contour segment, the contour integrity verification module identifies the two endpoints of the contour segment. The endpoint identification method involves checking the number of pixels belonging to the same contour segment within the eight-neighborhood of each pixel in the contour segment. If a pixel has exactly one other pixel belonging to the same contour segment within its eight-neighborhood, then that pixel is an endpoint of the contour segment. If the contour segment is a closed contour, meaning that all pixels in the contour segment have at least two other pixels belonging to the same contour segment within their eight-neighborhood, then the contour segment has no endpoints and does not participate in subsequent connectivity judgments.
[0056] The contour integrity verification module performs connectivity checks on the endpoints of each contour segment. For a currently processed endpoint, the module searches for the endpoints of other contour segments within a neighborhood search window centered on that endpoint. The size of the neighborhood search window is set to 21×21 pixels, which is a rectangular area extending 10 pixels upwards, downwards, leftwards, and rightwards from the endpoint coordinates. The reason for setting the neighborhood search window size to 21×21 is that the contour breakage spacing of micro-defects on the rocker arm material surface is usually no more than 10 pixels in the original grayscale image with a resolution of 2048×2048 pixels. A 21×21 search window is sufficient to cover most contour breakage cases without excessively increasing the computational burden.
[0057] For each endpoint of another contour fragment found within the neighborhood search window, the contour integrity verification module calculates the Euclidean distance between the two endpoints. The Euclidean distance between the two endpoints is calculated according to the following formula: in, Indicates the first endpoint With the second endpoint The Euclidean distance between them; Indicates the first endpoint The x-coordinate value in the original grayscale image; Indicates the first endpoint The ordinate value in the original grayscale image; Indicates the second endpoint The x-coordinate value in the original grayscale image; Indicates the second endpoint The vertical coordinate value in the original grayscale image.
[0058] Simultaneously, the contour integrity verification module calculates the directional angle between the two endpoints. The directional angle is calculated as follows: take the first endpoint... The direction angle value recorded in its corresponding contour segment is taken as the second endpoint. The direction angle values recorded in its corresponding contour segment are used to calculate the absolute value of the difference between two direction angle values as the direction angle. If the absolute value exceeds... Then use Subtracting this absolute value yields the direction angle, which ranges from 0 to... .
[0059] The contour integrity verification module compares the calculated Euclidean distance with a preset connectivity threshold, and simultaneously compares the direction angle with a preset angle threshold. The preset connectivity threshold is set to 10 pixels, and the preset angle threshold is set to... Radius. The preset connection threshold is set to 10 pixels based on the same criteria as the neighborhood search window size setting mentioned earlier; a 10-pixel spacing corresponds to the typical maximum spacing of the rocker arm material surface contour fracture. The preset angle threshold is set to... The basis for the curvature is that the deviation of the tangent directions of two contour segments at the connection point exceeds [a certain value]. When dealing with arcs, straight-line interpolation will fail to accurately reflect the curvature of the original contour, resulting in a significant deviation between the repaired contour and the actual surface texture.
[0060] If the Euclidean distance between the two endpoints is less than a preset connection threshold and the directional angle is less than a preset angle threshold, the contour integrity verification module uses linear interpolation to connect the two contour segments into a single contour. The specific method of linear interpolation is as follows: taking the first endpoint... The coordinates are the starting point and the second endpoint. Using the coordinates of the endpoint as the endpoint, a set of interpolated pixels is generated between the two points according to the pixel spacing. The number of interpolated pixels is equal to... The coordinates of each interpolated pixel are obtained by connecting the start and end points of the linear sampling, and the orientation angle of each interpolated pixel is set to the first endpoint. Direction angle and second endpoint The average value of the direction angle. Add all interpolated pixels to the contour fragment, and merge the two original contour fragments with the interpolated pixels into a single contour. Update the connectivity between pixels in the merged contour.
[0061] For the missing opening portion of the closed contour, the contour integrity verification module uses the direction angles of the first and last endpoints of the contour segment to fit an arc segment for completion. The criteria for judging a missing closed contour are: neither of the first nor last endpoints of a contour segment is successfully connected to any other contour segment, and the Euclidean distance between the first and last endpoints is less than or equal to twice the preset connection threshold, i.e., 20 pixels. After identifying the missing opening portion of the closed contour, the contour integrity verification module draws tangents at the endpoints using the direction angles of the first and last endpoints respectively. The direction of the tangent at the first endpoint is determined by the direction angle of the first endpoint, and the direction of the tangent at the last endpoint is determined by the direction angle of the last endpoint. Using the intersection of the two tangents as the center constraint, an arc segment is generated that starts from the first endpoint and ends at the last endpoint, and is tangent to the directions of the two tangents respectively. The pixel coordinates and direction angles obtained by discrete sampling on the arc segment are inserted into the opening to complete the closed contour. All contour pixels generated after the connection and completion operations are integrated to form the repaired contour set.
[0062] The contour integrity verification module feeds back the repaired contour set to the gradient direction optimization module. The gradient direction optimization module receives the repaired contour set and replaces the initial contour set received earlier, which is used for subsequent sub-block contour pixel gradient direction distribution statistics and recalculation of direction consistency entropy values. The light source controller and lens drive unit in the image acquisition module are both closed-loop controllers. The light source controller integrates a photoelectric feedback sensor; when the deviation between the actual illuminance and the corrected illuminance value exceeds 3%, it automatically adjusts the LED drive duty cycle for compensation. The stepper motor in the motorized zoom lens unit is equipped with an encoder; when the deviation between the actual focal length offset and the focal length adjustment step size exceeds 1μm, it corrects the drive pulse count through a PID controller for precise positioning. This closed-loop control mechanism ensures that the actual output parameters revolve around... Figure 4 The numerical convergence shown indicates that the deviation is limited to within the engineering tolerance range. Furthermore, even if extreme environmental disturbances cause the actual resampling parameters of a certain sub-block to deviate from the correction value, the local contrast adaptive weighting strategy adopted by the defect identification and analysis module in the fusion stage, as well as the subsequent dynamic threshold determination method for high-brightness / darkness reference values, both have tolerance for small fluctuations in the absolute grayscale value and contrast of the input image. Specifically, the fusion weight is based on the grading of the grayscale standard deviation within a 5×5 window in the optimized resampling image. The width of this grading interval is much larger than the amount of grayscale change that may be introduced by hardware illumination fluctuations. The decrease in edge sharpness caused by a 2μm focal length deviation only affects the local high-frequency components within the sub-block, while the phase consistency amplitude map is generated using a multi-scale Log-Gabor filter bank weighted summation, which has a natural smoothing and suppression effect on slight defocusing at a single scale.
[0063] In some implementations, when the defect identification and analysis module performs the block segmentation operation, the size of each block is the same as the size of the sub-blocks in the gradient orientation optimization module. When the original grayscale image resolution is 2048×2048 pixels and the gradient orientation optimization module divides the original grayscale image into sub-blocks with a side length of 128 pixels, the side length of each block used by the defect identification and analysis module for fusion feature map segmentation is also 128 pixels, and the boundary position of the block is completely consistent with the boundary position of the sub-blocks divided by the gradient orientation optimization module.
[0064] When calculating the highlight and dark area reference values, the defect identification and analysis module uses a pre-specified quantity and a post-specified quantity of 10% of the total number of pixels within the block. For a square block with a side length of 128 pixels, the total number of pixels within the block is 16384 pixels, and the specific values for both the pre-specified quantity and the post-specified quantity are 1638 pixels. The 10% threshold is chosen because it effectively eliminates interference from a few extreme bright / dark noise pixels within the block, while retaining a sufficient number of sample pixels to obtain the highlight and dark area reference values that reflect the normal grayscale dynamic range within the block. The calculation process for the highlight reference value is as follows: All pixels within the block are sorted in descending order of grayscale values from highest to lowest. The grayscale values of the first 1638 pixels in this descending order are taken, and the arithmetic mean of these 1638 pixel grayscale values is calculated. This arithmetic mean is used as the highlight reference value. The calculation process for the dark area reference value is as follows: Arrange the gray values of all pixels in the block in ascending order from low to high, take the gray values of the first 1638 pixels in the ascending order, calculate the arithmetic mean of these 1638 pixel gray values, and use the arithmetic mean as the dark area reference value.
[0065] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any changes or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application.
Claims
1. A vision inspection system for optimizing the observation of rocker arm material surfaces based on contour enhancement, characterized in that, include: The image acquisition module is used to acquire the original grayscale image of the rocker arm material surface and record the light source angle and focal length parameters during acquisition. The phase contour enhancement module is used to extract contours from the original grayscale image based on local phase consistency in the frequency domain, generate a phase consistency amplitude map, and select pixels with local maximum response to form an initial contour set. The gradient direction optimization module is used to receive the initial contour set, divide the original grayscale image into multiple sub-blocks, count the gradient direction distribution of the contour pixels in each sub-block and calculate the direction consistency entropy value, and generate the observation compensation coefficient of each sub-block based on the direction consistency entropy value. An adaptive observation control module is used to adjust the light source illuminance and lens focal length of the corresponding sub-block during re-acquisition according to the observation compensation coefficient, so as to obtain an optimized re-acquisition image. The defect identification and analysis module is used to perform pixel-level fusion of the optimized resampled image and the phase consistency amplitude map to generate a fused feature map, and to identify the defect area on the surface of the rocker arm material based on the local gray-level abrupt change in the fused feature map.
2. The contour-enhanced rocker arm material surface observation optimization visual inspection system according to claim 1, characterized in that, The image acquisition module includes an adjustable color temperature multi-source light source array and an electric zoom lens unit; The adjustable color temperature multi-channel light source array consists of multiple independently controlled LED beads, with each LED bead corresponding to the illumination of a sub-region. The electric zoom lens unit changes the focal length by driving the lens group to move via a stepper motor according to the focal length adjustment command output by the adaptive observation control module. The image acquisition module uses a preset uniform illumination and initial focal length during the initial acquisition, and transmits the acquired original grayscale image along with the corresponding light source angle and focal length parameters to the phase contour enhancement module.
3. The contour-enhanced rocker arm material surface observation optimization visual inspection system according to claim 1, characterized in that, The phase contour enhancement module performs contour extraction based on local phase consistency in the frequency domain on the original grayscale image, including: Construct a set of Log-Gabor filters with arithmetic distribution of direction angles and logarithmic distribution of scale. Convolve the original grayscale image with each Log-Gabor filter of each direction and each scale to obtain a set of complex responses. For each pixel, the ratio of the sum of the magnitudes of the complex responses at all directions and all scales to the sum of the absolute magnitudes is calculated and used as the phase consistency feature value of that pixel. Non-maximum suppression is applied to the phase consistency feature values to retain local maxima pixels, and the coordinates and corresponding directional angles of the local maxima pixels are stored in the initial contour set.
4. The contour-enhanced rocker arm material surface observation optimization visual inspection system according to claim 3, characterized in that, The gradient direction optimization module statistically analyzes the gradient direction distribution of contour pixels within each sub-block and calculates the direction consistency entropy value, including: For each sub-block, extract the orientation angles of all pixels falling within the sub-block from the initial contour set, divide the orientation angles into multiple angle intervals at equal intervals, and count the number of pixels in each angle interval to form a histogram. Calculate the normalized probability distribution of the histogram, and then calculate the information entropy of the normalized probability distribution as the directional consistency entropy value; The directional consistency entropy value is mapped to the first observation compensation coefficient, and the lower the entropy value, the larger the compensation coefficient.
5. The contour-enhanced rocker arm material surface observation optimization visual inspection system according to claim 4, characterized in that, The adaptive observation control module adjusts the light source illuminance and lens focal length of the corresponding sub-block during re-acquisition based on the observation compensation coefficient, including: For each sub-block, the first observation compensation coefficient is multiplied by the base illuminance value to obtain the corrected illuminance value, and the corrected illuminance value is output to the light source controller; Meanwhile, based on the threshold range of the directional consistency entropy value, the focal length adjustment step size is obtained by querying the preset focal length offset table, the focal length adjustment step size is superimposed on the current focal length value to form a new focal length parameter, and then sent to the lens drive unit. During resampling, the light source controller and lens drive unit execute according to the corrected illuminance value and the new focal length parameter, respectively, to obtain the optimized resampling image.
6. The contour-enhanced rocker arm material surface observation optimization visual inspection system according to claim 5, characterized in that, The defect identification and analysis module performs pixel-level fusion of the optimized resampled image and the phase consistency amplitude map, including: The optimized resampled image and the phase consistency amplitude map are size aligned and fused using a weighted overlay strategy. The weights are selected based on the local contrast of each pixel in the optimized resampled image, with pixels having higher local contrast being assigned higher phase consistency amplitude weights. The grayscale values of the merged pixels are normalized to a preset range to obtain the fused feature map.
7. The contour-enhanced rocker arm material surface observation optimization visual inspection system according to claim 6, characterized in that, The defect identification and analysis module identifies defect areas on the rocker arm material surface based on local grayscale abrupt changes in the fused feature map, including: The fused feature map is divided into blocks, and the pixel gray values in each block are arranged in descending order. The average of the first specified number of pixel gray values is taken as the highlight reference value, and the average of the last specified number of pixel gray values is taken as the dark area reference value. Calculate the absolute value of the difference between the gray value of each pixel and the gray value of its neighboring pixels. If the absolute value exceeds half of the difference between the highlight reference value and the dark area reference value, then mark the corresponding pixel as a pixel with a gray value change. The adjacent connected regions of all pixels marked as grayscale abrupt changes are identified as the defective regions.
8. The contour-enhanced rocker arm material surface observation optimization visual inspection system according to claim 1, characterized in that, It also includes a contour integrity verification module, which is used to perform connectivity judgment and closure repair on the contour segments in the initial contour set after the initial contour set is generated, generate a repaired contour set and feed it back to the gradient direction optimization module to replace the initial contour set. The contour integrity verification module extracts contour segments from the initial contour set, searches for the endpoints of other contour segments in the neighborhood of the endpoints of each contour segment, and if the Euclidean distance between the two endpoints is less than a preset connection threshold and the directional angle is less than a preset angle threshold, then the two segments are connected into a single contour using a straight line interpolation method. For the missing opening portion of the closed contour, the arc segment is fitted using the direction angle of the first and last endpoints of the contour segment to complete it, generating the repaired contour set.
9. The contour-enhanced rocker arm material surface observation optimization visual inspection system according to claim 4, characterized in that, The gradient direction optimization module is also used to receive the repaired contour set, recalculate the direction consistency entropy value of the contour pixels in each sub-block, and perform a second correction on the first observation compensation coefficient. The secondary correction method is as follows: if the directional consistency entropy value within a certain sub-block decreases by more than a specified proportion after the correction compared to before the correction, then the first observation compensation coefficient is multiplied by an amplification factor greater than 1. If the directional consistency entropy value increases after the repair, then the first observation compensation coefficient is multiplied by a reduction factor less than 1. The observation compensation coefficients after secondary correction are output as the final compensation coefficients to the adaptive observation control module.
10. The contour-enhanced rocker arm material surface observation optimization visual inspection system according to claim 7, characterized in that, When the defect identification and analysis module divides the data into blocks, the size of each block is the same as the size of the sub-block, and in the calculation of the highlight reference value and the dark area reference value, the specified number before and the specified number after are both 10% of the total number of pixels in the block.
