A visual measurement error compensation method and system

By using semantic segmentation and WOA-RBF model for multidimensional grayscale feature extraction and nonlinear coupling relationship mapping, the error problem caused by illumination and material changes in machine vision size measurement is solved, achieving high-precision and low-cost adaptive error compensation.

CN122156089APending Publication Date: 2026-06-05INST OF HIGH ENERGY PHYSICS CHINESE ACAD OF SCI

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
INST OF HIGH ENERGY PHYSICS CHINESE ACAD OF SCI
Filing Date
2026-02-06
Publication Date
2026-06-05

Smart Images

  • Figure CN122156089A_ABST
    Figure CN122156089A_ABST
Patent Text Reader

Abstract

The present application belongs to the technical field of machine vision, and discloses a kind of vision measurement error compensation method and system.The method steps include: image acquisition is carried out to target object, and target image is generated;Different material areas in target image are segmented and extracted, and multidimensional gray feature vector reflecting the surface optical response difference of different material areas is generated;Multidimensional gray feature vector is input into a pre-trained error compensation model, and the error compensation coefficient of target image is obtained;Target image is compensated according to error compensation coefficient;Wherein error compensation model is a mapping model, with multidimensional gray feature vector as input, with size measurement error compensation coefficient as output, mapping the nonlinear coupling relationship between light source, material and imaging process.The present application does not need to introduce illumination sensor, and realizes light source error compensation based on only image itself multidimensional information modeling, greatly improves the stability and measurement precision of machine vision size measurement under different materials and complex illumination conditions.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of machine vision technology and relates to a visual measurement error compensation method based on illumination brightness changes of multi-dimensional grayscale information. Background Technology

[0002] Machine vision-based part dimension measurement has been widely applied in precision manufacturing, online inspection, and quality control due to its advantages such as non-contact operation, high efficiency, and high precision. In such measurement systems, the image edge position is usually used as the basis for geometric dimension calculation, and its positioning accuracy directly determines the accuracy of the final measurement result.

[0003] In actual imaging, the grayscale distribution of an image is not only affected by the intensity of the light source, but also closely related to the reflection, scattering, and absorption characteristics of the surface of the object being measured. Different materials, different surface roughnesses, and different processing conditions result in significant differences in their response to incident light. When the illumination intensity is insufficient, the image signal-to-noise ratio decreases, edge contrast weakens, and noise amplification can easily lead to unstable edge extraction; while when the illumination intensity is too high, local overexposure can easily occur, causing the true edge position to be eroded or blurred, which will also introduce measurement errors.

[0004] Therefore, achieving stable, reliable, and high-precision edge positioning under complex lighting conditions and diverse material surface properties has always been one of the key technical problems that urgently need to be solved in the field of machine vision dimensional measurement. Traditional solutions to this problem are as follows.

[0005] Option 1: One-dimensional light intensity-error fitting method This type of method is a widely used error compensation technique in engineering practice. Its basic idea is to establish a mapping relationship between illumination parameters and measurement errors by adjusting the light source intensity. Specific steps include: 1. Change the output intensity of the light source in the measurement system and record the corresponding light intensity parameters or overall image brightness characteristics; 2. Measure standard parts or objects with known dimensions, and calculate the error between the actual measured value and the true size; 3. Based on the collected data, establish a one-dimensional linear model or polynomial fitting model of "light intensity value and size error", and correct the measurement results accordingly.

[0006] This method is simple to implement and requires minimal system modifications, but it only models the light source intensity as a single influencing factor, failing to consider the differences in the surface material and optical reflection characteristics of the object being measured. Under the same light intensity conditions, the imaging grayscale distribution and edge response of targets made of different materials vary significantly, resulting in low fitting accuracy and insufficient versatility and stability of this type of model under multi-material or complex working conditions.

