A megapixel camera control method based on multi-functional fusion

By generating an initial brightness distribution map and color temperature information for white balance correction, combined with real-time ambient light monitoring and flash compensation, high-quality imaging of megapixel cameras in complex scenes is achieved, solving the problems of image clarity, color accuracy and exposure stability, and improving the application performance of cameras in consumer electronics and security monitoring fields.

CN120935465BActive Publication Date: 2026-01-30NINGBO JINSHENGXIN IMAGE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511468759.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-10-15
Publication Date
2026-01-30
Estimated Expiration
2045-10-15

AI Technical Summary

Technical Problem

Existing megapixel cameras struggle to balance image clarity, color accuracy, and exposure stability in complex scenarios. The lack of coordination mechanisms between control modules leads to a decline in image quality, failing to meet the high-quality imaging requirements of consumer electronics, security monitoring, and other fields.

Method used

By generating an initial brightness distribution map to calculate the scene's dynamic range, combining color temperature information for white balance correction, and monitoring ambient light intensity in real time to activate the flash compensation module, the exposure parameters and focus motor travel are dynamically adjusted, achieving deep integration of exposure control, white balance correction, touchscreen focusing, and flash compensation.

Benefits of technology

It improves the overall clarity and color consistency of images, reduces overexposed or underexposed areas, ensures accurate color reproduction of images under different lighting conditions, and enhances the imaging stability and adaptability of the camera in complex scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120935465B_ABST
    Figure CN120935465B_ABST
Patent Text Reader

Abstract

This invention relates to the field of camera control technology and discloses a megapixel camera control method based on multi-functional fusion. The method includes acquiring raw image data from an image sensor, preprocessing to generate an initial brightness distribution map; calculating the scene dynamic range based on this to determine a target exposure parameter set including exposure time, gain coefficient, and aperture value; simultaneously analyzing color temperature information and matching a preset white balance model to output correction coefficients; and combining both to generate a first control command which is sent to the image sensor. The method also includes receiving a touchscreen focus signal, extracting the focus area coordinates to adjust the focus motor travel parameters, and monitoring ambient light intensity in real time. When the ambient light intensity is below a preset threshold, the flash compensation module is activated and a compensation light value is calculated. In shooting mode, the flash output power is adjusted according to the compensation light value, and the target exposure parameter set is recalibrated based on the focus area coordinates to improve the camera's adaptability to complex scenes and image quality.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of camera control, in particular to a million-pixel camera control method based on multi-function fusion. BACKGROUND

[0002] With the increasing demand for image acquisition quality in the field of consumer electronics and security monitoring, million-pixel cameras have become mainstream application devices. Currently, most camera control methods present a single feature in function implementation, and there is a lack of effective coordination mechanism between control modules, making it difficult to balance image clarity, color accuracy and exposure stability in complex scenes.

[0003] In terms of exposure control, traditional methods rely on fixed parameters or single brightness feedback for adjustment, which can only roughly adapt to the overall brightness of the scene and cannot accurately respond to environments with large light-dark contrast. For example, in backlight scenes, the foreground is often too dark or the background is overexposed, making it difficult to ensure image details in different regions. At the same time, during the adjustment of traditional exposure parameters, the influence of color temperature changes on image color restoration is not fully considered, resulting in image color deviation in different light source environments, such as warm tone deviation under incandescent lamp environment or cold tone deviation under fluorescent lamp environment, affecting visual experience and the accuracy of subsequent image analysis.

[0004] In the focus control link, existing touch screen focusing technology can only perform simple focus positioning according to user click position, without coordinated adjustment of scene brightness, exposure parameters and other information. When the user triggers focus in a low brightness area, due to the lack of effective light compensation and parameter calibration, problems such as focus blur and increased image noise may occur, reducing the imaging quality. In addition, in flash use scenarios, traditional control methods usually use fixed power output or simple light quantity estimation, without dynamic matching with the focus area and real-time ambient light intensity, resulting in over-brightness in close-range shooting and insufficient light quantity in long-range shooting, which cannot achieve accurate light compensation.

[0005] The current million-pixel camera control functions lack deep fusion and coordinated optimization, and the parameter mismatch caused by independent work of each module makes it difficult for the camera to continuously and stably output high-quality images in complex and variable application scenarios, which cannot meet the needs of high definition, high color restoration and high scene adaptability in the fields of consumer electronics, security monitoring, machine vision and other fields. A camera control scheme that can realize multi-parameter coordination and multi-function fusion is needed to improve the overall imaging performance and scene adaptation ability. SUMMARY

[0006] The present application aims to provide a million-pixel camera control method based on multi-function fusion to solve the problems raised in the background.

[0007] To achieve the above object, the application provides a million-pixel camera control method based on multi-function fusion, which comprises the following steps:

[0008] obtaining original image data collected by an image sensor and pre-processing the original image data to generate an initial brightness distribution map;

[0009] calculating a scene dynamic range according to the initial brightness distribution map, determining a target exposure parameter set based on the scene dynamic range, and the target exposure parameter set comprising an exposure time, a gain coefficient and an aperture value;

[0010] synchronously analyzing color temperature information of the initial brightness distribution map, matching a preset white balance model through the color temperature information, and outputting a white balance correction coefficient;

[0011] combining the target exposure parameter set and the white balance correction coefficient, generating a first control instruction and sending the first control instruction to the image sensor;

[0012] receiving a touch screen focusing signal triggered by a user, extracting focal point area coordinates corresponding to the touch screen focusing signal, and adjusting stroke parameters of a focusing motor according to the focal point area coordinates;

[0013] real-time monitoring of ambient light intensity, activating a flash compensation module and calculating a compensation light amount value when the ambient light intensity is lower than a preset threshold;

[0014] in a photographing mode, adjusting a flash output power according to the compensation light amount value, and recalibrating the target exposure parameter set based on the focal point area coordinates.

[0015] Preferably, the pre-processing comprises the following steps:

