Image brightness adjustment method, device, storage medium and program product

By acquiring the raw pixel data of the image, calculating the brightness information of the preset area, adjusting the exposure parameters, and generating the target image, the distortion and poor adaptability of image brightness adjustment in the prior art are solved, achieving efficient and accurate image brightness adjustment, and improving image quality and adjustment efficiency.

CN121037703BActive Publication Date: 2026-02-27SHANGHAI INNOVATECH INFORMATION TECH
View PDF 4 Cites 0 Cited by

Patent Information

Application Number
CN202511564848.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-30
Publication Date
2026-02-27
Estimated Expiration
2045-10-30

AI Technical Summary

Technical Problem

Existing technologies suffer from image distortion and are unable to meet the demand for fine-grained control of image brightness in image brightness adjustment. In particular, when processing raw image data, traditional automatic exposure algorithms cannot meet the differential brightness calculation of key areas and rely on user experience or fixed rules, resulting in poor adaptability.

Method used

By acquiring the raw pixel data of the image, calculating the brightness information of the preset area, and adjusting the exposure parameters according to the difference between the brightness information and the target brightness, the target image is generated. The debug bridge command is used to acquire the MIPI raw image file, verify device permissions, lock the adjusted exposure parameters, and disable the automatic exposure algorithm to achieve automated image brightness adjustment.

Benefits of technology

It achieves precise adjustment of image brightness, avoids deviations caused by global image brightness, improves image quality and adjustment efficiency, adapts to image brightness adjustment in various scenarios, reduces manual intervention, and ensures the stability and consistency of exposure parameters.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121037703B_ABST
    Figure CN121037703B_ABST
Patent Text Reader

Abstract

The application provides an image brightness adjusting method, device, storage medium and program product, and relates to the technical field of image data processing. The method is applied to an electronic device, and the method comprises the following steps: acquiring original pixel data of an image, wherein the original pixel data is in an original data format output by an image sensor and has not been compressed or processed by an image; calculating brightness information of a preset region in the image based on the original pixel data; adjusting an exposure parameter of the electronic device according to the difference between the brightness information and a target brightness; and generating a target image based on the original pixel data and the adjusted exposure parameter. The method provided in the application can accurately adjust the brightness of an image.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of image data processing, and in particular, to an image brightness adjustment method and device, a storage medium, and a program product. BACKGROUND

[0002] With the development of image technology, electronic devices such as smartphones, industrial cameras, security monitoring devices, and professional photography devices can capture images. How to accurately and efficiently adjust the brightness of an image directly affects the quality of the image.

[0003] Some related technologies usually adjust the brightness of an image based on a compressed data format, and the image in the compressed data format has a certain image distortion, which leads to poor image brightness adjustment effect.

[0004] Some related technologies use traditional automatic exposure algorithms to adjust the brightness of an image, but the traditional automatic exposure algorithms cannot meet the requirements of scenes with strict image brightness requirements, and often result in overexposure or underexposure of the image. SUMMARY

[0005] The present application provides an image brightness adjustment method, device, storage medium, and program product to accurately adjust the brightness of an image.

[0006] In a first aspect, the present application provides a brightness adjustment method, including: obtaining original pixel data of an image, the original pixel data being in an original data format output by an image sensor and not being compressed or processed by an image; calculating brightness information of a preset region in the image based on the original pixel data; adjusting exposure parameters of an electronic device according to a difference between the brightness information and target brightness; and generating a target image based on the original pixel data and the adjusted exposure parameters.

[0007] In one possible embodiment, generating the target image based on the original pixel data and the adjusted exposure parameters includes: locking the adjusted exposure parameters so that the exposure settings do not change during the process of generating the target image based on the original pixel data.

[0008] In one possible embodiment, the exposure parameters include exposure time and gain, and locking the adjusted exposure parameters includes: locking the adjusted exposure parameters by using a debug bridge command, and disabling an automatic exposure (AE) algorithm.

[0009] In one possible embodiment, the original data format includes a mobile industry processor interface (MIPI) raw image file format, and the preset region includes a center region. Calculating the brightness information of the preset region in the image based on the original pixel data includes: performing matrix calculation on the original pixel data to extract the brightness information of the center region of the original pixel data.

[0010] In a possible embodiment, the acquiring the original pixel data of the image comprises: searching for the latest MIPI original image file in the electronic device by using a debugging bridge command to obtain the original pixel data.

[0011] In a possible embodiment, the brightness adjustment method further comprises: verifying, by using a debugging bridge command, whether the electronic device has root permission and permission to temporarily modify system files; and loading a configuration file to obtain an initial exposure time, a gain, and an image size parameter from the configuration file, in a case where the electronic device has the root permission and the permission to temporarily modify system files.

[0012] In a possible embodiment, the adjusting the exposure parameter of the electronic device according to the difference between the brightness information and the target brightness comprises: obtaining an exposure multiple according to the difference between the brightness information and the target brightness; and adjusting the exposure parameter of the electronic device at least once according to the exposure multiple until the brightness corresponding to the exposure parameter is in a preset brightness interval, to obtain an adjusted exposure parameter.

[0013] In a second aspect, the present application provides an image brightness adjustment apparatus, comprising: an original pixel data acquisition module, configured to acquire original pixel data of an image, the original pixel data being in a raw data format output by an image sensor and not being compressed or processed; a brightness information calculation module, configured to calculate brightness information of a preset region in the image based on the original pixel data; an exposure parameter adjustment module, configured to adjust an exposure parameter of an electronic device according to a difference between the brightness information and a target brightness; and an image generation module, configured to generate a target image based on the original pixel data and the adjusted exposure parameter.