[0007] Option 2: Multidimensional Fitting Method Based on External Sensors To improve error modeling capabilities, some studies have proposed introducing external optical sensors to establish measurement error models using multi-dimensional information. Typical implementation steps include: 1. Deploy multiple illuminance meters or light sensors in the measurement environment to collect environmental illuminance information in real time; 2. Using the collected illuminance data and the corresponding size measurement error as input, a least squares support vector machine (GA-LSSVM) machine learning model optimized by genetic algorithm is used to establish the mapping relationship between illuminance parameters and measurement errors; 3. Perform error compensation on the measurement results based on the model output.

[0008] This approach improves the nonlinear representation capability of error modeling to some extent, but it relies on additional external hardware, increasing system cost and structural complexity, which hinders engineering integration and widespread application. Furthermore, the illuminance meter acquires ambient light information, rather than the actual reflected light distribution on the object's surface that participates in imaging, leading to incomplete information matching and potentially causing the loss of key optical features, thus limiting further improvements in error compensation.

[0009] Option 3: A method for multidimensional fitting using an SVR model based on gray-level histogram information of edge regions. Some scholars have directly used the gray-level histogram information of edge regions under different illumination levels for error compensation. The basic idea is to use a Support Vector Regression (SVR) model to parameterize the gray-level histogram of the measured edge region into a generalized Gaussian distribution, and then use this statistical parameter as input features to perform error compensation using the SVR model. However, under actual imaging conditions, the edge gray-level distribution often exhibits non-Gaussian or multimodal characteristics. The parameterization assumptions are insufficient to fully characterize the true statistical features and introduce human error. Typical implementation steps include: 1. Randomly select an edge point detected by the algorithm, and extract a nearby rectangular region centered on this edge point; 2. Calculate the grayscale histogram of this rectangular region; 3. Fit this gray-level histogram using a generalized Gaussian distribution and calculate the mean, variance, and decay rate of the Gaussian distribution curve as the input vector for the experimental dataset.

[0010] 4. Input this input vector into the pre-trained SVR model and output the compensation coefficients to achieve error compensation.

[0011] This approach bypasses the dependence of the first two methods on a single variable of illumination, and directly models and fits the edge region. Theoretically, it takes into account factors such as illuminance, differences in the surface material of the measured object, local reflection characteristics, and imaging geometry, which improves the nonlinear expression capability of error modeling to a certain extent. However, it relies on fitting the gray-level histogram with a generalized Gaussian distribution. In many cases, the gray-level histogram does not satisfy a Gaussian distribution, but has bimodal characteristics. This method of fitting the gray-level histogram with a generalized Gaussian distribution will obviously introduce systematic errors, resulting in unstable compensation accuracy.

[0012] The aforementioned existing technical solutions still have the following technical shortcomings in practical engineering applications.

[0013] 1. Error mechanism modeling has a single dimension, making it difficult to characterize the coupling effect of multiple factors. Existing error compensation methods typically use light source intensity, overall image grayscale, or illuminance as the main modeling variables. This approach has a relatively singular modeling dimension and fails to fully consider the combined impact of factors such as differences in the surface material of the measured object, local reflection characteristics, and imaging geometry on edge imaging and positioning errors. In practical applications, when the material of the measured object changes or the lighting conditions are complex, the nonlinear coupling effect between the light source, material, and imaging process is difficult to effectively characterize, leading to insufficient adaptability and decreased compensation accuracy in the error compensation model.

[0014] 2. The region of interest relies on manual definition, resulting in insufficient model generalization ability. Some existing methods require manual selection of specific regions of interest (ROIs) and error modeling based on the average grayscale or statistical characteristics of those regions. This process is highly dependent on the operator's experience and is sensitive to the location, size, and shape of the ROI. When the material, surface condition, or structure of the workpiece being measured changes, the original model often needs to be re-set or retrained, making it difficult to meet the general measurement needs under multiple scenarios and material conditions.