[0016] dividing the original image data into a plurality of sub-regions, and calculating average brightness values of each sub-region respectively;

[0017] constructing a brightness histogram according to the average brightness values, and identifying overexposed regions and underexposed regions through the brightness histogram;

[0018] weighting the overexposed regions and the underexposed regions, and generating a weighted brightness distribution map as the initial brightness distribution map.

[0019] Preferably, the step of determining the target exposure parameter set comprises the following steps:

[0020] querying a preset exposure mapping table according to the scene dynamic range, and obtaining a basic exposure time and a basic gain coefficient;

[0021] dynamically correcting the basic exposure time based on a difference between a peak brightness and a mean brightness of the initial brightness distribution map;

[0022] According to the modified basic exposure time and the basic gain coefficient, a diaphragm control curve is matched to determine a diaphragm value.

[0023] Preferably, the generation of the white balance correction coefficient comprises:

[0024] Color temperature sampling points of the highlight area and the shadow area are extracted from the initial brightness distribution map.

[0025] A color temperature difference value of the highlight area and the shadow area is calculated, and a corresponding white balance algorithm is selected according to the color temperature difference value.

[0026] A red channel gain and a blue channel gain are output by the white balance algorithm to form the white balance correction coefficient.

[0027] Preferably, the adjustment of the stroke parameter of the focusing motor comprises:

[0028] A depth of field range is calculated according to the focus area coordinates, and a target step length of the focusing motor is determined based on the depth of field range.

[0029] Contrast data of the image sensor are collected in real time, and the target step length is adjusted by feedback of the contrast data.

[0030] When the contrast data reaches a local maximum value, the final stroke parameter of the focusing motor is locked.

[0031] Preferably, the step of calculating the compensation light amount value comprises:

[0032] An average brightness of the ambient light intensity and the focus area coordinates is obtained, and a difference between the two is calculated as a reference compensation amount.

[0033] A flash power mapping table is queried according to the reference compensation amount to obtain an initial compensation light amount value.

[0034] The initial compensation light amount value is nonlinearly scaled in combination with the gain coefficient in the target exposure parameter set.

[0035] Preferably, the recalibration of the target exposure parameter set comprises:

[0036] A brightness change rate of an image frame in a flash activated state is detected, and an upper threshold of the exposure time is adjusted according to the brightness change rate.

[0037] Based on real-time brightness fluctuations of the focus area coordinates, a smoothing filter parameter of the gain coefficient is dynamically updated.

[0038] According to the updated smoothing filter parameter and the upper threshold of the exposure time, a second control instruction is generated.

[0039] Preferably, the dynamic updating of the smoothing filter parameter of the gain coefficient comprises:

[0040] Establish a time series of brightness changes in the coordinates of the focal region, and calculate the first derivative of the time series;

[0041] When the first derivative exceeds the preset fluctuation threshold, increase the window width of the smoothing filter parameters;

[0042] The moving average of the gain coefficient is recalculated using the window width.

[0043] Preferably, the response of the touchscreen focus signal includes:

[0044] It recognizes the duration of the touchscreen focus signal and activates multi-point focus mode when the duration exceeds a set threshold.

[0045] In multi-point focus mode, the depth-of-field weight value of each touch point is calculated separately;

[0046] The composite focus area is generated by fusing based on the depth-of-field weight value, and the focus priority of the composite focus area is output.

[0047] Preferably, the generation of the composite focus area includes:

[0048] Extract the coordinate set of each touch point, and construct a spatial distribution matrix based on the coordinate set;

[0049] The density cluster centers are calculated using the spatial distribution matrix, and these density cluster centers are used as the core coordinates of the composite focusing region.

[0050] The stroke weights of the focusing motors are assigned based on the Euclidean distance between the core coordinates and each touch point.

[0051] Compared with the prior art, the beneficial effects of the present invention are:

[0052] In the image preprocessing stage, by generating an initial brightness distribution map and calculating the scene dynamic range based on it, the brightness differences in different areas of the scene can be accurately captured. This provides comprehensive scene brightness information for subsequent exposure parameter adjustments, avoiding parameter adaptation deviations caused by traditional single brightness feedback. This makes the determination of the exposure parameter set (including exposure time, gain coefficient, and aperture value) more consistent with the actual brightness distribution of the scene, effectively improving the image detail presentation in environments with large brightness contrast, reducing the occurrence of overexposed or underexposed areas, and improving the overall image clarity and detail richness.

[0053] In the color temperature processing and white balance correction stages, the color temperature information from the initial brightness distribution map is simultaneously incorporated into the analysis. By matching the preset white balance model to output correction coefficients, synergistic optimization of exposure control and color reproduction is achieved. This integrated processing method breaks through the limitations of traditional independent adjustment of exposure and white balance, avoiding image color cast problems caused by untimely adaptation to color temperature changes. It ensures that image colors can accurately reproduce the true colors of the scene under different lighting environments, improving image color consistency and visual comfort, and meeting the needs of application scenarios with high color reproduction requirements, such as product photography and ID photo shooting.

[0054] The combination of touchscreen focusing and parameter calibration further optimizes the accuracy of focus control and imaging stability. By extracting the coordinates of the focus area corresponding to the touchscreen focusing signal and adjusting the focus motor travel parameters accordingly, the desired focus position can be quickly and accurately located. Simultaneously, in shooting mode, the target exposure parameter set is recalibrated based on the focus area coordinates, achieving dynamic matching between the focus position and exposure parameters. This collaborative mechanism avoids the problem of unsuitable brightness in the focus area caused by unchanged exposure parameters after focusing in traditional methods, ensuring that the focus area is always in optimal exposure, improving image clarity in the focus area, and reducing focus blur caused by parameter mismatch.