[0014] In a third aspect, the present application provides an electronic device, comprising: an image sensor, a processor in communication connection with the image sensor, and a memory in communication connection with the processor; the image sensor is configured to acquire original pixel data of an image; the memory stores computer execution instructions; and the processor executes the computer execution instructions stored in the memory to implement the method of the first aspect.

[0015] In a fourth aspect, the present application provides a computer readable storage medium, the computer readable storage medium storing computer execution instructions, the computer execution instructions being executed by a processor to implement the method of the first aspect.

[0016] In a fifth aspect, the present application provides a computer program product, comprising a computer program, the computer program being executed by a processor to implement the method of the first aspect.

[0017] The image brightness adjustment method of the embodiment of the present application supports image brightness adjustment based on original pixel data of an image. The original pixel data of the image is unprocessed image data. The accuracy of subsequent steps based on the original pixel data of the image to achieve image brightness adjustment is better, and the image quality of the target image generated through image brightness adjustment is better.

[0018] In addition, the image brightness adjustment method of the embodiment of the present application further calculates the brightness information of a preset region in the image through the original pixel data to focus on the brightness of the preset region. According to the difference between the brightness information and the target brightness, the exposure parameter of the electronic device is adjusted, and the target image is generated based on the original pixel data and the adjusted exposure parameter to avoid the global brightness of the image causing image brightness adjustment deviation, and the image quality of the generated target image is better. For example, the brightness of the non-preset region of the image is too high, resulting in high global brightness, causing overexposure, or the brightness of the non-preset region of the image is too low, resulting in low global brightness, causing underexposure. Unlike this, the brightness of the non-preset region of the image is not introduced for image brightness adjustment in the embodiment of the present application, so that the image brightness can be accurately adjusted.

[0019] Furthermore, the image brightness adjustment method of the embodiment of the present application does not require manual intervention and can realize automatic image brightness adjustment to improve the efficiency of image brightness adjustment. BRIEF DESCRIPTION OF DRAWINGS

[0020] The accompanying drawings, which are incorporated herein and form part of the specification, illustrate embodiments consistent with the present application and, together with the description, further serve to explain the principles of the present application.

[0021] Figure 1 a flowchart of the image brightness adjustment method of an embodiment of the present application;

[0022] Figure 2 a flowchart of the image brightness adjustment method of another embodiment of the present application;

[0023] Figure 3 a schematic diagram of the image brightness adjustment device of the embodiment of the present application;

[0024] Figure 4 a structural schematic diagram of the electronic device of the embodiment of the present application.

[0025] The specific embodiments of the present application have been shown through the above-described drawings, and will be described in more detail hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0026] The exemplary embodiments will be described in detail herein with reference to the attached drawings. The following description is made with reference to the accompanying drawings in which like reference numerals refer to like elements, unless the context of use indicates otherwise. The following description of exemplary embodiments is not representative of all embodiments consistent with the present application. Rather, it is merely an example of apparatus and methods consistent with some aspects of the present application as detailed in the appended claims.

[0027] The image brightness adjustment method, device, storage medium and program product disclosed in the present application can be applied to the scene of image acquisition by a smart phone, an industrial camera, a security monitoring device and a professional camera device. In these scenes, image brightness directly affects image quality, for example:

[0028] Photography with a smart phone: when a user takes a photo in a complex lighting condition (such as backlight, dark environment), quick and accurate exposure adjustment is needed to avoid overexposure or underexposure.

[0029] Detection task with an industrial camera: the stability of image brightness affects detection tasks such as defect recognition and size measurement.

[0030] Security detection with security monitoring: security monitoring devices need to maintain clear image pictures in day-night alternating or dynamic lighting environments to avoid monitoring failure due to brightness fluctuations.

[0031] Professional photography with a camera: when a photographer shoots a high dynamic range scene, he needs to accurately control the exposure parameters to ensure the details of the key area are preserved.

[0032] In the above scenarios, the image brightness adjustment method adopted by the related art cannot meet the fine control requirements of image brightness, especially when processing raw image data, the limitations of the image brightness adjustment method of the related art are particularly prominent.

[0033] Specifically, the image brightness adjustment method adopted by the related art relies on the automatic exposure algorithm (AE) built in the electronic device. Some related art solutions will be illustrated by way of example below.

[0034] For example, a related technology employs a conventional AE algorithm to dynamically adjust an exposure time and a gain by calculating a global average brightness of an image to match a preset brightness target. This approach does not perform differentiated brightness calculation for key regions of the image (such as a central region), resulting in overexposure or underexposure in certain scenarios. For another example, in a related technology, an electronic device supports user manual adjustment of exposure parameters, but this approach relies on user experience and cannot provide real-time feedback on the adjustment effect of the exposure parameters. This manual adjustment of exposure parameters requires repeated trial and error and lacks an automated process, resulting in low efficiency. Moreover, the exposure parameters cannot be adjusted according to real-time brightness feedback, but rely on user experience or fixed rules, resulting in poor adaptability.

[0035] For another example, in a related technology, most support image brightness adjustment for compressed data format images, but support for original image file formats is limited, resulting in the inability to directly parse pixel data of the image to achieve accurate exposure control and implement image brightness adjustment.

