Testing method and device, electronic device and readable storage medium

The mapping function and exposure time are calculated through the open exposure control algorithm, which solves the problem of low testing efficiency caused by the closed AE algorithm, and achieves fast and accurate test image generation and problem positioning.

CN115379200BActive Publication Date: 2025-08-19GUANGDONG OPPO MOBILE TELECOMMUNICATIONS CORP LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202210981218.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-16
Publication Date
2025-08-19
Estimated Expiration
2042-08-16

AI Technical Summary

Technical Problem

In the prior art, the image-related test items during mobile phone production use a closed AE algorithm, resulting in low testing efficiency and difficulty in quickly positioning the problem, which affects the testing efficiency.

Method used

The open exposure control algorithm is used to calculate the current grayscale value by obtaining the pixel value of the preview image, determine the mapping function of the exposure control algorithm, and calculate the target exposure time based on the target grayscale value to generate the target test image.

Benefits of technology

The test images of the target grayscale value are quickly generated, and the testers can quickly check whether there are problems in the exposure process, improving the testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115379200B_ABST
    Figure CN115379200B_ABST
Patent Text Reader

Abstract

The present application provides a testing method, testing device, electronic device, and non-volatile computer-readable storage medium. The testing method includes exposing the image based on a preset exposure control algorithm and a current exposure time to obtain a preview image; calculating a current grayscale value based on pixel values in a preset area of the preview image, and determining a mapping function of the exposure control algorithm based on the current grayscale value and the current exposure time; determining a target exposure time based on the mapping function and a preset target grayscale value; and exposing the image based on the exposure control algorithm and the target exposure time to obtain a target test image. Because the exposure control algorithm is open and the algorithm's mapping function can be accurately obtained, not only can a target test image with a target grayscale value be quickly and accurately generated, but testers can also quickly check whether there are any problems with the output process of the target test image, thereby improving testing efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of testing technology, and in particular to a testing method, a testing device, an electronic device, and a non-volatile computer-readable storage medium. Background Art

[0002] During the current mobile phone production process, all imaging-related tests require automatic exposure (AE) of the test environment to achieve the appropriate image brightness. For example, clarity testing requires images to be tested at the appropriate brightness. However, the AE algorithms used in mobile phone production are all provided by the platform and are completely closed, with only debugging parameters exposed to the mobile phone electronics. This makes it difficult to quickly locate any issues that arise during testing, impacting test efficiency. Summary of the Invention

[0003] Embodiments of the present application provide a testing method, a testing device, an electronic device, and a non-volatile computer-readable storage medium to solve the problem of low testing efficiency.

[0004] The testing method of the embodiment of the present application includes exposing based on a preset exposure control algorithm and a current exposure time to obtain a preview image; calculating a current grayscale value based on pixel values of a preset area of the preview image, and determining a mapping function of the exposure control algorithm based on the current grayscale value and the current exposure time; determining a target exposure time based on the mapping function and a preset target grayscale value; and exposing according to the exposure control algorithm and the target exposure time to obtain a target test image.

[0005] The test device according to an embodiment of the present application includes an acquisition module, a first determination module, a second determination module, and an exposure control module. The acquisition module is configured to perform exposure based on a preset exposure control algorithm and a current exposure time to acquire a preview image; the first determination module is configured to calculate a current grayscale value based on pixel values in a preset area of the preview image and determine a mapping function of the exposure control algorithm based on the current grayscale value and the current exposure time; and the second determination module is configured to determine a target exposure time based on the mapping function and a preset target grayscale value. The exposure control module is configured to perform exposure based on the exposure control algorithm and the target exposure time to acquire a target test image.

[0006] An electronic device according to an embodiment of the present application includes a processor and a camera, wherein the camera is used to capture a preview image, and the processor is used to control the camera to perform exposure based on a preset exposure control algorithm and a current exposure time to obtain the preview image; calculate a current grayscale value according to pixel values of a preset area of the preview image, and determine a mapping function of the exposure control algorithm according to the current grayscale value and the current exposure time; determine a target exposure time according to the mapping function and a preset target grayscale value; and control the camera to perform exposure according to the exposure control algorithm and the target exposure time to obtain a target test image.

