Camera signal-to-noise ratio test method and device and electronic equipment

By capturing multiple images under preset conditions and calculating the mean and standard deviation of grayscale values, the signal-to-noise ratio (SNR) test of a camera is simplified, solving the problems of complex environments and high costs in existing technologies, and achieving efficient and low-cost SNR testing.

CN121603649APending Publication Date: 2026-03-03MATRIXTIME ROBOTICS (SHANGHAI) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411141915.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-20
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

Existing camera signal-to-noise ratio testing methods and environmental requirements are complex and costly, making them difficult to implement effectively in practical applications.

Method used

By controlling the camera to capture multiple images under preset shooting conditions, the mean and standard deviation of the grayscale value at each pixel location are obtained. The signal-to-noise ratio data is then calculated using a formula, reducing the requirements for the testing environment and conditions.

Benefits of technology

It simplifies the camera signal-to-noise ratio testing process, reduces testing costs, and improves testing accuracy and efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121603649A_ABST
    Figure CN121603649A_ABST
Patent Text Reader

Abstract

The invention provides a signal-to-noise ratio testing method and device for a camera and electronic equipment, and the method comprises the steps: controlling the camera to shoot a plurality of images under each shooting condition; obtaining a pixel gray value corresponding to each pixel position in each image; calculating a gray value mean value of a plurality of pixel gray values corresponding to the same pixel position in each image; summing and averaging the average values of the gray values to obtain a target average gray value; calculating a standard deviation based on the gray value mean value corresponding to each pixel position and the pixel gray value corresponding to each pixel position in the specified image; and calculating signal-to-noise ratio data of the camera under the shooting condition based on the standard deviation and the target mean gray value. According to the mode, only the camera needs to be controlled to shoot the multiple images under the preset shooting condition, the signal-to-noise ratio data of the camera under the shooting condition can be determined according to the pixel gray values of the multiple images, the requirements for the testing environment and the testing condition are reduced, and meanwhile the testing cost is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of testing technology, and in particular to a method, apparatus, and electronic device for testing the signal-to-noise ratio of a camera. Background Technology

[0002] In industrial cameras, signal-to-noise ratio (SNR) is a crucial performance indicator with a significant impact on camera performance. The internationally recognized camera performance testing standard EMVA 1288 provides clear procedures for SNR testing. In this standard, the SNR testing method is typically based on image quality assessment. Specifically, SNR refers to the ratio of signal strength to noise strength in an image; it is a key indicator for measuring image quality and camera performance. However, the testing environment specified in the standard is complex and stringent, and some test conditions are difficult or costly to implement. Summary of the Invention

[0003] The purpose of this invention is to provide a method, apparatus, and electronic device for testing the signal-to-noise ratio (SNR) of a camera, which reduces the requirements for the test environment and test conditions when determining the SNR data of a camera, while also reducing test costs.

[0004] This invention provides a signal-to-noise ratio (SNR) testing method for a camera. The method includes: controlling the camera to capture multiple images under each preset shooting condition; obtaining the pixel grayscale value corresponding to each pixel position in each image; calculating the average grayscale value of multiple pixels corresponding to the same pixel position in each image for each pixel position; summing and averaging the average grayscale values ​​corresponding to each pixel position to obtain a target average grayscale value; calculating the standard deviation based on the average grayscale value corresponding to each pixel position and the pixel grayscale value corresponding to each pixel position in the specified image; and calculating the camera's SNR data under the shooting condition based on the standard deviation and the target average grayscale value.

[0005] Furthermore, the camera's aperture is directly facing a uniformly illuminated test target; the preset shooting conditions include: a first shooting condition, a second shooting condition, a third shooting condition, and a fourth shooting condition; wherein, the first shooting condition is: no light enters the camera, and the camera parameters are set to the camera parameters corresponding to the specified application scenario; the second shooting condition is: no light enters the camera, the camera's exposure time is increased to a specified exposure time, and other camera parameters are set to the camera parameters corresponding to the specified application scenario; the third shooting condition is: by adjusting the brightness of the external light source and / or the camera's exposure time, so that in the first image containing the test target captured by the camera, for each image... The first mean value obtained by summing and averaging the pixel grayscale values ​​at each pixel location matches the specified grayscale value, and other camera parameters are set to the camera parameters corresponding to the specified application scenario; wherein, the specified grayscale value is the mean value of the pixel grayscale values ​​at each pixel location in the specified image captured by the camera in the specified application scenario; the fourth shooting condition is: by adjusting the brightness of the external light source and / or the exposure time of the camera, so that the second mean value obtained by summing and averaging the pixel grayscale values ​​at each pixel location in the second image containing the test target captured by the camera is the grayscale value in the saturated state, and other camera parameters are set to the camera parameters corresponding to the specified application scenario.

[0006] Furthermore, the step of calculating the standard deviation based on the mean gray value corresponding to each pixel position and the pixel gray value corresponding to each pixel position in the specified image includes: subtracting the pixel gray value of the corresponding pixel position in the specified image from the mean gray value corresponding to each pixel position to obtain the gray value difference corresponding to each pixel position; and calculating the standard deviation based on the gray value difference corresponding to each pixel position.