[0036] The image brightness adjustment method, device, storage medium, and program product provided in this application aim to solve the above technical problems of the prior art.

[0037] The technical solutions of the present application and how the technical solutions of the present application solve the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes can not be described again in some embodiments. The embodiments of the present application will be described below with reference to the accompanying drawings.

[0038] Figure 1 A flowchart of an image brightness adjustment method according to an embodiment of the present application. The image brightness adjustment method according to an embodiment of the present application can be executed by an electronic device, specifically by an image processing module of the electronic device. The image processing module includes, for example, a processor of a smartphone or a camera. As shown in Figure 1 The image brightness adjustment method includes steps S101 to S104.

[0039] S101, obtaining original pixel data of an image, the original pixel data being in a raw data format output by an image sensor and not being compressed or processed.

[0040] The original pixel data of the image is unprocessed image data, and the accuracy of the subsequent steps based on the original pixel data of the image for image brightness adjustment is better, and the image quality of the target image generated through image brightness adjustment is better.

[0041] In a possible embodiment, the obtaining the raw pixel data of the image in step S101 includes: searching for a latest MIPI raw image file in the electronic device by using a debugging bridge command to obtain the raw pixel data.

[0042] The debugging bridge command can be understood as a debugging command for implementing device management, file transmission, command execution and the like. The debugging bridge command can directly interact with the underlying of the electronic device without opening an application or manually operating an interface, and can perform efficient operations. For example, the debugging bridge command is used to obtain the raw pixel data of the image, or the debugging bridge command is used to lock the adjusted exposure parameter, verify whether the electronic device has root permission and the speed of temporarily modifying the permission of the system file is faster, and has cross-device and cross-system compatibility, and is suitable for various types of electronic devices.

[0043] In this embodiment, the electronic device interacts with the file system through a hardware interface, for example, by using a debugging bridge (Android Debug Bridge, adb) command, the electronic device can directly access a storage path of the image in the file system (such as / data / vendor / camera / ). For example, the electronic device can use the debugging bridge command (adb pull) to download the latest MIPI raw image file in the electronic device to a local storage to obtain the raw pixel data.

[0044] In addition, by searching for the latest MIPI raw image file in the electronic device, the raw pixel data can be obtained, and the real-time performance of obtaining the raw pixel data can be improved. Since the image brightness adjustment method of the present application can be performed for each newly generated MIPI raw image file, the image coverage range of the image brightness adjustment can be improved.

[0045] S102, calculating brightness information of a preset region in the image based on the raw pixel data.

[0046] For example, the raw image data can be decoded, and then the brightness information of the preset region in the image is calculated.

[0047] The preset region can include a central region of the image, or other more important or key regions other than the central region, and the specific preset region is not limited herein.

[0048] For example, the luminance information can include an average luminance value. The electronic device can perform weighted average processing or linear weighted processing on luminance components (Y) of a luminance-chrominance-saturation color space (YUV) of the preset region, to obtain the average luminance value of the preset region, to strip the color influence and improve the accuracy of calculating the average luminance value. Alternatively, the electronic device can perform weighted average processing or linear weighted processing on pixel data of a red-green-blue color space (RGB) of the center region, to improve the accuracy of calculating the luminance information.

[0049] In a possible embodiment, the original data format includes a Mobile Industry Processor Interface (MIPI) raw image file format, and the preset region includes a center region. The step of calculating the luminance information of the preset region in the image based on the original pixel data includes: performing matrix calculation on the original pixel data, and extracting the luminance information of the center region of the original pixel data.

[0050] The Mobile Industry Processor Interface (MIPI) raw image file format (mipi_raw) retains pixel data directly output by an image sensor, without any color space conversion or compression processing. The pixel data can be a digital signal value, which can be mapped to a color space through color channel restoration.

[0051] The center region can be defined by a center region percentage parameter (center_area_percentage) in a configuration file. The center region percentage parameter is used to calculate the boundary coordinates of the center region in proportion to the width and height of the image. For example, a 50% center region of the image width and the image height respectively can be used as the center region.

[0052] For example, still taking the average luminance value as the luminance information and the MIPI raw image file format as the RGB color space, the MIPI raw image file format is usually stored in the Bayer format and needs to be decoded by a demosaicing algorithm or the like to restore the RGB color space. When calculating the average luminance value of the central region, a sliding window method (for example, taking a 50% region of the center of the image) or a histogram-based statistical method can be used to extract the average luminance value of the central region. For example, for an image with a resolution of 4032x3024, the central region can be defined as a sub-matrix from (1008, 756) to (3024, 2268), and the luminance information of the central region can be calculated by the mean() function of Numpy.

[0053] Generally, the key information of an image is located in the central region of the image and conforms to the central focusing characteristics of vision, so the central region can be set as a preset region, and the luminance information of the central region can be used as a reference for subsequent adjustment of the luminance of the image, thereby avoiding the luminance adjustment deviation of the image caused by the traditional AE algorithm for calculating the global luminance of the image, and especially suitable for scenes that require accurate control of the luminance of the central region (such as portrait photography), and can also avoid distortion of the key information or poor display effect in the target image generated after the luminance adjustment of the image.

[0054] For example, the preset region can also be obtained by identifying the image by a deep learning model. The number of preset regions can be one or more. In the case where the number of preset regions is more than one, the deep learning model can also be used to set weights for the identified multiple preset regions. The step S102 of calculating the luminance of the preset region in the image based on the original image data can include: calculating the luminance information of the multiple preset regions, and performing weighted averaging on the luminance information of the multiple preset regions according to the weights to obtain the luminance information of the preset region.