[0015] 3. High system hardware cost or high implementation complexity To improve error modeling capabilities, some existing technologies introduce external optical sensors such as illuminometers to acquire ambient lighting information and construct multidimensional error models. However, this approach requires additional hardware, increasing system costs and the complexity of installation, calibration, and maintenance, which hinders the miniaturization, integration, and large-scale engineering application of measurement systems. Furthermore, there is a discrepancy between the illuminance information acquired by external sensors and the actual distribution of reflected light from the object's surface involved in imaging, making it difficult to comprehensively reflect key optical characteristics during the imaging process.

[0016] 4. The principle of error compensation methods assumes the introduction of systematic errors. To improve error modeling capabilities, some existing techniques parameterize the gray-level histogram of the measured edge region into a generalized Gaussian distribution and use this statistical parameter as input features to perform error compensation using an SVR model. However, under actual imaging conditions, the gray-level distribution at the edge often exhibits non-Gaussian or multimodal characteristics. The parameterization assumptions are insufficient to fully characterize the true statistical features and introduce human error, leading to unstable measurement accuracy and poor performance.

[0017] Therefore, current technical solutions for solving high-precision dimensional measurement using machine vision suffer from technical problems such as unstable edge positioning, edge position offset, and decreased measurement accuracy caused by changes in lighting conditions, differences in the surface material of the measured object, and coupling effects of the optical imaging system. Summary of the Invention

[0018] To address the problems existing in the prior art, the purpose of this invention is to provide a visual measurement error compensation method based on illumination brightness changes using multidimensional grayscale information. This invention eliminates the need for external light sensors, achieving light source error compensation solely through modeling based on the multidimensional information of the image itself, significantly improving the stability and accuracy of machine vision dimensional measurements under different materials and complex lighting conditions.

[0019] The technical solution of this invention is as follows: A method for compensating for visual measurement errors, comprising the following steps: The target object is captured to generate a target image; The target image is segmented and extracted to generate a multi-dimensional gray-scale feature vector that reflects the differences in the surface optical response of the different material regions. The multidimensional grayscale feature vector is input into a pre-trained error compensation model to obtain the error compensation coefficients of the target image; The target image is compensated according to the error compensation coefficient; The error compensation model is a mapping model, which is constructed with multi-dimensional gray-scale feature vectors as input and size measurement error compensation coefficients as output, mapping the nonlinear coupling relationship between the light source, material and imaging process.

[0020] Preferably, the key hyperparameters of the mapping model are jointly and adaptively optimized.

[0021] Preferably, the key hyperparameters include at least the kernel width parameter of the Gaussian radial basis function and the learning rate parameter of the output layer weights.

[0022] Preferably, the target image is segmented into regions of different materials to obtain multiple regions with different optical reflectance properties; and the multidimensional gray-scale feature vector is constructed based on the gray-scale statistical features extracted from each region.

[0023] Preferably, the Segmentation All Model (SAM) is used to segment different material regions in the target image; the gray-level statistical features are the average gray-level value, variance, or gradient mean; the gray-level statistical features corresponding to each region are combined in a predetermined order to construct the multidimensional gray-level feature vector.

[0024] Preferably, the mapping model is a radial basis function neural network model, including an input layer, a hidden layer, and an output layer; wherein, the number of nodes in the input layer is consistent with the dimension of the multidimensional gray-level feature vector, the hidden layer uses Gaussian radial basis function as activation function, and the output layer outputs the corresponding size error compensation coefficient; the radial basis function neural network model is jointly and adaptively optimized using the whale optimization algorithm.

[0025] Preferably, the mapping model is a support vector regression model (SVR), a backpropagation neural network model, or a random forest regression model; the error compensation model is obtained by optimizing the parameters of the mapping model using a particle swarm optimization algorithm or a genetic algorithm.

