Gray consistency calibration method, device and program product of machine vision system

By constructing a benchmark and fitting curve, and calculating compensation coefficients for calibration, the problem of grayscale differences in machine imaging was solved, and grayscale consistency and comparability of detection results were achieved among multiple machines.

CN123160404APending Publication Date: 2026-11-24GUANGDONG ADA SEMICON EQUIP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202611654545.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-10-26
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

Differences in image grayscale between different machines make it difficult to guarantee the consistency of visual inspection results. Existing hardware control solutions cannot effectively eliminate differences in image grayscale when using the same set of interface output parameters.

Method used

By acquiring the PWM output values ​​and grayscale values ​​of the reference and target machines, a reference curve and a fitting curve are constructed, and compensation coefficients, including slope compensation coefficient and intercept compensation coefficient, are calculated and calibrated to achieve grayscale consistency.

Benefits of technology

It accurately characterizes the actual grayscale response trend of the machine tool, decouples the deviation caused by the difference in quantum efficiency of the LED beads and dark current drift, ensures high accuracy and determinism of calibration, and achieves grayscale consistency of multiple machines.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123160404A_ABST
    Figure CN123160404A_ABST
Patent Text Reader

Abstract

This invention relates to a grayscale consistency calibration method, apparatus, and program product for a machine vision system. The method includes: acquiring N PWM output values ​​and N first grayscale values ​​corresponding to a reference machine, where the first grayscale values ​​indicate the grayscale values ​​of the corresponding image of the reference machine, and N is an integer greater than or equal to 3; obtaining a reference curve based on the N PWM output values ​​and the N first grayscale values; acquiring N second grayscale values ​​of the image corresponding to the target machine under the N PWM output values; obtaining a fitting curve based on the N PWM output values ​​and the N second grayscale values; determining compensation coefficients, including slope compensation coefficients and intercept compensation coefficients, according to the reference curve and the fitting curve; and calibrating the actual PWM output values ​​of the target machine according to the compensation coefficients.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of image processing technology, and in particular to a grayscale consistency calibration method, device, and program product for machine vision systems. Background Technology

[0002] With the large-scale deployment of vision inspection equipment in industrial production, multiple vision inspection machines of the same model often need to perform the same inspection tasks. This requires that, under the same software output parameters, each machine can present a consistent imaging grayscale effect to ensure the uniformity of inspection standards and the comparability of inspection results. Therefore, how to eliminate the imaging grayscale differences between different machines has become a key common technical problem in the mass application of vision inspection equipment.

[0003] Currently, the industry generally adopts hardware control solutions to ensure the consistency of lighting between machines. Specifically, this involves strictly screening and classifying the brightness of incoming LED chips, and precisely controlling the installation angle and position tolerances of the LED chips during assembly, thereby minimizing individual differences from the physical output end of the light source.

[0004] However, when using the same set of interface output parameters to control different machines, the actual imaging grayscale of each machine varies significantly, making it difficult to guarantee the consistency of visual inspection results. Summary of the Invention

[0005] This invention provides a method, apparatus, and program product for grayscale consistency calibration of a machine vision system. The technical solution is as follows: On the one hand, a grayscale consistency calibration method for a machine vision system is provided, the method comprising: Obtain N PWM output values ​​and N first grayscale values ​​corresponding to the reference machine, where the first grayscale values ​​indicate the grayscale values ​​of the image corresponding to the reference machine, and N is an integer greater than or equal to 3; Based on the N PWM output values ​​and the N first grayscale values, a baseline curve is obtained; Obtain the N second grayscale values ​​of the image corresponding to the target machine under the N PWM output values ​​respectively; Based on the N PWM output values ​​and the N second grayscale values, a fitting curve is obtained; Based on the baseline curve and the fitted curve, compensation coefficients are determined, including slope compensation coefficients and intercept compensation coefficients. The actual PWM output value of the target machine is calibrated based on the compensation coefficient.