[0007] Furthermore, the method also includes: calculating the range based on the difference in grayscale values ​​corresponding to each pixel position.

[0008] Furthermore, the standard deviation corresponding to the first shooting condition represents the readout noise of the camera under the first shooting condition; the difference between the standard deviation corresponding to the second shooting condition and the standard deviation corresponding to the first shooting condition represents the dark current noise of the camera under the specified exposure time; the standard deviation corresponding to the third shooting condition represents the sum of the dark current noise and readout noise of the camera under the third shooting condition; and the standard deviation corresponding to the fourth shooting condition represents the sum of the dark current noise and readout noise of the camera under the fourth shooting condition.

[0009] Furthermore, based on the standard deviation and the target mean gray value, the steps for calculating the camera's signal-to-noise ratio data under this shooting condition include:

[0010] Based on the standard deviation and the target mean gray value, the signal-to-noise ratio (SNR) of the camera under this shooting condition is calculated according to a preset formula; where the preset formula is:

[0011] SNR = 20 × log 10 (M / N);

[0012] Where SNR represents the signal-to-noise ratio; M represents the target mean gray value; and N represents the standard deviation.

[0013] Furthermore, the test target is: an external light source or an object that can uniformly reflect light.

[0014] This invention provides a signal-to-noise ratio (SNR) testing device for a camera. The device includes: a control module for controlling the camera to capture multiple images under each preset shooting condition; a first acquisition module for acquiring the pixel grayscale value corresponding to each pixel position in each image; a first calculation module for calculating the average grayscale value of multiple pixel grayscale values ​​corresponding to the same pixel position in each image for each pixel position; a second acquisition module for summing and averaging the average grayscale values ​​corresponding to each pixel position to obtain a target average grayscale value; a second calculation module for calculating the standard deviation based on the average grayscale value corresponding to each pixel position and the pixel grayscale value corresponding to each pixel position in the specified image; and a third calculation module for calculating the camera's SNR data under the shooting condition based on the standard deviation and the target average grayscale value.

[0015] The present invention provides an electronic device, including a processor and a memory, wherein the memory stores machine-executable instructions that can be executed by the processor, and the processor executes the machine-executable instructions to implement the signal-to-noise ratio testing method of the camera described above.

[0016] The present invention provides a machine-readable storage medium storing machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions cause the processor to implement any of the above-mentioned camera signal-to-noise ratio testing methods.

[0017] The present invention provides a camera signal-to-noise ratio (SNR) testing method, apparatus, and electronic device. For each preset shooting condition, the camera is controlled to capture multiple images under those conditions. The grayscale value of each pixel location in each image is obtained. For each pixel location, the mean grayscale value of multiple pixels at the same location in each image is calculated. The mean grayscale values ​​of each pixel location are summed and averaged to obtain a target mean grayscale value. Based on the mean grayscale value of each pixel location and the corresponding pixel grayscale value in the specified image, the standard deviation is calculated. Based on the standard deviation and the target mean grayscale value, the camera's SNR data under those shooting conditions is calculated. This method only requires controlling the camera to capture multiple images under preset shooting conditions, and the SNR data under those conditions can be determined based on the pixel grayscale values ​​of the multiple images, reducing the requirements for the testing environment and conditions, and simultaneously reducing testing costs. Attached Figure Description

[0018] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0019] Figure 1 A flowchart illustrating a signal-to-noise ratio testing method for a camera, provided as an embodiment of the present invention;

[0020] Figure 2 A flowchart illustrating a signal-to-noise ratio testing method for a camera, provided as an embodiment of the present invention;

[0021] Figure 3 A schematic diagram of the signal-to-noise ratio testing device for a camera provided in an embodiment of the present invention;

[0022] Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation

[0023] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and 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] In industrial cameras, signal-to-noise ratio (SNR) is a crucial performance indicator with a significant impact on the camera's performance. Here are some key aspects of how SNR affects industrial cameras:

[0025] Image quality: Industrial cameras are commonly used in applications such as machine vision, automated inspection, and measurement, and image quality directly affects the effectiveness of these applications. A good signal-to-noise ratio results in clear, detailed images, which is beneficial for accurate image analysis and recognition, and improves the accuracy and stability of image processing.

[0026] Inspection Accuracy: In industrial applications, industrial cameras are commonly used for product inspection, measurement, and identification. The signal-to-noise ratio (SNR) directly affects the accuracy and precision of the inspection, especially under uneven lighting or low-light conditions, where the impact of the SNR is even more significant.

[0027] High-speed imaging: Some industrial applications require imaging of fast-moving objects, such as product inspection on high-speed production lines. A good signal-to-noise ratio can provide clear high-speed images, which is beneficial to the stable operation and efficient work of high-speed imaging systems.

[0028] Long-term stability: In some industrial applications, cameras need to operate continuously for extended periods, such as in long-term production or unmanned workshops. A good signal-to-noise ratio ensures stable image quality and guarantees reliable system operation over long periods.

[0029] Therefore, in industrial cameras, the signal-to-noise ratio (SNR) directly affects the camera's performance in practical applications. Manufacturers typically place great emphasis on SNR performance when designing and manufacturing industrial cameras, and strive to optimize camera hardware and algorithms to provide superior image quality and stability.