[0055] The weight setting rule of the preset region, for example, indicates that the weight is set according to the information quantity or the weight is set according to the image scene. The information quantity can be determined by indicators such as feature density. For example, in a portrait image, the feature density of the portrait face region is higher than that of the background region. The image scene can be pre-set, for example. The image scene can include a portrait scene, an outdoor scene, a light source scene, etc. For example, in a portrait scene, the region where the portrait is located is a preset region, and the weight of the region where the portrait is located is higher.

[0056] The deep learning model can include a convolutional neural network (CNN), a recurrent neural network (RNN), etc., and the specific type of the deep learning model is not limited herein. The deep learning model can be trained using training samples. The training samples are image samples and have preset region labels and preset region weight labels. The deep learning model trained by the training samples can be used to identify the preset regions in the image and set the weights of the preset regions.

[0057] Thus, the preset regions can be intelligently identified by the deep learning model, and the actual application scenarios of the preset regions being one or more are adapted. The brightness information of each preset region is weighted and averaged according to the weight of each preset region, so that the brightness information of the preset region determined is more accurate and can cover the brightness information of each preset region with information value in the image.

[0058] S103, adjusting the exposure parameter of the electronic device according to the difference between the brightness information and the target brightness.

[0059] For example, the target brightness (target_luma) is preset or set by the user as a default value. The default value can be a standard value of the light sensitivity.

[0060] For example, the exposure parameter can include an exposure time (exposure_time) and a gain (gain). The exposure time can be understood as the length of time for which the image sensor receives light, and the exposure time is positively correlated with the image brightness. The gain can be understood as the multiple of electronic amplification of the light signal received by the image sensor, and the gain is positively correlated with the image brightness.

[0061] For example, in step S103, if the brightness information is lower than the target brightness, the electronic device can increase the exposure time (incremented by 10ms as a step) and the gain (incremented by 128 as the minimum unit) to improve the brightness information. If the brightness information is higher than the target brightness, the electronic device can decrease the exposure time (decreased by 10ms as a step) and the gain (decreased by 128 as the minimum unit).

[0062] It should be noted that adjusting the exposure parameter of the electronic device needs to consider the hardware limitations of the electronic device, such as the maximum value of the exposure time (e.g., 3000ms) and the upper limit of the gain (e.g., 4096), to ensure that the exposure parameter adjustment is within the range of the exposure parameter supported by the electronic device.

[0063] In one possible embodiment, step S103 of adjusting the exposure parameter of the electronic device according to the difference between the brightness information and the target brightness includes: obtaining an exposure multiple according to the brightness information and the target brightness; and adjusting the exposure parameter of the electronic device at least once according to the exposure multiple until the brightness corresponding to the exposure parameter is in a preset brightness interval, to obtain an adjusted exposure parameter.

[0064] The exposure parameter is, for example, the ratio of the target brightness to the brightness information, and both the target brightness and the brightness information are brightness values. The exposure parameter is updated by the product of the exposure multiple and the current exposure parameter, so as to adjust the exposure parameter of the electronic device.

[0065] The preset luminance interval can be understood as a luminance interval that is not underexposed and not overexposed. The preset luminance interval corresponding to the RGB color space can be 30-220. The preset luminance interval corresponding to the Y component of the YUV color space can be 32-224.

[0066] In this embodiment, when the luminance corresponding to the exposure parameter is in the preset luminance interval, the adjustment of the exposure parameter of the electronic device according to the exposure multiplier can be stopped. When the luminance corresponding to the exposure parameter is not in the preset luminance interval, the adjustment of the exposure parameter of the electronic device according to the exposure multiplier can be continued until the luminance corresponding to the exposure parameter is in the preset luminance interval, so that closed-loop adjustment of the image luminance is achieved. Thus, it can be ensured that the target image generated according to the adjusted exposure parameter in the subsequent step will not have problems of underexposure or overexposure.

[0067] S104: generating a target image based on the original pixel data and the adjusted exposure parameter.

[0068] For example, the electronic device can process the original image data by using the adjusted exposure parameter to generate a target image. Specifically, the pixel data of each pixel in the original pixel data is determined according to the light intensity, the exposure time, and the gain. The adjusted exposure parameter includes the adjusted exposure time and the adjusted gain. The pixel data of each pixel in the target image can be determined by the light intensity of the signal value of each pixel in the original pixel data, the adjusted exposure time, and the adjusted gain, so that the target image is obtained.

[0069] The image luminance adjustment method of the embodiment of the present application supports image luminance adjustment based on original pixel data of an image. The original pixel data of the image is unprocessed image data. The accuracy of the subsequent steps based on the original pixel data of the image to achieve image luminance adjustment is better, and the image quality of the target image generated by the image luminance adjustment is better.

[0070] In addition, the image luminance adjustment method of the embodiment of the present application further calculates the luminance information of a preset region in the image by using the original pixel data, so as to focus on the luminance of the preset region. According to the difference between the luminance information and the target luminance, the exposure parameter of the electronic device is adjusted, and a target image is generated based on the original pixel data and the adjusted exposure parameter, so as to avoid the global luminance of the image causing deviation of the image luminance adjustment, and the image quality of the generated target image is better. For example, the luminance of the non-preset region of the image is too high, which causes the global luminance to be high, resulting in overexposure, or the luminance of the non-preset region of the image is too low, which causes the global luminance to be low, resulting in underexposure. Unlike this, the luminance of the non-preset region of the image is not introduced for image luminance adjustment in the embodiment of the present application, so that the image luminance can be accurately adjusted.

