An optimization method and device for collecting images, a storage medium and an electronic device
By adjusting the camera's focus position to a defocused focus position, the problem of lateral color difference in scenes where the camera is at the boundary between high and low light was solved, and the purple fringing effect was reduced without increasing costs or affecting portability.
Patent Information
- Application Number
- CN202510527096.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-25
- Publication Date
- 2026-11-03
AI Technical Summary
In shooting scenarios where high and low light meet, existing technologies are prone to lateral color difference in cameras. Existing hardware modification methods are costly and affect the portability of the device.
By determining the standard focus position, acquiring the current frame preview image, and adjusting the focus position to the defocused focus position according to the image acquisition conditions, the optimized image is acquired.
Without increasing hardware costs or affecting device portability, the lateral color difference is reduced or avoided, thus mitigating the purple edge effect.
Smart Images

Figure CN123035375A_ABST
Abstract
Description
Technical Field
[0001] This specification relates to the field of computer technology, and in particular to an optimization method, apparatus, storage medium, and device for image acquisition. Background Technology
[0002] Currently, cameras are widely used in electronic devices in various fields, such as professional photography equipment, mobile phones, tablets, traffic security monitoring cameras, etc., and the imaging effect of cameras is particularly important.
[0003] In practical applications, in shooting scenarios where there is a transition between high and low light, the images captured by the camera may exhibit purple fringing, also known as lateral chromatic aberration. This is because the camera lens has different refractive indices for different wavelengths of light, causing aberrations where high-contrast edges appear as colored edges (usually purple, blue, or green).
[0004] To reduce or avoid this lateral chromatic aberration, existing technologies typically involve hardware modifications to the camera, including using high-quality lenses, coating the lenses, and using lens hoods.
[0005] However, high-quality lenses are often expensive, which greatly increases the cost of the camera. Lens coatings have limited effect on reducing lateral chromatic aberration and also increase the cost of the camera. Using lens hoods will seriously affect the portability of electronic devices with cameras.
[0006] Therefore, how to minimize lateral color difference without increasing hardware costs or affecting device portability has become an urgent problem to be solved. Summary of the Invention
[0007] This specification provides an image acquisition optimization method, apparatus, storage medium, and electronic device to partially solve the problems existing in the prior art.
[0008] The embodiments in this specification adopt the following technical solutions:
[0009] This specification provides an optimization method for acquiring images, the method comprising:
[0010] Determine the standard focus position, and acquire the current frame preview image based on the standard focus position;
[0011] Determine the image acquisition conditions when acquiring the current frame preview image;
[0012] When the image acquisition conditions meet the preset conditions, the standard focus position is adjusted to obtain the defocused focus position;
[0013] Optimized images are acquired based on the defocused focus position.
[0014] This specification provides an image acquisition optimization device, the device comprising:
[0015] The preview module is used to determine the standard focus position and acquire the current frame preview image based on the standard focus position;
[0016] The condition determination module is used to determine the image acquisition conditions when acquiring the current frame preview image;
[0017] The adjustment module is used to adjust the standard focus position to obtain the defocused focus position when the image acquisition conditions meet the preset conditions.
[0018] The acquisition module is used to acquire optimized images based on the defocused focus position.
[0019] This specification provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described optimization method for acquiring images.
[0020] This specification provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements the above-described image acquisition optimization method.
[0021] The above-described at least one technical solution adopted in the embodiments of this specification can achieve the following beneficial effects:
[0022] This specification discloses an image acquisition optimization method. The method first acquires a preview image of the current frame based on an accurate standard focus position, determines the image acquisition conditions for acquiring the preview image, and checks whether the image acquisition conditions meet preset conditions. If they do, the standard focus position is adjusted to obtain a defocused focus position. Finally, an optimized image is acquired based on the defocused focus position. This method can reduce or even avoid lateral chromatic aberration by changing the camera's focus position, while maintaining acceptable sharpness. This achieves the goal of mitigating purple fringing caused by lateral chromatic aberration without increasing hardware costs or affecting device portability. Attached Figure Description
[0023] The accompanying drawings, which are included to provide a further understanding of this specification and form part of this specification, illustrate exemplary embodiments and are used to explain this specification, but do not constitute an undue limitation thereof. In the drawings:
[0024] Figure 1 A flowchart illustrating the image acquisition optimization method provided in the embodiments of this specification;
[0025] Figure 2A schematic diagram of an image acquisition optimization device provided in an embodiment of this specification;
[0026] Figure 3 This is a schematic diagram of the structure of the electronic device provided in the embodiments of this specification. Detailed Implementation
[0027] The purple fringing (i.e., lateral chromatic aberration) is caused by the different refractive indices of the camera lens for different wavelengths of light, resulting in a purplish rim at high-contrast edges. Slight defocusing softens the edges of high-contrast areas, reducing the contrast between the purple fringing and the background, making the purple fringing less noticeable to the naked eye. Therefore, in the embodiments of this specification, a certain degree of acceptable defocusing is used to weaken the purple fringing effect in the image.
[0028] To make the objectives, technical solutions, and advantages of this specification clearer, the technical solutions of this specification will be clearly and completely described below in conjunction with specific embodiments and corresponding drawings. Obviously, the described embodiments are only a part of the embodiments of this specification, and not all of them. Based on the embodiments in this specification, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this specification.
[0029] The technical solutions provided in the various embodiments of this specification are described in detail below with reference to the accompanying drawings.
[0030] Figure 1 The flowchart of the image acquisition optimization method provided in the embodiments of this specification includes the following steps:
[0031] S100: Determine the standard focus position and acquire the current frame preview image based on the standard focus position.
[0032] In the embodiments of this specification, the following are used: Figure 1 The device used to optimize the image acquisition process by the camera can be any electronic device with a camera, such as a mobile phone or tablet. The following description uses a mobile phone as an example to illustrate the embodiments in this specification.
[0033] In the embodiments of this specification, after the mobile phone starts its own camera, it can first use an autofocus (AF) algorithm to automatically determine the accurate focus position, called the standard focus position, and then acquire the current frame image based on the standard focus position, called the current frame preview image.
[0034] Autofocus (AF) is a technology used in cameras, mobile phones, and other electronic devices to automatically adjust the focus position of the lens group in the camera to ensure a sharp image of the subject. Its core goal is to replace manual focusing, allowing users to quickly and accurately capture clear images. Generally, AF algorithms analyze the image through sensors to detect whether it is in focus, that is, to determine whether the subject in the image is sharp. Based on the detection result, they control the motor to move the lens group in the camera to the accurate focus position.
[0035] S102: Determine the image acquisition conditions when acquiring the current frame preview image.
[0036] When capturing the current frame preview image according to the above-mentioned standard focus position, the mobile phone can simultaneously determine the image acquisition conditions for capturing the current frame preview image. The image acquisition conditions described in this specification include the hardware acquisition conditions of the mobile phone when capturing the above-mentioned current frame preview image through the camera, including but not limited to at least one of the following: acquisition angle, sensitivity (ISO), and light value (LV), which will be described in detail below.
[0037] S104: When the image acquisition conditions meet the preset conditions, the standard focus position is adjusted to obtain the defocused focus position.
[0038] In the embodiments of this specification, a corresponding range can be preset for each type of image acquisition condition. When all the above-mentioned image acquisition conditions fall within their respective ranges, the mobile phone determines that the current image acquisition condition meets the preset conditions, and then the current standard focus position can be adjusted. Since the focus position is no longer an accurate focus position after the standard focus position is adjusted, resulting in a certain degree of out-of-focus, the focus position after the standard focus position is adjusted is referred to as the out-of-focus focus position in the embodiments of this specification.
[0039] Specifically, in order to minimize the impact of out-of-focus issues while reducing lateral chromatic aberration, the embodiments in this specification can preset a focus position change amount. When adjusting the standard focus position, the mobile phone can first obtain the preset focus position change amount, and then adjust the standard focus position according to the preset focus position change amount to obtain the out-of-focus focus position. Specifically, the standard focus position can be increased by the preset focus position change amount, or the standard focus position can be decreased by the preset focus position change amount to obtain the out-of-focus focus position.
[0040] Furthermore, since the focus position is adjusted by controlling the position of the camera's lens assembly via a motor, in the embodiments of this specification, the method for adjusting the standard focus position can specifically be to adjust the digital-to-analog conversion (DAC) value of the lens focusing motor (i.e., the motor used to control the focus position of the camera's lens assembly). The DAC value is used for precise control of the lens focusing motor; its core function is to convert digital signals into analog commands for the movement of the physical lens elements. The mobile phone calculates the required focus position using an AF algorithm; this focus position is a digital signal. The DAC value is then used to convert this digital signal into an analog signal (such as a voltage or current signal), which drives the lens focusing motor to move the lens assembly.
[0041] Specifically, the entire focusing position range of the lens group in the mobile phone camera can be mapped to the DAC value range of the lens focusing motor. Different DAC values are used to drive the lens group to move to different focusing positions. Therefore, the aforementioned preset focusing position variable can specifically be the change in DAC value. When adjusting the standard focusing position, the DAC value corresponding to the standard focusing position can be adjusted according to this change in DAC value. Specifically, the DAC value corresponding to the standard focusing position can be increased or decreased by the change in DAC value to obtain the DAC value corresponding to the out-of-focus focusing position. Then, based on the DAC value corresponding to the out-of-focus focusing position, the lens focusing motor is controlled to adjust the camera lens group to that out-of-focus focusing position. Accordingly, in order to minimize the impact of out-of-focus effects while reducing lateral chromatic aberration, the aforementioned change in DAC value can be set to 10.
[0042] S106: Acquire an optimized image based on the defocused focus position.
[0043] After adjusting the standard focus position to the defocus focus position, the phone can capture an image based on this defocus focus position. The image captured at this time is an image that loses some sharpness within an acceptable range but reduces the purple fringing effect caused by lateral color difference, and is called an optimized image.
[0044] The method described above first acquires a preview image of the current frame based on an accurate standard focus position, determines the image acquisition conditions for acquiring the preview image, and checks whether the image acquisition conditions meet preset conditions. If they do, the standard focus position is adjusted to obtain a defocused focus position. Finally, an optimized image is acquired based on the defocused focus position. This method can reduce or even eliminate lateral chromatic aberration by changing the camera's focus position, while still meeting the required sharpness loss. This achieves the goal of mitigating the purple fringing effect caused by lateral chromatic aberration without increasing hardware costs or affecting device portability.
[0045] Furthermore, in step S102 above, the image acquisition condition when the mobile phone acquires the preview image of the current frame can be the acquisition angle when acquiring the preview image of the current frame. Specifically, the mobile phone can detect the acquisition angle when acquiring the preview image of the current frame using a built-in accelerometer (such as a gyroscope). Correspondingly, the preset condition in step S104 can include a preset acquisition angle range (for example, it can be set to 5 to 40 degrees). When the image acquisition condition includes the acquisition angle, it is necessary to determine that the acquisition angle when the mobile phone acquires the preview image of the current frame falls within the preset acquisition angle range in order to determine that the image acquisition condition meets the preset condition. That is, at this time, the acquisition angle when the mobile phone acquires the preview image of the current frame falling within the preset acquisition angle range is a necessary condition for the image acquisition condition to meet the preset condition.
[0046] When a mobile phone captures a preview image of the current frame, the image capture condition can be the ISO at which that preview image is captured. ISO is a parameter that characterizes the sensitivity of a camera sensor to light. A higher ISO value indicates a more sensitive camera sensor to light, and vice versa. In well-lit shooting conditions such as daytime, lowering the ISO can result in a cleaner image. Conversely, in low-light conditions such as nighttime, higher ISO is needed to achieve brighter exposure. However, increasing the ISO may introduce noise into the image, making it grainy and reducing image quality.
[0047] In step S102, when the mobile phone captures the preview image of the current frame, it can obtain the ISO at the time of capturing the preview image through the mobile phone's operating system. Correspondingly, the preset conditions in step S104 may include a preset ISO range (e.g., set to 100-400). Therefore, when the image capture conditions include ISO, it is necessary to determine that the ISO of the mobile phone capturing the preview image of the current frame falls within the preset ISO range before it can be determined that the image capture conditions meet the preset conditions. That is, the fact that the ISO of the mobile phone capturing the preview image of the current frame falls within the preset ISO range is a necessary condition for the image capture conditions to meet the preset conditions.
[0048] The image acquisition condition when the mobile phone captures the current frame preview image can also be the LV (Level Value) at the time of acquisition. LV is a numerical value that quantifies the intensity of ambient light during shooting, used to objectively describe the brightness of the shooting scene, and is directly related to exposure parameters (including ISO, shutter speed, and aperture value). In step S102, when the mobile phone captures the current frame preview image, it can directly determine the LV at the time of acquisition using the exposure parameters, or it can convert the ambient light intensity into LV using the ambient light sensor in the mobile phone. Correspondingly, the preset condition in step S104 can include a preset LV range (e.g., set to 90-120). Therefore, when the image acquisition condition includes LV, it is necessary to determine that the LV at the time of acquisition falls within the preset LV range for the image acquisition condition to be satisfied. That is, the LV falling within the preset LV range is a necessary condition for the image acquisition condition to satisfy the preset condition.
[0049] Only when all the above-mentioned image acquisition conditions fall within their respective preset ranges can it be determined that the image acquisition conditions meet the preset conditions. Specifically, when the image acquisition conditions include acquisition angle, ISO, and LV, it can be first determined whether the acquisition angle falls within the preset acquisition angle range. If so, it can then be determined whether the ISO falls within the preset sensitivity range. If so, it can then be determined whether the LV falls within the preset brightness range. If any one of the three determinations results in a negative result, it can be directly determined that the image acquisition conditions do not meet the preset conditions.
[0050] Furthermore, when the hardware conditions for image acquisition meet preset conditions, the mobile phone can further determine whether further processing is needed based on the image content of the current frame preview image. Figure 1 The defocus optimization is shown below. Specifically, when the phone determines that the image acquisition conditions for capturing the current frame preview image meet preset conditions, it can determine whether the current frame preview image contains a face. If so, it determines the proportion of the face in the current frame preview image and continues to determine whether this proportion falls within a preset ratio range. If the current frame preview image contains a face, and the proportion of the face in the current frame preview image falls within the preset ratio range (for example, it can be set to 30% to 70%), then the standard focus position needs to be adjusted. If the current frame preview image does not contain a face, or if the current frame preview image contains a face but the proportion of the face in the current frame preview image does not fall within the preset ratio range, then the standard focus position does not need to be adjusted.
[0051] Furthermore, in the embodiments of this specification, whether based solely on the aforementioned image acquisition conditions or combining the aforementioned image acquisition conditions with the image content of the current preview image, misjudgments may occur due to external factors (such as slight shaking) when determining whether it is necessary to reduce the purple fringing effect caused by lateral chromatic aberration through defocusing. Therefore, in order to ensure the reliability of the judgment, in the embodiments of this specification, the mobile phone may adjust the standard focus position only when the judgment results for n consecutive current frame preview images (n is a positive integer, referred to below as the preset number threshold) are all that it is necessary to reduce the purple fringing effect caused by lateral chromatic aberration through defocusing.
[0052] Specifically, for a current frame preview image, when the phone determines that the standard focus position needs adjustment for that current frame preview image, it temporarily suspends the adjustment. Instead, it identifies the current preview image as the frame to be blurred and increments the number of consecutively identified frames to be blurred by 1. It then checks whether the number of consecutively identified frames to be blurred reaches a preset threshold. If it does, the standard focus position is adjusted using the method shown in step S104 to obtain a defocused focus position. The optimized image is then acquired using this defocused focus position in step S106. If the threshold is not reached, the phone continues to determine whether the standard focus position needs adjustment for the next current frame preview image. When the phone determines that the standard focus position does not need adjustment for the current frame preview image, the number of consecutively identified frames to be blurred is set to 0. Therefore, the standard focus position is only adjusted when it is determined that adjustment is needed for n consecutive current frame preview images. The optimized image is then acquired based on the adjusted defocused focus position, avoiding misjudgments caused by external factors.
[0053] The above is an example of an image acquisition optimization method provided by the embodiments of this specification. Based on the same idea, the embodiments of this specification also provide corresponding devices, storage media and electronic devices.
[0054] Figure 2 This is a schematic diagram of an image acquisition optimization device provided in an embodiment of this specification. The device includes:
[0055] The preview module 201 is used to determine the standard focus position and acquire the current frame preview image according to the standard focus position;
[0056] The condition determination module 202 is used to determine the image acquisition conditions when acquiring the current frame preview image;
[0057] The adjustment module 203 is used to adjust the standard focus position to obtain the defocused focus position when the image acquisition conditions meet the preset conditions.
[0058] The acquisition module 204 is used to acquire an optimized image based on the defocused focus position.
[0059] Optionally, the condition determination module 202 is specifically used to determine the acquisition angle when acquiring the current frame preview image;
[0060] The image acquisition conditions satisfying the preset conditions include at least the following: the acquisition angle falls within the preset acquisition angle range.
[0061] Optionally, the condition determination module 202 is specifically used to determine the photosensitivity when acquiring the current frame preview image;
[0062] The image acquisition conditions satisfying the preset conditions include at least the following: the photosensitivity falls within the preset acquisition photosensitivity range.
[0063] Optionally, the condition determination module 202 is specifically used to determine the brightness when acquiring the current frame preview image;
[0064] The image acquisition conditions satisfying the preset conditions include at least the following: the light intensity falls within the preset acquisition light intensity range.
[0065] Optionally, the adjustment module 203 is specifically used to: when the image acquisition conditions meet preset conditions, determine whether the current frame preview image contains a face; if so, determine the proportion of the face in the current frame preview image; when the current frame preview image contains a face and the proportion of the face in the current frame preview image falls within a preset proportion range, adjust the standard focus position.
[0066] Optionally, the adjustment module 203 is specifically used to: when the image acquisition conditions meet preset conditions, determine the current frame preview image as the frame to be blurred; if the number of consecutively determined frames to be blurred reaches a preset number threshold, then adjust the standard focus position.
[0067] Optionally, the adjustment module 203 is specifically used to obtain a preset change in focus position; and adjust the standard focus position according to the focus position variable to obtain a defocused focus position.
[0068] This specification also provides a computer-readable storage medium storing a computer program that, when executed by a processor, can be used to perform the above-described actions. Figure 1 The provided method for optimizing acquired images.
[0069] based on Figure 1 The image acquisition optimization method shown in this specification is further provided in the embodiments. Figure 3 The diagram shows the structure of the electronic device. Figure 3 At the hardware level, this electronic device includes a processor, internal bus, network interface, memory, and non-volatile memory, and may also include other hardware required for business operations. The processor reads the corresponding computer program from the non-volatile memory into memory and then executes it to achieve the above. Figure 1 The method for optimizing the acquired images.
[0070] The above description is merely an embodiment of this specification and is not intended to limit this specification. Various modifications and variations can be made to this specification by those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this specification should be included within the scope of the claims of this specification.
Claims
1. An optimization method for image acquisition, characterized in that, The method includes: Determine the standard focus position, and acquire the current frame preview image based on the standard focus position; Determine the image acquisition conditions when acquiring the current frame preview image; When the image acquisition conditions meet the preset conditions, the standard focus position is adjusted to obtain the defocused focus position; Optimized images are acquired based on the defocused focus position.
2. The method as described in claim 1, characterized in that, Determining the image acquisition conditions when acquiring the current frame preview image specifically includes: Determine the acquisition angle when acquiring the current frame preview image; The image acquisition conditions satisfying the preset conditions include at least the following: the acquisition angle falls within the preset acquisition angle range.
3. The method as described in claim 1, characterized in that, Determining the image acquisition conditions when acquiring the current frame preview image specifically includes: Determine the photosensitivity when acquiring the current frame preview image; The image acquisition conditions satisfying the preset conditions include at least the following: the photosensitivity falls within the preset acquisition photosensitivity range.
4. The method as described in claim 1, characterized in that, Determining the image acquisition conditions when acquiring the current frame preview image specifically includes: Determine the brightness when acquiring the current frame preview image; The image acquisition conditions satisfying the preset conditions include at least the following: the light intensity falls within the preset acquisition light intensity range.
5. The method as described in claim 1, characterized in that, When the image acquisition conditions meet preset conditions, the standard focus position is adjusted, specifically including: When the image acquisition conditions meet the preset conditions, it is determined whether the current frame preview image contains a human face based on the current frame preview image. If so, determine the proportion of the face in the current frame preview image; When the current frame preview image contains a face, and the proportion of the face in the current frame preview image falls within a preset ratio range, the standard focus position is adjusted.
6. The method as described in claim 1, characterized in that, When the image acquisition conditions meet preset conditions, the standard focus position is adjusted, specifically including: When the image acquisition conditions meet the preset conditions, the current frame preview image is determined as the frame that needs to be blurred; If the number of consecutively identified frames that need to be blurred reaches a preset threshold, the standard focus position is adjusted.
7. The method as described in claim 1, characterized in that, Adjusting the standard focus position to obtain a defocused focus position specifically includes: Obtain the preset focus position change amount; The standard focus position is adjusted according to the focus position variable to obtain the defocused focus position.
8. An image acquisition optimization device, characterized in that, The device includes: The preview module is used to determine the standard focus position and acquire the current frame preview image based on the standard focus position; The condition determination module is used to determine the image acquisition conditions when acquiring the current frame preview image; The adjustment module is used to adjust the standard focus position to obtain the defocused focus position when the image acquisition conditions meet the preset conditions. The acquisition module is used to acquire optimized images based on the defocused focus position.
9. A computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in any one of claims 1-7.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the program, implements the method described in any one of claims 1-7.