[0055] The linkage between real-time ambient light monitoring and the flash compensation module effectively solves the image quality problem in low-light environments. When the ambient light intensity is lower than a preset threshold, the flash compensation module is automatically activated and the compensation light amount is calculated. Simultaneously, the flash output power is adjusted based on the compensation light amount, achieving dynamic adaptation between light compensation and ambient light intensity. This dynamic adjustment method avoids the problem of excessive or insufficient light caused by traditional fixed-power flashes, ensuring that in low-light environments, sufficient light is provided to enhance image brightness while avoiding loss of detail due to excessive brightness. Furthermore, parameter calibration combined with focus area coordinates allows flash compensation to accurately target the focus area, further improving the imaging effect in the focus area, reducing image noise, and improving overall image quality in low-light environments.

[0056] Throughout the entire control process, functions such as exposure control, white balance correction, touchscreen focusing, and flash compensation do not operate independently. Instead, they are deeply integrated through parameter transmission and collaborative calibration. Parameters in each stage are mutually adapted and dynamically adjusted, forming a complete closed-loop control system. This multi-functional integrated control method effectively eliminates parameter conflicts and adaptation deviations caused by the independent operation of traditional modules. It enables the camera to adjust various parameters in real time according to scene changes, significantly improving its adaptability to different lighting conditions, color temperatures, and user operation needs. This allows for the continuous and stable output of high-quality images in various application scenarios such as consumer electronics, security monitoring, and machine vision, enhancing the camera's product competitiveness and application applicability. Attached Figure Description

[0057] Figure 1 This is a schematic diagram illustrating the working principle of the megapixel camera control method based on multi-functional fusion described in this invention.

[0058] Figure 2 This is a flowchart of the preprocessing steps;

[0059] Figure 3 A flowchart of the steps to determine the target exposure parameter set. Detailed Implementation

[0060] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0061] Please see Figure 1This invention provides a megapixel camera control method based on multi-functional fusion. The method includes: acquiring raw image data collected by an image sensor, wherein the raw image data is input in RAW format and parsed by a preprocessing module. The preprocessing includes de-mosaicing and noise suppression operations on the raw data to generate an initial brightness distribution map reflecting the scene brightness characteristics; the initial brightness distribution map is used to calculate the scene dynamic range, which is obtained by analyzing the ratio of the maximum and minimum values ​​of the brightness distribution; based on the dynamic range, a preset exposure parameter database is queried to determine a target exposure parameter set including exposure time, gain coefficient, and aperture value; simultaneously, color temperature information is extracted from the initial brightness distribution map, which is obtained by analyzing the color coordinates of the highlight and shadow areas in the image, matching a preset white balance model such as a gray-world model or a perfect reflection model, and outputting white balance correction coefficients including red channel gain and blue channel gain; combined with the target... The system generates a first control command based on the exposure parameter set and white balance correction coefficients. This command is encapsulated using I2C or SPI protocol and sent to the image sensor to drive it to adjust its operating parameters. At the user interaction level, it receives touchscreen focus signals from the touchscreen device. These signals contain the coordinates of the touch point. After extracting the coordinates of the focus area, a coordinate mapping algorithm is used to convert them into the corresponding area on the image plane. Based on this area, the travel parameters of the focus motor are adjusted to achieve rapid focus point positioning. Ambient light intensity is monitored in real-time by a photosensor. When the ambient light intensity is lower than a preset threshold (set according to typical indoor and outdoor lighting conditions), the flash compensation module is activated. This module calculates a compensation light value based on the current exposure parameters and focus brightness. In shooting mode, the compensation light value is used to adjust the flash output power. Simultaneously, based on real-time feedback of the focus area coordinates, the target exposure parameter set is recalibrated to ensure stable image quality.

[0062] Example 1: See Figure 2The preprocessing step is the initial stage of the image data processing flow, and its processing quality directly affects the decision-making accuracy of all subsequent control modules. This process begins with the raw data stream acquired by the image sensor, which is typically in Bayer array format and contains unprocessed color and brightness information. The preprocessing module first performs preliminary corrections on the raw data, including bad pixel repair and lens shading compensation, to eliminate inherent sensor defects and distortions introduced by the environment. Then, the core sub-region segmentation stage begins, dividing the entire image frame into several regular rectangular blocks. The segmentation strategy is not fixed but dynamically adjusted based on the total image resolution and the real-time load of the processing system. For example, an image with a megapixel count can be divided into a grid system consisting of several rows and columns, with each grid cell containing a specific number of pixels. This segmentation method aims to transform global, complex image information into local, more manageable statistical units, providing a foundation for subsequent statistical analysis. After segmentation, the system calculates the average brightness value of each sub-region in parallel, a computationally intensive process. The calculation of the average brightness value is not a simple summation of the brightness values ​​of all pixels within a region divided by the number of pixels. Instead, a weighted calculation method is used, assigning higher weights to pixels closer to the center of the region and relatively lower weights to pixels at the edges. This design is intended to simulate the higher visual sensitivity of the fovea region in the human visual system. During the calculation, the brightness value of each pixel is extracted from its original RGB color space using a standard conversion formula, resulting in a scalar value representing the brightness level of that point. The brightness values ​​of all pixels are then accumulated and averaged after weight adjustment, ultimately yielding a representative brightness index for each sub-region. These indices constitute a discretized sampling of the brightness distribution of the entire image.