[0030] Regarding signal-to-noise ratio (SNR) testing, the internationally recognized camera performance testing standard EMVA 1288 provides clearly defined procedures. According to the 1288 standard, the camera SNR testing method typically includes the following steps:

[0031] 1. Environmental Preparation: Testing needs to be conducted under suitable environmental conditions to ensure the accuracy of the test results. This may include controlling factors such as light conditions, temperature, and humidity.

[0032] 2. Signal Acquisition: Using specific test patterns or scenes to acquire camera signals, usually test patterns with different gray levels and contrast are selected.

[0033] 3. Noise Analysis: By analyzing the acquired images, the noise level in the images can be calculated. Various mathematical methods and algorithms can be used to evaluate and analyze the noise.

[0034] 4. Signal-to-noise ratio calculation: The signal-to-noise ratio of the camera is calculated based on the intensity of the signal and noise, and is usually expressed in decibels (dB).

[0035] 5. Results Evaluation: Based on the calculated signal-to-noise ratio, the camera's performance is evaluated and compared to guide product design and improvement.

[0036] However, the testing environment specified in the standard is complex and stringent, with some testing conditions being difficult or costly to implement, and the specific testing process and calculation steps lack clear definitions. Therefore, this invention provides a method, apparatus, and electronic device for testing the signal-to-noise ratio (SNR) of a camera. This technology can be applied to applications requiring SNR testing of cameras.

[0037] To facilitate understanding of this embodiment, a signal-to-noise ratio testing method for a camera disclosed in this embodiment of the invention will first be introduced, such as... Figure 1 As shown, the method includes the following steps:

[0038] Step S101: For each preset shooting condition, control the camera to take multiple images under that shooting condition;

[0039] The aforementioned cameras are typically industrial cameras, a key component of machine vision systems. Their primary function is to convert received light signals into ordered electrical signals. They are specialized image acquisition devices designed for industrial applications, primarily used for acquiring high-precision image data, and for monitoring, detection, measurement, and quality control in industrial automation. The preset shooting conditions can be set according to actual needs, typically including shooting conditions corresponding to the actual application scenario of using the camera, shooting conditions corresponding to testing the maximum signal-to-noise ratio (SNR), etc. The number of images can be set according to actual needs, for example, 20, 30, etc. In practice, when testing the camera's SNR data, multiple different shooting conditions are usually preset, and the camera can be controlled to capture multiple images corresponding to each shooting condition separately.

[0040] Step S102: Obtain the pixel grayscale value corresponding to each pixel position in each image.

[0041] For each shooting condition, after acquiring multiple images corresponding to that shooting condition, the pixel grayscale value corresponding to each pixel position in each image can be obtained. Although multiple images are captured under the same shooting conditions, considering the influence of camera noise and other factors, the pixel grayscale value corresponding to the same pixel position in different images may be the same or different.

[0042] Step S103: For each pixel location, calculate the average gray value of multiple pixels at the same pixel location in each image.

[0043] For each shooting condition, after acquiring multiple images corresponding to that condition, the average grayscale value of multiple pixels at the same pixel position in the multiple images can be calculated to obtain the average grayscale value corresponding to each pixel position. For example, if 20 images are captured under a certain shooting condition, for the first pixel position, the grayscale value of the pixel corresponding to the first pixel position in each image can be obtained, resulting in 20 pixel grayscale values. The average of these 20 pixel grayscale values ​​can be obtained to get the average grayscale value corresponding to the first pixel position. Similarly, the average grayscale value corresponding to each pixel position can be obtained.

[0044] Step S104: Sum the mean gray values ​​corresponding to each pixel position and average them to obtain the target mean gray value;

[0045] For each shooting condition, after calculating the average gray value of each pixel position under that shooting condition, the average gray values ​​can be summed and the average value can be calculated to obtain the target average gray value corresponding to that shooting condition. The target average gray value is a specific numerical value.

[0046] Step S105: Calculate the standard deviation based on the mean gray value corresponding to each pixel position and the pixel gray value corresponding to each pixel position in the specified image;

[0047] For each shooting condition, the specified image can be any one of multiple images taken by the camera under that shooting condition, such as the first image taken. In actual implementation, after determining the mean gray value corresponding to each pixel position, the standard deviation can be calculated by combining the pixel gray value corresponding to each pixel position in the specified image.

[0048] Step S106: Calculate the signal-to-noise ratio (SNR) of the camera under the shooting conditions based on the standard deviation and the target mean gray value.

[0049] In practice, for each shooting condition, the signal-to-noise ratio of the camera can be calculated based on the standard deviation and target mean gray value obtained above.