[0071] Further, the image brightness adjustment method of the embodiment of the present application can realize automatic image brightness adjustment without manual intervention, thereby improving the efficiency of image brightness adjustment.

[0072] In a possible embodiment, the image brightness adjustment method further comprises: verifying whether the electronic device has root permission and permission of temporarily modifying system files through a debugging bridge command; in the case that the electronic device has the root permission and the permission of temporarily modifying system files, loading a configuration file, and exposing the initial exposure time and the initial gain from the configuration file, wherein the exposure parameters comprise obtaining the initial exposure time, the initial gain, and the image size parameters.

[0073] The root permission is root permission, through which the file system can be accessed to obtain the original pixel data of the image. The permission of temporarily modifying system files can comprise remount permission, through which the configuration file can be modified to adjust the initial exposure time and the initial gain configured in the configuration file.

[0074] For example, the debugging bridge command adb shell su –c "id" is used to verify whether the electronic device has the root permission. Wherein, adb shell indicates connecting the electronic device through the debugging bridge command and entering the command line terminal of the electronic device; su indicates switching to the root user; -c "id" indicates executing the id command with the root permission; and id is used to display the permission information of the current user, thereby verifying whether the electronic device has the root permission.

[0075] For example, the debugging bridge command adb shell mount|grep / system is used to verify whether the electronic device has the remount permission. Wherein, mount indicates viewing the mounting state (such as mounting path, read-write mode) of all partitions of the electronic device; grep / system indicates screening the mounting information of the / system partition (the / system is the core partition of the Android system, storing system files and configurations). Thereby, whether the electronic device has the remount permission can be verified.

[0076] After verification, the electronic device can load the configuration file (such as / sdcard / exposure_config.json), and read the initial exposure time, the initial gain, and the image size parameters (image_width, image_height) from the configuration file.

[0077] In this embodiment, by verifying the root permission and the permission of temporarily modifying the system file, the legality of obtaining the original pixel data of the image, the legality of adjusting the exposure parameter, and the legality of locking the adjusted exposure parameter in the following are ensured. In the case that the electronic device has the root permission and the permission of temporarily modifying the system file, the image brightness adjustment of the electronic device can perform the underlying operations such as reading the exposure parameter in the configuration file, obtaining the original pixel data of the image, and locking the adjusted exposure parameter, avoiding data distortion caused by operation deformation and other problems, so as to realize efficient and accurate image brightness adjustment.

[0078] It should be noted that the legality of obtaining the original pixel data of the image, adjusting the exposure parameter, and locking the adjusted exposure parameter are all based on the premise that the electronic device has the root permission and the permission of temporarily modifying the system file. In order to perform the image brightness adjustment method of the embodiments of the present application to accurately adjust the image brightness, the electronic device usually has the root permission and the permission of temporarily modifying the system file.

[0079] In a possible embodiment, the step S102 of generating the target image based on the original pixel data and the adjusted exposure parameter includes: locking the adjusted exposure parameter, so that the exposure setting does not change in the process of generating the target image based on the original pixel data.

[0080] In the embodiments of the present application, by locking the adjusted exposure parameter, the exposure setting does not change in the process of generating the target image based on the original pixel data, avoiding the adjusted exposure parameter being adjusted again due to the existence of factors such as automatic exposure AE algorithm adjusting the exposure setting, that is, the adjusted exposure parameter will no longer respond to the change of ambient light, thereby avoiding exposure fluctuation caused by the image brightness being adjusted again, so as to improve the accuracy of image brightness adjustment and the stability of image brightness adjustment.

[0081] In addition, by locking the adjusted exposure parameter, the consistency of image brightness adjustment can be realized. That is, the image brightness adjustment is based on the original image data from beginning to end, without introducing other factors affecting the image brightness adjustment, so as to accurately adjust the image brightness and ensure the effect of image brightness adjustment.

[0082] In a possible embodiment, the exposure parameter includes exposure time and gain, and locking the adjusted exposure parameter includes: locking the adjusted exposure parameter by a debug bridge command, and disabling the automatic exposure AE algorithm.

[0083] In the embodiments of the present application, the debug bridge command communicates with the kernel of the electronic device through the debug interface, after executing the debug bridge command to lock the adjusted exposure parameter, the camera driver layer writes the adjusted exposure parameter into the register, and closes the dynamic exposure parameter adjustment function of the AE algorithm, so as to lock the adjusted exposure parameter.

[0084] In one possible embodiment, the electronic device can also record each operation of the image brightness adjustment method to form an image brightness adjustment log. The image brightness adjustment log can record the preset region, the brightness information of the preset region, the difference between the brightness information and the target brightness, the exposure multiple, the exposure parameter, the adjusted exposure parameter, etc., the preset brightness interval, the brightness information of the target image, etc.

[0085] For example, the electronic device can store the brightness adjustment log and provide an interface for calling the brightness adjustment log, and the user can call the interface of the brightness adjustment log to obtain the brightness adjustment log.

[0086] Figure 2 A flowchart of the image brightness adjustment method of another embodiment of the present application. The image brightness adjustment method is applied to an electronic device. As shown in the figure, the image brightness adjustment method can include steps S201 to S217. Figure 2