[0026] A visual measurement error compensation system, characterized in that it includes an image acquisition module, a feature extraction module, an error compensation model, and an image compensation module; The image acquisition module is used to acquire images of the target object and generate a target image; The feature extraction module is used to segment and extract different material regions in the target image, and generate a multi-dimensional gray-scale feature vector that reflects the differences in surface optical response of the different material regions. The error compensation model is used to obtain the compensation coefficients of the target image based on the multidimensional gray-scale feature vector; The image compensation module is used to compensate the target image according to the error compensation coefficient; Specifically, by constructing a radial basis function neural network model with multidimensional gray-scale feature vectors as input and size measurement error compensation coefficients as output, and optimizing its parameters, an error compensation model is obtained that maps the nonlinear coupling relationship between the light source, material, and imaging process.

[0027] A computing device, characterized in that it comprises: a processor and a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method described above.

[0028] A computer-readable storage medium, characterized in that it stores instructions that, when executed on a computer, cause the computer to perform the method described above.

[0029] The advantages of this invention are as follows: This invention demonstrates significant technical advantages in high-precision dimensional measurement in machine vision by introducing a multidimensional grayscale feature modeling method based on semantic segmentation and a nonlinear error compensation mechanism for whale-optimized radial basis neural networks.

[0030] First, regarding measurement accuracy, this invention can significantly reduce dimensional measurement errors caused by changes in illumination. Experimental results show that, compared to traditional one-dimensional light intensity fitting methods, methods based on genetic algorithms to optimize support vector machines, and methods based on support vector regression, the WOA-RBF error compensation model used in this invention achieves an order-of-magnitude reduction in the mean squared error (MSE) index, significantly suppressing measurement errors. Under experimental conditions, it can achieve micrometer-level precision control, significantly improving the accuracy and stability of dimensional measurement results.

[0031] Secondly, regarding system robustness and engineering practicality, this invention, by simultaneously introducing grayscale response features from multiple material regions, can effectively distinguish imaging differences caused by different surface reflectivity under the same illumination conditions, solving the problem of error model failure in traditional methods under multi-material conditions. Simultaneously, relying on the zero-sample segmentation capability of the Segmentation of Everything (SAM) model and the automatic optimization mechanism of the whale optimization algorithm, a fully automated processing flow is achieved without manual selection of regions of interest or manual adjustment of model parameters. Without adding any external hardware, error compensation can be completed using only the image's own information, effectively reducing system cost and deployment complexity, and possessing significant engineering application value. Attached Figure Description

[0032] Figure 1 This is a flowchart of the method of the present invention.

[0033] Figure 2 Flowchart for obtaining grayscale value-error dataset.

[0034] Figure 3 This is a flowchart of the neural network training process. Detailed Implementation

[0035] Exemplary embodiments of the present disclosure will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.

[0036] This invention introduces the Segment Anything Model (SAM), a general image segmentation model with zero-shot segmentation capability, to automatically segment and extract regions of different materials in the tested image, thereby obtaining multi-dimensional grayscale features reflecting differences in surface optical response. Based on this, the Whale Optimization Algorithm (WOA) is used to optimize the parameters of the Radial Basis Function (RBF) neural network, constructing an error compensation model that can characterize nonlinear coupling relationships, effectively correcting edge localization deviations. The specific implementation method of parameter optimization using the Whale Optimization Algorithm is as follows: First, the Whale Optimization Algorithm is used to perform a global search optimization of the network structure and training hyperparameters, including the number of RBF centers, hidden layer M=30, and RBF kernel width. and learning rate During optimization, the Whale Algorithm population size was set to 8, the maximum number of iterations was 20, and the normalized mean squared error (MSE) under 10-fold cross-validation was used as the fitness function. After obtaining the optimal parameter combination, the WOA-RBF model was finally trained on the complete normalized dataset. The training process used the Adam optimizer and the MSELoss loss function, and the number of training epochs was set to 300.

[0037] Through the above-mentioned technical means, this invention improves the adaptability of the error compensation model to different materials and lighting conditions without increasing the complexity of the system hardware, thus providing an effective technical approach for achieving high-precision and stable machine vision dimension measurement.