[0063] Based on these discrete brightness sampling points, the system begins to construct a brightness histogram for the entire image. The horizontal axis of the histogram represents possible brightness levels, typically ranging from 0 to 255 (256 levels in total), while the vertical axis represents the proportion or absolute number of pixels belonging to each brightness level in the entire image. The process of constructing the histogram is essentially a statistical classification process. The system iterates through all sub-regions, calculates the average brightness value, categorizes it into the corresponding brightness level interval, and updates the count for that interval. The generated brightness histogram presents the distribution of pixels with different levels of brightness in the image, forming an intuitive, global brightness overview. By analyzing the shape of this histogram—for example, whether it is biased to the left (dark tones), the right (bright tones), or has a central bulge (midtones)—the overall lighting characteristics of the scene can be quickly grasped. The system uses the constructed brightness histogram to identify areas in the image with exposure problems, primarily overexposed and underexposed areas. Overexposed areas refer to those areas where the brightness value reaches or approaches the maximum value that the sensor can record. In these areas, the image's detail information is lost due to brightness saturation, appearing as a textureless bright spot. Conversely, underexposed areas refer to regions with extremely low brightness values, close to the bottom of the sensor noise level, where details are buried in darkness. The identification algorithm uses thresholds to achieve this; for example, sub-regions with brightness values ​​above a certain upper threshold are marked as overexposed areas, and sub-regions with brightness values ​​below a certain lower threshold are marked as underexposed areas. These thresholds are not absolutely fixed and are sometimes fine-tuned by referring to the distribution patterns at both ends of the histogram to avoid misclassifying a few noise points as problem areas.

[0064] After accurately identifying overexposed and underexposed areas, the system needs to assign them differentiated weights. The core idea of ​​the weighting strategy is that exposure problems at different locations have varying degrees of impact on the final image's subjective quality. Generally, overexposed or underexposed areas located in the image center, being more likely to contain the main subject, have a more severe impact and are therefore assigned higher weights (possibly negative weights, indicating a problem requiring priority correction); while exposure problems located at the image edges are assigned lower weights. The weighting coefficients may be determined based on a predefined weight map, which has the highest values ​​in the image center and smoothly decreases towards the edges. Each sub-region is assigned a weighting coefficient based on its position within the entire image. The system uses the brightness values ​​of all sub-regions and their corresponding weighting coefficients to generate a weighted initial brightness distribution map. This process involves multiplying the average brightness value calculated for each sub-region by its assigned weighting coefficient to obtain a weighted brightness value. Then, all these weighted brightness values ​​together constitute a new brightness distribution map that reflects the importance of each region. This weighted brightness distribution map is no longer just an objective record of brightness, but incorporates subjective evaluations of the importance of different areas of the image. It will serve as core input data for subsequent critical control decisions such as exposure parameter calculation and white balance adjustment. The entire preprocessing process is implemented through highly parallelized hardware logic or optimized software algorithms, ensuring a reliable data foundation for high-quality imaging of megapixel cameras under strict real-time requirements.

[0065] The preprocessing workflow is designed with the complexity of real-world applications in mind. For example, in scenarios with highly uneven brightness distribution, a simple global average brightness might lead to misjudgments. By dividing the scene into sub-regions and assigning weights, the system can more precisely perceive the exposure requirements of different parts of the image. Especially in backlit or high-contrast scenes, this approach helps preserve highlight details or enhance shadow brightness, avoiding severe local exposure errors. The weighting model can be dynamically adjusted according to different shooting modes. For instance, in portrait mode, the system might preload a profile that emphasizes the weight of the central area, while in landscape mode, the weight distribution might be more uniform to ensure balanced exposure across the entire image. The entire preprocessing process is completed at the front end of the image signal processor, and its computational efficiency and accuracy directly affect the response speed and quality of camera control. To achieve real-time processing, the calculation of average brightness in sub-regions typically employs optimization algorithms such as integral maps to accelerate the process. The brightness histogram is also constructed using a dynamic update mechanism. It's not built from scratch for each frame, but rather weighted and fused with the histogram of the previous frame. This ensures fast response times while smoothing brightness fluctuations between frames, avoiding screen flickering caused by frequent changes in exposure parameters. The algorithm for identifying overexposed and underexposed areas also has a degree of fault tolerance; for example, it ignores very small, isolated areas to prevent unnecessary exposure adjustments due to a few highlights or noise points in the image.

[0066] Example 2: See Figure 3The process of determining the target exposure parameter set begins with the precise calculation of the scene's dynamic range. This calculation is based on an initial brightness distribution map generated during the preprocessing stage, which provides weighted brightness values ​​for each sub-region of the image. The system extracts the global maximum and minimum brightness values ​​from this distribution map. The maximum brightness value typically corresponds to light sources or highlight areas in the scene, while the minimum brightness value corresponds to shadows or dark object surfaces. The logarithm of the ratio between these two values ​​is converted into a linear dynamic range index to characterize the scene's brightness span. This dynamic range value is used to retrieve an exposure map pre-stored in the device firmware. This map contains combinations of base exposure times and base gain coefficients calibrated through extensive testing within different dynamic range intervals. Its purpose is to provide an initial, roughly correct exposure starting point for the current scene, avoiding the delays and uncertainties associated with calculating from scratch. After obtaining the base exposure parameters, the system introduces a dynamic correction step to improve the accuracy and adaptability of the exposure. This correction is based on an analysis of the difference between the peak brightness and the average brightness of the initial brightness distribution map. Peak brightness reflects the intensity of the brightest point in an image, while average brightness represents the overall brightness level of the scene. The difference between the two indicates the contrast characteristics of the scene. A larger difference usually means that there are particularly bright highlights and dark shadows in the scene, resulting in strong contrast. In this case, a more conservative exposure strategy is needed to prevent the loss of highlight details, thus the base exposure time is adjusted downwards. Conversely, if the difference is small, it indicates that the scene is evenly lit, allowing for a longer exposure time to improve the overall signal-to-noise ratio. The correction logic is implemented through a feedback algorithm that uses the difference as an input variable to dynamically adjust the increase or decrease of the base exposure time, ultimately outputting a corrected exposure time value.

[0067] After determining the corrected exposure time and base gain, the process moves to determining the aperture value. The choice of aperture size is closely coupled with the exposure time and gain, jointly affecting the final image brightness and depth of field. The system calls the corresponding aperture control curve based on the currently used lens model. This curve defines the trade-off between aperture, shutter speed, and gain under different lighting conditions to achieve optimal image quality. For example, in bright light, the system may tend to choose a smaller aperture to obtain a greater depth of field, while using a shorter exposure time and lower gain; in low light, it may prioritize opening the aperture to ensure sufficient light intake and carefully use gain to control noise. The matching process is a multi-objective optimization process that needs to find a balance point under multiple constraints such as appropriate brightness, reasonable depth of field, and controllable noise, thereby ultimately determining a set of target exposure parameters that work together: exposure time, gain, and aperture value.

