Image shooting method and device under low illumination, electronic equipment and storage medium
By capturing images with a camera, calculating human proportion data, and dynamically configuring flash parameters, the problem of overexposure or insufficient light in low-light nighttime images was solved, achieving optimal exposure in low-light conditions.
Patent Information
- Application Number
- CN202511065267.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-31
- Publication Date
- 2025-11-18
AI Technical Summary
When shooting portraits at night in low light conditions, fixed-intensity fill lights can cause overexposure or insufficient light collection.
The system acquires images using a camera, calculates human proportion data, searches a preset data table to obtain image segmentation granularity, average brightness kernel, and human distance, dynamically configures flash parameters, and adjusts light intensity to achieve optimal exposure.
Achieve optimal exposure in low-light conditions, avoiding overexposure or underexposure, and capture clear images.
Smart Images

Figure CN120980360A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of image processing technology, and in particular to a method and apparatus for capturing images under low light conditions, an electronic device, and a storage medium. Background Technology
[0002] When capturing images of people in low-light conditions at night, most cameras use supplemental lighting to illuminate the environment and make the person and face visible. However, since these supplemental lights typically provide a fixed intensity, the lighting effect is often poor. For example, when the person is close to the camera, overexposure may occur, while when the person is far away, insufficient light may result. Therefore, how to capture clear images in low-light conditions at night has become a pressing issue. Summary of the Invention
[0003] The main objective of this application is to provide a method, apparatus, electronic device, and storage medium for capturing images in low light conditions, with the aim of obtaining clear images in low light conditions at night.
[0004] To achieve the above objectives, a first aspect of this application provides a low-light image capture method applied to a camera, the method comprising:
[0005] The camera captures images to obtain the original images;
[0006] The original image is subjected to human proportion calculation to obtain human proportion data;
[0007] The image segmentation granularity, brightness mean kernel, and human figure distance are obtained by looking up the preset data table based on the human figure ratio data.
[0008] The camera flash parameters are configured based on the image segmentation granularity, the brightness mean kernel, the human figure distance, and the original image.
[0009] Images are captured using the configured camera.
[0010] In some embodiments, the step of calculating the human proportions of the original image to obtain human proportion data includes:
[0011] Human detection is performed on the original image to obtain multiple candidate target images;
[0012] For each of the candidate target images, the pixel area of the candidate target image is statistically analyzed to obtain the area of the candidate target;
[0013] For each of the candidate target images, the proportion data of the human figure is obtained by calculating the proportion of the candidate target area and the original image.
[0014] In some embodiments, the preset data table includes multiple preset ratio data; the step of looking up the preset data table based on the human figure ratio data to obtain the image segmentation granularity, the mean brightness kernel, and the human figure distance includes:
[0015] Based on the human figure proportion data, a nearest neighbor search is performed on each of the preset proportion data to obtain the target proportion data; wherein, the difference between the target proportion data and the human figure proportion data is less than or equal to the difference between each of the preset proportion data and the human figure proportion data;
[0016] The image segmentation granularity, the mean brightness kernel, and the human figure distance are obtained by looking up the preset data table based on the target ratio data.
[0017] In some embodiments, configuring the camera's flash parameters based on the image segmentation granularity, the brightness mean kernel, the human distance, and the original image includes:
[0018] The original image is segmented according to the image segmentation granularity to obtain the target sub-image and the remaining sub-images;
[0019] The camera flash parameters are configured based on the target sub-image, the remaining sub-images, the brightness mean kernel, and the human distance.
[0020] In some embodiments, configuring the camera's flash parameters based on the target sub-image, the remaining sub-images, the brightness mean kernel, and the human distance includes:
[0021] The position of the target sub-image in the original image is obtained to obtain the target position information;
[0022] Based on the target location information and the average brightness value, the remaining sub-images are filtered to obtain neighboring sub-images;
[0023] The mean brightness is obtained by calculating the mean value of the neighboring sub-image and the target sub-image.
[0024] The camera's flash parameters are configured based on the target location information, the average brightness, and the distance to the human figure.
[0025] In some embodiments, configuring the camera's flash parameters based on the target location information, the average brightness, and the distance to the human figure includes:
[0026] The target brightness is obtained by looking up a preset brightness table based on the average brightness and the distance to the human figure.
[0027] Calculate the difference between the target brightness and the average brightness to obtain the brightness difference;
[0028] Based on the target location information, the candidate flash units for the camera are filtered to obtain the selected flash unit;
[0029] The selected flash is configured with parameters based on the brightness difference to configure the flash parameters of the camera.
[0030] In some embodiments, the step of looking up a preset brightness table based on the average brightness and the distance to the human figure to obtain the target brightness includes:
[0031] Based on the human figure distance, a nearest neighbor search is performed on the preset brightness table to obtain the target distance, and multiple alternative brightness levels corresponding to the target distance are obtained from the preset brightness table;
[0032] Based on the average brightness, a nearest neighbor search is performed on each of the candidate brightnesses to obtain the selected brightness, and the target brightness corresponding to the selected brightness is obtained from the preset brightness table.
[0033] To achieve the above objectives, a second aspect of this application provides an image capturing device under low light conditions, applied to a camera, the device comprising:
[0034] The image acquisition module is used to acquire images through the camera to obtain raw images;
[0035] The proportion calculation module is used to calculate the human proportion of the original image to obtain human proportion data;
[0036] The data lookup module is used to look up the preset data table based on the human figure ratio data to obtain the image segmentation granularity, the brightness mean kernel, and the human figure distance;
[0037] The parameter configuration module is used to configure the flash parameters of the camera based on the image segmentation granularity, the brightness mean kernel, the human distance, and the original image.
[0038] An image capture module is used to capture images using the configured camera.
[0039] To achieve the above objectives, a third aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described in the first aspect.
[0040] To achieve the above objectives, a fourth aspect of the present application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the first aspect.
[0041] This application proposes a method, apparatus, electronic device, and storage medium for capturing images in low-light conditions. It acquires an original image using a camera; calculates the human proportions in the original image to obtain human proportion data; looks up the human proportion data in a preset data table to obtain image segmentation granularity, brightness mean kernel, and human distance; configures the camera's flash parameters based on the image segmentation granularity, brightness mean kernel, human distance, and the original image; and captures an image using the configured camera. Thus, this application's embodiment dynamically configures the camera's flash based on the human proportion data in the original image, the preset data table, and the flash parameter configuration. By dynamically adjusting the flash parameters, it ensures that the camera can achieve optimal exposure in low-light environments based on the human distance and image brightness requirements, avoiding overexposure or underexposure caused by fixed light intensity. Attached Figure Description
[0042] Figure 1 This is a flowchart of the low-light image capture method provided in the embodiments of this application;
[0043] Figure 2 yes Figure 1 The flowchart of step S102 in the document;
[0044] Figure 3 yes Figure 1 The flowchart of step S103 in the process;
[0045] Figure 4 yes Figure 1 The flowchart of step S104 in the process;
[0046] Figure 5 yes Figure 4 The flowchart of step S402 in the document;
[0047] Figure 6 yes Figure 5 The flowchart of step S504 in the process;
[0048] Figure 7 yes Figure 6 The flowchart of step S601 in the process;
[0049] Figure 8 This is a schematic diagram of the low-light image capturing device provided in the embodiments of this application;
[0050] Figure 9This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0051] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0052] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0053] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0054] When capturing images of people in low-light conditions at night, most cameras use supplemental lighting to illuminate the environment and make the person and face visible. However, since these supplemental lights typically provide a fixed intensity, the lighting effect is often poor. For example, when the person is close to the camera, overexposure may occur, while when the person is far away, insufficient light may result. Therefore, how to capture clear images in low-light conditions at night has become a pressing issue.
[0055] Based on this, embodiments of this application provide a method and apparatus for capturing images under low light conditions, an electronic device, and a storage medium, with the aim of capturing clear images under low light conditions at night.
[0056] This application provides a method, apparatus, electronic device, and storage medium for capturing images under low light conditions, which will be specifically described through the following embodiments. First, the method for capturing images under low light conditions in this application embodiment will be described.
[0057] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.
[0058] Foundational technologies for artificial intelligence generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, speech processing, natural language processing, and machine learning / deep learning.
[0059] The low-light image capture method provided in this application relates to the field of image processing technology. This low-light image capture method can be applied to a terminal, a server, or software running on either a terminal or a server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc.; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application implementing the low-light image capture method, but is not limited to the above forms.
[0060] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0061] It should be noted that in all specific embodiments of this application, when processing data related to user identity or characteristics, such as user information, user behavior data, user historical data, and user location information, user permission or consent is obtained first. Furthermore, the collection, use, and processing of this data comply with relevant laws, regulations, and standards. In addition, when embodiments of this application require access to sensitive personal information of users, separate permission or consent from the user is obtained through pop-ups or redirection to confirmation pages. Only after obtaining the user's separate permission or consent is the necessary user-related data required for the proper functioning of these embodiments acquired.
[0062] Figure 1 This is an optional flowchart of the low-light image capture method provided in the embodiments of this application. Figure 1 The method may include, but is not limited to, steps S101 to S105.
[0063] Step S101: Acquire images using a camera to obtain the original image;
[0064] Step S102: Calculate the human proportions of the original image to obtain human proportion data;
[0065] Step S103: Look up the preset data table according to the human figure ratio data to obtain the image segmentation granularity, brightness mean kernel and human figure distance;
[0066] Step S104: Configure the camera flash parameters based on the image segmentation granularity, brightness mean kernel, human distance, and the original image;
[0067] Step S105: Capture images using the configured camera.
[0068] Steps S101 to S105 of this embodiment involve acquiring an original image using a camera; calculating the human proportion in the original image to obtain human proportion data; looking up the human proportion data in a preset data table to obtain image segmentation granularity, brightness mean kernel, and human distance; configuring the camera's flash parameters based on the image segmentation granularity, brightness mean kernel, human distance, and the original image; and capturing an image using the configured camera. Thus, this embodiment dynamically configures the camera flash based on the human proportion data in the original image, the preset data table, and the flash parameter configuration. By dynamically adjusting the flash parameters, the camera can achieve optimal exposure in low-light environments based on the human distance and image brightness requirements, avoiding overexposure or insufficient light collection caused by fixed light intensity.
[0069] In step S101 of some embodiments, when the camera detects the presence of someone in the frame under low-light conditions such as at night, it directly captures that frame, thus obtaining the original image. In this case, the original image may appear dark due to insufficient light.
[0070] Please see Figure 2 In some embodiments, step S102 may include, but is not limited to, steps S201 to S203:
[0071] Step S201: Perform human detection on the original image to obtain multiple candidate target images;
[0072] Step S202: For each candidate target image, perform pixel area statistics on the candidate target image to obtain the candidate target area;
[0073] Step S203: For each candidate target image, the proportion of the human figure is calculated based on the area of the candidate target and the original image.
[0074] Steps S201 to S203, as shown in this embodiment, involve performing human detection on the original image to obtain multiple candidate target images. For each candidate target image, pixel area statistics are performed to obtain the candidate target area. For each candidate target image, a ratio calculation is performed based on the candidate target area and the original image to obtain human proportion data. Thus, this embodiment obtains multiple candidate target images by performing human detection on the original image, and performs pixel area statistics on each candidate target image to obtain the candidate target area. Based on the relationship between the candidate target area and the original image, human proportion data is calculated to determine the proportion of the human figure in the image, accurately judging the size of the human figure in the image, and providing data support for subsequent image processing.
[0075] In step S201 of some embodiments, human detection involves detecting the outlines of people appearing in the image. In one embodiment, human detection can be performed by, for example, using an edge detection algorithm to extract human outlines from the image, and then using the outline information to identify the human figure. In another embodiment, a trained model can be used to identify human figures. After these regions are identified, they become multiple candidate target images. For example, if there are multiple people in the original image, multiple regions will be detected, each region corresponding to a candidate target image.
[0076] In step S202 of some embodiments, for each candidate target image, the area of the candidate target is calculated by statistically analyzing its pixel area. Simply put, the pixel area is obtained by calculating the number of pixels in that region of the image. For example, if a candidate target image contains 1000 pixels, then its area is 1000.
[0077] In step S203 of some embodiments, for example: if the area of a candidate target image is 1,000 pixels and the total area of the original image is 10,000 pixels, then the proportion of the human figure is 1,000 / 10,000 = 0.1, that is, the human figure occupies 10% of the area of the original image.
[0078] Please see Figure 3 In some embodiments, the preset data table includes multiple preset ratio data, and step S103 may include, but is not limited to, steps S301 to S302:
[0079] Step S301: Based on the human figure proportion data, perform a nearest neighbor search on each preset proportion data to obtain the target proportion data; wherein, the difference between the target proportion data and the human figure proportion data is less than or equal to the difference between each preset proportion data and the human figure proportion data.
[0080] Step S302: Look up the preset data table according to the target ratio data to obtain the image segmentation granularity, the mean brightness kernel, and the human figure distance.
[0081] In steps S301 to S302 of this embodiment, a nearest neighbor lookup is performed on each preset ratio data based on the human figure ratio data to obtain the target ratio data; then, a lookup is performed on a preset data table based on the target ratio data to obtain the image segmentation granularity, the mean brightness kernel, and the human figure distance. Thus, this embodiment obtains the image segmentation granularity, the mean brightness kernel, and the human figure distance by looking up tables, providing accurate parameters for subsequent image processing and improving the accuracy of image processing.
[0082] In steps S301 to S302 of some embodiments, for example, as shown in Table 1:
[0083] Human proportion data Image segmentation granularity Luminance mean kernel Human Distance 0.0096 16*20 5 10 0.0385 8*10 3 5 0.077 4*5 1 3
[0084] Table 1
[0085] For example, when the human figure ratio data is 0.009, in step S301, the difference between the human figure ratio data and each preset ratio data is calculated, and the human figure ratio data with the smallest difference is obtained to obtain the target ratio data. Then, the corresponding image segmentation granularity, brightness mean kernel, and human figure distance are obtained based on this target ratio data. For example, Table 1 shows that the image segmentation granularity corresponding to the human figure ratio data of 0.0096 is 16*20, the brightness mean kernel is 5, and the human figure distance is 10.
[0086] Image segmentation granularity refers to the size of the grid into which an image is divided, usually expressed in terms of the number of rows and columns. For example, 16*20 means dividing the image into a small grid of 16 rows and 20 columns. Each grid region calculates the average brightness or other image features. When the human figure is relatively large, a larger grid is needed; when the human figure is relatively small, it means the person is far from the camera, and a smaller grid is needed.
[0087] A brightness mean kernel is a window used to calculate the brightness of an image region. For example, a 3×3 brightness mean kernel means nine sub-images. For a selected sub-image, this means the eight surrounding sub-images.
[0088] Human distance refers to the distance between the camera and the person.
[0089] Please see Figure 4 In some embodiments, step S104 may include, but is not limited to, steps S401 to S402:
[0090] Step S401: Perform image segmentation on the original image according to the image segmentation granularity to obtain the target sub-image and the remaining sub-images;
[0091] Step S402: Configure the camera flash parameters based on the target sub-image, the remaining sub-images, the brightness mean kernel, and the distance to the human figure.
[0092] Steps S401 to S402, as illustrated in this embodiment, involve segmenting the original image according to the image segmentation granularity to obtain a target sub-image and other sub-images; and configuring the camera's flash parameters based on the target sub-image, other sub-images, brightness mean kernel, and human distance. Thus, this embodiment's fine-grained processing and precise parameter configuration of the camera's flash helps ensure that, in low-light environments, the camera can adjust the intensity and exposure of the supplementary light according to the brightness requirements of different areas, thereby guaranteeing image quality.
[0093] In step S401 of some embodiments, image segmentation is the process of dividing the original image into multiple small blocks. The granularity of image segmentation determines the size of each small block; the finer the granularity, the smaller the small blocks, and the coarser the granularity, the larger the small blocks. A target sub-image refers to an image containing a human figure during image segmentation. In step S201, human figure detection is performed to obtain multiple candidate target images, at which point the region containing the human figure has been determined. Then, images that overlap with the region containing the human figure are used as target sub-images, while those that do not overlap are used as the remaining sub-images.
[0094] Please see Figure 5In some embodiments, step S402 includes, but is not limited to, steps S501 to S504:
[0095] Step S501: Obtain the position of the target sub-image in the original image to obtain the target position information;
[0096] Step S502: Based on the target location information and the average brightness value, the remaining sub-images are filtered to obtain the neighboring sub-images;
[0097] Step S503: Calculate the mean value based on the neighboring sub-images and the target sub-image to obtain the mean brightness;
[0098] Step S504: Configure the camera flash parameters based on the target location information, average brightness, and distance to the human figure.
[0099] Steps S501 to S504 of this embodiment illustrate the following steps: obtaining the position of the target sub-image within the original image to obtain target position information; filtering the remaining sub-images based on the target position information and the average brightness value to obtain neighboring sub-images; calculating the average brightness based on the neighboring sub-images and the target sub-image; and configuring the camera's flash parameters based on the target position information, average brightness, and distance to the human figure. Thus, this embodiment effectively avoids excessively high local brightness caused by specular reflection or diffuse reflection by calculating the average brightness of neighboring sub-images and the target sub-image. In low-light environments, specular reflection or diffuse reflection often leads to excessive brightness in certain areas, affecting image quality. By calculating the average brightness of the target sub-image and its neighboring areas, a more balanced brightness value can be obtained, thereby compensating during the camera's flash parameter configuration process and avoiding loss of image detail or brightness distortion caused by local overexposure.
[0100] In step S501 of some embodiments, the target location information is the location information of the target sub-image within each original sub-image. For example, suppose the original image is divided into a 4×4 sub-image grid, with each grid representing a sub-image. If the target sub-image is located in the third row from top to bottom and the fourth row from left to right, then its location information is "third row, fourth column".
[0101] In step S502 of some embodiments, a luminance mean kernel is used to determine neighboring sub-images around the target sub-image. For example, if the luminance mean kernel is 3×3, then a 3×3 neighborhood will be considered for filtering the target sub-image and its surrounding area. Assuming the target sub-image is located in "the third row and the fourth column", then the neighboring area of the target sub-image is the sub-image in one row and one column above, below, left, and right of the target sub-image. For example, neighboring sub-images may include "the second row and the third column", "the second row and the fourth column", "the second row and the fifth column", "the third row and the third column", "the third row and the fifth column", "the fourth row and the third column", "the fourth row and the fourth column", and "the fourth row and the fifth column".
[0102] In step S503 of some embodiments, the average brightness of the neighboring sub-images and the target sub-image is calculated as the brightness of the target sub-image, i.e., the average brightness.
[0103] Please see Figure 6 In some embodiments, step S504 includes, but is not limited to, steps S601 to S604:
[0104] Step S601: Look up the preset brightness table according to the average brightness and the distance to the human figure to obtain the target brightness;
[0105] Step S602: Calculate the difference between the target brightness and the average brightness to obtain the brightness difference;
[0106] Step S603: Based on the target location information, filter the candidate flash units for the camera to obtain the selected flash unit;
[0107] Step S604: Configure the parameters of the selected flash based on the brightness difference to configure the camera's flash parameters.
[0108] In steps S601 to S604 of this embodiment, the target brightness is obtained by looking up a preset brightness table based on the average brightness and the distance to the human figure; the difference between the target brightness and the average brightness is calculated to obtain the brightness difference; the candidate flash units for the camera are screened based on the target position information to obtain the selected flash unit; and the parameters of the selected flash unit are configured based on the brightness difference to achieve flash unit parameter configuration for the camera. Thus, this embodiment, through fine-grained adjustment of the flash unit, enables the camera to perform precise dimming of the corresponding area of the image, thereby ensuring that the human figure and face are accurately captured in the captured image, improving image quality.
[0109] Please see Figure 7 In some embodiments, step S601 may include, but is not limited to, steps S701 to S702:
[0110] Step S701: Perform a proximity search on the preset brightness table based on the distance to the human figure to obtain the target distance, and obtain multiple alternative brightness levels corresponding to the target distance from the preset brightness table;
[0111] Step S702: Perform a nearest neighbor search on each candidate brightness based on the average brightness to obtain the selected brightness, and retrieve the target brightness corresponding to the selected brightness from the preset brightness table.
[0112] Steps S701 to S702, as illustrated in this embodiment, involve performing a proximity search on a preset brightness table based on the distance to the human figure to obtain the target distance, and then obtaining multiple candidate brightness values corresponding to the target distance from the preset brightness table. Next, a proximity search is performed on each candidate brightness value based on the average brightness to obtain the selected brightness, and the target brightness corresponding to the selected brightness is obtained from the preset brightness table. This ensures that the camera selects the most suitable brightness value based on the target distance and the actual brightness requirements of the image during shooting, avoiding uneven exposure caused by fixed brightness and effectively improving image quality in low-light environments.
[0113] In some embodiments, steps S701 to S702 are, for example, shown in Table 2:
[0114]
[0115]
[0116] Table 2
[0117] For example, when the distance to the human figure is 10 meters, multiple alternative brightness levels can be obtained by looking up the table, namely 20, 40, and 50. Then, assuming the average brightness is 38, the target brightness can be determined to be 35.
[0118] In step S602 of some embodiments, the difference between the target brightness and the average brightness is calculated to obtain the brightness difference value. For example, if the average brightness is 40 and the target brightness is 35, then the brightness difference value is -5.
[0119] In step S603 of some embodiments, each position information corresponds to a flash lamp. For example, the upper left corner of the image corresponds to the flash lamp bead in the upper left corner. Based on the target position information, it can be determined which lamp can affect the brightness of the image corresponding to the target position information. The lamp bead corresponding to the target position information is the selected flash lamp.
[0120] In step S604 of some embodiments, for example, when the brightness difference is positive (e.g., 5), the flash can be controlled to increase its brightness, thereby reducing the difference between the target brightness and the average brightness, making the image brightness closer to the expected target. Conversely, when the brightness difference is negative (e.g., -5), the selected flash can be controlled to turn off, while the camera's exposure is reduced, thereby reducing overexposure at that location in the image, making the brightness difference closer to 0.
[0121] In step S105 of some embodiments, after configuration, the camera finely controls the turning on and off of the flash, and determines the brightness of each flash, thereby accurately acquiring a clear image.
[0122] In one embodiment, when shooting in a low-light environment, the original image is first acquired using a camera. Then, human detection is performed on the original image to identify the target human figure region and calculate the proportion of that region in the original image. For example, suppose the calculation result shows that the target human figure region occupies 10% of the original image, i.e., the human figure proportion data is 0.1. Based on the human figure proportion data, a preset data table is consulted to obtain the image segmentation granularity, brightness mean kernel, and human figure distance corresponding to that proportion. Suppose the table shows an image segmentation granularity of 8×10, a brightness mean kernel of 3×3, and a human figure distance of 5 meters.
[0123] Based on the image segmentation granularity, the camera divides the original image into multiple sub-images, each with a size of 8×10. Through image segmentation, a target sub-image and the remaining sub-images are obtained. Then, based on the target sub-image's location information and its mean brightness kernel, surrounding sub-images are filtered to obtain neighboring sub-images. Further, the mean brightness of the region is obtained by calculating the mean brightness of the target sub-image and its neighboring sub-images. Assume the calculated mean brightness is 50.
[0124] Next, the camera looks up the target brightness in a preset brightness table based on the average brightness and the distance to the person. Given a target distance of 5 meters, the camera retrieves several candidate brightness values from the preset brightness table, assuming these are 80, 85, and 90. Based on the average brightness of 50, the camera selects the brightness value of 80, which is closest to the average brightness, as the selected brightness. Then, it retrieves the corresponding value of the selected brightness from the table to obtain the target brightness.
[0125] The brightness difference is calculated by measuring the difference between the target brightness and the average brightness. If the brightness difference is positive, the camera adjusts its flash accordingly to ensure the target area's brightness is close to the target brightness. If the brightness difference is negative (e.g., the target brightness is 50 while the average brightness is 60), the camera turns off the flash and reduces exposure to avoid overexposure. Ultimately, by adjusting the flash brightness, the camera ensures a clear and evenly exposed image in low-light conditions.
[0126] Please see Figure 8 This application also provides a low-light image capturing device, which can realize the above-mentioned low-light image capturing method. The device includes:
[0127] The image acquisition module 801 is used to acquire images through a camera to obtain raw images;
[0128] The proportion calculation module 802 is used to calculate the human proportion of the original image and obtain human proportion data;
[0129] The data lookup module 803 is used to look up a preset data table based on the human figure proportion data to obtain the image segmentation granularity, the brightness mean kernel, and the human figure distance;
[0130] The parameter configuration module 804 is used to configure the camera's flash parameters based on the image segmentation granularity, brightness mean kernel, human distance, and the original image.
[0131] Image capture module 805 is used to capture images using a configured camera.
[0132] The specific implementation of this low-light image capturing device is basically the same as the specific implementation of the low-light image capturing method described above, and will not be repeated here.
[0133] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described low-light image capture method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0134] Please see Figure 9 , Figure 9 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes:
[0135] The processor 901 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0136] The memory 902 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 902 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 902 and is called and executed by the processor 901 to execute the low-light image capture method of the embodiments of this application.
[0137] The input / output interface 903 is used to implement information input and output;
[0138] The communication interface 904 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0139] Bus 905 transmits information between various components of the device (e.g., processor 901, memory 902, input / output interface 903, and communication interface 904);
[0140] The processor 901, memory 902, input / output interface 903, and communication interface 904 are connected to each other within the device via bus 905.
[0141] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described low-light image capture method.
[0142] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0143] The low-light image capture method, device, electronic equipment, and storage medium provided in this application embodiment acquire images using a camera to obtain original images; calculate the human proportions of the original images to obtain human proportion data; look up the human proportion data in a preset data table to obtain image segmentation granularity, brightness mean kernel, and human distance; configure the camera's flash parameters based on the image segmentation granularity, brightness mean kernel, human distance, and the original image; and capture images using the configured camera. Thus, this application embodiment dynamically configures the camera flash based on human proportion data in the original image, a preset data table, and flash parameter configuration. By dynamically adjusting the flash parameters, it ensures that the camera can achieve optimal exposure in low-light environments based on the human distance and image brightness requirements, avoiding overexposure or underexposure caused by fixed light intensity.
[0144] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0145] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0146] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0147] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0148] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0149] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0150] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0151] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0152] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0153] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0154] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A method for capturing images under low light conditions, characterized in that, Applied to a camera, the method includes: The camera captures images to obtain the original images; The original image is subjected to human proportion calculation to obtain human proportion data; The image segmentation granularity, brightness mean kernel, and human figure distance are obtained by looking up the preset data table based on the human figure ratio data. The camera flash parameters are configured based on the image segmentation granularity, the brightness mean kernel, the human figure distance, and the original image. Images are captured using the configured camera.
2. The method according to claim 1, characterized in that, The step of calculating the human proportions of the original image to obtain human proportion data includes: Human detection is performed on the original image to obtain multiple candidate target images; For each of the candidate target images, the pixel area of the candidate target image is statistically analyzed to obtain the area of the candidate target; For each of the candidate target images, the proportion data of the human figure is obtained by calculating the proportion of the candidate target area and the original image.
3. The method according to claim 1, characterized in that, The preset data table includes multiple preset ratio data; the step of looking up the preset data table based on the human figure ratio data to obtain the image segmentation granularity, brightness mean kernel, and human figure distance includes: Based on the human figure proportion data, a nearest neighbor search is performed on each of the preset proportion data to obtain the target proportion data; wherein, the difference between the target proportion data and the human figure proportion data is less than or equal to the difference between each of the preset proportion data and the human figure proportion data; The image segmentation granularity, the mean brightness kernel, and the human figure distance are obtained by looking up the preset data table based on the target ratio data.
4. The method according to claim 1, characterized in that, The step of configuring the camera's flash parameters based on the image segmentation granularity, the brightness mean kernel, the human distance, and the original image includes: The original image is segmented according to the image segmentation granularity to obtain the target sub-image and the remaining sub-images; The camera flash parameters are configured based on the target sub-image, the remaining sub-images, the brightness mean kernel, and the human distance.
5. The method according to claim 4, characterized in that, The step of configuring the camera's flash parameters based on the target sub-image, the remaining sub-images, the brightness mean kernel, and the human distance includes: The position of the target sub-image in the original image is obtained to obtain the target position information; Based on the target location information and the average brightness value, the remaining sub-images are filtered to obtain neighboring sub-images; The mean brightness is obtained by calculating the mean value of the neighboring sub-image and the target sub-image. The camera's flash parameters are configured based on the target location information, the average brightness, and the distance to the human figure.
6. The method according to claim 5, characterized in that, The step of configuring the camera's flash parameters based on the target location information, the average brightness, and the distance to the human figure includes: The target brightness is obtained by looking up a preset brightness table based on the average brightness and the distance to the human figure. Calculate the difference between the target brightness and the average brightness to obtain the brightness difference; Based on the target location information, the candidate flash units for the camera are filtered to obtain the selected flash unit; The selected flash is configured with parameters based on the brightness difference to configure the flash parameters of the camera.
7. The method according to claim 6, characterized in that, The step of looking up a preset brightness table based on the average brightness and the distance to the human figure to obtain the target brightness includes: Based on the human figure distance, a nearest neighbor search is performed on the preset brightness table to obtain the target distance, and multiple alternative brightness levels corresponding to the target distance are obtained from the preset brightness table; Based on the average brightness, a nearest neighbor search is performed on each of the candidate brightnesses to obtain the selected brightness, and the target brightness corresponding to the selected brightness is obtained from the preset brightness table.
8. A device for capturing images under low light conditions, characterized in that, Applied to a camera, the device includes: The image acquisition module is used to acquire images through the camera to obtain raw images; The proportion calculation module is used to calculate the human proportion of the original image to obtain human proportion data; The data lookup module is used to look up the preset data table based on the human figure ratio data to obtain the image segmentation granularity, the brightness mean kernel, and the human figure distance; The parameter configuration module is used to configure the flash parameters of the camera based on the image segmentation granularity, the brightness mean kernel, the human distance, and the original image. An image capture module is used to capture images using the configured camera.
9. An electronic device, characterized in that, The electronic device includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the low-light image capture method according to any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the low-light image capture method according to any one of claims 1 to 7.