[0038] In the field of illumination error compensation for machine vision size measurement, this invention focuses on the technical goal of "no external sensors required, based on the multi-dimensional information of the image itself, and automatically adapting to differences in multiple materials," and has formed the following key innovations.

[0039] 1. A multidimensional optical response feature extraction method based on semantic segmentation: This invention proposes a multidimensional optical response feature construction method based on semantic segmentation. It utilizes the Segment Anything Model (SAM) to automatically segment industrial measurement images, obtaining multiple regions with different optical reflectance properties. Unlike traditional methods that rely solely on the background or a single region of interest (ROI), this invention extracts grayscale statistical features from multiple material regions and constructs a multidimensional grayscale feature vector as a physical descriptor characterizing the coupling response between light source conditions and the surface material of the measured object, thereby significantly enhancing the completeness and stability of feature representation.

[0040] 2. Construction and optimization method of WOA-RBF nonlinear error prediction model: This invention constructs a Radial Basis Function (RBF) neural network model that takes a multi-dimensional gray-level feature vector as input and a size measurement error compensation coefficient as output. A Whale Optimization Algorithm (WOA) is introduced to jointly and adaptively optimize the key hyperparameters of the RBF network. These key hyperparameters include at least the kernel width parameter of the Gaussian radial basis function and the learning rate parameter of the output layer weights. The global optimization mechanism avoids the uncertainties and local optima problems caused by manual parameter tuning, achieving high-precision modeling of complex nonlinear error relationships.

[0041] 3. An adaptive closed-loop compensation process for light intensity error: This invention proposes a complete adaptive compensation process for light intensity errors. This process sequentially includes image semantic segmentation, multi-dimensional grayscale feature vector construction, error prediction based on an intelligent model, and compensation correction of the measurement results, forming a closed-loop processing mechanism of "image input—error prediction—result output." Through this process, online and adaptive compensation for machine vision dimensional measurement errors under different light intensities and material conditions is achieved without relying on external illumination sensors or manual intervention.

[0042] An optional embodiment of this invention provides a multidimensional grayscale light intensity error adaptive compensation method based on the Segment Anything Model (SAM) and Whale Optimization Algorithm–Radial Basis Function (WOA-RBF). This method, without introducing an external light sensor, relies solely on image information to achieve nonlinear modeling and adaptive compensation of dimensional measurement errors under different materials and lighting conditions. The specific method flow is as follows: Figure 1 As shown, it includes the following steps: The target object is captured to generate a target image; The target image is segmented and extracted to generate a multi-dimensional gray-scale feature vector that reflects the differences in the surface optical response of the different material regions. The multidimensional grayscale feature vector is input into a pre-trained error compensation model to obtain the error compensation coefficients of the target image; The target image is compensated according to the error compensation coefficient; The error compensation model is a mapping model, which is constructed with multi-dimensional gray-scale feature vectors as input and size measurement error compensation coefficients as output, mapping the nonlinear coupling relationship between the light source, material and imaging process.

[0043] In an optional embodiment, the construction of multidimensional gray-level feature vectors and the construction of a gray-level-error dataset are achieved through the following steps one to three, as follows: Figure 2 As shown.

[0044] Step 1, Image Acquisition An industrial camera is used to acquire images of the workpiece under test. The industrial camera is fixedly installed in the measurement system, maintaining a stable relative position with the workpiece. The light source adopts various arrangements such as ring light, coaxial light, or backplane light, and the illumination intensity is adjustable. Multiple images of the same workpiece are captured under different illumination intensities, resulting in multiple workpiece images. The acquired images serve as the raw input data for subsequent segmentation, feature extraction, and error modeling.

[0045] The technical effect of this step is that, without introducing an additional illuminance sensor, it indirectly reflects the impact of changes in lighting conditions on the imaging results through the grayscale changes inherent in the image itself.