[0007] The present application discloses a non-volatile computer-readable storage medium containing a computer program. When the computer program is executed by one or more processors, the processors are caused to perform a test method. The test method includes performing exposure based on a preset exposure control algorithm and a current exposure time to obtain a preview image; calculating a current grayscale value based on pixel values in a preset area of the preview image, and determining a mapping function of the exposure control algorithm based on the current grayscale value and the current exposure time; determining a target exposure time based on the mapping function and a preset target grayscale value; and performing exposure based on the exposure control algorithm and the target exposure time to obtain a target test image.

[0008] The test method, test device, electronic device, and non-volatile computer-readable storage medium of the embodiments of the present application are based on a preset exposure control algorithm and perform exposure at a current exposure time to obtain a preview image. In the preset exposure control algorithm, a preset mapping function is satisfied between the exposure time and the image brightness of a preset area of the corresponding image. The parameter values of the mapping function are then determined using the current exposure time and the current grayscale value calculated from the pixel values of the preset area in the preview image, thereby obtaining an accurate mapping function. Thereafter, a target exposure time is calculated based on the target grayscale value of the target test image to be output and the mapping function, so that exposure can be performed according to the target exposure time and the exposure control algorithm to obtain a target test image with the preset area having the target grayscale value. Because the exposure control algorithm is open and the algorithm's mapping function can be accurately obtained, not only can a target test image with a target grayscale value be generated quickly and accurately, but the tester can also quickly check whether there are any problems in the output process of the target test image, thereby improving test efficiency.

[0009] Additional aspects and advantages of the present application will be given in part in the description below, and in part will become obvious from the description below, or will be learned through practice of the present application. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0011] Figure 1 is a flow chart of a testing method according to certain embodiments of the present application;

[0012] Figure 2 is a schematic diagram of a module of a testing device according to certain embodiments of the present application;

[0013] Figure 3 is a schematic plan view of an electronic device according to certain embodiments of the present application;

[0014] Figure 4 is a schematic diagram of a scenario of a testing method according to certain embodiments of the present application;

[0015] Figure 5 is a flow chart of a testing method according to certain embodiments of the present application;

[0016] Figure 6 is a flow chart of a testing method according to certain embodiments of the present application; and

[0017] Figure 7 A schematic diagram illustrating the connection between a processor and a computer-readable storage medium in certain embodiments of the present application. DETAILED DESCRIPTION

[0018] The following further describes the embodiments of the present application in conjunction with the accompanying drawings. Throughout the accompanying drawings, the same or similar reference numerals represent the same or similar elements or elements having the same or similar functions. Furthermore, the embodiments of the present application described below in conjunction with the accompanying drawings are exemplary and are intended only to explain the embodiments of the present application and are not to be construed as limiting the present application.

[0019] See also Figure 1 , the testing method of the embodiment of the present application comprises the following steps:

[0020] 011: Expose based on the preset exposure control algorithm and current exposure time to obtain a preview image;

[0021] 012: Calculate the current grayscale value according to the pixel values of the preset area of the preview image, and determine the mapping function of the exposure control algorithm according to the current grayscale value and the current exposure time;

[0022] 013: Determine the target exposure time according to the mapping function and the preset target grayscale value; and

[0023] 014: Expose according to the exposure control algorithm and the target exposure time to obtain a target test image.

[0024] See also Figure 2 The test device 10 of the embodiment of the present application includes an acquisition module 11, a first determination module 12, a second determination module 13, and an exposure control module 14. The acquisition module 11 is used to perform exposure based on a preset exposure control algorithm and a current exposure time to obtain a preview image; the first determination module 12 is used to calculate the current grayscale value based on the pixel values of a preset area of the preview image, and determine the mapping function of the exposure control algorithm based on the current grayscale value and the current exposure time; and the second determination module 13 is used to determine the target exposure time based on the mapping function and a preset target grayscale value; the exposure control module 14 is used to perform exposure based on the exposure control algorithm and the target exposure time to obtain a target test image. In other words, the acquisition module 11, the first determination module 12, the second determination module 13, and the exposure control module 14 are used to execute steps 011, 012, 013, and 014, respectively.

[0025] See also Figure 3 The electronic device 100 of the present application further includes a processor 20 and a camera 30. The camera 30 is used to capture a preview image, and the processor 20 is used to control the camera 30 to perform exposure based on a preset exposure control algorithm and a current exposure time to obtain the preview image; calculate the current grayscale value based on the pixel values of a preset area of the preview image, and determine the mapping function of the exposure control algorithm based on the current grayscale value and the current exposure time; determine the target exposure time based on the mapping function and a preset target grayscale value; and control the camera 30 to perform exposure based on the exposure control algorithm and the target exposure time to obtain the target test image. In other words, steps 011 and 014 can be implemented by the processor 20 in cooperation with the camera 30, and steps 012 and 013 can be implemented by the processor 20 alone.