[0050] The aforementioned signal-to-noise ratio (SNR) testing method for cameras involves controlling the camera to capture multiple images under each preset shooting condition; obtaining the pixel grayscale value corresponding to each pixel location in each image; calculating the average grayscale value of multiple pixels corresponding to the same pixel location in each image for each pixel location; summing and averaging the average grayscale values ​​corresponding to each pixel location to obtain a target average grayscale value; calculating the standard deviation based on the average grayscale value corresponding to each pixel location and the pixel grayscale value corresponding to each pixel location in the specified image; and calculating the camera's SNR data under that shooting condition based on the standard deviation and the target average grayscale value. This method only requires controlling the camera to capture multiple images under preset shooting conditions, and the SNR data of the camera under that shooting condition can be determined based on the pixel grayscale values ​​of multiple images, reducing the requirements for the testing environment and conditions, and also reducing testing costs.

[0051] This invention also provides another method for testing the signal-to-noise ratio (SNR) of a camera. This method is implemented based on the method described in the previous embodiment. In this method, the camera aperture faces a uniformly illuminated test target. The test target is an external light source or an object that can uniformly reflect light. This can be an external light source directly facing the camera aperture, or an external light source shining on an object that can uniformly reflect light (such as white paper), through which the light is reflected to the camera aperture. In practical implementation, when testing the camera's SNR data, it is usually necessary to prepare the test environment first. Specifically, a uniformly illuminated test target is prepared facing the camera aperture, ensuring stable illumination without camera minimum visible flicker or brightness fluctuations. The test system is also fixed to avoid vibration and other interference factors. Then, camera parameters are preset, setting the Gain value, exposure time (e.g., 5ms), AOI (Area of ​​Interest) region, and other parameters specific to the actual application scenario, ensuring the measurement results are consistent with the actual application scenario. All ISP (Image Signal Processing) algorithm functions of the camera, such as noise reduction, sharpening, and automatic white balance, are disabled to obtain the original image data and prevent data distortion.

[0052] like Figure 2 As shown, the method includes the following steps:

[0053] Step S201: For each preset shooting condition, control the camera to take multiple images under that shooting condition;

[0054] The preset shooting conditions include: first shooting condition, second shooting condition, third shooting condition, and fourth shooting condition;

[0055] The first shooting condition is: no light enters the camera, and the camera parameters are set to the camera parameters corresponding to the specified application scenario, i.e., the aforementioned preset camera parameters; the specified application scenario can be the actual application scenario in which the camera is used subsequently; under this first shooting condition, the camera lens cap can be closed to ensure that no light enters the camera, and multiple images can be taken. Since no light enters the camera, the multiple images taken are usually completely dark images. For example, 20 images can be taken, denoted as A1-A20. A1-A20 represent the pixel grayscale value of each pixel position in each image. For example, A1 corresponds to the pixel grayscale value of each pixel position in the first image, and so on, with A20 corresponding to the pixel grayscale value of each pixel position in the twentieth image.

[0056] The second shooting condition is as follows: no light enters the camera, the camera's exposure time is increased to a specified exposure time, and other camera parameters are set to those corresponding to the specified application scenario. The specified exposure time can be set according to actual needs, for example, 5000ms. Under this second shooting condition, the camera lens cap can be closed to ensure no light enters the camera. Based on the preset camera parameters, the camera's exposure time is increased, for example, to 5000ms, to capture multiple images, for example, 20 images, denoted as AL1-AL20. AL1-AL20 represent the pixel grayscale value of each pixel position in each corresponding image. For example, AL1 corresponds to the pixel grayscale value of each pixel position in the first image, and so on, with AL20 corresponding to the pixel grayscale value of each pixel position in the twentieth image.

[0057] The third shooting condition is as follows: by adjusting the brightness of the external light source and / or the camera's exposure time, the first average value obtained by summing and averaging the pixel grayscale values ​​at each pixel position in the first image containing the test target captured by the camera matches a specified grayscale value, and other camera parameters are set to the camera parameters corresponding to the specified application scenario; wherein, the specified grayscale value is the average of the pixel grayscale values ​​at each pixel position in the specified image captured by the camera in the specified application scenario; in actual implementation, the brightness of the external light source and / or the camera's exposure time can be fine-tuned based on the above preset camera parameters, and then the first image is captured, the pixel grayscale values ​​at each pixel position in the first image are summed, and the average value is calculated to obtain the first average value, and the first average value is obtained by fine-tuning so that the first average value corresponding to the captured first image is consistent with the specified grayscale value corresponding to the specified image captured in the actual application scenario, for example, the specified grayscale value is 100, etc.; the above first image is mainly used to verify whether the first average value of the image captured after fine-tuning matches the specified grayscale value. After fine-tuning, take multiple images, for example, 20 images, denoted as B1-B20. B1-B20 represent the pixel grayscale value of each pixel position in each corresponding image. For example, B1 corresponds to the pixel grayscale value of each pixel position in the first image, and so on, with B20 corresponding to the pixel grayscale value of each pixel position in the twentieth image.