[0046] Step 2: Automatic Multi-Material Region Segmentation Based on SAM (Simplified Method Aspect) In step two, the workpiece image obtained in step one is input into the SegmentAnything Model (SAM) for semantic segmentation processing.

[0047] SAM is a general-purpose image segmentation model with zero-shot segmentation capability. It can automatically segment regions in an image with different visual and optical properties without requiring pre-training for specific workpieces or materials. SAM segmentation can divide an image into multiple semantic regions, including but not limited to: ● Background area; ●Areas of different materials on the workpiece being tested; ●Standard gauge blocks or reference areas.

[0048] The aforementioned different regions typically correspond to different materials or different surface conditions, and their optical reflection characteristics (i.e., bidirectional reflection distribution functions) vary significantly.

[0049] The technical benefits of this step are: avoiding manual selection of regions of interest (ROIs) and increasing the input dimension of the error compensation model, enabling automatic and stable extraction of multi-material regions, and providing a reliable foundation domain for subsequent multi-dimensional feature construction.

[0050] Step 3: Construct multi-dimensional gray-level feature vectors and build a gray-level-error dataset. In step three, grayscale statistical analysis is performed on each segmented region obtained in step two.

[0051] Specifically, for each segmented region, the statistical characteristics of the pixel grayscale values ​​within that region are calculated, preferably using the average grayscale value as the grayscale representation parameter for that region. Of course, this can also be extended to statistical characteristics such as variance and gradient mean. The grayscale statistical characteristics corresponding to each segmented region are combined in a predetermined order to construct a multidimensional grayscale feature vector. This multidimensional feature vector can simultaneously reflect the imaging response characteristics of different material regions under the current illumination conditions, thus implicitly containing information about illumination intensity, material reflectivity, and the coupling effect of the imaging system.

[0052] The workpiece image obtained in step one is used to measure the workpiece size using an image measurement algorithm, and the error between the algorithm's measurement result and the actual size is calculated, so that each image has a corresponding gray-level multidimensional feature vector and algorithm measurement error, thereby constructing a gray-level-error dataset.

[0053] In an optional embodiment, the nonlinear error compensation model is constructed and the error adaptive compensation is achieved through steps four and five below; the overall process of steps four and five is as follows: Figure 3 As shown.

[0054] Step 4: Construction of the nonlinear error compensation model based on WOA-RBF (WOA-RBF) In step four, a radial basis function neural network (RBF network) is first constructed. This network includes an input layer, hidden layers, and an output layer. ● The number of nodes in the input layer is consistent with the dimension of the multidimensional gray-level feature vector; ●The hidden layer uses Gaussian radial basis functions as activation functions; ● The output layer outputs the corresponding size error compensation coefficient.

[0055] To improve the modeling accuracy of RBF networks under complex nonlinear conditions, the Whale Optimization Algorithm (WOA) is introduced to globally optimize the key parameters of the RBF network. The optimized parameters include, but are not limited to: ● Gaussian kernel width parameter; ●Network learning rate; ●Hidden layer node distribution parameters.

[0056] WOA achieves a global search of the parameter space by simulating the feeding behavior of humpback whales, thus avoiding the problem of traditional gradient methods getting trapped in local optima. Using collected training samples, multidimensional gray-level feature vectors are used as network input, and the corresponding actual measurement errors are used as supervision signals to train a stable nonlinear mapping model of "multidimensional gray-level features - measurement error compensation coefficients".

[0057] Step 5: Online Measurement and Adaptive Error Compensation In the online measurement phase, the image of the workpiece to be measured is input into the system, and steps two and three are executed sequentially to obtain the multi-dimensional grayscale feature vector corresponding to the current image. This feature vector is then input into the pre-trained WOA-RBF neural network model, which outputs the corresponding error compensation coefficient. The original dimensional measurement result is corrected based on this compensation coefficient to obtain the final compensated dimensional measurement value. This step achieves real-time, adaptive error compensation under different lighting intensities and material conditions. Note that the error compensation is for the measured value of the workpiece dimension calculated by the visual measurement algorithm, excluding image edge localization correction; the specific aspects compensated vary depending on the measurement task.