[0068] The generation of white balance correction coefficients is an independent process processed in parallel with exposure control. Its purpose is to eliminate the influence of light source color temperature on the inherent color of objects, aiming to ensure that white objects remain white under different lighting conditions. This process first extracts effective color temperature sampling points from the initial brightness distribution map. The selection of sampling points is targeted, mainly focusing on the highlight and shadow areas of the image. Highlight areas typically contain more color temperature information from the light source, while shadow areas may reflect the color temperature characteristics of ambient light. The system filters pixels in these areas by setting brightness thresholds; for example, only the top 10% of pixels with brightness values ​​are sampled as highlight samples, and the bottom 10% as shadow samples. After collecting enough sample points, the system calculates the average color temperature value of the highlight and shadow areas and obtains the color temperature difference between them. This difference reveals possible mixed light sources or color temperature changes caused by light attenuation in the scene. Based on the magnitude of this color temperature difference, the system selects the most suitable white balance algorithm from a preset algorithm library. If the color temperature difference is small, it indicates that the lighting is relatively uniform, and the computationally efficient gray-world algorithm may be used. If the color temperature difference is large, it indicates that the lighting conditions are complex, and a more accurate color temperature estimation method may be used, such as correcting by finding the point in the image that is closest to a neutral color.

[0069] The selected white balance algorithm performs statistical analysis on the collected color temperature samples, ultimately outputting a set of channel gain coefficients. These coefficients typically include red and blue channel gains, while the green channel gain is usually kept at 1.0 as a reference. These gain coefficients constitute the white balance correction coefficients, which are applied to the color correction matrix in the image signal processing pipeline to scale the raw RGB data output from the sensor to compensate for color casts. For example, under low color temperature light sources such as tungsten lamps, the image will appear warm and yellowish; the algorithm will calculate a higher blue channel gain to increase the blue light component, thus neutralizing the yellow tone. In high color temperature environments such as shadows, the image will appear cool and blueish, requiring a higher red channel gain to add warmth. The entire white balance correction process is a closed-loop system; the correction coefficients are fine-tuned based on feedback from subsequent image frames to achieve stable color reproduction. The determination of exposure parameters and white balance coefficients is not an isolated decision; there are subtle interactions between them. For example, changes in exposure may slightly affect the calculated color temperature value. Therefore, in advanced implementations, there may be some minor data exchange and iterative optimization between these two processes. For example, after a significant change in exposure parameters, the white balance calculation may be quickly recalculated with reference to the new brightness distribution map to ensure the overall coordination between color and exposure control. The entire decision-making process relies heavily on pre-calibrated data maps and adjustable parameters. These data are typically precisely calibrated for the sensor and lens combination before leaving the factory and allow for some user customization to accommodate different shooting styles and preferences.

[0070] Example 3: The adjustment of the focus motor's stroke parameters and the calculation of the flash compensation light amount are two processes closely linked in camera control to improve focusing accuracy and image quality in low-light environments. This implementation begins with the parsing of the touchscreen focusing signal. When a user touches the screen, the touch drive circuit generates an interrupt signal containing the coordinate information of the touch point, as well as metadata such as pressure and timestamp. The system kernel's interrupt service routine immediately responds to this signal and calls the coordinate transformation module to map the touch point's screen coordinates to the image sensor's pixel coordinates. The mapping process considers the geometric correspondence between the screen and the sensor and may involve rotation and scaling corrections to ensure that the touch point accurately corresponds to the expected area on the image. The mapped coordinates are defined as the focus area coordinates, which are two-dimensional vectors representing the target focus point on the image plane. Based on the acquired focus area coordinates, the system initiates the depth-of-field calculation process. The depth-of-field range defines the range of distances in front of and behind objects in the image that can maintain sharp focus; its calculation depends on the lens's physical parameters and the current optical settings. During calculation, the system reads the lens's focal length, the current aperture value, and the estimated object distance. The object distance can be obtained through an active rangefinder (such as infrared or laser) or estimated based on historical data from contrast detection. The depth of field is determined by two boundary values: near depth of field and far depth of field, which define the spatial range for sharp imaging. Based on the calculated depth of field, the system then determines the target step size that the focusing motor needs to move. The target step size is an integer value representing the motor's micro-movement distance, and it is inversely proportional to the depth of field—the smaller the depth of field, the higher the focusing accuracy required, and the finer the required step size. The specific value of the step size is obtained by querying a pre-stored focusing curve table, which maps the depth of field to the corresponding step size increment.

[0071] After determining the target step size, the system enters a real-time acquisition and feedback adjustment phase. It acquires contrast data from the image sensor near the focus area in real time. This contrast data quantifies image sharpness by calculating the gradient magnitude or Laplacian variance of pixels in that area. The acquisition process is performed at a high frame rate, such as tens of times per second, to ensure timely response to scene changes. The acquired contrast data is sent to a feedback controller, which uses a hill-climbing algorithm or a variant of the gradient ascent method to dynamically adjust the target step size of the focusing motor. The core idea of ​​the feedback controller is to drive the motor to move at the current step size while monitoring the trend of contrast value changes. If the contrast increases after moving, it continues to move in the same direction and may appropriately increase the step size to accelerate convergence; if the contrast decreases, it moves in the opposite direction or decreases the step size to improve accuracy. This adjustment process iterates continuously, gradually approaching the optimal focus point. When the contrast data reaches a local maximum, the system determines that focusing is complete and then locks the final travel parameters of the focusing motor. The locking mechanism includes stopping the motor movement and recording the current stepper position. Local maximum detection is achieved by setting a stability threshold. For example, if the change in contrast sampling values ​​is less than a certain minimum value after several consecutive iterations, the peak value is considered to have been found. The locked travel parameters are stored in non-volatile memory for direct access in subsequent shooting operations, avoiding delays caused by repeated focusing. The entire focus adjustment process emphasizes real-time performance and adaptability, effectively handling focus deviations caused by object movement or changes in lighting in the scene.