[0006] On the other hand, a grayscale consistency calibration device for a machine vision system is provided, the device comprising: The numerical acquisition module is used to acquire N PWM output values ​​and N first grayscale values ​​corresponding to the reference machine, wherein the first grayscale values ​​indicate the grayscale values ​​of the image corresponding to the reference machine, and N is an integer greater than or equal to 3; The reference curve acquisition module is used to obtain a reference curve based on the N PWM output values ​​and the N first grayscale values; The second grayscale value acquisition module is used to acquire N second grayscale values ​​of the image corresponding to the target machine under the N PWM output values ​​respectively; The fitting curve acquisition module is used to obtain a fitting curve based on the N PWM output values ​​and the N second grayscale values; The compensation coefficient determination module is used to determine the compensation coefficients based on the benchmark curve and the fitted curve, wherein the compensation coefficients include the slope compensation coefficient and the intercept compensation coefficient. The calibration module is used to calibrate the actual PWM output value of the target machine according to the compensation coefficient.

[0007] In one possible implementation, the reference curve acquisition module is used to calculate a first slope and a first intercept based on the N PWM output values ​​and the N first grayscale values; and to calculate a reference curve based on the first slope and the first intercept using a first-order fitting algorithm.

[0008] In one possible implementation, N is 4, and the reference curve acquisition module is used to calculate the sum of the PWM outputs and the sum of the first grayscale values ​​respectively using formulas one and two, based on the four PWM output values ​​and the four first grayscale values: Formula 1; Formula 2; These are the four PWM output values. These are the four first grayscale values ​​corresponding to the four PWM output values. It is the sum of PWM outputs. It is the sum of the first grayscale values; Based on the four PWM output values ​​and the four first grayscale values, the sum of squares and the sum of cross products of the PWM outputs are calculated using Formulas 3 and 4, respectively: Formula 3; Formula 4; It is the sum of squares of the PWM output. It is the sum of cross products; Based on the sum of the PWM outputs, the sum of the first grayscale values, and the sum of the squares of the PWM outputs, the first slope and the first intercept are calculated using formulas five and six: Formula 5; Formula Six; It is the first slope. It is the first intercept.

[0009] In one possible implementation, the benchmark curve acquisition module is configured to determine the benchmark curve as Equation 7 based on the first slope and the first intercept: Formula 7; u is the set PWM output value.

[0010] In one possible implementation, the compensation coefficient determination module is used to obtain the second slope and the second intercept in the fitted curve; Based on the first slope, the second slope, the first intercept, and the second intercept, the slope compensation coefficient and the intercept compensation coefficient are calculated using Formulas 8 and 9: Formula 8; Formula Nine; It is the second slope. It is the second intercept. It is the slope compensation coefficient. It is the intercept compensation coefficient.

[0011] In one possible implementation, the calibration module is used to determine the actual PWM output value of the target machine based on the slope compensation coefficient and the intercept compensation coefficient using Formula 10, and to control the target machine based on the actual PWM output value. Formula 10; This is the actual PWM output value, and u is the set PWM output value. It is the slope compensation coefficient. It is the intercept compensation coefficient.

[0012] In another aspect, a computer device is provided, the computer device comprising a processor and a memory, the memory storing at least one instruction, at least one program, code set or instruction set, the at least one instruction, the at least one program, the code set or instruction set being loaded and executed by the processor to implement the grayscale consistency calibration method of the machine vision system as described above.

[0013] In another aspect, a computer-readable storage medium is provided, wherein at least one instruction, at least one program, code set, or instruction set is stored therein, wherein the at least one instruction, the at least one program, the code set, or the instruction set is loaded and executed by a processor to implement the grayscale consistency calibration method of the machine vision system as described above.

[0014] In another aspect, a computer program product is provided, comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the grayscale consistency calibration method for the machine vision system provided in the various optional implementations described above.