[0058] The fourth shooting condition is as follows: By adjusting the brightness of the external light source and / or the camera's exposure time, the second mean value obtained by summing and averaging the pixel grayscale values ​​at each pixel location in the second image containing the test target is the grayscale value under saturation. Other camera parameters are set to those corresponding to the specified application scenario. In actual implementation, the brightness of the external light source and / or the camera's exposure time can be fine-tuned based on preset camera parameters. Then, a second image is captured, and the pixel grayscale values ​​at each pixel location in the second image are summed and averaged to obtain the second mean value. Fine-tuning ensures that the second mean value of the captured second image is the grayscale value under saturation without overexposure; for example, the grayscale value under saturation is 250. The aforementioned second image is mainly used to verify whether the second mean value of the image captured after fine-tuning is the grayscale value under saturation. After fine-tuning, multiple images are captured, for example, 20 images, denoted as C1-C20. C1-C20 represent the pixel grayscale value of each pixel position in each corresponding image. For example, C1 corresponds to the pixel grayscale value of each pixel position in the first image, and so on, with C20 corresponding to the pixel grayscale value of each pixel position in the twentieth image.

[0059] Step S202: Obtain the pixel grayscale value corresponding to each pixel position in each image;

[0060] Step S203: For each pixel location, calculate the average gray value of multiple pixels at the same pixel location in each image.

[0061] For example, taking 20 images A1-A20 captured under the first shooting condition as an example, the gray value of the pixel corresponding to the first pixel position in each image can be obtained, resulting in 20 pixel gray values. The average of these 20 pixel gray values ​​can be obtained to get the average gray value corresponding to the first pixel position. Similarly, the average gray value corresponding to each pixel position can be obtained, denoted as A.

[0062] Similarly, based on the 20 images AL1-AL20 taken under the second shooting condition, the average gray value corresponding to each pixel position can be determined and denoted as AL.

[0063] Based on 20 images B1-B20 taken under the third shooting condition, the average gray value corresponding to each pixel position can be determined and denoted as B.

[0064] Based on 20 images C1-C20 taken under the fourth shooting condition, the average gray value corresponding to each pixel position can be determined and denoted as C.

[0065] Noise includes temporal domain noise and spatial domain noise. Under the same shooting conditions, each image captured will be different, such as A1 and A2 being different. By capturing multiple images and calculating the average gray value corresponding to each pixel position in multiple images, temporal domain noise can be filtered out. That is, A, A1, B, and C above do not contain temporal domain noise.

[0066] Step S204: Sum the mean gray values ​​corresponding to each pixel position and average them to obtain the target mean gray value;

[0067] Step S205: Subtract the gray value of the corresponding pixel position in the specified image from the mean gray value of each pixel position to obtain the gray value difference of each pixel position.

[0068] Step S206: Calculate the standard deviation based on the difference in grayscale values ​​corresponding to each pixel position.

[0069] Step S207: Calculate the range based on the grayscale value difference corresponding to each pixel position.

[0070] The standard deviation corresponding to the first shooting condition represents the readout noise of the camera under the first shooting condition;

[0071] Multiple images captured can be imported into Matlab to calculate noise distribution and signal-to-noise ratio data. For example, taking the first shooting condition as an example, let D = A - A1, and calculate the range of D to obtain R. DCalculate the standard deviation to obtain σ D , σ D This is the sum of dark current noise and readout noise of the camera under the first shooting condition. Due to the short exposure time, readout noise dominates, while dark current noise is negligible. It should be noted that A has no time-domain noise, while A1 does. Subtracting A from A1 yields the jump of each pixel at the corresponding time point. Since image A1 has a sufficient number of pixels, it reflects that the jump distribution of all pixels over time follows a normal distribution. Furthermore, when calculating D, the first image A1 is not necessarily chosen; any image from A1 to A20 can be selected.

[0072] The difference between the standard deviation corresponding to the second shooting condition and the standard deviation corresponding to the first shooting condition represents the dark current noise of the camera at the specified exposure time.

[0073] The range R under long exposure time was obtained using the same method as under the first shooting condition described above. DL and standard deviation σ DL , σ DL -σ D The difference is the dark current noise of the camera at a specified exposure time (e.g., 5000ms).

[0074] The standard deviation corresponding to the third shooting condition represents the sum of the dark current noise and readout noise of the camera under the third shooting condition;

[0075] Let E = B - B1, and calculate its range to obtain R. E Standard deviation σ E , σ E This is the total noise value of the camera under the corresponding third shooting condition, which is the sum of dark current noise and readout noise under the third shooting condition. Similarly, when calculating E, it is not necessary to choose the first image B1; any image from B1 to B20 can be selected.

[0076] The standard deviation corresponding to the fourth shooting condition represents the sum of the dark current noise and readout noise of the camera under the fourth shooting condition.

[0077] Let F = C - C1, and find its range to obtain R. F The standard deviation is σ. F ;σ F This is the total noise value of the camera under the corresponding fourth shooting condition. This total noise value is the sum of dark current noise and readout noise under the fourth shooting condition. Similarly, when calculating F, it is not necessary to choose the first image C1; any image from C1 to C20 can be selected.

[0078] Step S208: Based on the standard deviation and the target mean gray value, calculate the signal-to-noise ratio data of the camera under the shooting conditions according to the preset calculation formula;

[0079] The preset calculation formula is as follows:

[0080] SNR = 20 × log 10 (M / N);

[0081] Wherein, SNR (Signal to Noise Ratio) represents the signal-to-noise ratio data; M represents the target mean gray value; and N represents the standard deviation.