[0087] S201, detecting whether the electronic device is normal.

[0088] Detecting whether the electronic device is normal is, for example, for detecting the connection state of the electronic device and verifying whether the electronic device has root permission and the permission to temporarily modify system files.

[0089] S202, initializing the device driver.

[0090] Initializing the device driver is to ensure that the hardware driver of the electronic device can work normally.

[0091] S203, loading a configuration file to obtain an initial exposure time, an initial gain, and an image size parameter.

[0092] Steps S201 to S203 can be understood as an initialization stage of the image brightness adjustment.

[0093] S204, starting to cyclically collect images.

[0094] For example, the electronic device can control the image sensor of the camera component to cyclically collect images.

[0095] S205, turning on the image collection function.

[0096] S206, determining whether the image brightness meets the requirement and the number of attempts is less than the maximum number of attempts.

[0097] If the image brightness meets the requirement and the number of attempts is less than the maximum number of attempts, step S207 is performed. If the image brightness meets the requirement, step S215 is performed.

[0098] ​Whether the image brightness meets the requirement is determined according to the dynamic range, noise, artificial brightness perception result of the image, and scene requirement, for example.

[0099] The dynamic range can be understood as the ratio of the brightest region and the darkest region that can be simultaneously accommodated. For example, an image with a low dynamic range (such as 8 exposure values, 8EV) may appear “overexposed in bright parts or underexposed in dark parts” even if the global brightness of the image is in the range of 30-220, for a high-contrast scene (such as backlight). Therefore, the image brightness adjustment method of the embodiments of the present application can be used for image brightness adjustment.

[0100] An image with a high noise level may appear “dirty” in the dark part due to the noise even if the image brightness is normal, which affects the visual experience. Therefore, the image brightness adjustment method of the embodiments of the present application can be used for image brightness adjustment.

[0101] In an industrial detection scene, the brightness of the surface of a part needs to be stabilized at 80-150, to ensure that the brightness difference between a defect (such as a scratch) region and a normal region is greater than 30, facilitating algorithm recognition of the defect.

[0102] In a security monitoring scene, the brightness of a night picture needs to be greater than or equal to 50, to ensure that the outline of a pedestrian is clear; and the brightness of a day picture needs to be less than or equal to 200, to avoid overexposure in a strong light region.

[0103] In a medical image scene, such as an X-ray film, the brightness of a lesion region needs to be in the range of 120-180, to ensure that the contrast between the lesion (such as a shadow) and normal tissue is greater than 40.

[0104] The number of attempts refers to the number of attempts to collect an image, and the maximum number of attempts can be set to 5.

[0105] S207, lock the exposure parameter.

[0106] Specifically, the initial exposure time and the initial gain in the configuration file can be locked.

[0107] S208, automatically collect an image.

[0108] For example, the image sensor is controlled to automatically collect an image.

[0109] S209, obtain a latest MIPI raw image file.

[0110] The electronic device can use a debug bridge command to find the latest MIPI raw image file in the electronic device, to obtain raw pixel data.

[0111] S210, decode the latest MIPI raw image file.

[0112] The electronic device can restore the latest MIPI raw image file to pixel array data by decoding. The decoded pixel array data can be used to determine the preset region and calculate the luminance information of the preset region.

[0113] S211. Calculate the luminance information of the preset region based on the configuration file.

[0114] S212. Determine whether the luminance information meets the requirements.

[0115] The electronic device can determine whether the luminance information meets the requirements by whether the luminance corresponding to the luminance information is in the preset luminance interval.

[0116] If the luminance information meets the requirements, step S215 is performed. If the luminance information does not meet the requirements, step S213 is performed.

[0117] S213. Calculate the exposure multiple.

[0118] The electronic device can calculate the exposure multiple according to the luminance information and the target luminance.

[0119] S214. Adjust the exposure parameter according to the exposure multiple and return to S207.

[0120] The electronic device can adjust the exposure multiple of the electronic device at least once according to the exposure multiple until the luminance corresponding to the exposure parameter is in the preset luminance interval to obtain an adjusted exposure multiple. The adjusted exposure parameter is locked through step S207.

[0121] S215. Determine whether the number of attempts is greater than or equal to the maximum number of attempts.

[0122] If the number of attempts is greater than or equal to the maximum number of attempts, step S216 is performed. If the number of attempts is less than the maximum number of attempts, step S217 is performed.

[0123] S216. Report an error.

[0124] The error indicates that the image acquisition fails.

[0125] S217. Output an image whose luminance meets the requirements and save the corresponding exposure parameter. The image whose luminance meets the requirements includes the target image generated after the image luminance adjustment method of the present application is performed.

[0126] Steps S204 to S217 can be understood as the stage of the electronic device performing image luminance adjustment.

[0127] Figure 2 In the illustrated embodiments, some steps have been described in detail in the above embodiments and will not be described again here.

[0128] In summary, the image brightness adjustment method of the embodiments of the present application has at least one of the following technical effects:

[0129] (1) The image brightness adjustment is based on the raw pixel data of the image in the.mipi_raw file format, so as to avoid additional image distortion in the image brightness adjustment process and improve the image quality.

[0130] (2) The exposure parameter is adjusted based on the brightness information of the preset region such as the center region of the image, and then the image brightness is adjusted, so as to accurately adjust the image brightness in a regional manner, and the performance in special scenes such as too low or too high brightness of the non-pre-set region is better.