[0015] The technical solution provided by this invention may include the following beneficial effects: By selecting N≥3 PWM output values ​​for oversampling and using least-squares fitting to minimize the sum of squared residuals, the inherent nonlinear response error of the wire bonding machine's light source drive circuit and LEDs is evenly distributed across the entire range. This effectively avoids the drawback of traditional two-point calibration, which amplifies the error locally. This allows for accurate characterization of the machine's actual grayscale response trend. Slope compensation coefficients and intercept compensation coefficients are constructed to decouple and independently correct the proportional deviation caused by differences in LED quantum efficiency and the static offset caused by dark current drift. This avoids the cross-coupling error caused by single-parameter compensation. By substituting the compensated actual PWM output value into the target machine's fitting curve through feedforward calibration, it can be rigorously mathematically deduced that the compensated grayscale is completely consistent with the reference machine across the entire output domain, and the deviation is reduced to zero. This ensures high accuracy and determinism of the calibration at the mechanistic level. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0017] Figure 1 This is a system configuration diagram of a grayscale consistency calibration system for a machine vision system according to an embodiment of the present invention; Figure 2 This is a flowchart of a grayscale consistency calibration method for a machine vision system provided in one embodiment of the present invention; Figure 3 This is a flowchart of a grayscale consistency calibration method for a machine vision system with refined benchmark curve fitting steps, provided in one embodiment of the present invention. Figure 4 This is a flowchart of a grayscale difference algorithm for a calibration image recognition system provided in one embodiment of the present invention; Figure 5 This is a block diagram of a grayscale consistency calibration device for a machine vision system provided in an exemplary embodiment of the present invention. Detailed Implementation

[0018] Exemplary embodiments will now be described in detail, examples of which are illustrated in the accompanying drawings. When the following description relates to the drawings, unless otherwise indicated, the same numerals in different drawings denote the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present invention. Rather, they are merely examples of apparatuses and methods consistent with some aspects of the invention as detailed in the appended claims.

[0019] Figure 1 This is a system configuration diagram of a grayscale consistency calibration system for a machine vision system according to an embodiment of the present invention. Both the reference machine 101 and the target machine 102 in this system are wire bonding machines. Figure 1 As shown, N PWM output values ​​and N first grayscale values ​​corresponding to the reference machine 101 are obtained. The first grayscale values ​​indicate the grayscale values ​​of the image corresponding to the reference machine 101, and N is an integer greater than or equal to 3. Based on the N PWM output values ​​and N first grayscale values, a reference curve is obtained. N second grayscale values ​​of the image corresponding to the target machine 102 under the N PWM output values ​​are obtained. Based on the N PWM output values ​​and N second grayscale values, a fitting curve is obtained. According to the reference curve and the fitting curve, compensation coefficients are determined, including slope compensation coefficients and intercept compensation coefficients. According to the compensation coefficients, the actual PWM output values ​​of the target machine 102 are calibrated.

[0020] Please refer to Figure 2 , Figure 2 It illustrates a flowchart of a grayscale consistency calibration method for a machine vision system according to an embodiment of the present invention. For example... Figure 2 As shown, the grayscale consistency calibration method of the machine vision system can be performed by the wire bonding machine. This method can be implemented through steps 210 to 260, and the specific steps are as follows.

[0021] Step 210: Obtain N PWM output values ​​and N first grayscale values ​​corresponding to the reference machine. The first grayscale value indicates the grayscale value of the image corresponding to the reference machine. N is an integer greater than or equal to 3.

[0022] The aforementioned benchmark equipment refers to a standard device that has been officially calibrated or verified over a long period of time to have stable imaging performance and optimal grayscale response characteristics within the same production batch or model of equipment. It is used as a reference benchmark for the calibration of all subsequent target equipment.

[0023] The PWM output value mentioned above is a digital drive parameter used in wire bonding machines to control the brightness of the lighting source. The value range can be between 0 and 255 (or 0 and 4095). The larger the PWM output value, the higher the duty cycle of the light source and the greater the irradiation intensity.

[0024] The aforementioned first grayscale value refers to the pixel grayscale statistics of the image acquired by the reference machine under a given PWM output value (usually the arithmetic mean of the grayscale of all pixels in the central region of the image or the entire image). The first grayscale value reflects the light intensity response received by the camera sensor of the reference machine, and the unit is grayscale level.

[0025] On a reference machine, N representative PWM output values ​​(e.g., PWM1, PWM2, ..., PWM...) are pre-selected at equal or logarithmic intervals (N≥3, e.g., N=8 or N=11). n (Covering the full dynamic range from low to high brightness), and for each PWM output value, controlling the light source of the reference machine to illuminate at that value, while simultaneously triggering the camera to acquire an image of a standard white board or a uniformly diffused reference object. The acquired image is then processed to extract the Region of Interest (ROI), and the mean grayscale value of all pixels within that region is calculated to obtain the first grayscale value corresponding to that PWM output value, forming N sets of data pairs (PWM). i Gray1 i ), where i=1,2,…,N, and the mapping relationship between the PWM output value and the grayscale value is stored in the memory of the reference machine.