[0082] The signal-to-noise ratio (SNR) data calculated using the above formula is typically expressed in dB. For example, the SNR data measured when the camera is close to saturation is SNR. F =20*log 10 (meanC / σ F If the camera is not given additional gain during testing, such as using the default gain of 1, the calculated SNR will be... F The calculated SNR will be very close to the SNRmax given in the camera's manufacturer's manual. If additional gain is set, the calculated SNR will be even higher. F It will be smaller than the SNRmax given in the camera's manufacturer's manual. Similarly, the signal-to-noise ratio (SNR) measured in real-world applications is the actual value of the camera. E =20*log 10 (meanC / σ E ).

[0083] SNR F This corresponds to the maximum signal-to-noise ratio (SNR), which can be compared with the camera manual. Under full saturation conditions, if the SNR data is good, the SNR measured under other conditions will generally be better than other similar cameras, i.e., there is a linear relationship.

[0084] The above signal-to-noise ratio data can be used for analysis:

[0085] 1) If σ D The value is small, R D Smaller values, such as σ D <1,R D If the reading noise is less than 3DN, it indicates that the camera has low readout noise and is suitable for shooting high signal-to-noise ratio images in low-light environments.

[0086] 2) If σ DL The value is small, R DL A smaller value (the specific value needs to be compared between different cameras based on the temperature under the test conditions) indicates that the camera has lower dark current noise for the same camera chip operating temperature, making it suitable for long exposure applications.

[0087] 3) If SNR F Better but R FPoor, such as SNR F >40db, but R F A signal-to-noise ratio (SNR) >20DN indicates that the camera's SNR is acceptable, but the chip has some serious dead pixels, requiring post-processing algorithmic compensation or contacting the supplier for replacement. Similarly, in practical applications, a side-by-side comparison of cameras can be conducted to select the appropriate SNR. E and R E All cameras are of good quality to ensure a high signal-to-noise ratio in the acquired images.

[0088] 4) If SNR F A signal-to-noise ratio (SNR) greater than 40 dB indicates a high signal-to-noise ratio (SNR) for the camera, suitable for most industrial applications. If the SNR... F If the signal-to-noise ratio is less than 36dB, the camera's signal-to-noise ratio is poor and cannot be used for high-precision detection or measurement.

[0089] 5) Try to increase image brightness by brightening external light sources rather than increasing camera gain, so as to ensure the signal-to-noise ratio of the image.

[0090] 6) The same chip may have significant differences in signal-to-noise ratio due to differences in circuit design and data reading methods from different manufacturers, but the most important factor affecting the signal-to-noise ratio is the chip sensor itself.

[0091] 7) The full-well capacity, quantum efficiency, and actual photosensitive area of ​​the sensor are the core factors that determine the signal-to-noise ratio of the chip sensor.

[0092] The above-mentioned camera signal-to-noise ratio (SNR) testing method, based on extensive camera SNR test results and experience, summarizes a relatively convenient and accurate method. It also provides methods for analyzing test results and some reference opinions for selecting industrial cameras based on SNR performance. This method simplifies the complex camera SNR testing process while clearly defining the operating steps and data processing methods. It clarifies the testing methods for key parameters of camera SNR performance and how to analyze these parameters to draw relevant conclusions, providing guidance for the selection of industrial cameras.

[0093] This invention provides a signal-to-noise ratio testing device for a camera, such as... Figure 3As shown, the device includes: a control module 30, used to control the camera to capture multiple images under each preset shooting condition; a first acquisition module 31, used to acquire the pixel grayscale value corresponding to each pixel position in each image; a first calculation module 32, used to calculate the average grayscale value of multiple pixel grayscale values ​​corresponding to the same pixel position in each image for each pixel position; a second acquisition module 33, used to sum and average the average grayscale values ​​corresponding to each pixel position to obtain a target average grayscale value; a second calculation module 34, used to calculate the standard deviation based on the average grayscale value corresponding to each pixel position and the pixel grayscale value corresponding to each pixel position in the specified image; and a third calculation module 35, used to calculate the signal-to-noise ratio data of the camera under the shooting condition based on the standard deviation and the target average grayscale value.

[0094] The aforementioned camera signal-to-noise ratio (SNR) testing device, for each preset shooting condition, controls the camera to capture multiple images under those conditions; acquires the pixel grayscale value corresponding to each pixel position in each image; for each pixel position, calculates the average grayscale value of multiple pixels corresponding to the same pixel position in each image; sums and averages the average grayscale values ​​corresponding to each pixel position to obtain a target average grayscale value; calculates the standard deviation based on the average grayscale value corresponding to each pixel position and the pixel grayscale value corresponding to each pixel position in the specified image; and calculates the camera's SNR data under those shooting conditions based on the standard deviation and the target average grayscale value. This device only requires controlling the camera to capture multiple images under preset shooting conditions, and the SNR data of the camera under those conditions can be determined based on the pixel grayscale values ​​of the multiple images, reducing the requirements for the testing environment and conditions, and simultaneously reducing testing costs.