[0058] In this invention, the Segment Anything Model (SAM) is preferably used to automatically segment multi-material regions of the measurement image. Alternatively, supervised learning-based semantic segmentation networks, such as U-Net and Mask R-CNN, can be used to segment different regions of the image.

[0059] In the error compensation modeling stage, besides radial basis function (RBF) neural networks, support vector regression (SVR), back propagation neural networks (BP networks), or random forest regression models can be used as alternatives to establish the mapping relationship between multidimensional gray-level features and measurement errors. However, while these models can achieve nonlinear regression modeling under certain conditions, SVR has high computational complexity with large sample sizes or high-dimensional feature inputs; BP neural networks are sensitive to initial parameters and learning rates, and are prone to getting trapped in local minima; random forests have relatively limited accuracy and stability in fine-grained modeling of continuous errors. In contrast, the WOA-RBF model used in this invention has advantages in both convergence speed and modeling accuracy.

[0060] In the process of model parameter optimization, in addition to the Whale Optimization Algorithm (WOA), swarm optimization methods such as Particle Swarm Optimization (PSO) or Genetic Algorithm (GA) can also be used to search and optimize the parameters of the regression model. However, although the above optimization algorithms can achieve global search to a certain extent, they are generally less stable than the WOA algorithm in terms of search efficiency, convergence accuracy, and the balance between global exploration and local exploitation capabilities. Especially when the parameter space is complex or the degree of nonlinearity is high, insufficient convergence accuracy or fluctuations in optimization results are prone to occur. Experiments have verified that the WOA-RBF neural network is the most suitable.

[0061] Experimental Platform The CCD image acquisition system employed a high-resolution GP-660V microscope with a resolution of 1920×1080 pixels, illuminated by a D-100 ring light source. The computer used an Intel Core i5-12400F CPU, 16 GB of memory, and Windows 10 (64-bit) operating system. A 7×7 array of circular calibration targets was used, with characteristic dots having a diameter of 0.625 mm and a center-to-center distance of 1.25 mm between adjacent dots. By extracting the pixel coordinates of the high-precision circular markers on the calibration plate, a correspondence between them and three-dimensional world coordinates was established to achieve high-precision solution of the camera's intrinsic and extrinsic parameters. The diameter of the chromium-zirconium-copper workpiece measured by a KEYENCE VK-X3000 laser confocal microscope equipped with a 20x objective lens and a spatial resolution of 686.688 nm / pixel was used as the true value for error comparison.

[0062] Construction of grayscale-error dataset A randomly selected chromium-zirconium copper (CZC) fixture was continuously imaged using a CCD image acquisition system while controlling the ring light source to gradually brighten. After removing out-of-focus and redundant samples, 284 high-quality images of the CZC fixture were obtained. The diameter of these 284 high-quality images was measured using the Canny-Zernike subpixel moment algorithm and used as the algorithm's diameter. The average grayscale values ​​of different material surfaces of the CZC workpiece were obtained using the SAM segmentation algorithm as input. In this study, five different inputs were obtained: the average grayscale values ​​of the background, standard blocks, the outer ring, inner ring, and middle ring of the CZC fixture. The output is the error compensation coefficient. These image data were used as the training dataset for the illumination error measurement experiment.

[0063] An embodiment of the present invention also provides a visual measurement error compensation system, characterized in that it includes an image acquisition module, a feature extraction module, an error compensation model, and an image compensation module; The image acquisition module is used to acquire images of the target object and generate a target image; The feature extraction module is used to segment and extract different material regions in the target image, and generate a multi-dimensional gray-scale feature vector that reflects the differences in surface optical response of the different material regions. The error compensation model is used to obtain the compensation coefficients of the target image based on the multidimensional gray-scale feature vector; The image compensation module is used to compensate the target image according to the error compensation coefficient; Specifically, by constructing a radial basis function neural network model with multidimensional gray-scale feature vectors as input and size measurement error compensation coefficients as output, and optimizing its parameters, an error compensation model is obtained that maps the nonlinear coupling relationship between the light source, material, and imaging process.