[0026] Step 220: Based on N PWM output values ​​and N first grayscale values, obtain the baseline curve.

[0027] The aforementioned reference curve is a continuous function curve that accurately describes the response relationship between the PWM output value and the grayscale value of the reference machine; that is, the reference curve. The reference curve serves as the absolute reference for subsequent calibration, reflecting the mapping relationship between the light source driving quantity and the camera response under ideal conditions.

[0028] Based on the solutions shown in any one or more of the above embodiments, please refer to Figure 3 , Figure 3 This document illustrates a flowchart of a grayscale consistency calibration method for a machine vision system with a refined baseline curve fitting step, provided by an embodiment of the present invention. Step 220 can be implemented as steps 220a and 220b: Step 220a: Calculate the first slope and the first intercept based on the N PWM output values ​​and the N first grayscale values.

[0029] The first slope characterizes the average rate of change of the image grayscale response (unit: grayscale level / PWM step) when the light source drive of the reference machine changes by one PWM unit.

[0030] The first intercept characterizes the theoretical baseline grayscale value (unit: grayscale level) contributed by the system due to inherent factors such as camera dark current and ambient stray light when the PWM output value is zero.

[0031] Based on the scheme shown in any one or more of the above embodiments, in some embodiments, N is 4, and step 220a can be implemented as follows: based on the 4 PWM output values ​​and the 4 first grayscale values, the sum of the PWM outputs and the sum of the first grayscale values ​​are calculated respectively using formula one and formula two: Formula 1; Formula 2; There are 4 PWM output values. These are the four first grayscale values ​​corresponding to the four PWM output values. It is the sum of PWM outputs. It is the sum of the first grayscale values; Based on the four PWM output values ​​and the four first grayscale values, the sum of squares and the sum of cross products of the PWM outputs are calculated using Formulas 3 and 4, respectively: Formula 3; Formula 4; It is the sum of squares of the PWM output. It is the sum of cross products; Based on the sum of PWM outputs, the sum of the first grayscale values, the sum of the squares of PWM outputs, and the sum of cross products, the first slope and the first intercept are calculated using formulas five and six: Formula 5; Formula Six; It is the first slope. It is the first intercept.

[0032] Step 220b: Calculate the baseline curve using a first-order fitting algorithm based on the first slope and the first intercept.

[0033] Based on the solutions shown in any one or more of the above embodiments, in some embodiments, step 220b can be implemented as follows: determining the reference curve as Equation 7 based on the first slope and the first intercept: Formula 7; u is the set PWM output value.

[0034] Step 230: Obtain the N second grayscale values ​​of the image corresponding to the target machine under N PWM output values.

[0035] The aforementioned target machine is the machine to which the calibration operation will be transferred (i.e., the production equipment that currently needs to maintain grayscale consistency with the reference machine).

[0036] The second grayscale value is the statistical mean of the grayscale values ​​of the images obtained by the target machine from the same type of standard reference object under the same N PWM output values.

[0037] In some embodiments, the lighting source of the target machine is sequentially set to N PWM output values ​​(i.e., PWM1~PWM2) predetermined in step 210. n (The order and values ​​are exactly the same as the reference machine). Under each PWM value, the target machine's vision system performs automatic exposure (if fixed exposure is supported, the same exposure time as the reference machine) and image acquisition. Then, the acquired image is applied with the exact same ROI position and size as in step 210, and the average gray level of the pixels within the ROI is calculated to obtain N second gray level values, denoted as Gray2. i (i=1,2,…,N). To ensure data reliability, multiple frames (e.g., 5~10 frames) are typically collected continuously at each PWM value, and the time average of the grayscale mean is taken to suppress the influence of random noise. Finally, N pairs of actual response data (PWM) of the target machine are obtained. i Gray2 i (and temporarily store it in memory for subsequent fitting).

[0038] Step 240: Based on N PWM output values ​​and N second grayscale values, obtain the fitting curve.

[0039] The fitted curve is a function curve constructed based on the measured data of the target machine to describe the current response characteristics of the target machine.

[0040] The fitted curve characterizes the actual mapping relationship between the PWM input and grayscale output of the target machine under the current state.