[0095] Furthermore, the camera's aperture is directly facing a uniformly illuminated test target; the preset shooting conditions include: a first shooting condition, a second shooting condition, a third shooting condition, and a fourth shooting condition; wherein, the first shooting condition is: no light enters the camera, and the camera parameters are set to the camera parameters corresponding to the specified application scenario; the second shooting condition is: no light enters the camera, the camera's exposure time is increased to a specified exposure time, and other camera parameters are set to the camera parameters corresponding to the specified application scenario; the third shooting condition is: by adjusting the brightness of the external light source and / or the camera's exposure time, so that in the first image containing the test target captured by the camera, for each image... The first mean value obtained by summing and averaging the pixel grayscale values ​​at each pixel location matches the specified grayscale value, and other camera parameters are set to the camera parameters corresponding to the specified application scenario; wherein, the specified grayscale value is the mean value of the pixel grayscale values ​​at each pixel location in the specified image captured by the camera in the specified application scenario; the fourth shooting condition is: by adjusting the brightness of the external light source and / or the exposure time of the camera, so that the second mean value obtained by summing and averaging the pixel grayscale values ​​at each pixel location in the second image containing the test target captured by the camera is the grayscale value in the saturated state, and other camera parameters are set to the camera parameters corresponding to the specified application scenario.

[0096] Furthermore, the second calculation module 34 is also used to: subtract the gray value of the corresponding pixel position in the specified image from the mean gray value of each pixel position to obtain the gray value difference of each pixel position; and calculate the standard deviation based on the gray value difference of each pixel position.

[0097] Furthermore, the second calculation module 34 is also used to: calculate the range based on the difference in grayscale values ​​corresponding to each pixel position.

[0098] Furthermore, the standard deviation corresponding to the first shooting condition represents the readout noise of the camera under the first shooting condition; the difference between the standard deviation corresponding to the second shooting condition and the standard deviation corresponding to the first shooting condition represents the dark current noise of the camera under the specified exposure time; the standard deviation corresponding to the third shooting condition represents the sum of the dark current noise and readout noise of the camera under the third shooting condition; and the standard deviation corresponding to the fourth shooting condition represents the sum of the dark current noise and readout noise of the camera under the fourth shooting condition.

[0099] Furthermore, the third computing module 35 is also used for:

[0100] Based on the standard deviation and the target mean gray value, the signal-to-noise ratio (SNR) of the camera under this shooting condition is calculated according to a preset formula; where the preset formula is:

[0101] SNR = 20 × log 10 (M / N);

[0102] Where SNR represents the signal-to-noise ratio; M represents the target mean gray value; and N represents the standard deviation.

[0103] Furthermore, the test target is: an external light source or an object that can uniformly reflect light.

[0104] The camera signal-to-noise ratio testing device provided in this embodiment of the invention has the same implementation principle and technical effect as the aforementioned camera signal-to-noise ratio testing method embodiment. For the sake of brevity, any parts not mentioned in the camera signal-to-noise ratio testing device embodiment can be referred to the corresponding content in the aforementioned camera signal-to-noise ratio testing method embodiment.

[0105] This invention also provides an electronic device, see [link to relevant documentation]. Figure 4 As shown, the electronic device includes a processor 130 and a memory 131. The memory 131 stores machine-executable instructions that can be executed by the processor 130. The processor 130 executes the machine-executable instructions to implement the signal-to-noise ratio testing method of the camera described above.

[0106] Furthermore, Figure 4 The electronic device shown also includes a bus 132 and a communication interface 133, with the processor 130, the communication interface 133 and the memory 131 connected via the bus 132.

[0107] The memory 131 may include high-speed random access memory (RAM) or non-volatile memory, such as at least one disk storage device. Communication between this system network element and at least one other network element is achieved through at least one communication interface 133 (which can be wired or wireless), such as the Internet, wide area network, local area network, or metropolitan area network. The bus 132 may be an ISA bus, PCI bus, or EISA bus, etc. The bus can be divided into address bus, data bus, control bus, etc. For ease of representation, Figure 4 The symbol is represented by a single double-headed arrow, but this does not mean that there is only one bus or one type of bus.

[0108] Processor 130 may be an integrated circuit chip with signal processing capabilities. In implementation, each step of the above method can be completed by the integrated logic circuitry in the hardware of processor 130 or by instructions in software form. Processor 130 may be a general-purpose processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc.; it may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field-Programmable Gate Array (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components. It can implement or execute the methods, steps, and logic block diagrams disclosed in the embodiments of this invention. The general-purpose processor may be a microprocessor or any conventional processor. The steps of the methods disclosed in the embodiments of this invention can be directly manifested as execution by a hardware decoding processor, or execution by a combination of hardware and software modules in the decoding processor. The software module can reside in a mature storage medium in the art, such as random access memory, flash memory, read-only memory, programmable read-only memory, electrically erasable programmable memory, or registers. This storage medium is located in memory 131, and processor 130 reads the information in memory 131 and, in conjunction with its hardware, completes the steps of the method described in the foregoing embodiments.

[0109] This invention also provides a machine-readable storage medium storing machine-executable instructions. When these machine-executable instructions are called and executed by a processor, they cause the processor to implement the aforementioned signal-to-noise ratio testing method for the camera. For specific implementation details, please refer to the method embodiments, which will not be repeated here.

[0110] The computer program product of the camera signal-to-noise ratio testing method, apparatus, and electronic device provided in the embodiments of the present invention includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the preceding method embodiments. For specific implementation, please refer to the method embodiments, which will not be repeated here.

[0111] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this invention, essentially, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0112] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; 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 or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.