[0072] While focusing, the system simultaneously monitors ambient light intensity, continuously measured by an onboard ambient light sensor typically located near the camera module to minimize measurement errors. The monitored data is smoothed using a low-pass filter to eliminate instantaneous fluctuations. When the ambient light intensity falls below a preset threshold (set based on typical shooting scenarios, such as indoors or at night), the system activates the flash compensation module. Upon activation, the module first acquires the average ambient light intensity and the average brightness corresponding to the focal area coordinates. The average brightness is extracted from real-time statistical information output by the image sensor, representing the brightness of the focus point. Calculating the baseline compensation amount is a crucial step in determining the compensation value. The baseline compensation amount is defined as the difference between the ambient light intensity and the average brightness of the focal area, reflecting the degree of underexposure of the target area under current lighting conditions. The difference is calculated using absolute value operations to ensure a positive compensation amount. To improve robustness, the system averages the differences over multiple consecutive sampling periods to smooth out occasional fluctuations. After the baseline compensation is calculated, the system queries the pre-stored flash power mapping table, which defines the correspondence between the compensation amount and the flash output power. This mapping table is usually obtained through experimental calibration. The query result is an initial compensation light value, which represents the flash intensity required under ideal conditions.

[0073] The initial compensation light level needs to be adjusted based on the current exposure parameters, especially the gain coefficient, because gain amplifies the signal but also amplifies noise, and excessive flash can lead to highlight blowout. This adjustment is achieved through a non-linear scaling function that uses the gain coefficient as an input variable to scale the initial compensation light level. The scaling function is designed to account for the non-linear relationship between flash output and image brightness, for example, by using exponential or logarithmic models to simulate the perceived light intensity. The scaling process can be expressed as:

[0074]

[0075] in: This represents the final compensated light intensity value after scaling, and is a dimensionless intensity ratio value; It is the initial compensation light intensity value obtained by querying the mapping table, which is also a relative intensity value; It is the gain coefficient in the current target exposure parameter set, usually a real number greater than or equal to 1, representing the signal amplification factor; This is a scaling factor constant, the value of which is experimentally determined and used to adjust the degree to which gain affects light output, typically between 0.1 and 0.5. This formula reflects the modulating effect of the gain coefficient on flash demand: at lower gains, flash compensation mainly relies on the initial light output; at higher gains, the logarithmic term in the formula reduces the additional contribution of the flash, avoiding overexposure. The scaling calculation is performed quickly by a dedicated hardware multiplier or software algorithm, ensuring that the adjustment is completed at the moment of capture.

[0076] Example 4: The complete process of recalibrating the target exposure parameter set after the flash is activated. The core of this process lies in responding to the sudden change in lighting conditions caused by the flash activation and dynamically adjusting the exposure control strategy based on real-time feedback from the focus area to prevent overexposure or underexposure and maintain image stability. Consider a specific scenario: a user is photographing a birthday cake on a table in a dimly lit room, with lit candles on it. The user focuses on the candle flame by touching the screen. At this time, the ambient light intensity is low, and the system detects this and activates the flash compensation module. The recalibration process begins with the detection of the image frame brightness change rate. The system continuously captures image data within a very short time before and after the flash is triggered (e.g., within a time window of several frames). In the birthday cake example, before the flash is activated, the overall image is dark, with the candle flame being the only bright area; after the flash is activated, the entire cake, the table, and even the nearby background are strongly illuminated, resulting in a sharp increase in overall image brightness. The system calculates the rate of change in brightness by comparing the statistical average brightness of consecutive image frames before and after flash activation. Specifically, it calculates the brightness difference between the current frame and the previous frame and uses the ratio of this difference to the inter-frame time interval as a measure of the rate of change. A high positive rate of change indicates that the flash has a significant supplementary lighting effect.

[0077] Based on the calculated rate of change in brightness, the system adjusts the upper limit of the exposure time threshold. This upper limit sets a safe limit for exposure time, preventing overexposure, especially when the flash provides ample auxiliary light. In the cake scene, the flash significantly increases the scene's brightness; using a longer exposure time in dim lighting would easily cause the white frosting to lose detail. Therefore, the system dynamically lowers the upper limit based on the rate of change in brightness. For example, the initial upper limit might be set to 1 / 30 of a second to adapt to low-light conditions; however, when the rate of change in brightness exceeds a certain threshold, the system might tighten the upper limit to 1 / 100 of a second to quickly converge the exposure and protect highlight details. Simultaneously, the system continuously monitors the real-time brightness fluctuations in the focal area (i.e., the area where the candle flame is located). Even with flash illumination, the candle flame itself, as a small, bright light source, may still fluctuate in brightness, and the frosting around the flame is brighter due to reflected flash. These fluctuations in the focal area directly affect the automatic exposure algorithm's judgment. To smooth out these fluctuations and prevent noise caused by frequent fluctuations in the gain coefficient (ISO), the system dynamically updates the smoothing filter parameters used to calculate the gain coefficient. These smoothing filter parameters determine the system's reliance on historical gain data when calculating new gain values. The core parameter is the width of the filter window; a wider window results in a stronger smoothing effect but a slower response time; a narrower window is more sensitive to changes in brightness but may also introduce gain jitter.