[0041] Step 250: Determine the compensation coefficients based on the baseline curve and the fitted curve. The compensation coefficients include the slope compensation coefficient and the intercept compensation coefficient.

[0042] The compensation coefficients are a set of coefficients derived by comparing the difference between the baseline curve and the fitted curve, which can be used for subsequent real-time correction.

[0043] The slope compensation coefficient and the intercept compensation coefficient are correction factors corresponding to the gain deviation and offset deviation of the actual PWM-grayscale response line of the target machine relative to the reference curve, respectively. The slope compensation coefficient is used to correct the response slope difference caused by light source attenuation or camera gain change, while the intercept compensation coefficient is used to correct the fixed grayscale shift caused by dark current, ambient stray light, etc.

[0044] Based on the solutions shown in any one or more of the above embodiments, in some embodiments, step 250 can be implemented as: obtaining the second slope and the second intercept in the fitted curve; Based on the first slope, second slope, first intercept, and second intercept, the slope compensation coefficient and intercept compensation coefficient are calculated using formulas eight and nine: Formula 8; Formula Nine; It is the second slope. It is the second intercept. It is the slope compensation coefficient. It is the intercept compensation coefficient.

[0045] Step 260: Calibrate the actual PWM output value of the target machine according to the compensation coefficient.

[0046] Based on the solutions shown in any one or more of the above embodiments, in some embodiments, step 260 can be implemented as follows: determining the actual PWM output value of the target machine based on the slope compensation coefficient and the intercept compensation coefficient using Formula 10, and controlling the target machine based on the actual PWM output value: Formula 10; This is the actual PWM output value, and u is the set PWM output value. It is the slope compensation coefficient. It is the intercept compensation coefficient.

[0047] This scheme selects N≥3 PWM output values ​​for oversampling and uses least squares fitting to minimize the sum of squared residuals. This evenly distributes the inherent nonlinear response error of the wire bonding machine's light source drive circuit and LEDs across the entire range, effectively avoiding the drawback of traditional two-point calibration that amplifies the error locally. This allows for accurate characterization of the machine's actual grayscale response trend. Slope compensation coefficients and intercept compensation coefficients are constructed to decouple and independently correct the proportional deviation caused by differences in LED quantum efficiency and the static offset caused by dark current drift. This avoids the cross-coupling error caused by single-parameter compensation. By substituting the compensated actual PWM output value into the target machine's fitting curve through feedforward calibration, it can be rigorously mathematically deduced that the compensated grayscale is completely consistent with the reference machine across the entire output domain, and the deviation is reduced to zero. This ensures high accuracy and determinism of calibration at the mechanistic level.

[0048] For example, based on Figures 2 to 3 For any one or more embodiments, the present invention proposes a method for calibrating grayscale differences in an image recognition system.

[0049] refer to Figure 4 The diagram illustrates a flowchart of a grayscale difference algorithm for a calibration image recognition system according to an embodiment of the present invention. The steps of this workflow are as follows: This solution relies on existing hardware and software systems. By setting the output value through the software interface, it controls the driver to output the corresponding current, enabling the LEDs to achieve a certain brightness. A vision system and recognition algorithm acquire the corresponding image grayscale values ​​to represent the actual brightness, thus obtaining a series of data to represent the brightness corresponding to different output currents on different machines. Using one machine as a reference machine, a baseline curve is obtained through the algorithm, and other machines can obtain their calibration curves. Through first-order fitting, the calibration curves of the other machines are further adjusted. By applying the adjusted calibration curves, consistent brightness across different machines can be achieved under the same output current value.

[0050] This solution can improve the brightness consistency of visual imaging, thereby reducing the grayscale difference between machines. Furthermore, it allows a single set of interface output parameters to be applied to multiple machines, thus improving the consistency of equipment parameters.

[0051] The process of the fitting algorithm is as follows: Figure 4 As shown. For the reference machine, the software sets four output values, which refer to the actual panel settings. The light driver outputs current according to the set output value through its built-in circuit. After taking a picture, the camera and vision algorithm process the image using a general vision algorithm to collect the grayscale values ​​of the image within the field of view. The baseline curve of the reference machine is obtained using a standard first-order fitting algorithm: ; The specific process is as follows: Basic summation: , ; The sum of squares is the sum of cross products: ; ; Substitute and sum: ; ; In the above formula: The output values ​​set for the software are these four PWM (Pulse Width Modulation) output values ​​set in the software interface. These four values ​​are chosen precisely for data fitting, neither too many nor too few. The light driver processes the set PWM values ​​through hardware circuitry and outputs current. This is an industry standard solution, and the implementation principle will not be described in detail. The camera takes a picture, obtaining the image result of the calibration fixture. A visual algorithm is then used to process the image and extract grayscale values. This method of extracting grayscale values ​​after taking a picture is also a common method in visual processing.