Claims

1. A method for testing the signal-to-noise ratio of a camera, characterized in that, The method includes: For each preset shooting condition, control the camera to capture multiple images under that shooting condition; Obtain the pixel grayscale value corresponding to each pixel position in each image; For each pixel location, calculate the average gray value of multiple pixels corresponding to the same pixel location in each image; The average of the grayscale values ​​corresponding to each pixel position is summed to obtain the target mean grayscale value. The standard deviation is calculated based on the mean gray value at each pixel location and the pixel gray value at each pixel location in the specified image. Based on the standard deviation and the target mean gray value, the signal-to-noise ratio of the camera is calculated under the shooting conditions.

2. The method according to claim 1, characterized in that, The camera's camera port is directly facing a uniformly illuminated test target; the preset shooting conditions include: a first shooting condition, a second shooting condition, a third shooting condition, and a fourth shooting condition; The first shooting condition is: no light enters the camera, and the camera parameters of the camera are set to the camera parameters corresponding to the specified application scenario. The second shooting condition is: no light enters the camera, the camera's exposure time is increased to a specified exposure time, and the camera's other camera parameters are set to the camera parameters corresponding to the specified application scenario; The third shooting condition is as follows: by adjusting the brightness of the external light source and / or the exposure time of the camera, the first average value obtained by summing and averaging the pixel grayscale values ​​at each pixel position in the first image containing the test target captured by the camera matches a specified grayscale value, and other camera parameters of the camera are set to camera parameters corresponding to the specified application scenario; wherein, the specified grayscale value is the average value of the pixel grayscale values ​​at each pixel position in the specified image captured by the camera in the specified application scenario; The fourth shooting condition is as follows: by adjusting the brightness of the external light source and / or the exposure time of the camera, the second mean value obtained by summing and averaging the pixel gray values ​​at each pixel position in the second image containing the test target captured by the camera is the gray value in the saturated state, and the other camera parameters of the camera are set to the camera parameters corresponding to the specified application scenario.

3. The method according to claim 1, characterized in that, The steps for calculating the standard deviation based on the mean gray value at each pixel location and the pixel gray value at each pixel location in a specified image include: Subtract the gray value of the corresponding pixel in the specified image from the mean gray value of each pixel location to obtain the gray value difference for each pixel location. The standard deviation is calculated based on the difference in grayscale values ​​at each pixel location.

4. The method according to claim 3, characterized in that, The method further includes: The range is calculated based on the difference in grayscale values ​​at each pixel location.

5. The method according to claim 2, characterized in that, The standard deviation corresponding to the first shooting condition represents the readout noise of the camera under the first shooting condition; The difference between the standard deviation corresponding to the second shooting condition and the standard deviation corresponding to the first shooting condition represents the dark current noise of the camera at the specified exposure time; The standard deviation corresponding to the third shooting condition represents the sum of the dark current noise and readout noise of the camera under the third shooting condition; The standard deviation corresponding to the fourth shooting condition represents the sum of the dark current noise and readout noise of the camera under the fourth shooting condition.

6. The method according to claim 1, characterized in that, The steps for calculating the signal-to-noise ratio (SNR) of the camera under the shooting conditions, based on the standard deviation and the target mean gray value, include: Based on the standard deviation and the target mean gray value, the signal-to-noise ratio (SNR) of the camera under the shooting conditions is calculated according to a preset calculation formula; wherein the preset calculation formula is: SNR=20×log 10 (M / N); Where SNR represents the signal-to-noise ratio; M represents the target mean gray value; and N represents the standard deviation.

7. The method according to claim 2, characterized in that, The test target is an external light source or an object that can uniformly reflect light.

8. A signal-to-noise ratio testing device for a camera, characterized in that, The device includes: The control module is used to control the camera to capture multiple images under each preset shooting condition. The first acquisition module is used to acquire the pixel grayscale value corresponding to each pixel position in each image; The first calculation module is used to calculate the average gray value of multiple pixels at the same pixel position in each image for each pixel position. The second acquisition module is used to sum and average the gray values ​​corresponding to each pixel position to obtain the target mean gray value. The second calculation module is used to calculate the standard deviation based on the mean gray value corresponding to each pixel position and the pixel gray value corresponding to each pixel position in the specified image. The third calculation module is used to calculate the signal-to-noise ratio data of the camera under the shooting conditions based on the standard deviation and the target mean gray value.

9. An electronic device, characterized in that, It includes a processor and a memory, the memory storing machine-executable instructions that can be executed by the processor, the processor executing the machine-executable instructions to implement the signal-to-noise ratio testing method for the camera according to any one of claims 1-7.

10. A machine-readable storage medium, characterized in that, The machine-readable storage medium stores machine-executable instructions that, when invoked and executed by a processor, cause the processor to implement the signal-to-noise ratio testing method for the camera as described in any one of claims 1-7.