[0026] Specifically, the electronic device 100 can be a mobile phone, a tablet computer, a display device, a laptop computer, an ATM, a gate machine, a smart watch, a head-mounted display device, a game console, etc. Figure 3 As shown, the embodiment of the present application is described by taking the electronic device 100 as a mobile phone as an example. It can be understood that the specific form of the electronic device 100 is not limited to a mobile phone.

[0027] Currently, platform-side AE algorithms are developed based on various user scenarios in real-world use, aiming to cover as many possible user scenarios as possible. During the mobile phone production process, imaging-related tests focus on the hardware functionality and performance of the phone's camera, and the test scenarios are all simple, fixed environments.

[0028] Using platform-side AE algorithms in such scenarios results in tight coupling between testing and AE parameter debugging. For example, during image testing, if the platform-side AE algorithm is used to achieve exposure solely for the purpose of testing hardware functionality and performance, to generate a target image whose brightness meets the preset test requirements (e.g., the brightness reaches the preset brightness), and then subsequent clarity testing, cleanliness testing, etc. are performed based on the target image, then, because the test results rely on the accuracy of the target image, if a problem occurs during the test, it may be that there was a problem with the target test image during its generation. This requires a significant amount of time to first investigate whether the problem was introduced by improper AE algorithm debugging, and then determine whether there is a problem with the hardware functionality and performance. This seriously affects the efficiency of problem analysis and wastes R&D manpower.

[0029] This application utilizes a pre-designed, relatively simple exposure control algorithm, allowing testers to quickly determine if there are any issues with the algorithm. Exposure is performed to acquire target test images. It is understood that due to the potential for deviations between the design and actual use of the exposure control algorithm, it is necessary to first determine the parameters of the exposure control algorithm in actual use based on actual exposure results. For example, if the exposure control algorithm is a linear function, it is sufficient to determine the slope of the linear function, thereby obtaining an accurate mapping function for the exposure control algorithm in actual use.

[0030] Optionally, when designing the exposure control algorithm, it is determined that the exposure time and the grayscale value of a preset area of the generated image are in a linear functional relationship, such as y = ax, where a is the slope, y is the grayscale value, and x is the exposure time. In this case, the camera 30 can be controlled to perform exposure based on the exposure control algorithm at the current exposure time to obtain a corresponding preview image. The current grayscale value is then calculated based on the pixel values of the preset area of the preview image. For example, the current grayscale value can be the mean, maximum, minimum, etc. of the pixel values of the preset area of the preview image. The current grayscale value and the current exposure time are then substituted into the linear function y = ax to calculate the parameters of the linear function, i.e., the slope a, thereby determining the accurate mapping function of the exposure control algorithm when it is actually used.

[0031] Optionally, when designing the exposure control algorithm, it is determined that the exposure time and the grayscale value of the preset area of the generated image are in a nonlinear functional relationship, such as y=ax 2 +b, a and b are constant parameters of the function, y is the grayscale value, and x is the exposure time. At this time, the camera 30 can be controlled to expose at different current exposure times based on the exposure control algorithm to obtain corresponding multiple frames of preview images. Each current exposure time and the current grayscale value calculated based on the corresponding preview image are used as a set of data to substitute multiple sets of data (for a quadratic function, two sets of data can obtain two constant parameters) into y=ax 2+ b, the parameters of the nonlinear function, namely a and b, can be calculated, thereby determining the accurate mapping function when the exposure control algorithm is actually used.

[0032] See also Figure 4 , where the preset area S can be the central area of the preview image P0, such as a rectangular area of a preset size (such as a preset size equal to a preset ratio (such as 1 / 100, 1 / 25, etc.) of the size of the preview image P0) with the center of the preview image P0 as the intersection point of diagonals; or, the preset area S is a rectangular area of a preset size located at four vertices of the preview image P0 in the preview image P0. The preset area can be determined according to actual test requirements and is not limited here.

[0033] After the accurate mapping function is determined, the target exposure time can be calculated based on the mapping function and the target grayscale value of the target test image to be generated. If the target grayscale value is substituted into the mapping function, the target exposure time can be calculated.