[0078] The specific operation of dynamically updating the smoothing filter parameters is as follows: The system takes a small image block centered on the coordinates of the focal area and establishes a sequence of the average brightness value of this block changing over time. By calculating the first derivative (i.e., the instantaneous rate of change) of this brightness time series, the severity of the fluctuation can be quantified. In the cake example, the flickering of the candle flame may cause a large peak in the first derivative of the brightness sequence. When the system detects that the absolute value of the first derivative exceeds the preset fluctuation threshold, it determines that the brightness of the focal area is unstable. At this time, the system increases the window width of the smoothing filter parameters. This means that in the new gain calculation, more gain values ​​from past moments will be included for averaging, making the final output gain coefficient less sensitive to the current brightness fluctuation, thereby effectively suppressing the overall brightness flicker of the image that may be caused by the flickering of the flame. Refer to Table 1, which shows the correspondence between the brightness fluctuation of the focal area and the dynamic adjustment of the smoothing filter parameters in five consecutive frames of images monitored by the system at a certain moment in the birthday cake shooting scene:

[0079] Table 1: Focus Area Brightness Fluctuation and Filter Parameter Adjustment

[0080]

[0081] In the example shown in the table, in frame 3, the brightness of the focus area experiences a drastic jump (the first derivative reaches +38), exceeding the preset fluctuation threshold (assuming the threshold is ±15). The system immediately increases the width of the smoothing filter window from 5 frames to 8 frames. This means that when calculating the gain coefficient in frame 3 and subsequent frames, the system will use historical data from the current frame and the previous 7 frames (a total of 8 frames) for moving average calculation, instead of the original data from the previous 4 frames (a total of 5 frames). The increased window width dilutes the impact of the brightness jump in frame 3 on the final gain value, thus smoothing the output. After updating the upper limit threshold for exposure time and the smoothing filter parameters, the system recalculates the target exposure parameter set by integrating these new parameters. Specifically, the final value of the exposure time will not exceed the newly set upper limit threshold; the gain coefficient calculation uses a new, wider window for moving average to obtain a more stable value. The aperture value may be fine-tuned accordingly to match the new exposure combination. All these adjustments are integrated to generate a second control command, which is sent to the image sensor and aperture drive mechanism via the control bus to complete a recalibration of the exposure parameters under flash conditions. Throughout the process, the monitoring of brightness fluctuations in the focal area and the adaptive updating of filtering parameters form a fast feedback loop. This loop enables the system to distinguish between overall lighting changes in the scene and transient fluctuations in the focal area. In the birthday cake scene, it ensures that after flash illumination, the overall exposure of the image quickly stabilizes to a reasonable level, without the flickering of the candle flame causing constant changes in brightness throughout the image. Ultimately, it captures a photograph with clear cake details, balanced exposure, and no significant noise caused by frequent gain adjustments. This fine-grained control mechanism is particularly suitable for complex flash photography scenes containing dynamic light sources or highly reflective objects.