[0052] The output value corresponds to the image grayscale value. These represent the slope and intercept of the first-order baseline curve, respectively. Simultaneously, a baseline file is generated, containing these four sets of output values, grayscale values, and the coefficients of the fitted baseline curve. This file can be copied to other machines during subsequent consistency calibration for machine discrepancies.

[0053] The same software-set output values ​​were also used on the other calibration machines. The corresponding grayscale data was collected. The curve obtained using the same standard first-order fitting algorithm is: ; Based on this process, the actual output curves of other machines before calibration can be obtained: ; ...... ; in, This indicates the machine that needs calibration.

[0054] Taking a reference machine and the first machine that needs calibration as examples, the following is illustrated: ; as well as ; The compensation coefficient for the first machine can be obtained through calculation: ; ; The two compensation coefficients above represent the difference between the calibration and reference equipment. In actual output, this compensation needs to be introduced to achieve consistent grayscale between the reference and calibration equipment. That is: Before compensation: Output value: ; After compensation: The actual output value is: ; Following this process and using the same method, the compensation coefficients for other machines can be obtained, thus achieving the effect of consistent image grayscale when all machines output the same output value.

[0055] The above is merely one embodiment of the present invention and should not be considered as a limitation thereof. Those skilled in the art will understand that various modifications and variations can be made to the embodiments to adapt to different application requirements. Therefore, the scope of the present invention should be defined by the appended claims.

[0056] Please refer to Figure 5 The diagram illustrates a block diagram of a grayscale consistency calibration device for a machine vision system according to an exemplary embodiment of the present invention. This grayscale consistency calibration device can be implemented as all or part of a welding machine through hardware or a combination of hardware and software, to achieve the above-described... Figures 2 to 4 All or part of the steps in the illustrated embodiments. For example... Figure 5 As shown, the grayscale consistency calibration device of the machine vision system includes: The numerical acquisition module 501 is used to acquire N PWM output values ​​and N first grayscale values ​​corresponding to the reference machine, wherein the first grayscale values ​​indicate the grayscale values ​​of the image corresponding to the reference machine, and N is an integer greater than or equal to 3. The reference curve acquisition module 502 is used to obtain a reference curve based on the N PWM output values ​​and the N first grayscale values; The second grayscale value acquisition module 503 is used to acquire N second grayscale values ​​of the image corresponding to the target machine under the N PWM output values ​​respectively; The fitting curve acquisition module 504 is used to obtain a fitting curve based on the N PWM output values ​​and the N second grayscale values; The compensation coefficient determination module 505 is used to determine the compensation coefficients based on the benchmark curve and the fitted curve, wherein the compensation coefficients include the slope compensation coefficient and the intercept compensation coefficient. The calibration module 506 is used to calibrate the actual PWM output value of the target machine according to the compensation coefficient.

[0057] In one possible implementation, the reference curve acquisition module 502 is used to calculate a first slope and a first intercept based on the N PWM output values ​​and the N first grayscale values; and to calculate a reference curve based on the first slope and the first intercept using a first-order fitting algorithm.

[0058] In one possible implementation, N is 4, and the reference curve acquisition module 502 is used to calculate the sum of the PWM outputs and the sum of the first grayscale values ​​based on the four PWM output values ​​and the four first grayscale values, using formulas one and two respectively: Formula 1; Formula 2; These are the four PWM output values. These are the four first grayscale values ​​corresponding to the four PWM output values. It is the sum of PWM outputs. It is the sum of the first grayscale values; Based on the four PWM output values ​​and the four first grayscale values, the sum of squares and the sum of cross products of the PWM outputs are calculated using Formulas 3 and 4, respectively: Formula 3; Formula 4; It is the sum of squares of the PWM output. It is the sum of cross products; Based on the sum of the PWM outputs, the sum of the first grayscale values, and the sum of the squares of the PWM outputs, the first slope and the first intercept are calculated using formulas five and six: Formula 5; Formula Six; It is the first slope. It is the first intercept.