[0034] Finally, after determining the target exposure time, the camera 30 can be controlled again for exposure according to the exposure control algorithm and the target exposure time, thereby obtaining a target test image with the target grayscale value. In this way, by utilizing a pre-designed, simplified exposure control algorithm for exposure control and accurately determining the exposure control algorithm's mapping function, a target test image with the target grayscale value can be accurately generated. Furthermore, because the exposure control algorithm is transparent to the tester, the tester can quickly identify any issues with the algorithm, ensuring the accuracy of the generated target test image. Subsequent image testing is unaffected by the target test image. Target test image generation and image testing are completely decoupled, thereby improving the efficiency of subsequent testing based on the target test image.

[0035] The test method, test device 10, and electronic device 100 of the embodiments of the present application perform exposure at a current exposure time based on a preset exposure control algorithm, thereby obtaining a preview image. In the preset exposure control algorithm, a preset mapping function is satisfied between the exposure time and the image brightness of a preset area of the corresponding image. The parameter values of the mapping function are then determined using the current exposure time and the current grayscale value calculated from the pixel values of the preset area in the preview image, thereby obtaining an accurate mapping function. Subsequently, a target exposure time is calculated based on the target grayscale value of the target test image to be output and the mapping function, so that exposure can be performed according to the target exposure time and the exposure control algorithm to obtain a target test image with the preset area having the target grayscale value. Because the exposure control algorithm is open to testers and the algorithm's mapping function can be accurately obtained, testers can quickly check whether there are any problems in the output process of the target test image, ensuring the accuracy of the generated target test image. This ensures that subsequent image testing is not affected by the target test image. The generation of the target test image and the image testing are completely decoupled, thereby improving the efficiency of subsequent testing based on the target test image.

[0036] See also Figure 5 In some embodiments, the testing method further comprises the following steps:

[0037] 015: When the grayscale value of the preset area of the target test image does not match the target grayscale value, adjust the target exposure time, and perform exposure according to the adjusted target exposure time to obtain the target test image of the target grayscale value;

[0038] 016: When the grayscale value of the preset area of the target test image matches the target grayscale value, determining that the target test image with the target grayscale value is obtained.

[0039] Please refer again Figure 2 In some embodiments, the testing device 10 further includes an adjustment module 15 and a third determination module 16. The adjustment module 15 is configured to adjust the target exposure time if the grayscale value of a preset region of the target test image does not match the target grayscale value, and perform exposure according to the adjusted target exposure time to obtain a target test image with the target grayscale value. The third determination module 16 is configured to determine that the target test image with the target grayscale value has been obtained if the grayscale value of the preset region of the target test image matches the target grayscale value. In other words, steps 015 and 016 can be implemented by the adjustment module 15 and the third determination module 16, respectively.

[0040] Please refer again Figure 3In some embodiments, processor 20 is further configured to adjust the target exposure time if the grayscale value of the preset region of the target test image does not match the target grayscale value, and perform exposure according to the adjusted target exposure time to obtain the target test image having the target grayscale value; and to determine that the target test image having the target grayscale value has been obtained if the grayscale value of the preset region of the target test image matches the target grayscale value. In other words, steps 015 and 016 can be implemented by processor 20.

[0041] Specifically, after obtaining the target test image, in order to further ensure the accuracy of the target test image and ensure that the target test image does not affect the accuracy of subsequent image tests, it is necessary to recalculate the grayscale value of the preset area of the target test image. If the grayscale value of the preset area of the target test image matches the target grayscale value (for example, the grayscale value of the preset area of the target test image is equal to the target grayscale value or the difference between the two is less than a preset threshold), it is determined that the target test image is accurate, and it can be determined that the target test image with the target grayscale value has been obtained.

[0042] If the grayscale value of the preset area of the target test image does not match the target grayscale value, it means that the target test image is still not accurate enough. Therefore, it is necessary to adjust the target exposure time, so as to perform exposure according to the exposure control algorithm and the adjusted target exposure time to obtain the target test image with the target grayscale value, such as increasing the target exposure time, or reducing the target exposure time to obtain multiple target test images, and then calculating the grayscale value of the preset area of each target test image to obtain the target test image that reaches the target grayscale value.

[0043] It can be understood that the longer the exposure time, the greater the overall grayscale value of the general image. Therefore, optionally:

[0044] If the grayscale value of a preset area of the target test image is lower than the target grayscale value, the target exposure time is increased; if the grayscale value of the preset area of the target test image is higher than the target grayscale value, the target exposure time is decreased. This allows for quick adjustment of the target exposure time, improving the efficiency of acquiring target test images with the target grayscale value.