[0082] Example 5: The implementation process begins with the precise identification of the duration of the touchscreen focus signal. When a user's finger first touches the screen, a high-precision timer within the system begins recording the duration of the touch event. The initial touch immediately triggers single-point focus, the focus frame appears at the first touch point, and contrast detection begins. However, if the user's finger does not immediately lift but remains on the screen and subsequently moves to another location to tap (or uses multi-finger touch simultaneously), the system continuously monitors this contact state. When the total touch duration (from the first touch to the last touch) exceeds a preset threshold (e.g., 500 milliseconds), and multiple discrete touch point events are detected, the system determines that the user intends to perform multi-point focus and switches from the standard single-point focus mode to multi-point focus mode. Upon entering multi-point focus mode, the system first processes and records the information of each touch point; each valid touch event generates a set of screen coordinate data. In the group photo example, the three touch points correspond to the approximate positions of the faces of the three family members on the screen. The system collects these two-dimensional coordinate points to form a set of touch point coordinates. Next, the system calculates a depth weight value for each touch point in the coordinate set. This depth weight value reflects the relative importance of that focus point and is calculated based on factors such as the distance of the point from the image center, the contrast of the area where the point is located (which may indicate the required sharpness of the subject's edges), and the order or pressure applied by the user during touch (if the screen supports pressure sensitivity). For example, the first point touched, the point closest to the center of the screen, or the point pressed harder by the user may be assigned a higher depth weight, indicating that the subject represented by that point needs to be prioritized for sharpness.

[0083] After obtaining the coordinates and depth-of-field weights of each touch point, the system enters the stage of generating a composite focus region. The goal of this step is to merge multiple discrete focus points into a logical focus region so that the focusing motor can find a compromise focus position, ensuring that all specified points fall within the depth of field, or at least that high-weight points achieve optimal sharpness. The first step in generating the composite focus region is to construct a spatial distribution matrix based on the set of touch point coordinates. This matrix describes the two-dimensional distribution of these points on the image plane, including point density and clustering characteristics. The system applies a density clustering algorithm (such as a variant of the DBSCAN algorithm) to analyze this spatial distribution matrix. Density clustering algorithms can automatically identify areas with high point density. In a group photo scenario, if three family members stand close together, the three touch points may form a distinct cluster; if they stand very far apart, they may form multiple small clusters or be identified as discrete points. The algorithm outputs one or more density cluster centers, which represent the "centroid" position of the touch point clustering region. The system typically selects the most important density cluster center, which contains the most points, as the core coordinate of the composite focusing area. This core coordinate becomes the new target point for the subsequent movement of the focusing motor, attempting to geometrically balance the positions of the various touch points.

[0084] After determining the core coordinates of the composite focus area, the system needs to decide how to drive the focusing motor for focusing. This is a process of allocating the motor's travel weights. The travel weights determine the proportion of the focusing distance represented by different touch points that the motor considers when searching for the optimal focus. The system calculates the Euclidean distance from the core coordinates to each touch point; this distance reflects the degree of deviation of the touch point from the core area. Then, it combines this with the previously calculated depth-of-field weights for each point to comprehensively allocate the travel weights. A basic allocation principle is: touch points closer to the core coordinates have higher travel weights; simultaneously, points with inherently high depth-of-field weights will also have their travel weights appropriately increased. Finally, the travel weights of all points are normalized so that their sum is 1. The focusing system drives the motor based on this weighted distance information to find a focusing plane that maximizes the weighted average contrast. The system needs to output the focusing priority of the composite focus area; this priority information is used to make decisions when it is impossible to achieve optimal focus for all points simultaneously. For example, in a group photo scenario, if the distance between three family members is too large, exceeding the lens's depth of field, it will prevent all three from being fully sharp. In this case, the system will output a focus priority sequence based on the depth of field weight and spatial distribution of each touch point. The point with the highest weight (such as the family member in the middle who is touched first) has the highest priority, and the system will prioritize ensuring the sharpness of that point; points with lower weights will follow. The priority information will also be displayed on the user interface, for example, using different colors or sizes of focus boxes to indicate the current focus priority to the user.

[0085] It should be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such process, method, article, or apparatus.

[0086] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A multi-function fusion-based control method for a megapixel camera, characterized by, The method comprises the following steps: Obtaining raw image data collected by an image sensor, and preprocessing the raw image data to generate an initial brightness distribution map; Calculating a scene dynamic range according to the initial brightness distribution map, determining a target exposure parameter set based on the scene dynamic range, the target exposure parameter set including an exposure time, a gain coefficient and an aperture value; Synchronously analyzing color temperature information of the initial brightness distribution map, matching a preset white balance model through the color temperature information, and outputting a white balance correction coefficient; Generating a first control instruction in combination with the target exposure parameter set and the white balance correction coefficient, and sending the first control instruction to the image sensor; Receiving a touch screen focusing signal triggered by a user, extracting focus area coordinates corresponding to the touch screen focusing signal, and adjusting a stroke parameter of a focusing motor according to the focus area coordinates; Real-time monitoring of ambient light intensity, activating a flash compensation module and calculating a compensation light amount value when the ambient light intensity is lower than a preset threshold; In a shooting mode, adjusting a flash output power according to the compensation light amount value, and recalibrating the target exposure parameter set based on the focus area coordinates; The recalibration of the target exposure parameter set comprises: Detecting a brightness change rate of an image frame in a flash activated state, and adjusting an upper threshold of the exposure time according to the brightness change rate; Based on real-time brightness fluctuation of the focus area coordinates, dynamically updating a smoothing filter parameter of the gain coefficient; According to the updated smoothing filter parameter and the upper threshold of the exposure time, a second control instruction is generated; The dynamic updating of the smoothing filter parameter of the gain coefficient comprises: Establishing a brightness change time sequence of the focus area coordinates, and calculating a first derivative of the time sequence; When the first derivative exceeds a preset fluctuation threshold, the window width of the smoothing filter parameter is increased; The moving average value of the gain coefficient is recalculated through the window width. 2.The multi-function fusion-based 1-megapixel camera control method of claim 1, wherein, The preprocessing comprises: Dividing the raw image data into a plurality of sub-regions, and calculating an average brightness value of each sub-region respectively; Constructing a brightness histogram according to the average brightness value, and identifying overexposed regions and underexposed regions through the brightness histogram; Weight distribution is performed on the overexposed regions and the underexposed regions, and a weighted brightness distribution map is generated as the initial brightness distribution map. 3.The multi-function fusion based 1-megapixel camera control method of claim 1, wherein, The step of determining the target exposure parameter set comprises: According to the scene dynamic range, a preset exposure mapping table is queried to obtain a basic exposure time and a basic gain coefficient; Based on the difference between the peak brightness and the average brightness of the initial brightness distribution map, the basic exposure time is dynamically corrected; According to the corrected basic exposure time and the basic gain coefficient, a diaphragm control curve is matched to determine the aperture value. 4.The multi-function fusion based 1-megapixel camera control method of claim 1, wherein, The generation of the white balance correction coefficient comprises: Extracting color temperature sampling points of highlight regions and shadow regions from the initial brightness distribution map; Calculating the color temperature difference value of the highlight regions and the shadow regions, and selecting a corresponding white balance algorithm according to the color temperature difference value; Outputting red channel gain and blue channel gain through the white balance algorithm to form the white balance correction coefficient. 5.The multi-function fusion based 1-megapixel camera control method according to claim 1, wherein, The adjustment of the stroke parameter of the focusing motor comprises: Calculating a depth of field range according to the focus area coordinates, and determining a target step length of the focusing motor based on the depth of field range; Real-time acquisition of contrast data of the image sensor, and adjustment of the target step length through contrast data feedback; When the contrast data reaches a local maximum value, the final stroke parameter of the focusing motor is locked. 6.The multi-function fusion based 1-megapixel camera control method according to claim 1, wherein, The step of calculating the compensation light value comprises: obtaining the ambient light intensity and the brightness average of the focus area coordinates, and calculating the difference between the two as a reference compensation value; querying a flash power mapping table according to the reference compensation value to obtain an initial compensation light value; combining the gain coefficient in the target exposure parameter set to perform nonlinear scaling on the initial compensation light value. 7.The multi-function fusion based 1-megapixel camera control method of claim 1, wherein, The response of the touch screen focus signal comprises: identifying the duration of the touch screen focus signal, and starting a multi-point focus mode when the duration is greater than a set threshold; in the multi-point focus mode, respectively calculating the depth of field weight value of each touch point; generating a composite focus area according to the depth of field weight value, and outputting the focus priority of the composite focus area. 8.The multi-function fusion based mega-pixel camera control method of claim 7, wherein, The generation of the composite focus area comprises: extracting the coordinate set of each touch point, and constructing a spatial distribution matrix based on the coordinate set; calculating the density clustering center through the spatial distribution matrix, and taking the density clustering center as the core coordinate of the composite focus area; allocating the stroke weight of the focus motor according to the Euclidean distance between the core coordinate and each touch point.

Citation Information

Patent Citations

  • Automatic exposure method and device, dynamic range identification method and device, medium and equipment

    CN114449176A

  • Image processing method, electronic equipment, storage medium and chip

    CN119299866A