[0059] In one possible implementation, the reference curve acquisition module 502 is used to determine the reference curve as Equation 7 based on the first slope and the first intercept: Formula 7; u is the set PWM output value.

[0060] In one possible implementation, the compensation coefficient determination module 505 is used to obtain the second slope and the second intercept in the fitted curve; Based on the first slope, the second slope, the first intercept, and the second intercept, the slope compensation coefficient and the intercept compensation coefficient are calculated using Formulas 8 and 9: Formula 8; Formula Nine; It is the second slope. It is the second intercept. It is the slope compensation coefficient. It is the intercept compensation coefficient.

[0061] In one possible implementation, the calibration module 506 is used to determine the actual PWM output value of the target machine based on the slope compensation coefficient and the intercept compensation coefficient using Formula 10, and to control the target machine based on the actual PWM output value. Formula 10; This is the actual PWM output value, and u is the set PWM output value. It is the slope compensation coefficient. It is the intercept compensation coefficient.

[0062] In an exemplary embodiment, a computer device is also provided, the computer device including a processor and a memory, the memory storing instructions which are executed by the processor.

[0063] In an exemplary embodiment, a computer program product is also provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions to implement all or part of the steps of the methods shown in the above embodiments of the present invention.

[0064] In an exemplary embodiment, a computer-readable storage medium is also provided, which stores a computer program that is loaded and executed by a processor to implement all or part of the steps of the methods shown in the above embodiments of the present invention.

[0065] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware, or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0066] Although the operations are described in a specific order in the accompanying drawings, this should not be construed as requiring these operations to be performed in the specific order or serial order shown, or requiring all of the operations shown to obtain the desired result. In certain environments, multitasking and parallel processing may be advantageous.

[0067] Any step, operation, or procedure described herein may be performed or implemented using one or more hardware or software modules, either alone or in combination with other devices. In one embodiment, the software module is implemented using a computer program product comprising a computer-readable medium containing computer program code, which is executable by a computer processor to perform any or all of the described steps, operations, or procedures.

[0068] The foregoing description of embodiments of the invention has been provided for purposes of illustration and description. The foregoing description is not exhaustive and is not intended to limit the invention to the exact forms disclosed; various modifications and variations may be made in accordance with the foregoing teachings, or may be derived from the practice of the invention. These embodiments were chosen and described to illustrate the principles of the invention and its practical application, enabling those skilled in the art to utilize the invention in various embodiments and with various modifications to suit the particular purpose of the concept.

[0069] It can be further understood that, unless otherwise specified, "connection" includes both direct connections where no other components exist between the two parties and indirect connections where other components exist between them.

[0070] It is further understood that although the operations are described in a specific order in the accompanying drawings in the embodiments of the present invention, this should not be construed as requiring these operations to be performed in the specific order or serial order shown, or requiring all the operations shown to obtain the desired result. In certain environments, multitasking and parallel processing may be advantageous.

[0071] Other embodiments of the invention will readily occur to those skilled in the art upon consideration of the specification and practice of the invention disclosed herein. This invention is intended to cover any variations, uses, or adaptations of the invention that follow the general principles of the invention and include common knowledge or customary techniques in the field of the invention not disclosed herein. The specification and examples are to be considered exemplary only, and the true scope and spirit of the invention are indicated by the following claims.

[0072] It should be understood that the present invention is not limited to the precise structure described above and shown in the accompanying drawings, and various modifications and changes can be made without departing from its scope. The scope of the invention is limited only by the appended claims.

[0073] The above embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for calibrating grayscale consistency in a machine vision system, characterized in that, The method includes: Obtain N PWM output values ​​and N first grayscale values ​​corresponding to the reference machine, where the first grayscale values ​​indicate the grayscale values ​​of the image corresponding to the reference machine, and N is an integer greater than or equal to 3; Based on the N PWM output values ​​and the N first grayscale values, a baseline curve is obtained; Obtain the N second grayscale values ​​of the image corresponding to the target machine under the N PWM output values ​​respectively; Based on the N PWM output values ​​and the N second grayscale values, a fitting curve is obtained; Based on the baseline curve and the fitted curve, compensation coefficients are determined, including slope compensation coefficients and intercept compensation coefficients. The actual PWM output value of the target machine is calibrated based on the compensation coefficient.