[0045] See also Figure 6 In some embodiments, step 0122 further includes the following steps:

[0046] 017: After adjusting the target exposure time a preset number of times, if the grayscale value of the preset area of the target test image does not match the target grayscale value, it is determined that the image sensor exposure is abnormal.

[0047] Please refer again Figure 2In some embodiments, the testing device 10 further includes a fourth determination module 17. This fourth determination module 17 is configured to determine that the image sensor has an exposure abnormality if the grayscale value of a predetermined region of the target test image does not match the target grayscale value after adjusting the target exposure time a predetermined number of times. In other words, step 017 can be performed by the fourth determination module 17.

[0048] Please refer again Figure 3 In some embodiments, processor 20 is further configured to determine that the image sensor exposure is abnormal if the grayscale value of a predetermined region of the target test image does not match the target grayscale value after adjusting the target exposure time a predetermined number of times. In other words, step 017 can be implemented by processor 20.

[0049] Specifically, if the grayscale value of a preset area of the target test image does not match the target grayscale value, the target exposure time needs to be adjusted. However, if the image sensor of the camera 30 has an exposure anomaly, no matter how the target exposure time is adjusted, the grayscale value of the preset area of the target test image output will never match the target grayscale value. Therefore, after adjusting the target exposure time a preset number of times (e.g., 10 times, 100 times, etc.) to obtain multiple frames of target test images, if the grayscale value of the preset area of all target test images does not match the target grayscale value, it can be determined that the image sensor has an exposure anomaly, such as an image sensor register write anomaly, resulting in the brightness remaining unchanged regardless of whether the exposure time is increased or decreased. In this way, the tester can quickly determine whether there is a problem with the exposure control algorithm, and thus quickly locate the problem with the image sensor when there is a problem with the target test image, thereby improving test efficiency.

[0050] In some embodiments, before obtaining the preview image, the parameters of the camera 30 may be set first to set the parameters of the camera 30 to fixed values to prevent the parameters of the camera 30 from changing and affecting the target test image.

[0051] Specifically, camera 30 parameters include the image sensor's exposure gain and frame rate. The exposure gain can be set to 1, meaning no exposure gain is applied, to prevent the exposure gain algorithm from affecting the target test. The frame rate can be fixed to a maximum value to quickly acquire more frames and improve test efficiency.

[0052] See also Figure 7 , a non-volatile computer-readable storage medium 300 storing a computer program 302 according to an embodiment of the present application, when the computer program 302 is executed by one or more processors 20, enables the processor 20 to execute the test method of any of the above embodiments.

[0053] For example, please combine Figure 1When the computer program 302 is executed by one or more processors 20, the processor 20 performs the following steps:

[0054] 011: Expose based on the preset exposure control algorithm and current exposure time to obtain a preview image;

[0055] 012: Calculate the current grayscale value according to the pixel values of the preset area of the preview image, and determine the mapping function of the exposure control algorithm according to the current grayscale value and the current exposure time;

[0056] 013: Determine the target exposure time according to the mapping function and the preset target grayscale value; and

[0057] 014: Expose according to the exposure control algorithm and the target exposure time to obtain a target test image.

[0058] For another example, please combine Figure 5 When the computer program 302 is executed by one or more processors 20, the processor 20 may further perform the following steps:

[0059] 014: When the grayscale value of the preset area of the target test image does not match the target grayscale value, adjust the target exposure time, and perform exposure according to the adjusted target exposure time to obtain the target test image;

[0060] 015: When the grayscale value of the preset area of the target test image matches the target grayscale value, determining that the target test image with the target grayscale value is obtained.

[0061] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "illustrative embodiments", "example", "specific example" or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, unless they are mutually inconsistent.

[0062] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, segment or portion of code of a program that includes one or more steps for implementing a specific logical function or process, and the scope of the preferred embodiments of the present application includes additional implementations in which functions may be performed in a different order than shown or discussed, including performing functions in a substantially simultaneous manner or in the reverse order depending on the functions involved, which should be understood by those skilled in the art to which the embodiments of the present application belong.

[0063] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limitations on the present application. Ordinary technicians in this field can change, modify, replace and modify the above embodiments within the scope of the present application.

Claims