[0131] (3) The embodiments of the present application are an automatic image brightness adjustment method, which can reduce manual intervention and is not dependent on the experience of personnel adjusting the exposure parameter, and is suitable for image brightness adjustment in various scenes. It is also suitable for brightness adjustment of a large number of images, and can improve the speed and efficiency of image brightness adjustment.

[0132] (4) The traditional AE algorithm based on the electronic device has the function of dynamic adjustment of the exposure parameter, and adaptively locks the adjusted exposure parameter, so as to avoid the adjusted exposure parameter being adjusted again and ensure the stability of the adjusted exposure parameter.

[0133] (5) The image brightness adjustment log can record the related data in the image brightness adjustment process in detail and support user call and viewing, forming a feedback mechanism of the image brightness adjustment process and result. The user can follow the image brightness adjustment process, analyze the image brightness adjustment, and archive the image brightness adjustment related data for backtracking.

[0134] Figure 3 A structural schematic diagram of an image brightness adjustment device provided by the embodiments of the present application is shown. The image brightness adjustment device can be applied to an electronic device. As shown in the figure, the image brightness adjustment device provided by the embodiments of the present application includes an original pixel data acquisition module 310, a brightness information calculation module 320, an exposure parameter adjustment module 330, and an image generation module 340. Figure 3

[0135] The original pixel data acquisition module 310 is used to acquire the original pixel data of the image. The original pixel data is the original data format output by the image sensor and has not been compressed and image processed.

[0136] The brightness information calculation module 320 is used to calculate the brightness information of the preset region in the image based on the original pixel data.

[0137] The exposure parameter adjustment module 330 is used to adjust the exposure parameter of the electronic device according to the difference between the brightness information and the target brightness.​

[0138] The image generation module 340 is configured to generate a target image based on the original pixel data and the adjusted exposure parameter.

[0139] In a possible implementation, the image generation module comprises a locking submodule configured to lock the adjusted exposure parameter, so that the exposure setting does not change during the process of generating the target image based on the original pixel data.

[0140] In a possible implementation, the exposure parameter comprises an exposure time and a gain, and the locking submodule comprises a locking unit configured to lock the adjusted exposure parameter by using a debug bridge command, and disable an automatic exposure (AE) algorithm.

[0141] In a possible implementation, the original data format comprises a Mobile Industry Processor Interface (MIPI) raw image file format, the preset area comprises a center area, and the brightness information calculation module comprises a matrix calculation submodule configured to perform matrix calculation on the original pixel data, and extract the brightness information of the center area of the original pixel data.

[0142] In a possible implementation, the original pixel data acquisition module comprises an acquisition submodule configured to find the latest MIPI raw image file in the electronic device by using a debug bridge command, and obtain the original pixel data.

[0143] In a possible implementation, the image brightness adjustment apparatus further comprises an authority verification module and a configuration file loading module. The authority verification module is configured to verify, by using a debug bridge command, whether the electronic device has root authority and authority to temporarily modify system files. The configuration file loading module is configured to load a configuration file, and obtain an initial exposure time, an initial gain, and an image size parameter from the configuration file, in a case where the electronic device has the root authority and the authority to temporarily modify system files.

[0144] In a possible implementation, the exposure parameter adjustment module comprises an exposure multiple determination submodule and an adjustment submodule. The exposure multiple determination submodule is configured to obtain an exposure multiple according to the brightness information and the target brightness. The adjustment submodule is configured to adjust the exposure parameter of the electronic device at least once according to the exposure multiple, until the brightness corresponding to the exposure parameter is in a preset brightness interval, to obtain the adjusted exposure parameter.

[0145] Figure 4 A structural schematic diagram of an electronic device is provided in an embodiment of the present application. As shown in the figure, Figure 4 The electronic device provided in the embodiment of the present application comprises a processor 401, a memory 402, and an image sensor 403. Optionally, the device further comprises a communication component 404. The processor 401, the memory 402, the image sensor 403, and the communication component 404 are connected through a bus 405.

[0146] The electronic device may, for example, be a smartphone, a camera, a security monitoring device, etc.

[0147] In the implementation process, the image sensor collects original pixel data of an image, the memory 402 stores codes, and the processor 401 executes the codes stored in the memory 402 to perform the method of the above method embodiment.

[0148] The specific implementation process of the processor 401 can be referred to the above method embodiment, which has similar implementation principles and technical effects, and details are not described here again.

[0149] In the above Figure 4 In the embodiment shown, it should be understood that the processor 401 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor or any conventional processor. The steps of the method disclosed in the application can be directly embodied as hardware processor execution or executed by a combination of hardware and software modules in the processor.

[0150] The memory 402 can include a high-speed RAM memory, and can also include a non-volatile storage NVM, such as at least one disk memory.

[0151] The image sensor 403 can be understood as an electronic element that converts an optical signal (photon) into an electrical signal (voltage / current).

[0152] The bus 405 can be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus 405 can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus 405 in the drawings of the present application does not limit to only one bus or one type of bus.

[0153] The embodiment of the present application provides a computer readable storage medium, and the computer readable storage medium stores computer execution instructions. When the computer execution instructions are executed by a processor, the computer execution instructions are used to implement the method of the above method embodiment.

[0154] The computer readable storage medium described above can be realized by any type of volatile or nonvolatile storage devices or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic storage, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special purpose computer.