[0064] An optional embodiment of the present invention also provides a computing device, characterized in that it includes: a processor and a memory storing a computer program, wherein the computer program is executed by the processor to perform the above-described method.

[0065] An optional embodiment of the present invention also provides a computer-readable storage medium, characterized in that it stores instructions that, when executed on a computer, cause the computer to perform the above-described method.

[0066] The above are preferred embodiments of the present invention. It should be noted that, for those skilled in the art, several improvements and modifications can be made without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.

Claims

1. A method for compensating for visual measurement errors, comprising the following steps: The target object is captured to generate a target image; The target image is segmented and extracted to generate a multi-dimensional gray-scale feature vector that reflects the differences in the surface optical response of the different material regions. The multidimensional grayscale feature vector is input into a pre-trained error compensation model to obtain the error compensation coefficients of the target image; The target image is compensated according to the error compensation coefficient; The error compensation model is a mapping model, which is constructed with multi-dimensional gray-scale feature vectors as input and size measurement error compensation coefficients as output, mapping the nonlinear coupling relationship between the light source, material and imaging process.

2. The method according to claim 1, characterized in that, Joint adaptive optimization is performed on the key hyperparameters of the mapping model.

3. The method according to claim 2, characterized in that, The key hyperparameters include at least the kernel width parameter of the Gaussian radial basis function and the learning rate parameter of the output layer weights.

4. The method according to claim 1, 2, or 3, characterized in that, The target image is segmented into regions of different materials to obtain multiple regions with different optical reflection properties; The multidimensional gray-scale feature vector is constructed based on the gray-scale statistical features extracted from each of the regions.

5. The method according to claim 4, characterized in that, The Segmentation Model (SAM) is used to segment different material regions in the target image; the gray-level statistical features are the average gray-level value, variance, or gradient mean; the gray-level statistical features corresponding to each region are combined in a predetermined order to construct the multidimensional gray-level feature vector.

6. The method according to claim 1, 2, or 3, characterized in that, The mapping model is a radial basis function neural network model, including an input layer, a hidden layer, and an output layer; wherein, the number of nodes in the input layer is consistent with the dimension of the multidimensional gray-level feature vector, the hidden layer uses Gaussian radial basis function as activation function, and the output layer outputs the corresponding size error compensation coefficient; the radial basis function neural network model is jointly and adaptively optimized using the whale optimization algorithm.

7. The method according to claim 1, characterized in that, The mapping model is a support vector regression model (SVR), a backpropagation neural network model, or a random forest regression model; the error compensation model is obtained by optimizing the parameters of the mapping model using a particle swarm optimization algorithm or a genetic algorithm.

8. A visual measurement error compensation system, characterized in that, It includes an image acquisition module, a feature extraction module, an error compensation model, and an image compensation module; The image acquisition module is used to acquire images of the target object and generate a target image; The feature extraction module is used to segment and extract different material regions in the target image, and generate a multi-dimensional gray-scale feature vector that reflects the differences in surface optical response of the different material regions. The error compensation model is used to obtain the compensation coefficients of the target image based on the multidimensional gray-scale feature vector; The image compensation module is used to compensate the target image according to the error compensation coefficient; Specifically, by constructing a radial basis function neural network model with multidimensional gray-scale feature vectors as input and size measurement error compensation coefficients as output, and optimizing its parameters, an error compensation model is obtained that maps the nonlinear coupling relationship between the light source, material, and imaging process.

9. A computing device, characterized in that, include: A processor, a memory storing a computer program, wherein the computer program, when executed by the processor, performs the method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, A storage instruction that, when executed on a computer, causes the computer to perform the method as described in any one of claims 1 to 7.