1. A testing method, characterized in that: Applied to the image testing process in the production of electronic equipment, the testing method includes: Performing exposure based on a preset exposure control algorithm and a current exposure time to obtain a preview image; Calculating a current grayscale value according to pixel values of a preset area of the preview image, and determining a mapping function of the exposure control algorithm according to the current grayscale value and the current exposure time; Determining a target exposure time according to the mapping function and a preset target grayscale value; and Performing exposure according to the exposure control algorithm and the target exposure time to obtain a target test image; The determining of the mapping function of the exposure control algorithm according to the current grayscale value and the current exposure time includes: In the exposure control algorithm, when the current grayscale value and the current exposure time are in a linear relationship, a slope is determined according to the current grayscale value and the current exposure time to determine the mapping function; or In the exposure control algorithm, when the current grayscale value and the current exposure time are in a nonlinear relationship, one current grayscale value and one corresponding current exposure time are used as a set of data, and the mapping function is determined based on multiple sets of data.

2. The testing method according to claim 1, wherein: The preset area is a rectangular area of a preset size with the center of the preview image as the intersection point of diagonal lines, and calculating the current grayscale value according to the pixel values of the preset area of the preview image includes: The current grayscale value is calculated according to the average value of all pixel values in the preset area.

3. The testing method according to claim 1, wherein: Also includes: When the grayscale value of the preset area of the target test image does not match the target grayscale value, adjusting the target exposure time, and performing exposure according to the adjusted target exposure time to obtain the target test image with the target grayscale value; In a case where the grayscale value of the preset area of the target test image matches the target grayscale value, it is determined that the target test image with the target grayscale value is acquired.

4. The testing method according to claim 3, wherein: The adjusting the target exposure time includes: In a case where the grayscale value of the preset area of the target test image is less than the target grayscale value, increasing the target exposure time; When the grayscale value of the preset area of the target test image is greater than the target grayscale value, the target exposure time is reduced.

5. The testing method according to claim 3, wherein: Also includes: After adjusting the target exposure time a preset number of times, if the grayscale value of the preset area of the target test image does not match the target grayscale value, it is determined that the image sensor exposure is abnormal.

6. The testing method according to claim 1, wherein: Before exposing based on the current exposure time to get a preview image, it also includes: Set the camera's brightness gain to 1.

7. A testing device, characterized in that: Applied to the image testing link in the production process of electronic equipment, the testing device includes: An acquisition module, configured to perform exposure based on a preset exposure control algorithm and a current exposure time to acquire a preview image; a first determining module, configured to calculate a current grayscale value according to pixel values of a preset area of the preview image, and determine a mapping function of the exposure control algorithm according to the current grayscale value and the current exposure time; and a second determining module, configured to determine a target exposure time according to the mapping function and a preset target grayscale value; an exposure control module, configured to perform exposure according to the exposure control algorithm and the target exposure time to obtain a target test image; The first determining module is further configured to: In the exposure control algorithm, when the current grayscale value and the current exposure time are in a linear relationship, a slope is determined according to the current grayscale value and the current exposure time to determine the mapping function; or In the exposure control algorithm, when the current grayscale value and the current exposure time are in a nonlinear relationship, one current grayscale value and one corresponding current exposure time are used as a set of data, and the mapping function is determined based on multiple sets of data.

8. An electronic device, characterized in that: The electronic device includes a processor and a camera, the camera is used to capture a preview image, and the processor is used to control the camera to perform exposure based on a preset exposure control algorithm and a current exposure time to obtain the preview image; Calculating a current grayscale value based on pixel values of a preset area of the preview image, and determining a mapping function of the exposure control algorithm based on the current grayscale value and the current exposure time; determining a target exposure time based on the mapping function and a preset target grayscale value; and controlling the camera to perform exposure based on the exposure control algorithm and the target exposure time to acquire a target test image; The processor is further configured to: In the exposure control algorithm, when the current grayscale value and the current exposure time are in a linear relationship, a slope is determined according to the current grayscale value and the current exposure time to determine the mapping function; or In the exposure control algorithm, when the current grayscale value and the current exposure time are in a nonlinear relationship, one current grayscale value and one corresponding current exposure time are used as a set of data, and the mapping function is determined based on multiple sets of data.

9. A non-volatile computer-readable storage medium containing a computer program, characterized in that When the computer program is executed by a processor, the processor is caused to perform the testing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Method and device for regulating exposure

    CN101873437A

  • Exposure control method and device and electronic equipment

    CN111757015A

  • Image processing method, computer program product, device and storage medium

    CN114694191A