[0155] An exemplary readable storage medium is coupled to the processor, so that the processor can read information from the readable storage medium, and can write information to the readable storage medium. Of course, the readable storage medium can also be an integral part of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist as discrete components in the device.

[0156] The embodiment of the present application provides a computer program product, including a computer program, when the computer program is executed by a processor, the method provided by any of the above embodiments of the present application is realized.

[0157] It should be noted that, for the foregoing method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited to the order of the actions described, because according to the present application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to optional embodiments, and the actions and modules involved are not necessarily necessary for the present application.

[0158] It should be further noted that although each step in the flowchart is displayed in sequence according to the arrow, these steps are not necessarily executed in sequence according to the arrow. Unless otherwise stated in this paper, the execution of these steps has no strict order limit, and these steps can be executed in other order. Moreover, at least part of the steps in the flowchart can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily sequential, but can be executed with at least part of other steps or other steps or stages of sub-steps or stages, alternately or alternately.

[0159] It should be understood that the above-described apparatus embodiments are merely illustrative, and the apparatus of the present application can also be implemented in other manners. For example, the division of units / modules in the above-described embodiments is merely a logical function division, and actual implementation can be in another manner. For example, a plurality of units / modules or components can be combined, or can be integrated into another system, or some features can be omitted or not implemented.

[0160] In addition, unless specifically stated otherwise, each functional unit / module in each embodiment of the present application can be integrated in one unit / module, or can be physically present separately, or two or more units / modules can be integrated together. The integrated unit / module can be implemented in the form of hardware or in the form of a software program module.

[0161] The integrated unit / module, if implemented in the form of hardware, can be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. Unless specifically stated otherwise, the processor can be any suitable hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. Unless specifically stated otherwise, the storage unit can be any suitable magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory (RRAM), a dynamic random access memory (DRAM), a static random access memory (SRAM), an enhanced dynamic random access memory (EDRAM), a high-bandwidth memory (HBM), a hybrid memory cube (HMC), etc.

[0162] If the integrated units / modules are implemented in the form of software program modules and sold or used as independent products, they can be stored in a computer readable memory. Based on such understanding, the technical solutions of the present application essentially or the part that contributes to the prior art or the whole or part of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a memory and includes a number of instructions for causing a computer device (which can be a personal computer, a server or a network device, etc.) to execute all or part of the steps of the embodiments of the method of the present application. The aforementioned memory includes: a U disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a mobile hard disk, a magnetic disk or an optical disk, and various media that can store program codes.

[0163] In the above embodiments, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, not all possible combinations of the technical features in the above embodiments are described, however, as long as the combinations of the technical features do not exist contradictory, they should be considered as the scope of the present application.

[0164] Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. The application is intended to cover any variations, uses or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice in the art to which the application pertains or can relate. The specification and examples are to be regarded as exemplary only, and the true scope and spirit of the application are indicated by the following claims.

[0165] It should be understood that the application is not limited to the precise construction that has been described above and illustrated in the accompanying drawings, and that various modifications and changes can be made without departing from the scope thereof. The scope of the application is limited only by the claims that follow.

Claims

1. An image brightness adjustment method, characterized in that, Applied to electronic devices, the method includes: The debug bridge command is used to find the latest MIPI raw image file in the electronic device to obtain raw pixel data. The raw pixel data is the raw data format output by the image sensor and has not been compressed or processed. Calculate the brightness information of a preset region in the image based on the original pixel data; The debug bridge command is used to verify whether the electronic device has root privileges and the permission to temporarily modify system files; if the electronic device has the root privileges and the permission to temporarily modify system files, the configuration file is loaded, and the initial exposure time, initial gain, and image size parameters are obtained from the configuration file. Based on the difference between the brightness information and the target brightness, the exposure parameters of the electronic device are adjusted, including exposure time and gain. The adjusted exposure parameters are locked using the debug bridge command, and the automatic exposure (AE) algorithm is disabled. The target image is generated based on the original pixel data and the adjusted exposure parameters.

2. The method according to claim 1, characterized in that, The raw data format includes the Mobile Industry Processor Interface (MIPI) raw image file format, the preset region includes a central region, and the calculation of brightness information of the preset region in the image based on the raw pixel data includes: Matrix calculations are performed on the original pixel data to extract the brightness information of the central region of the original pixel data.

3. The method according to claim 1 or 2, characterized in that, The step of adjusting the exposure parameters of the electronic device based on the difference between the brightness information and the target brightness includes: The exposure factor is obtained based on the brightness information and the target brightness. The exposure parameters of the electronic device are adjusted at least once according to the exposure factor until the brightness corresponding to the exposure parameters is within the preset brightness range, thus obtaining the adjusted exposure parameters.

4. An electronic device, characterized in that, include: An image sensor, a processor communicatively connected to the image sensor, and a memory communicatively connected to the processor; The image sensor is used to acquire raw pixel data of the image; The memory stores computer-executed instructions; The processor executes computer execution instructions stored in the memory to implement the method as described in any one of claims 1 to 3.

5. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-executable instructions, which, when executed by a processor, are used to implement the method as described in any one of claims 1 to 3.

6. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the method of any one of claims 1 to 3.

Citation Information

Patent Citations

  • Exposure control method and related equipment

    CN118450259A

  • Exposure parameter adjustment method and device, electronic equipment and computer readable storage medium

    CN119893289A

  • Image processing method and device

    WO2021056538A1

  • Automatic exposure method, apparatus and device, and storage medium

    WO2023098743A1