2. The method according to claim 1, characterized in that, The process of obtaining the baseline curve based on the N PWM output values ​​and the N first grayscale values ​​includes: Based on the N PWM output values ​​and the N first grayscale values, the first slope and the first intercept are calculated. The baseline curve is calculated using a first-order fitting algorithm based on the first slope and the first intercept.

3. The method according to claim 2, characterized in that, The N is 4, and the calculation of the first slope and the first intercept based on the N PWM output values ​​and the N first grayscale values ​​includes: Based on the four PWM output values ​​and the four first grayscale values, the sum of the PWM outputs and the sum of the first grayscale values ​​are calculated using Formula 1 and Formula 2, respectively: Formula 1; Formula 2; These are the four PWM output values. These are the four first grayscale values ​​corresponding to the four PWM output values. It is the sum of PWM outputs. It is the sum of the first grayscale values; Based on the four PWM output values ​​and the four first grayscale values, the sum of squares and the sum of cross products of the PWM outputs are calculated using Formulas 3 and 4, respectively: Formula 3; Formula 4; It is the sum of squares of the PWM output. It is the sum of cross products; Based on the sum of the PWM outputs, the sum of the first grayscale values, and the sum of the squares of the PWM outputs, the first slope and the first intercept are calculated using formulas five and six: Formula 5; Formula Six; It is the first slope. It is the first intercept.

4. The method according to claim 2, characterized in that, The step of calculating the baseline curve using a first-order fitting algorithm based on the first slope and the first intercept includes: Based on the first slope and the first intercept, the reference curve is determined as Formula Seven: Formula 7; u is the set PWM output value.

5. The method according to claim 3, characterized in that, The step of determining the compensation coefficient based on the benchmark curve and the fitted curve includes: Obtain the second slope and the second intercept of the fitted curve; Based on the first slope, the second slope, the first intercept, and the second intercept, the slope compensation coefficient and the intercept compensation coefficient are calculated using Formulas 8 and 9: Formula 8; Formula Nine; It is the second slope. It is the second intercept. It is the slope compensation coefficient. It is the intercept compensation coefficient.

6. The method according to claim 1, characterized in that, The actual PWM output value of the target machine is calibrated according to the compensation coefficient, including: Based on the slope compensation coefficient and the intercept compensation coefficient, the actual PWM output value of the target machine is determined using Formula 10, and the target machine is controlled based on the actual PWM output value. Formula 10; This is the actual PWM output value, and u is the set PWM output value. It is the slope compensation coefficient. It is the intercept compensation coefficient.

7. A grayscale consistency calibration device for a machine vision system, characterized in that, The device includes: The numerical acquisition module is used to acquire N PWM output values ​​and N first grayscale values ​​corresponding to the reference machine, wherein the first grayscale values ​​indicate the grayscale values ​​of the image corresponding to the reference machine, and N is an integer greater than or equal to 3; The reference curve acquisition module is used to obtain a reference curve based on the N PWM output values ​​and the N first grayscale values; The second grayscale value acquisition module is used to acquire N second grayscale values ​​of the image corresponding to the target machine under the N PWM output values ​​respectively; The fitting curve acquisition module is used to obtain a fitting curve based on the N PWM output values ​​and the N second grayscale values; The compensation coefficient determination module is used to determine the compensation coefficients based on the benchmark curve and the fitted curve, wherein the compensation coefficients include the slope compensation coefficient and the intercept compensation coefficient. The calibration module is used to calibrate the actual PWM output value of the target machine according to the compensation coefficient.

8. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing instructions which are executed by the processor to implement the grayscale consistency calibration method for the machine vision system as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The storage medium stores instructions that are executed by a processor of a computer device to implement the grayscale consistency calibration method for the machine vision system as described in any one of claims 1 to 6.

10. A computer program product, characterized in that, The computer program product includes computer instructions stored in a computer-readable storage medium; the computer instructions are read and executed by the processor of a computer device to implement the grayscale consistency calibration method of the machine vision system as described in any one of claims 1 to 6.