Gradient dimming method and electronic equipment

By using a gradual light reduction method, the parameters of the light reduction device are adjusted according to the camera's posture and image information, thus solving the problem of poor shooting results under different lighting conditions and achieving high-quality shooting results.

CN121596444APending Publication Date: 2026-03-03HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411136890.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-16
Publication Date
2026-03-03

AI Technical Summary

Technical Problem

The light-reducing devices in existing camera equipment are difficult to adjust effectively under different lighting conditions, resulting in poor shooting results, especially in strong light or backlight conditions, which can easily lead to overexposure or loss of detail.

Method used

By using a gradient light reduction method, the gradient mode, direction, position, and transmittance of the light reduction device are dynamically adjusted according to the posture of the camera device and the image information captured by the camera, in order to match different light distributions and achieve better shooting results.

Benefits of technology

It enables the capture of clear, soft, high-quality photos or videos under different lighting conditions, avoiding overexposure and loss of detail.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121596444A_ABST
    Figure CN121596444A_ABST
Patent Text Reader

Abstract

The invention discloses a gradual change type dimming method and electronic equipment. In the shooting process of the electronic equipment, the parameters of the dimming device can be determined according to the equipment posture, the image collected by the camera and other information, and the dimming effect of the dimming device is adjusted according to the determined parameters, so that clear and soft high-quality photos or videos can be shot.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of terminal technology, and in particular to a gradual light reduction method and electronic equipment. Background Technology

[0002] Cameras in electronic devices such as camcorders and mobile phones typically incorporate light-reducing devices (NDDs) to filter light and reduce the amount of light entering the lens. NDs are commonly used in scenarios such as shooting in strong light, backlighting, night scenes, capturing misty water surfaces, and photographing flowing clouds. They help camcorders and mobile phones capture clear, soft images, avoiding overexposure and loss of detail. How to set up or adjust NDs to better function during shooting and obtain high-quality photos or videos is a topic worthy of discussion. Summary of the Invention

[0003] This application provides a gradual light reduction method and electronic device that can adjust the light reduction effect of the light reduction device according to information such as the device posture and the image captured by the camera, so as to capture clear and soft high-quality photos or videos.

[0004] Firstly, a gradient light reduction method is provided, applied to an electronic device including a first camera. The first camera includes a lens, a first light reduction device, and a photosensitive element arranged in parallel. The centers of the lens, the first light reduction device, and the photosensitive element are all located on the optical axis. The first light reduction device is a gradient light reduction device, and the photosensitive element is used to convert light passing through the lens and the first light reduction device into electrical signals to generate an image. The method may include:

[0005] The first camera is activated; based on the posture of the electronic device and / or the first image captured by the first camera, a first parameter is determined, the first parameter including one or more of the following: a first gradient mode, a first gradient direction, and a first position; wherein, the first gradient mode is a positive gradient mode or an inverse gradient mode; if the first gradient mode is a positive gradient mode, the transmittance of the first light-reducing device decreases from one side to the other; the first position refers to the position of the gradient line in the first light-reducing device, and the first gradient direction is perpendicular to the gradient line; if the first gradient mode is an inverse gradient mode, the first light-reducing device includes a first high-transmittance region, a second high-transmittance region, and a low-transmittance region, and the first high-transmittance region and the second high-transmittance region are located on both sides of the low-transmittance region; the first position refers to the position of the center line of the low-transmittance region in the light-reducing device, and the first gradient direction is perpendicular to the center line; the first gradient direction refers to the direction from the high-transmittance region to the low-transmittance region in the first light-reducing device; the parameters of the first light-reducing device are adjusted according to the first parameter.

[0006] By implementing the first approach, electronic devices can adjust the light-reducing effect of light-reducing devices based on information such as device posture and images captured by the camera, thereby capturing clear, soft, high-quality photos or videos.

[0007] In conjunction with the first aspect, in some embodiments, the first gradient mode is a positive gradient mode; the electronic device also includes an accelerometer to determine a first parameter based on the attitude of the electronic device, specifically including: determining a first direction as a first gradient direction, wherein the first direction is the direction of the component of the acceleration detected by the accelerometer on the plane where the first dimming device is located.

[0008] Considering that the light is positively distributed in most shooting scenarios, and the light intensity gradually decreases in the direction from the sky to the ground, the area closer to the ground on the plane where the photosensitive element is located receives stronger light. Therefore, by adopting the above implementation method, the electronic device can adapt to the shooting scenario with positively distributed light to reduce the light and achieve a good shooting effect.

[0009] In conjunction with the previous embodiment, in some embodiments, the gradient line passes through a preset first position point. Therefore, after determining the first gradient direction, the location of the gradient line can be determined based on the perpendicular relationship between the gradient line and the first gradient direction and the first position point.

[0010] In conjunction with the first aspect, in some implementations, determining the first parameter based on the first image captured by the first camera specifically includes: identifying the bright and low-bright areas in the first image, and determining the first gradient mode based on the distribution of the bright and low-bright areas.

[0011] In some implementations, identifying bright and dark regions in the first image specifically includes: determining the grayscale value of each pixel in the first image; identifying regions of pixels in the first image with grayscale values ​​greater than a first value as bright regions, and identifying regions of pixels in the first image with grayscale values ​​less than the first value as dark regions.

[0012] In some implementations, determining the first parameter based on the first image captured by the first camera specifically includes: when the first image includes a bright area and a low-brightness area, determining the first gradient mode as a positive gradient mode, and determining the direction from the low-brightness area to the bright area as the first gradient direction; when the first image includes a first low-brightness area, a second low-brightness area, and a bright area, and the first low-brightness area and the second low-brightness area are located on both sides of the bright area, determining the first gradient mode as an inverse gradient mode, and determining the direction from the first low-brightness area to the bright area and the direction from the second low-brightness area to the bright area as the first gradient direction.

[0013] In some embodiments, the first parameter further includes a first gradient width. When the first gradient mode is a positive gradient mode, the first gradient width is the width of the region in the first light-reducing device where the transmittance changes abruptly from high to low; when the first gradient mode is an inverse gradient mode, the first gradient width is the width of the region in the first high-transmittance region and the first low-transmittance region where the transmittance changes abruptly from high to low, and the region in the second high-transmittance region and the second low-transmittance region where the transmittance changes abruptly from high to low, as well as the width of the region between the two regions.

[0014] In some implementations, determining the first parameter based on the first image captured by the first camera specifically includes: when the first gradient mode is a positive gradient mode, determining the first straight line and the first region based on the first image, wherein the first straight line is located at the middle position of the brightness distribution in the first image, and the first region is the region in the first image where the brightness change rate exceeds the first threshold; determining the first position based on the position of the first straight line in the first image; and determining the first gradient width based on the width of the first region.

[0015] In conjunction with the previous embodiment, in some embodiments, determining the first straight line based on the first image specifically includes: determining the distance corresponding to a pixel in the first image based on a first fitting function and the value of the gray value of the pixel mapped to the range of the first fitting function; determining the first straight line based on the distance corresponding to the pixel in the first image; wherein the first fitting function includes one of the following: an error function, an S-shaped growth function, a hyperbolic tangent function, and an arctangent function. In conjunction with the previous embodiment, in some embodiments, before determining the first gradient width based on the width of the first region, the method may further include: drawing a first curve with the distance from the pixel in the first image to the first straight line as the abscissa and the value of the gray value of the pixel mapped to the range of the first fitting function as the ordinate; determining the width of the portion of the first curve whose slope exceeds a second threshold as the width of the first region.

[0016] In some implementations, determining the first parameter based on the first image captured by the first camera specifically includes: when the first gradient mode is an anti-gradient mode, determining the second straight line and the second region based on the first image, wherein the second straight line is located in the middle of the bright region, and the second region includes the region where the brightness change rate from the first low-brightness region to the bright region exceeds a third threshold, the region where the brightness change rate from the second low-brightness region to the bright region exceeds the third threshold, and the region between the above two regions; determining the first position based on the position of the second straight line in the first image; and determining the first gradient width based on the width of the second region.

[0017] In conjunction with the previous embodiment, in some embodiments, determining the second straight line based on the first image specifically includes: determining the distance corresponding to the pixel in the first image based on the second fitting function and the gray value of the pixel; determining the second straight line based on the distance corresponding to the pixel in the first image; wherein the first fitting function includes: a Gaussian function.

[0018] In conjunction with the previous embodiment, in some embodiments, before determining the first gradient width based on the width of the second region, the method may further include: drawing a second curve with the distance from a pixel in the first image to the second straight line as the abscissa and the gray value of the pixel as the ordinate; and determining the total width of the portion of the second curve whose slope exceeds the fourth threshold and the portion between the two portions as the width of the second region.

[0019] In some implementations, the first image is captured by a first camera at a first moment. A first parameter is determined based on the attitude of the electronic device and the first image captured by the first camera. Specifically, this includes: determining a third straight line in the first image; when the first image includes a bright area and a low-brightness area, the third straight line is the boundary between the bright and low-brightness areas; when the first image includes a first low-brightness area, a second low-brightness area, and a bright area, the third straight line is the center line of the bright area; moving the third straight line a first distance along the Y” axis to obtain a fourth straight line, the first distance being obtained based on the pitch angle change of the electronic device from the first moment to the second moment; moving the fourth straight line a second distance along the X” axis to obtain a fifth straight line, the second distance being obtained based on the yaw angle change of the electronic device from the first moment to the second moment; rotating the fifth straight line around the Z” axis in the X”Y” plane by a first angle to obtain a sixth straight line, the first angle being obtained based on the roll angle change of the electronic device from the first moment to the second moment; and determining a first position based on the position of the sixth straight line in the first image; wherein the X” axis and Y” axis are perpendicular to each other and located on the plane where the photosensitive element is located, and the Z” axis is perpendicular to the plane where the photosensitive element is located.

[0020] In conjunction with the previous embodiment, in some embodiments, the method may further include:

[0021] O”Y2 is calculated using the following formula:

[0022] Δpitch = pitch1 - pitch2

[0023]

[0024] The first distance is calculated based on the difference between O”Y2 and O”Y1, where Y1 is the intersection of the fourth line and the Y” axis, Y2 is the intersection of the fifth line and the Y” axis, O’ is the center point of the lens, O” is the center point of the photosensitive element, and O’O” is the focal length of the first camera; Δpitch is the change in the pitch angle of the electronic device from the first moment to the second moment, pitch1 is the angle between O’Y1 and the optical axis at the first moment, and pitch2 is the angle between O’Y2 and the optical axis at the second moment;

[0025] O”X2 is calculated using the following formula:

[0026] Δyaw=yaw1-yaw2

[0027]

[0028] The second distance is calculated based on the difference between O”X2 and O”X1, where Δyaw is the change in yaw angle of the electrons and equipment from the first moment to the second moment, yaw1 is the angle between O’X1 and the optical axis at the first moment, and yaw2 is the angle between O’X2 and the optical axis at the second moment.

[0029] In some embodiments, the electronic device further includes a gyroscope. Before determining the first parameter based on the attitude of the electronic device and the first image captured by the first camera, the method may further include: determining the attitude change of the electronic device from the first moment to the second moment by using data collected by the gyroscope. The attitude change of the electronic device from the first moment to the second moment includes one or more of the following: pitch angle change, yaw angle change, and roll angle change.

[0030] In conjunction with the previous implementation method, in some implementation methods, the frame rate of the image captured by the first camera is a first frame rate, and the frame rate of the data collected by the gyroscope is a second frame rate, which is greater than the first frame rate.

[0031] In some implementations, the width of the first gradient region is preset.

[0032] In conjunction with the first aspect or any of the above embodiments, in some embodiments, the method may further include: adjusting the parameters of the first light-reducing device according to a first light-reducing level; wherein the first light-reducing level is determined by an electronic device based on exposure parameters.

[0033] In conjunction with the first aspect, in some embodiments, the first light-reducing device is an electro-optical first light-reducing device, and the first camera also includes a microcontroller unit (MCU) and a driver integrated circuit. Adjusting the parameters of the first light-reducing device according to the first parameters specifically includes: sending a control signal to the driver integrated circuit through the MCU according to the first parameters, controlling the voltage output by the driver integrated circuit to the electro-optical first light-reducing device, so as to adjust the parameters of the first light-reducing device.

[0034] In conjunction with the first aspect, in some embodiments, the first light-reducing device includes a medium gray density ND filter, and the first camera also includes a microcontroller unit (MCU), a driver integrated circuit, and a motor. Adjusting the parameters of the first light-reducing device according to the first parameters specifically includes: sending a control signal to the driver integrated circuit through the MCU according to the first parameters, controlling the driver integrated circuit to output current to the motor, and driving one or more ND filters to move on the plane where the first light-reducing device is located through the motor, so as to adjust the parameters of the first light-reducing device.

[0035] In conjunction with the first aspect, in some embodiments, the first light-reducing device includes multiple polarizers, and the first camera also includes a microcontroller unit (MCU), a driver integrated circuit, and a motor. Adjusting the parameters of the first light-reducing device according to the first parameters specifically includes: sending a control signal to the driver integrated circuit through the MCU according to the first parameters, controlling the driver integrated circuit to output current to the motor, and driving one or more polarizers to rotate around the optical axis through the motor, so as to adjust the parameters of the first light-reducing device.

[0036] In a second aspect, an electronic device is provided, comprising: a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method provided as in the first aspect or any of the above embodiments.

[0037] In conjunction with the second aspect, the electronic device includes a first camera, which includes a lens, a first light-reducing device, and a photosensitive element arranged in parallel. The centers of the lens, the first light-reducing device, and the photosensitive element are all located on the optical axis. The first light-reducing device is a graduated light-reducing device, and the photosensitive element is used to convert the light passing through the lens and the first light-reducing device into electrical signals to generate an image.

[0038] Thirdly, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the method provided in the first aspect or any of the above embodiments.

[0039] Fourthly, a computer program product is provided, the computer program product including a computer program, which, when executed by a processor, implements the method provided as in the first aspect or any of the above embodiments.

[0040] Fifthly, a chip system is provided, the chip system including a processor and a memory, the memory storing a computer program, which, when executed by the processor, implements the method provided as in the first aspect or any embodiment of the first aspect. Attached Figure Description

[0041] Figure 1 This is a schematic diagram showing the positional relationship between the lens, light-reducing device, and photosensitive element in a camera provided in an embodiment of this application.

[0042] Figure 2 A schematic diagram illustrating the light reduction effect of the light-reducing device provided in this application when it is located at different positions;

[0043] Figure 3 A schematic diagram illustrating two gradient modes of the light-reducing device provided in the embodiments of this application;

[0044] Figure 4 A schematic diagram showing the correspondence between the light-reducing device, lens, and photosensitive element provided in the embodiments of this application;

[0045] Figure 5A This is a flowchart of a method for determining the gradual change direction based on the device posture, provided in Embodiment 1 of this application.

[0046] Figure 5B Force analysis diagram of the electronic device provided in the embodiments of this application;

[0047] Figure 6A This is a flowchart of a method for determining various parameters in a light-reducing device for a first image with a positive gradient distribution, as provided in Embodiment 2 of this application.

[0048] Figure 6B A first image of a positive gradient distribution provided in an embodiment of this application is shown;

[0049] Figure 6C The embodiments of this application provide a method for... Figure 6B The three-dimensional fitted surface is obtained by fitting the first image;

[0050] Figure 6D This application illustrates the embodiments of the present application that provide a method for... Figure 6C A cross-sectional view of the three-dimensional fitted surface;

[0051] Figure 7A This is a flowchart of a method for determining various parameters in a light-reducing device for a first image with an inverse gradient distribution, as provided in Embodiment 2 of this application.

[0052] Figure 7B A first image of the inverse gradient distribution provided in an embodiment of this application is shown;

[0053] Figure 7C The embodiments of this application provide a method for... Figure 7B The three-dimensional fitted surface is obtained by fitting the first image;

[0054] Figure 7D This application illustrates the embodiments of the present application that provide a method for... Figure 7C A cross-sectional view of the three-dimensional fitted surface;

[0055] Figure 8A The initial orientation of the electronic device is shown;

[0056] Figure 8B The diagram illustrates several posture changes of an electronic device as it "nods" from its initial posture.

[0057] Figure 8C The diagram illustrates several posture changes of an electronic device as it "shakes" from its initial position.

[0058] Figure 8D The diagram illustrates several posture changes of an electronic device as it "tumbles" from its initial posture.

[0059] Figure 8E The flowchart of the method for determining the position of the gradient line in a scene where the light has a positive gradient distribution is provided in Example 3;

[0060] Figures 9A-9C This diagram illustrates the image boundary before and after the electronic device changes its posture.

[0061] Figures 10A-10C This diagram illustrates the image boundary before and after the electronic device changes its posture.

[0062] Figures 11A-11D This diagram illustrates the image boundary before and after the electronic device changes its posture.

[0063] Figure 12 The present application provides a structure for adjusting an electroluminescent device according to an embodiment of the present application;

[0064] Figure 13 The present application provides a structure for adjusting a non-electroluminescence-reducing device according to an embodiment of the present application;

[0065] Figure 14 A hardware structure block diagram of the electronic device provided in the embodiments of this application;

[0066] Figure 15 The software architecture of the electronic device provided in the embodiments of this application. Detailed Implementation

[0067] The technical solutions in the embodiments of this application will be clearly and thoroughly described below with reference to the accompanying drawings.

[0068] The function of a light-reducing device is to filter light, reduce the amount of light entering the lens, and allow electronic devices such as cameras and mobile phones to take clear and soft photos, avoiding problems such as overexposure and loss of detail.

[0069] Position of the light-reducing device

[0070] Figure 1This example illustrates the positional relationship between the lens, light-reducing device, and photosensitive element (sensor) in a camera. Multiple lenses can be used. During shooting, light passes through the lens and light-reducing device before being transmitted to the photosensitive element. The photosensitive element then converts the light signal into an electrical signal, which is transmitted to other devices for processing. The planes containing the lens, photosensitive element, and photosensitive element are parallel to each other. Viewed along the optical axis, the three elements overlap. Figure 1 As shown in diagram a, the light-reducing device can be placed in front of all lenses. (As...) Figure 1 As shown in b, the light-reducing device can be placed between the lenses. (See diagram b) Figure 1 As shown in c, the light-reducing device can be placed behind the lens and in front of the image sensor.

[0071] Figure 2 This example illustrates how light passes through the lens and reaches the image sensor during photography. The scene being photographed reflects the light, for example... Figure 2 The image shows the light rays from the following three fields of view: ray 1 from the upper field of view, ray 2 from the middle field of view, and ray 3 from the lower field of view. Light rays from different fields of view pass through the lens and reach the image sensor, forming an inverted real image. (Example:...) Figure 2 As shown, light from different fields of view overlaps at positions close to the lens (such as the side of the subject being photographed that is close to the lens, or the side of the image sensor that is close to the lens); the closer the lens is to the image sensor, the less overlap there is between the different fields of view at that position.

[0072] Graduated neutral density (GND) devices have different light reduction requirements for different fields of view. When the GND device is placed behind the lens near the image sensor, the light from different fields of view passing through the same position of the GND device overlaps less, thus improving the accuracy of light reduction.

[0073] Light reduction principle

[0074] Based on their light reduction principle, light reduction devices can be categorized as follows:

[0075] 1. Electroluminescent devices, also known as electrochromic devices or electroluminescent devices. The working principle of electroluminescent devices is the electrochromic (ES) effect. When a voltage is applied to the electrochromic material in the device, the color and absorbance of these materials undergo reversible changes. This change alters the device's optical properties under voltage, thereby achieving a dimming effect. Electrochromic materials can include transition metal oxides, organic materials, and intercalated compounds.

[0076] The light reduction performance of electroluminescent devices is adjustable. The transmittance of the device can be controlled by regulating the voltage applied to it via a circuit. An electroluminescent device can be divided into multiple independent regions, each with its own independently controllable light reduction effect. Different voltages or currents can be applied to different regions as needed, causing different changes in the electrochromic material in each region, thus achieving the desired light reduction effect in each region.

[0077] 2. Neutral Density Filter (ND Filter). An ND filter, also known as a neutral density filter, is a type of high-grade optical glass used to reduce the brightness of transmitted light. Typically, the light reduction effect of a single ND filter is fixed, depending on its density. ND filters come in various densities, such as ND2, ND4, ND8, ND16, and ND32; the higher the density, the better the light reduction.

[0078] Two or more ND filters can be assembled into an adjustable ND filter. For example, a camera can have two or more ND filters. When the light reduction performance needs to be adjusted, the number of ND filters used for light reduction can be increased or decreased. For example, some ND filters can be overlapped as light reduction devices, thus adjusting the overall light reduction performance.

[0079] In addition, polarizers can also be used as light-reducing devices. For example, by keeping two polarizers parallel and then rotating one of them around the optical axis, the polarization direction of that polarizer in a fixed coordinate system can be changed, thus adjusting the light-reducing performance.

[0080] The transmittance and light-reducing properties of light-reducing devices are inversely related. The lower the transmittance, the better the light-reducing properties; the higher the transmittance, the worse the light-reducing properties. Light-reducing devices can also come in various shapes, such as circular or square.

[0081] Light-reducing devices can be divided into global light-reducing devices and graduated light-reducing devices. In a global light-reducing device, the transmittance is the same in every region, while in a graduated light-reducing device, the transmittance gradually changes from one end to the other. Most shooting scenarios involve gradual light transitions, and different areas have different light-reducing requirements. For example, strong light areas need to reduce more light than weak light areas. Therefore, graduated light-reducing devices are more practical and commonly used. The following embodiments of this application mainly focus on the use of graduated light-reducing devices. The light-reducing principle of graduated light-reducing devices in this application can be referred to above. For the sake of brevity, all subsequent references to light-reducing devices refer to graduated light-reducing devices.

[0082] Parameters of light-reducing devices

[0083] 1. Gradient mode, gradient direction, gradient line position / center line position of low light transmittance area, gradient area width.

[0084] The gradient mode determines how the transmittance changes in a neutral density (ND) device. The gradient modes of ND devices can be divided into positive gradient and negative gradient. Figure 3 This is a schematic diagram of these two gradient modes.

[0085] (1) Positive Gradient

[0086] like Figure 3 As shown in Figure a, a positive gradient means that the neutral density (ND) device uses a gradient line as a reference, with higher transmittance on one side of the gradient line and lower transmittance on the other. That is, the transmittance of the ND device gradually decreases from one side to the other. A positive gradient ND device can be divided into a low-transmittance region and a high-transmittance region, located on opposite sides of the gradient line. The transmittance of the former is less than that of the latter.

[0087] In a positive gradient light-reducing device, the gradient direction is either from the low-transmittance region to the high-transmittance region or the opposite direction.

[0088] In a positive gradient dimming device, the gradient line is a line segment formed by the two endpoints on the edge of the dimming device. The gradient line may be located in the middle of the gradient device or in other locations.

[0089] In an anti-gradient light-reducing device, the gradient line is perpendicular to the gradient direction.

[0090] In a positive gradient light-reducing device, the gradient region is the area where the light transmittance abruptly changes from high to low, and is also the region extending outwards from the gradient line as the center. The gradient line is located in the middle of the gradient region. That is, the gradient region includes a portion of the low-transmittance region near the high-transmittance region, and a portion of the high-transmittance region near the low-transmittance region. The width of the gradient region is the width of the gradient region in the gradient direction.

[0091] (2) Reverse Gradient

[0092] like Figure 3 As shown in b, a reverse gradient neutral density (NDD) device refers to an NDD device with high transmittance on both sides of a low-transmittance region, and low transmittance in the area between the two sides. That is, the transmittance of the NDD device gradually decreases from one side towards the two sides, and also gradually decreases from the other side towards the two sides. A reverse gradient NDD device can be divided into three regions: a first high-transmittance region, a low-transmittance region, and a second high-transmittance region, with the first and second high-transmittance regions located on either side of the low-transmittance region. The transmittance of the two high-transmittance regions is greater than that of the low-transmittance region.

[0093] In an anti-gradient light-reducing device, the gradient direction is either the direction from the low-transmittance region to the first high-transmittance region, or the direction from the low-transmittance region to the second high-transmittance region. Alternatively, the gradient direction is the opposite of the two directions mentioned above.

[0094] In an anti-gradient light-reducing device, the center line of the low-transmittance region passes through the center of the low-transmittance region and is perpendicular to the gradient direction.

[0095] In an anti-gradient light-reducing device, the gradient region comprises the area in the first high-transmittance region where the transmittance abruptly changes from high to low, the area in the second high-transmittance region where the transmittance abruptly changes from high to low, and the region in between. Specifically, the gradient region includes the portion of the first high-transmittance region near the low-transmittance region, the portion of the second high-transmittance region near the low-transmittance region, and the region in between.

[0096] Figure 3 For example only, in a positively graded neutral density (ND) device, the graded line can not only be located in... Figure 3 The middle position of the light-reducing device shown in Figure a can also be located in other positions. The center line of the low-transmittance region in the inverse gradient light-reducing device can not only be located in... Figure 3 The middle position of the dimming device shown in b can also be located in other positions, and this application embodiment does not limit this. For example, the gradient line of the positive gradient dimming device can also be compared to... Figure 3 The position of 'a' is higher, so the area of ​​the high-transmittance region is larger than the area of ​​the low-transmittance region. For example, in an inverse gradient light-reducing device, the center line of the low-transmittance region can also be compared to... Figure 3 The position of b is lower, so the area of ​​the first high light transmittance area is larger than the area of ​​the second high light transmittance area.

[0097] The terms "low transmittance area" and "high transmittance area" used here are relative, not absolute. Within a low transmittance area, the transmittance may be the same or different at various points, but all areas will remain within a low transmittance range. Within a high transmittance area, the transmittance may be the same or different at various points, but all areas will remain within a high transmittance range. The rate of change in transmittance in the gradient area is greater than that in other areas.

[0098] Gradual neutral density (GND) devices are suitable for shooting scenarios where the light intensity gradually decreases from one end to the other. Most shooting scenarios fall into this category, such as shooting sunsets or portraits, where the light is stronger near the sky and weaker near the ground.

[0099] Reverse graduated neutral density (ND) devices are suitable for shooting scenarios where the light intensity gradually decreases from one end to the other. For example, when shooting a sunrise over the sea, the light from the sun in the middle is stronger, while the light from the sky above and the sea below is weaker.

[0100] 2. Reduce brightness setting.

[0101] The light reduction level is also known as the light reduction intensity. The higher the light reduction level, the better the light reduction performance of the light reduction device, and the lower the light transmittance.

[0102] Correspondence between the photographed scene, the light-reducing device, and the image sensor

[0103] The purpose of explaining this correspondence is to better understand the description of the gradient light reduction method in the subsequent embodiments.

[0104] Figure 4 by Figure 1 Taking the positional relationship shown in Figure c as an example, this diagram illustrates the correspondence between the photographed scene, the light-reducing device, and the image sensor. Figure 4 In this setup, the light-reducing device, lens, and image sensor are arranged in parallel, with the light-reducing device placed between the lens and the image sensor.

[0105] like Figure 4 As shown, three coordinate systems are first defined.

[0106] The coordinate system XYZ takes the center of the light-reducing device as the origin O, the plane where the light-reducing device is located as the XY plane, and the direction of light rays entering the light-reducing device on the optical axis as the Z axis.

[0107] The coordinate system X'Y'Z' has its origin O' at the center of the lens, its X'Y' plane at the plane where the lens is located, and its Z' axis at the direction in which light rays enter the lens.

[0108] The coordinate system X”Y”Z” takes the center of the photosensitive element as the origin O”, the plane where the photosensitive element is located as the X”Y” plane, and the direction of light entering the photosensitive device on the optical axis as the Z” axis.

[0109] The centers of the light-reducing device, lens, and image sensor are all on the optical axis, and the planes in which they lie are parallel. The X-axis, X'-axis, and X"-axis are parallel to each other and have the same direction; the Y-axis, Y'-axis, and Y"-axis are parallel to each other and have the same direction; and the Z-axis, Z'-axis, and Z"-axis coincide and have the same direction. The image sensor is used to acquire images, and the plane in which the image sensor lies can also be considered the plane in which the acquired image lies.

[0110] When the light reflected from the subject exhibits a positive gradient distribution (i.e., the light intensity gradually decreases from one end to the other), the subject can include a bright area with strong reflection and a dim area with weak reflection. After passing through the lens, the reflected light continues into the image sensor. Due to the inverted imaging principle of the lens, bright and dim areas are formed within the image sensor, inverted relative to the bright and dim areas of the subject. To achieve a good light reduction effect, the light-reducing device includes a low-transmittance area and a high-transmittance area.

[0111] The correspondence between the photographed scene, the light-reducing device, and the image sensor includes:

[0112] The bright areas of the photographed scene correspond to the bright areas in the image sensor and the low-transmittance areas in the neutral density filter. The coordinates of the bright areas in the image sensor in the X"Y"Z" coordinate system are the same as the coordinates of the low-transmittance areas in the neutral density filter in the XYZ coordinate system.

[0113] The low-brightness areas of the photographed scene, the low-brightness areas in the image sensor, and the high-transmittance areas in the neutral density filter correspond to each other. The coordinates of the low-brightness areas in the image sensor in the X"Y"Z" coordinate system are the same as the coordinates of the high-transmittance areas in the neutral density filter in the XYZ coordinate system.

[0114] The boundary line between the bright and low brightness areas in a photosensitive element corresponds to the gradient line in a light-reducing device, and the coordinates of the two are the same in their respective coordinate systems.

[0115] The terms "strong light" and "weak light" mentioned here and in subsequent embodiments are relative, not absolute. "High brightness" and "low brightness" are relative, not absolute. "High light transmittance" and "low light transmittance" are relative, not absolute; the actual light transmittance of the light-reducing device should be considered in relation to the light-reducing setting.

[0116] When shooting in a scene with an inverse gradient light distribution, there is a similar correspondence between the subject, the light-reducing device, and the image sensor. This light distribution brings different effects to the image sensor than... Figure 4 The impact of [the event / event].

[0117] Methods for determining the parameters of a light-reducing device

[0118] During the shooting process, i.e., after the camera is activated, the electronic device can determine various parameters of the light-reducing device. Specifically, the electronic device can determine one or more of the following parameters based on its orientation and the image captured by the camera: gradient mode, gradient direction, gradient line position / center line position of the low-transmittance area, and gradient area width. The electronic device can also adjust the light-reducing effect of the device based on these determined parameters, thereby capturing clear, soft, high-quality photos or videos.

[0119] In this embodiment of the application, the camera activated by the electronic device can be referred to as the first camera, and the light-reducing device in the first camera can be referred to as the first light-reducing device. Among the parameters of the first light-reducing device determined by the electronic device, the gradient mode can be referred to as the first gradient mode, the gradient direction can be referred to as the first gradient direction, the position of the gradient line or the position of the center line of the low-transmittance area can be referred to as the first position, and the width of the gradient area can be referred to as the first gradient width.

[0120] The following three examples illustrate how electronic devices determine the parameters of light-reducing devices.

[0121] Example 1

[0122] 1. Determine the gradient mode

[0123] In Example 1, considering that the light is positively distributed in most shooting scenarios, the default gradient mode of the light-reducing device is positive gradient.

[0124] Example 1 is applicable to most shooting scenarios.

[0125] 2. Determine the direction of the gradient.

[0126] In Example 1, the electronic device can determine the gradient direction of the light-reducing device based on its orientation. For a scene with a positive gradient light distribution, the light intensity gradually decreases in the direction from the sky to the ground. Due to the principle of inverted lens imaging, in any orientation of the electronic device, the area closer to the ground on the plane where the photosensitive element is located receives stronger light. Based on this, the electronic device can determine the gradient direction of the light-reducing device according to its own orientation.

[0127] Figure 5A This is a flowchart of the method for determining the gradual change direction based on the device posture provided in Example 1. Figure 5A As shown, the method may include the following steps:

[0128] S101, the electronic device acquires acceleration through an accelerometer and determines the direction of the component of the acceleration on the plane where the light-reducing device is located.

[0129] Figure 5B This is a force analysis diagram for an electronic device. (Example:) Figure 5B As shown, a coordinate system XYZ is defined, with the center of the light-reducing device as the origin O, the plane containing the light-reducing device as the XY plane, and the direction of light rays entering the light-reducing device along the optical axis as the Z-axis. For example, the X-axis can be set to the direction from the center of the light-reducing device to the bottom of the electronic device, and the Y-axis can be set to the direction from the center of the light-reducing device to the right edge of the electronic device. Of course, the X and Y axes can also be set to other mutually perpendicular directions on the plane containing the light-reducing device.

[0130] Electronic devices can acquire acceleration 'a' using an accelerometer. Then, the electronic device calculates the X-axis component 'a' of acceleration 'a'. x The component a on the Y-axis y The resultant component of acceleration *a* on the XY plane is defined as *a*. xy The electronic device can calculate a using the following formula 1, which represents an inverse trigonometric function. xy The angle β between the X-axis and the X-axis:

[0131] a can also be calculated using formula 2 or formula 3 of the inverse trigonometric functions. xy Angle α with the Y-axis:

[0132]

[0133] Formula 3: α = 90° - β

[0134] The direction of the resultant component of acceleration a in the XY plane (hereinafter referred to as the first direction) can be obtained through a. xy It can be represented by the angle β between the x-axis and the x-axis, or it can also be represented by a. xy It is represented by the angle α between the Y and the Y axis.

[0135] During the filming process, the acceleration of electronic devices is primarily gravitational acceleration. Since the direction of acceleration and the direction of force are always consistent, the direction of the resultant component of acceleration 'a' in the XY plane (i.e., the first direction) can be considered the same as the direction of the component of gravity in the XY plane. Therefore, for the XY plane, the area closer to the ground in the first direction receives stronger light. That is, during the filming process, the light entering the XY plane increases in intensity in the first direction.

[0136] S102, the electronic device determines the gradient direction of the light-reducing device as the opposite direction of the component direction of acceleration on the plane where the light-reducing device is located.

[0137] After learning about the changes in light on the XY plane, the electronic device can use the opposite direction of the first direction as the gradient direction of the light-reducing device, where the gradient direction refers to the direction from the low-transmittance area to the high-transmittance area. In this way, the light-reducing device can reduce the light transmittance of the strong light areas of the photosensitive element and increase the light transmittance of the weak light areas, thereby achieving gradient light reduction. Of course, in other embodiments, the electronic device can also use the first direction as the gradient direction of the light-reducing device, where the gradient direction refers to the direction from the high-transmittance area to the low-transmittance area.

[0138] 3. Determine the position of the gradient line

[0139] After determining the gradient direction, the direction of the gradient line can be determined based on the perpendicular relationship between the gradient direction and the gradient line. That is, the direction of the gradient line is perpendicular to the gradient direction. However, knowing only the direction of the gradient line is not enough to determine its position. After knowing the direction of the gradient line, a point on the neutral density filter is also needed. The position of the gradient line can be determined by this point and the direction of the gradient line.

[0140] In some implementations, the electronic device can preset a position point on the light-reducing device and set the gradient line to pass through that position point. This allows the electronic device to determine the position of the gradient line using the preset position point and the gradient line direction. The preset position point on the light-reducing device can be the center point of the device, a point closer to the low-transmission direction, or a point closer to the high-transmission direction, etc., and is not limited here. The preset position point can be referred to as the first position point.

[0141] 4. Determine the width of the gradient region

[0142] In some implementations, the electronic device may preset the width of the gradient region. This application does not limit the preset width of the gradient region.

[0143] 5. Determine the light reduction setting.

[0144] In some implementations, the electronic device can preset a light reduction level. This application does not limit the preset light reduction level.

[0145] In some implementations, the electronic device can calculate the light reduction level based on exposure parameters. Exposure parameters may include aperture value, shutter speed, and ISO sensitivity. These exposure parameters and the light reduction level work together to adjust the image brightness; therefore, a processor within the electronic device can coordinate these parameters to adjust the image brightness. In this embodiment, the electronic device can acquire the current exposure parameters and then determine the light reduction level based on those parameters, thereby adjusting the image brightness. The exposure parameters of the electronic device can be manually adjusted by the user or determined through an automatic exposure (AE) mechanism.

[0146] Example 2

[0147] In Embodiment 2, the electronic device determines some parameters of the light-reducing device based on the image captured by the photosensitive element in the camera. The image captured by the photosensitive element directly reflects the light entering the photosensitive element during the shooting process, and therefore, some parameters of the light-reducing device can be determined based on this image. In the following embodiments, the image captured by the photosensitive element is referred to as the first image.

[0148] Based on the preceding text Figure 4The positional correspondence between the photosensitive element and the light-reducing device is introduced. The parameters of the light-reducing device are mainly described below based on the first image.

[0149] The brightness in the first image may exhibit a positive gradient distribution or an inverse gradient distribution. For first images with different distributions, the electronic device determines the parameters of the light-reducing device differently, which will be explained in detail below.

[0150] 1. For the first image with a positive gradient distribution, how to determine the parameters of the light-reducing device?

[0151] Figure 6A The flowchart illustrates the method for determining various parameters in the light-reducing device for a first image with a positive gradient distribution, as provided in Example 2. Figure 6A As shown, the method may include the following steps:

[0152] S201, the camera of the electronic device captures the first image and recognizes that the brightness of the first image has a positive gradient distribution.

[0153] After the electronic device acquires the first image, it can identify the bright and dark areas in the first image and determine whether the brightness distribution of the first image is a positive or negative gradient distribution based on the distribution of the bright and dark areas.

[0154] In some implementations, the electronic device can determine the grayscale value of each pixel in the first image, identifying regions of pixels with grayscale values ​​greater than a first value as bright regions and regions of pixels with grayscale values ​​less than the first value as dark regions. The first value can be set as needed. The grayscale value typically ranges from 0 to 255, where 0 represents black and 255 represents white. The first value can be set to, for example, 120.

[0155] In this embodiment of the application, after the camera of the electronic device captures the first image, the brightness change of the first image can be identified by devices such as the application processor (AP), image signal processor (ISP), or neural-network processing unit (NPU) in the electronic device.

[0156] Figure 6B The brightness variations of the first image with a positive gradient distribution are shown. For example... Figure 6B As shown, in the positive gradient distribution, one side of the first image is a bright area and the other side is a dark area.

[0157] Therefore, when an electronic device recognizes that the first image includes a bright area and a dark area, it can determine that the brightness of the first image has a positive gradient distribution.

[0158] S202, the electronic device determines the various parameters of the light-reducing device based on the first image.

[0159] The following sections describe how to determine the various parameters of an optical neutral density (ORD) device.

[0160] (1) Determine the gradient mode

[0161] For the first image with a positive gradient distribution, the gradient mode of the subtraction device is positive gradient.

[0162] (2) Determine the direction of the gradual change

[0163] The gradient direction of the light-reducing device corresponds to the direction from the bright area to the low-brightness area in the first image, and this gradient direction is from the low-transmittance area to the high-transmittance area. Alternatively, the gradient direction of the light-reducing device can also correspond to the opposite direction, and this gradient direction is from the high-transmittance area to the low-transmittance area.

[0164] (3) Determine the position of the gradient line

[0165] For the first image with a positive gradient distribution, the gradient line of the light-reducing device is perpendicular to the gradient direction, and the position of the gradient line corresponds to the boundary line in the first image.

[0166] The electronic device can determine the position of the gradient line in the light-reducing device based on the dividing line in the first image. Here, the dividing line in the first image can also be referred to as the first straight line.

[0167] The electronic device can first determine the location of the dividing line in the first image.

[0168] In a positive gradient image, the dividing line is located in the middle of the brightness distribution. The brightness of a pixel in an image can be measured by its grayscale value; the higher the grayscale value, the brighter the pixel. The grayscale value typically ranges from 0 to 255, where 0 represents black and 255 represents white. That is, the dividing line of a positive gradient image is located in the middle of the grayscale value distribution. For example, if the overall grayscale value range of the first image is 0-100, then the dividing line is the position where the grayscale value in the first image is 50.

[0169] For example, such as Figure 6BAs shown, the first image is placed in the coordinate system X”Y”Z” where the photosensitive element is located, and the center of the first image is located at the origin O” of the coordinate system X”Y”Z”. If a certain coordinate (x”, y”) in the coordinate system X”Y”Z” represents a certain position of the first image and also represents a certain position of the photosensitive element, then the electrical signal generated at that position in the photosensitive element corresponds to the pixel point at that position in the first image. Figure 6B The dividing line of the first image shown is exactly in the direction of the X” axis. Of course, the dividing lines of other first images can be in other positions in the coordinate system X”Y”Z”, depending on the actual brightness distribution in the first image.

[0170] The following describes how an electronic device determines the location of the dividing line in the first image.

[0171] In this embodiment, the dividing line in the first image can be represented as the straight line ax”+by”+c=0 in the X”Y” coordinate system. Here, a, b, and c are constants that need to be solved. After determining a, b, and c, the straight line ax”+by”+c=0 is also determined.

[0172] Figure 6C An example is shown of the three-dimensional fitted surface corresponding to the first image in the X"Y"Z"" coordinate system. In the X"Y"Z"" coordinate system, the X"Y" surface can be the plane where the first image is located, and the Z"' axis represents the grayscale value.

[0173] Figure 6C The cross-sectional curve perpendicular to the line ax”+by”+c=0 in the three-dimensional fitted surface is shown as follows: Figure 6D As shown. Figure 6D The cross-sectional curve shown can be considered as viewed from the direction of the line ax"+by"+c=0 (i.e., the X" axis direction) in the X"Y"Z"" coordinate system. Figure 6C The result of the three-dimensional fitted surface is shown.

[0174] exist Figure 6D In the diagram, the direction of the line ax”+by”+c=0 is perpendicular to the origin O” and extends outward from the paper or in the opposite direction. The vertical axis represents the gray value of the pixel, and the horizontal axis represents the distance between the pixel and the line ax”+by”+c=0. The pixel coordinates can be represented as (x”, y”), which are located in the X”Y” coordinate system and are the pixels in the first image.

[0175] Figure 6D The origin O in the middle is Figure 6C The intersection point of the line ax”+by”+c=0 and the Z”’ axis in the shown 3D fitted surface is exactly [missing information]. Figure 6A The center of the first image shown is the origin O". In other first images with different brightness distributions, Figure 6D The origin may not be the origin O.

[0176] Figure 6D The curve of the curve perfectly matches the curve form of a partial fitting function, which may include, but is not limited to, the error function, the sigmoid function, the hyperbolic tangent function, and the arctangent function. The range of the error function is [-1, 1], the range of the sigmoid function is [0, 1], the range of the hyperbolic tangent function is [-1, 1], and the range of the arctangent function is [-π / 2, π / 2].

[0177] Based on the preceding paragraphs, let the independent variable of the fitting function be l. Then, the independent variable l satisfies the following formula 4, and any one of the fitting functions in formulas 5-8. Here, formula 5 represents the error function, formula 6 represents the sigmoid function, formula 7 represents the hyperbolic tangent function, and formula 8 represents the arctangent function.

[0178]

[0179] Taking the error function shown in Formula 5 as an example, the electronic device can determine the line ax”+by”+c=0 based on the error function in Formula 5 and the gray values ​​of each pixel in the first pixel. Each pixel in the first image corresponds to a set of data: l (the distance from the pixel to the line ax”+by”+c=0) as represented by Formula 4, and Erf(l) (the gray value of the pixel mapped to the range of the error function) as represented by Formula 10. Multiple pixels in the first image correspond to multiple sets of data. Using l as the horizontal axis and Erf(l) as the vertical axis, the result of fitting these multiple sets of data is the error function shown in Formula 5.

[0180] Based on the error function relationship expressed in Formula 5 and the grayscale values ​​of each pixel in the first image, the electronic device can determine the distance, l, corresponding to each pixel in the first image. Then, based on the value and physical meaning of l (the distance from the pixel to the line ax”+by”+c=0), and the positions of each pixel in the first image, the values ​​of a, b, and c can be calculated. Thus, the position of the line ax”+by”+c=0 in the first image can be determined.

[0181] Fitting refers to the process of knowing several discrete function values ​​(i.e., gray values ​​of each region) of a certain function, and adjusting several undetermined coefficients in the function to minimize the difference between the function and the known set of points (e.g., in the sense of least squares).

[0182] When using other fitting functions, the process of determining the line ax”+by”+c=0 is similar to the process described above, and will not be repeated here.

[0183] (4) Determine the width of the gradient region

[0184] For the first image with a positive gradient distribution, the gradient region of the dimming device corresponds to the region in the first image where the brightness changes abruptly from high to low.

[0185] The electronic device can first identify a first region in the first image whose brightness change rate exceeds a first threshold, and then determine the width of the gradient region based on the width of the first region. The first threshold can be set as needed.

[0186] After determining a, b, and c, the electronic device follows... Figure 6D The physical meaning of the curve shown can be plotted with the distance from a pixel in the first image to the first straight line as the x-axis and the value of the pixel's grayscale value mapped to the range of the first fitting function as the y-axis. Figure 6D The curve shown. Plotted. Figure 6D The curve can be called the first curve. According to... Figure 6D The physical meaning of the curve shown is that the width of the region with a large slope (i.e., the region where the slope exceeds the second threshold) is the width of the region in the first image where the brightness abruptly changes to low brightness. The second threshold can be set as needed. For example... Figure 6D As shown, the width of the region in the first image where the brightness abruptly changes to low brightness can be defined as σ.

[0187] 2. For the first image with an inverse gradient distribution, how to determine the parameters of the subtraction device?

[0188] Figure 7A This is a flowchart of a method for determining various parameters in a light-reducing device for a first image with an inverse gradient distribution, as provided in Embodiment 2 of this application.

[0189] like Figure 7A As shown, the method may include the following steps:

[0190] S301, the camera of the electronic device captures the first image and recognizes that the brightness of the first image has an inverse gradient distribution.

[0191] S301 can be referenced. Figure 6A S201.

[0192] Figure 7B The brightness variations of the first image with the inverse gradient distribution are shown. For example... Figure 7B As shown, in the inverse gradient distribution, the two sides of the first image are low-brightness areas, and gradually transition to high-brightness areas from the two sides towards the middle.

[0193] Therefore, when an electronic device recognizes that the first image includes a first low-brightness area, a second low-brightness area, and a high-brightness area, and that the first low-brightness area and the second low-brightness area are located on both sides of the high-brightness area, it can determine that the brightness of the first image has a positive gradient distribution.

[0194] S302, the electronic device determines the various parameters of the light-reducing device.

[0195] The following sections describe how to determine the various parameters of an optical neutral density (ORD) device.

[0196] (1) Determine the gradient mode

[0197] For the first image with an inverse gradient distribution, the gradient mode of the subtraction device is inverse gradient.

[0198] (2) Determine the direction of the gradual change

[0199] The gradient direction of the light-reducing device corresponds to the direction from the bright area to the low-brightness area in the first image, and this gradient direction is from the low-transmittance area to the high-transmittance area. Alternatively, the gradient direction of the light-reducing device can also correspond to the opposite direction, and this gradient direction is from the high-transmittance area to the low-transmittance area. Since there are two low-brightness areas in the first image with the inverse gradient distribution, there are also two directions from the bright area to the low-brightness area.

[0200] (3) Determine the center line of the low light transmittance area

[0201] For the first image with an inverse gradient distribution, the center line of the low-transmittance region in the light-reducing device is perpendicular to the gradient direction, and this center line corresponds to the center line of the high-brightness region in the first image.

[0202] The electronic device can determine the center line of the low-transmittance region in the light-reducing device based on the center line of the bright region in the first image. Here, the center line of the bright region in the first image can also be referred to as the second straight line.

[0203] The electronic device can first determine the center line of the highlighted area in the first image.

[0204] In an inverse gradient image, the center line of the highlight area is located in the middle of the highlight area, and the two low-brightness areas are located on either side of the highlight area. For example, if the grayscale values ​​of the two side areas of the first image are 0-49, and the grayscale value of the middle area is 50-100, then the middle area is the highlight area, and the center line of the middle area is perpendicular to the gradient direction.

[0205] For example, such as Figure 7B As shown, the first image is placed in the coordinate system X”Y”Z” where the photosensitive element is located, with the center of the first image located at the origin O” of the coordinate system X”Y”Z”. If a certain coordinate (x”, y”) in the coordinate system X”Y”Z” represents a certain position of the first image and also represents a certain position of the photosensitive element, then the electrical signal generated at that position in the photosensitive element corresponds to the pixel point at that position in the first image. In other words, when the first image is placed in the coordinate system X”Y”Z”, the area and orientation of the first image and the photosensitive element are the same. Figure 7B The dividing line of the first image shown is oriented exactly along the X” axis. Of course, the dividing line of other first images can be oriented at other positions in the X”Y”Z” coordinate system, depending on the actual brightness distribution in the first image.

[0206] The following describes how an electronic device determines the center line of the highlighted area in the first image.

[0207] In this embodiment, the center line of the highlighted area in the first image can be represented as the straight line ax”+by”+c=0 in the X”Y” coordinate system. Here, a, b, and c are constants that need to be solved for; once a, b, and c are determined, the straight line ax”+by”+c=0 is also determined.

[0208] Figure 7C An example is shown of the three-dimensional fitted surface corresponding to the first image in the X"Y"Z"" coordinate system. In the X"Y"Z"" coordinate system, the X"Y" surface can be the plane where the first image is located, and the Z"' axis represents the grayscale value.

[0209] Figure 7C The cross-sectional curve perpendicular to the line ax”+by”+c=0 in the three-dimensional fitted surface is shown as follows: Figure 7D As shown. Figure 7D The cross-sectional curve shown can be considered as viewed from the direction of the line ax"+by"+c=0 (i.e., the X" axis direction) in the X"Y"Z"" coordinate system. Figure 7C The result of the three-dimensional fitted surface is shown.

[0210] exist Figure 7D In the diagram, the direction of the line ax”+by”+c=0 is perpendicular to the origin O” and extends outward from the paper or in the opposite direction. The vertical axis represents the gray value of the pixel, and the horizontal axis represents the distance between the pixel and the line ax”+by”+c=0. The pixel coordinates can be represented as (x”, y”), which are located in the X”Y” coordinate system and are the pixels in the first image.

[0211] Figure 7D The origin O in the middle is Figure 7C The intersection point of the line ax”+by”+c=0 and the Z”’ axis in the shown 3D fitted surface is exactly [missing information]. Figure 7A The center of the first image shown is the origin O". In other first images with different brightness distributions, Figure 7D The origin may not be the origin O.

[0212] Figure 7D The curve of the function exactly matches the curve form of a partial fitting function, which may include, but is not limited to, a Gaussian function.

[0213] Based on the preceding paragraphs, let the independent variable of the fitted function be l. Then, this independent variable l satisfies the following formulas 9 and 10. Wherein, the formulas...

[0214] Equation 10 represents the Gaussian function, where A is the parameter of the Gaussian function.

[0215]

[0216] The electronic device can determine the line ax”+by”+c=0 based on the error function in Formula 10 and the grayscale values ​​of each pixel in the first pixel. Each pixel in the first image corresponds to a set of data: l (the distance from the pixel to the line ax”+by”+c=0) as represented by Formula 9, and S(l) (the grayscale value of that pixel) as represented by Formula 10. Multiple pixels in the first image correspond to multiple sets of data. Using l as the abscissa and S(l) as the ordinate, the result of fitting these multiple sets of data is the error function shown in Formula 5.

[0217] Based on the error function relationship expressed by Formula 10 and the grayscale values ​​of each pixel in the first image, the electronic device can determine the distance, l, corresponding to each pixel in the first image. Then, based on the value and physical meaning of l (the distance from the pixel to the line ax”+by”+c=0), and the positions of each pixel in the first image, the values ​​of a, b, and c can be calculated. Thus, the position of the line ax”+by”+c=0 in the first image can be determined.

[0218] (4) Determine the width of the gradient region

[0219] For the first image with an inverse gradient distribution, the gradient region of the dimming device corresponds to the two regions in the first image where the low brightness changes abruptly to high brightness, as well as the region between the two regions.

[0220] The electronic device can first determine a second region in the first image, which includes two regions in the first image whose brightness change rate exceeds a third threshold and the region between the two regions. Then, it determines the width of the gradient region based on the width of the second region. The third threshold can be set as needed.

[0221] After determining a, b, and c, the electronic device follows... Figure 7D The physical meaning of the curve shown can be illustrated by plotting the distance from a pixel in the first image to the first straight line on the x-axis and the grayscale value of the pixel on the y-axis. Figure 7D The curve shown. Plotted. Figure 7D The curve can be called the second curve. According to... Figure 7DThe curve shown has a physical meaning. The vertical axis of the curve represents the grayscale value. Therefore, the widths of the two regions with larger slopes (i.e., regions whose slopes exceed the fourth threshold) in the curve represent the widths of the two low-brightness regions in the first image that abruptly change to high-brightness, as well as the width of the region between these two regions. The fourth threshold can be set as needed. For example... Figure 7D As shown, the width of the two regions in the first image that abruptly change from low brightness to high brightness, and the width of the region between the two regions, can be defined as σ.

[0222] Regardless of whether the first image is positively or negatively gradient, the method for determining the light reduction level in the light reduction device can refer to the relevant description in Example 1, and will not be repeated here.

[0223] The preceding embodiments 1 and 2 can be implemented in combination. For example, an electronic device can determine the gradient direction using either embodiment 1 or embodiment 2, determine the gradient line position using either embodiment 1 or embodiment 2, and determine the gradient area width using either embodiment 1 or embodiment 2.

[0224] Example 3

[0225] In Example 3, the position of the gradient line or the center line position of the low-transmittance area, as well as the gradient direction, are determined based on the posture changes of the electronic device.

[0226] For scenarios where the light has a positive gradient distribution, we will first introduce the influence of the posture change of the electronic device on the position of the gradient line in the light-reducing device.

[0227] During filming, the electronic device may be in any posture and change to another posture from any posture. The electronic device may be in landscape mode, portrait mode, or an intermediate state between the two. The plane where the photosensitive element of the camera is located may be parallel to the direction of gravity or may be at an angle to the direction of gravity. The embodiments of this application do not limit the initial posture of the electronic device.

[0228] Figure 8A The initial orientation of the electronic device is shown.

[0229] like Figure 8A As shown, a coordinate system X0Y0Z0 is first defined. The X0 axis is the direction from left to right of the back of the electronic device when viewed along the optical axis in the initial orientation; the Y0 axis is the direction from top to bottom of the device when viewed along the optical axis in the initial orientation; and the Z0 axis is the optical axis of the camera on the back of the electronic device in the initial orientation. A line L1 is defined on the plane where the lens is located in the initial orientation, passing through the center of the lens and parallel to the Y0 axis. A line L2 is defined on the plane where the lens is located in the initial orientation, passing through the center of the lens and parallel to the X0 axis.

[0230] Starting from an initial posture, an electronic device may undergo the following posture changes:

[0231] 1. When an electronic device rotates around the X0 axis, the L1 and Y0 axes form a pitch angle, a process that can be called "nodding". When the electronic device rotates counterclockwise around the X0 axis in the Y0Z0 plane, the pitch angle is positive, and the positive pitch angle ranges from (0° to 180°); when the electronic device rotates clockwise around the X0 axis in the Y0Z0 plane, the pitch angle is negative, and the negative pitch angle ranges from (0° to -180°).

[0232] 2. When an electronic device rotates around the Y0 axis, the L2 and X0 axes form a yaw angle, a process known as "shaking". When the electronic device rotates counterclockwise around the Y0 axis in the X0Z0 plane, the yaw angle is positive, with a range of (0°, 180°); when the electronic device rotates clockwise around the Y0 axis in the X0Z0 plane, the yaw angle is negative, with a range of (0°, -180°).

[0233] 3. When an electronic device rotates around the Z0 axis, the L1 and Y0 axes form a roll angle, which can be called "roll". When the electronic device rotates counterclockwise around the Z0 axis in the X0Y0 plane, the roll angle is positive, and the positive roll angle ranges from (0° to 180°); when the electronic device rotates clockwise around the Z0 axis in the X0Y0 plane, the roll angle is negative, and the negative roll angle ranges from (0° to -180°).

[0234] The attitude changes of electronic devices may include any one or more combinations of the three attitudes mentioned above.

[0235] Figure 8B This example illustrates how the boundary line on the photosensitive element changes when an electronic device "nods," that is, rotates around the X0 axis. For example... Figure 8B As shown in Figure ac, when the electronic device rotates counterclockwise around the X0 axis in the Y0Z0 plane, the pitch angle is positive, and the dividing line on the photosensitive element moves in the positive direction of the Y” axis. The larger the pitch angle, the farther the movement distance. Figure 8B As shown in the diagram, when the electronic device rotates clockwise around the X0 axis in the Y0Z0 plane, the pitch angle is negative, and the dividing line on the photosensitive element moves in the opposite direction of the Y” axis. The larger the negative pitch angle, the farther the movement distance.

[0236] Figure 8C This example illustrates how the boundary line on the photosensitive element changes when an electronic device "shakes"—that is, rotates around the Y0 axis. For example... Figure 8CAs shown in Figure ac, when the electronic device rotates counterclockwise around the Y0 axis in the X0Z0 plane, the yaw angle yaw is positive, and the dividing line on the photosensitive element moves in the positive direction of the X” axis. The larger the yaw angle yaw, the farther the movement distance. Figure 8C As shown in df, when the electronic device rotates counterclockwise around the Y0 axis in the X0Z0 plane, the yaw angle is negative, and the dividing line on the photosensitive element moves in the opposite direction of the X” axis. The larger the negative yaw angle, the farther the movement distance.

[0237] Figure 8D This example illustrates how the boundary line on the photosensitive element changes when an electronic device "tumbles," that is, rotates around the Z0 axis. For example... Figure 8D As shown in Figure ac, when the electronic device rotates counterclockwise around the Z0 axis in the X0Y0 plane, the roll angle roll is positive, and the dividing line rotates clockwise in the X"Y" plane. The larger the roll angle roll, the larger the rotation angle. For example... Figure 8D As shown in the df, when the electronic device rotates clockwise around the Z0 axis in the X0Y0 plane, the roll angle roll is negative. The dividing line rotates counterclockwise in the X”Y” plane. The larger the negative roll angle roll is, the larger the rotation angle is.

[0238] Figures 8B-8D The boundary line in the sensor shown in the initial pose is only an example. In other cases, the boundary line in the sensor may be different, depending on the actual light reflected from the scene being photographed. Figures 8B-8D The boundary line shown can be a boundary line when the light has a positive gradient distribution or a boundary line when the light has a negative gradient distribution. This application does not limit this.

[0239] For example, when the dividing line in the photosensitive element is parallel to the X” axis, the electronic device “shakes”, that is, when it rotates around the Y0 axis, the position of the dividing line does not change.

[0240] For example, when the dividing line in the photosensitive element is parallel to the Y” axis, the electronic device “nods”, that is, when it rotates around the X0 axis, the position of the dividing line does not change.

[0241] It is evident that when an electronic device changes its orientation, the position of the dividing line in the plane containing the photosensitive element also changes.

[0242] Refer to the previous text Figure 4 As can be seen from the correspondence between the light-reducing device and the photosensitive element introduced in the article, the change of the device posture affects the position of the dividing line in the plane where the photosensitive element is located. Therefore, the change of the device posture also affects the position of the gradient line in the light-reducing device, and this effect is corresponding.

[0243] Based on the perpendicular relationship between the gradient line and the gradient direction, changes in the device's posture lead to changes in the position of the gradient line, and also to changes in the gradient direction.

[0244] For scenes where the light has an inverse gradient distribution, the effect of the electronic device's posture change on the center line of the low-transmittance region in the light-reducing device is similar to the effect of posture change on the gradient line in the light-reducing device described earlier, and will not be repeated here.

[0245] based on Figures 8A-8D The impact of changes in device posture has been introduced. The method for determining the parameters of the photosensitive device provided in Example 3 is described below.

[0246] First, we will introduce how to determine the various parameters of the photosensitive device for a scene where the light has a positive gradient distribution.

[0247] Figure 8E This is a flowchart of a method for determining the position of a gradient line in a scene where the light has a positive gradient distribution, as provided in Example 3. Figure 8E As shown, the method may include the following steps:

[0248] S401, the camera of the electronic device acquires the initial image at the first moment t1 and recognizes that the brightness of the first image has a positive gradual distribution.

[0249] After recognizing that the brightness of the first image exhibits a positive gradient distribution, it can be determined that the current scene is one with a positive gradient light distribution. Therefore, the electronic device can first determine the position of the gradient line in the light-reducing device. Subsequent steps will explain how to determine the position of the gradient line.

[0250] S402, the electronic device determines the boundary line l1 in the initial image. The method for determining the boundary line l1 can be referred to the relevant description in Embodiment 2.

[0251] S403, between the first time t1 and the second time t2, the electronic device collects data through the gyroscope sensor and determines the attitude change of the electronic device from t1 to t2 based on the data collected by the gyroscope.

[0252] t1 and t2 can be adjacent moments when the camera captures two images, and the time difference between t1 and t2 can be the reciprocal of the camera's frame rate.

[0253] S404, the electronic device determines the boundary line l2 in the image acquired by t2 based on the boundary line in the initial image and the device's posture change.

[0254] S405, the electronic device determines the position of the light-reducing device corresponding to the dividing line l2 as the position of the gradient line.

[0255] In some implementations, the position of the gradient line in the dimming device at t2 can be calculated only after determining that the attitude change of the electronic device from t1 to t2 exceeds a threshold. An attitude change exceeding the threshold can include one or more of the following: a pitch change exceeding a first threshold, a yaw change exceeding a second threshold, and a roll change exceeding a third threshold. The first, second, and third thresholds can be set as needed. This allows for adjustment of the dimming device parameters only when the attitude change is significant, avoiding the power consumption caused by frequent adjustments.

[0256] The following sections describe the specific methods for determining the position of gradient lines, broken down by scenario.

[0257] Scenario 1: The gradient lines in the initial image acquired by the electronic device at t1 are parallel to the X” axis.

[0258] (1) The electronic device only “nods” from t1 to t2, that is, its attitude change only includes the change of pitch angle.

[0259] Figure 9A This example illustrates the boundary between the images captured by the photosensitive element at t1 and t2 in this scenario. Figure 9A As shown, the image captured by the photosensitive element is placed in the coordinate system X”Y”Z”. Here, l1 is the boundary line in the initial image, and l2 is the boundary line in the image captured at t2. The intersection of l1 and the Y” axis is Y1, the intersection of l2 and the Y” axis is Y2, the center of the lens is O’, and the center of the photosensitive element is O”. The angle between O’Y1 and the optical axis is pitch1, and the angle between O’Y2 and the optical axis is pitch2.

[0260] Figure 9A The scenario shown conforms to the following formula:

[0261] Δpitch=pitch1-pitch2 Formula 11

[0262]

[0263] Here, Δpitch represents the pitch angle change of the electronic device from t1 to t2. Δpitch can be obtained by integrating the data collected by the gyroscope sensor around the X0 axis. The X0 axis is the coordinate axis in the three-dimensional coordinate system X0Y0Z0 of the electronic device at its initial attitude at t1. The coordinate system X0Y0Z0 can be referenced... Figure 8A The relevant descriptions are as follows: pitch1 is the angle between O'Y1 and the optical axis at time t1, and pitch2 is the angle between O'Y2 and the optical axis at time t2. O'O" is the focal length of the camera.

[0264] O”Y2 can be calculated using formulas 11-13. Based on O”Y1 and O”Y2, the distance Y1Y2 that l2 moves relative to l1 along the Y” axis can be determined, thus determining the position of l2. After determining the position of l2, according to... Figure 4 The correspondence between the light-reducing device and the photosensitive element introduced can be used to determine the position of the gradient line in the light-reducing device at time t2.

[0265] (2) The electronic device only “rolls” from t1 to t2, that is, its attitude change only includes the change of the roll angle.

[0266] Figure 9B This example illustrates the boundary line between the images acquired by the photosensitive element at t1 and t2 in this scenario. Here, l1 is the boundary line in the initial image, and l2 is the boundary line in the image acquired at t2. Since the electronic device only "rolls," O"Y1 = O"C1, where C1 is the intersection of the perpendicular line drawn from O" to l2 and l2. The angle between O"Y1 and O"C1 is Δroll, which represents the change in the roll angle roll of the electronic device from t1 to t2. Δroll can be obtained by integrating the data acquired by the gyroscope sensor around the Z0 axis.

[0267] As can be seen, l1 is obtained by rotating Δroll around O”. The electronic device can determine the position of l2 based on the position of l1 and Δroll. After determining the position of l2, according to Figure 4 The correspondence between the light-reducing device and the photosensitive element introduced can be used to determine the position of the gradient line in the light-reducing device at time t2.

[0268] (3) The electronic device “nods” and “rolls” from t1 to t2, that is, its attitude change includes changes in pitch and roll.

[0269] In this case, it can be seen as the electronic device first "nodding" and then "rolling".

[0270] Figure 9C This example illustrates the boundary line between the images captured by the photosensitive element at t1 and t2 in this scenario. Here, l1 is the boundary line in the initial image, l2' is the boundary line where the electronic device first "nods" from t1, and l2 is the boundary line where the electronic device "rolls" after "nodding," i.e., l2 is the boundary line in the image captured by the electronic device at t2. Here, O”Y2 = O”C2, and C2 is the intersection point of the perpendicular line drawn from O” to l2 and l2.

[0271] The electronic device can calculate the position of l2' in the manner described in case (1) above, and then rotate l2' around O” by Δroll to determine the position of l2. After determining the position of l2, according to Figure 4The correspondence between the light-reducing device and the photosensitive element introduced can be used to determine the position of the gradient line in the light-reducing device at time t2.

[0272] Of course, in the third case, it can also be seen as the electronic device first “rolling” and then “nodding”, and the position of l2 in the first image can be calculated accordingly.

[0273] Scenario 2: The gradient lines in the initial image acquired by the electronic device at t1 are parallel to the Y” axis.

[0274] (1) The electronic device only “shakes” from t1 to t2, that is, its attitude change only includes the change of yaw angle.

[0275] Figure 10A This example illustrates the boundary lines between the images captured by the photosensitive element at t1 and t2 in this scenario. Here, l1 is the boundary line in the initial image, and l2 is the boundary line in the image captured at t2. The intersection of l1 and the X” axis is X1, the intersection of l2 and the X” axis is X2, the lens center is O’, and the center of the photosensitive element is O”. The angle between O’X1 and the optical axis is yaw1, and the angle between O’X2 and the optical axis is yaw2.

[0276] Figure 10A The scenario shown conforms to the following formula:

[0277] Δyaw=yaw1-yaw2 Formula 14

[0278]

[0279] Where Δyaw represents the change in yaw angle of the electronic device from t1 to t2. Δyaw can be obtained by integrating the data collected by the gyroscope sensor around the Y0 axis. yaw1 is the angle between O'X1 and the optical axis at t1, and yaw2 is the angle between O'X2 and the optical axis at t2. O'O” is the focal length of the camera.

[0280] O”X2 can be calculated using formulas 14-16. Based on O”X2 and O”X1, the distance X1X2 that l2 moves relative to l1 along the X” axis can be determined, thus determining the position of l2. After determining the position of l2, according to... Figure 4 The correspondence between the light-reducing device and the photosensitive element introduced can be used to determine the position of the gradient line in the light-reducing device at time t2.

[0281] (2) The electronic device only “rolls” from t1 to t2, that is, its attitude change only includes the change of the roll angle.

[0282] Figure 10BThis example illustrates the boundary line between the images acquired by the photosensitive element at t1 and t2 in this scenario. Here, l1 is the boundary line in the initial image, and l2 is the boundary line in the image acquired at t2. Since the electronic device only "rolls," O”X1 = O”C1, where C1 is the intersection of the perpendicular line drawn from O” to l2 and l2. The angle between O”X1 and O”C1 is Δroll, which represents the change in the roll angle roll of the electronic device from t1 to t2. Δroll can be obtained by integrating the data acquired by the gyroscope sensor around the Z0 axis.

[0283] As can be seen, l1 is obtained by rotating Δroll around O”. The electronic device can determine the position of l2 based on the position of l1 and Δroll. After determining the position of l2, according to Figure 4 The correspondence between the light-reducing device and the photosensitive element introduced can be used to determine the position of the gradient line in the light-reducing device at time t2.

[0284] (3) The electronic device “shakes” and “rolls” from t1 to t2, that is, its attitude change includes the changes in yaw angle and roll angle.

[0285] In this case, it can be seen as the electronic device first "shaking its head" and then "rolling".

[0286] Figure 10C This example illustrates the boundary line between the images captured by the photosensitive element at t1 and t2 in this scenario. Here, l1 is the boundary line in the initial image, l2' is the boundary line where the electronic device first "shakes its head" starting from t1, and l2 is the boundary line where the electronic device "nods" and then "rolls over," i.e., l2 is the boundary line in the image captured by the electronic device at t2. Here, O”X2 = O”C2, and C2 is the intersection point of the perpendicular line drawn from O” to l2 and l2.

[0287] The electronic device can calculate the position of l2' in the manner described in case (1) above, and then rotate l2' around O” by Δroll to determine the position of l2. After determining the position of l2, according to Figure 4 The correspondence between the light-reducing device and the photosensitive element introduced can be used to determine the position of the gradient line in the light-reducing device at time t2.

[0288] Of course, in the third case, it can also be seen as the electronic device first “rolling” and then “shaking its head”, and the position of l2 in the first image can be calculated accordingly.

[0289] Scenario 3: The gradient lines in the initial image acquired by the electronic device at t1 intersect with both the X” axis and the Y” axis.

[0290] (1) The electronic device only “nods” from t1 to t2, that is, its attitude change only includes the change of pitch angle.

[0291] Figure 11A This example illustrates the boundary lines between the images captured by the photosensitive element at t1 and t2 in this scenario. Here, l1 is the boundary line in the initial image, and l2 is the boundary line in the image captured at t2. The intersection of l1 and the Y” axis is Y1, the intersection of l2 and the Y” axis is Y2, the lens center is O’, and the center of the photosensitive element is O”. The angle between O’Y1 and the optical axis is pitch1, and the angle between O’Y2 and the optical axis is pitch2.

[0292] In this case, the electronic device can calculate O”Y2 using the method described in scenario 1 (1) above. Based on O”Y1 and O”Y2, the distance Y1Y2 that l2 moves relative to l1 along the Y” axis can be determined, thus determining the position of l2. After determining the position of l2, based on... Figure 4 The correspondence between the light-reducing device and the photosensitive element introduced can be used to determine the position of the gradient line in the light-reducing device at time t2.

[0293] (2) The electronic device only “shakes” from t1 to t2, that is, its attitude change only includes the change of yaw angle.

[0294] Figure 11B This example illustrates the boundary lines between the images captured by the photosensitive element at t1 and t2 in this scenario. Here, l1 is the boundary line in the initial image, and l2 is the boundary line in the image captured at t2. The intersection of l1 and the X” axis is X1, the intersection of l2 and the X” axis is X2, the lens center is O’, and the center of the photosensitive element is O”. The angle between O’X1 and the optical axis is yaw1, and the angle between O’X2 and the optical axis is yaw2.

[0295] In this case, the electronic device can calculate O”X2 using the method described in scenario 2(1) above. Based on O”X2 and O”X1, the distance X1X2 that l2 moves relative to l1 along the X” axis can be determined, thus determining the position of l2. After determining the position of l2, based on... Figure 4 The correspondence between the light-reducing device and the photosensitive element introduced can be used to determine the position of the gradient line in the light-reducing device at time t2.

[0296] (3) The electronic device only “rolls” from t1 to t2, that is, its attitude change only includes the change of the roll angle.

[0297] Figure 11CThis example illustrates the boundary line between the images acquired by the photosensitive element at t1 and t2 in this scenario. Here, l1 is the boundary line in the initial image, and l2 is the boundary line in the image acquired at t2. Since the electronic device only "rolls," O"C3 = O"C4, where C3 is the intersection of the perpendicular line drawn from O" to l1 and l1, and C4 is the intersection of the perpendicular line drawn from O" to l2 and l2. The angle between O"C3 and O"C4 is Δroll, which represents the change in the roll angle roll of the electronic device from t1 to t2. Δroll can be obtained by integrating the data acquired by the gyroscope sensor around the Z0 axis.

[0298] As can be seen, l1 is obtained by rotating Δroll around O”. The electronic device can determine the position of l2 based on the position of l1 and Δroll. After determining the position of l2, according to Figure 4 The correspondence between the light-reducing device and the photosensitive element introduced can be used to determine the position of the gradient line in the light-reducing device at time t2.

[0299] (4) The electronic device “nods”, “shakes” and “rolls” from t1 to t2, that is, its attitude changes include changes in pitch, yaw and roll.

[0300] In this case, it can be seen as the electronic device first "nodding", then "shaking its head", and then "rolling".

[0301] Figure 11D This example illustrates the boundary lines of the images captured by the photosensitive element at t1 and t2 in this scenario. Here, l1 is the boundary line in the initial image, l2' is the boundary line where the electronic device first "nods" from t1, l2" is the boundary line where the electronic device "nods" and then "shakes" its head, and l2 is the boundary line where the electronic device "nods," then "shakes" its head, and then "rolls" its body – that is, l2 is the boundary line in the image captured by the electronic device at t2. Here, O"C3 = O"C4, where C3 is the intersection of the perpendicular line drawn from O" to l2" and l2", and C4 is the intersection of the perpendicular line drawn from O" to l2 and l2.

[0302] The electronic device can move l1 a first distance on the Y” axis to obtain l2’ in the manner described in case (1) above, move l2’ a second distance on the X” axis to obtain the position of l2” in the manner described in case (2) above, and rotate l2” around the Y” axis by a first angle in the manner described in case (3) above to obtain l2. After determining the position of l2, according to Figure 4 The correspondence between the light-reducing device and the photosensitive element introduced can be used to determine the position of the gradient line in the light-reducing device at time t2.

[0303] Here, l1 can be called the third line, l2' can be called the fourth line, l2” can be called the fifth line, and l2 can be called the sixth line.

[0304] In other embodiments, in case (4), the electronic device can also be regarded as "nodding", "shaking", and "rolling" in other orders respectively, and the position of l2 in the first image is calculated accordingly.

[0305] Of course, in scenario 3, the attitude change of the electronic device from t1 to t2 can also be only "nodding" or "shaking", or only "shaking" or "rolling". The calculation method of l2 position under different attitude changes can be obtained by referring to the previous text.

[0306] Determine the direction of the gradient

[0307] The relative relationship between the position and direction of the gradient line in the dimming device at time t1 is the same as that at time t2. Based on the perpendicular relationship between the gradient line and the gradient direction, the gradient direction can be determined after determining the position of the gradient line.

[0308] For example, first set the position and direction of the gradient line in the light-reducing device at time t1. If viewed from the direction of the gradient line, the left side of the gradient line is a high-transmittance area and the right side is a low-transmittance area. Then, when viewed from the direction of the gradient line in the light-reducing device at time t2, the left side of the gradient line is also a high-transmittance area and the right side is also a low-transmittance area.

[0309] Determine the gradient mode, gradient area width, and neutral density setting.

[0310] The electronic device can determine the gradient mode based on the initial image acquired at time t1. Specifically, the gradient mode can be determined based on the brightness changes of the initial image; the specific determination method can be found in the relevant description in Example 2.

[0311] The electronic device can determine the width of the gradient region based on the initial image acquired at time t1. For details on the determination method, please refer to the relevant description in Embodiment 2. Of course, in other embodiments, the width of the gradient region can also be preset.

[0312] The determination of the light reduction level can be found in the relevant description of Example 1.

[0313] In some implementations, the electronic device can acquire images via a camera at a first frame rate and data via a gyroscope sensor at a second frame rate. The second frame rate is higher than the first frame rate. That is, the frame rate of the gyroscope sensor is higher than the frame rate of the camera. This allows the electronic device to adjust the parameters of the gradient sensor after acquiring an initial image and subsequently acquiring data from the gyroscope sensor multiple times, thus achieving better image capture results. Furthermore, since the power consumption of the gyroscope sensor is lower than that of the image sensor, this method in embodiment 3 not only allows for adjustment of the gradient sensor at a higher second frame rate but also minimizes device power consumption, improving practicality and extending battery life.

[0314] Secondly, it introduces how to determine the various parameters of the photosensitive device for scenes where the light has an inverse gradient distribution.

[0315] For scenes with an inverse gradient light distribution, the methods for determining the parameters of the photosensitive device are the same as those for scenes with a positive gradient light distribution, as described earlier. The difference lies in the brightness distribution: the initial image acquired by the electronic device at time t1 has an inverse gradient; the initial image and the image acquired at time t2 do not include the dividing line but include the center line of the bright area; and the subtractive sensor does not include the gradient line but includes the center line of the low-transmittance area. For scenes with an inverse gradient light distribution, the methods for determining the parameters of the photosensitive device can be referenced above and will not be repeated here.

[0316] Adjust the light-reducing device according to the determined gradient parameters.

[0317] After determining the parameters of the light-reducing device, these parameters can be adjusted to bring one or more parameters to or close to the determined values. The adjustment method varies depending on the light-reducing principle of the device, as described above.

[0318] 1. Adjustment of electroluminescence devices

[0319] Electronic devices can apply different voltages to different regions of the electroluminescent device according to the parameters of the light-reducing device, so as to adjust the parameters of the electroluminescent device to the parameters determined above.

[0320] Figure 12 The various modules involved in adjusting the electroluminescence damping device are illustrated by way of example.

[0321] like Figure 12As shown, the electronic device includes an inertial measurement unit (IMU), a camera, and a processor. The IMU may include an accelerometer and a gyroscope. The camera includes a photosensitive element, an electroluminescent device, a microcontroller unit (MCU), and a driver integrated circuit (driverIC).

[0322] If the gradient direction is determined in accordance with the method of Embodiment 1 above, the accelerometer in the IMU can send the collected data to the MCU, and the MCU can determine the gradient direction based on the data from the accelerometer. Parameters other than the gradient direction can be determined by the processor and sent to the MCU.

[0323] If the gradient mode, gradient direction, gradient line position, and gradient area width are determined according to the method described in Example 2 above, the photosensitive element in the camera can send the captured image to the processor, which then determines the aforementioned parameters according to the method described in Example 2. The dimming level can also be determined by the processor. Afterward, the processor can send the determined parameters to the MCU.

[0324] If the gradient line position, gradient direction, gradient mode, and gradient area width are determined according to the method described in Example 3 above, the photosensitive element in the camera can send the acquired image to the processor, and the gyroscope sensor in the IMU can send the acquired data to the processor. The processor then determines the aforementioned parameters according to the method described in Example 3. The dimming level can also be determined by the processor. Afterward, the processor can send the determined parameters to the MCU.

[0325] After obtaining the parameters of the electroluminescent device, the MCU can send control signals to the driver IC to control the voltage output by the driver IC. The driver IC outputs voltage to various regions of the electroluminescent device to adjust one or more parameters of the device according to the parameters determined above. The adjustment principle of the electroluminescent device can be found in the introduction at the beginning.

[0326] 2. Adjustment of non-electroluminescence damping devices

[0327] Non-electroluminescent dimming devices can be composed of one or more dimming devices. When the relative positions of these one or more dimming devices change, their dimming performance also changes accordingly.

[0328] Figure 13 The various modules involved in adjusting a non-electroluminescent device are illustrated exemplarily.

[0329] Figure 13 The various modules shown and Figure 12 The difference lies in the fact that the driver IC and the non-electroluminescence device are connected to a motor. The motor can be a stepper motor. After the MCU learns the parameters of the non-electroluminescence device, it can send control signals to the driver IC to control the current output by the driver IC.

[0330] The driver IC is used to output current to drive the motor. When the non-electroluminescent device includes multiple ND mirrors, the motor drives one or more ND mirrors to translate within the plane of the device, thereby adjusting one or more parameters of the device to the parameters determined above. When the non-electroluminescent device includes multiple polarizers, the motor drives one or more polarizers to rotate around the optical axis, thereby adjusting one or more parameters of the device according to the parameters determined above. The adjustment principle of the non-electroluminescent device can be found in the introduction at the beginning.

[0331] In some implementations, the MCU can also be integrated into the processor. Figure 12 and Figure 13 The operations performed by the MCU described in the article can be completed by the processor.

[0332] Figure 12 and Figure 13 The processor mentioned can be an AP, ISP, or NPU in an electronic device, or a processor with a certain computing power.

[0333] Structure of electronic devices

[0334] Figure 14 This is a hardware structure diagram of the electronic device 100 provided in an embodiment of this application.

[0335] like Figure 14 As shown, the electronic device 100 may include: a processor 110, an external memory interface 120, an internal memory 121, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, a sensor module 180, a camera 193, a display screen 194, etc. The sensor module 180 may include a gyroscope sensor 180B, an accelerometer sensor 180E, etc.

[0336] It is understood that the structures illustrated in the embodiments of this application do not constitute a specific limitation on the electronic device 100. In other embodiments of this application, the electronic device 100 may include more or fewer components than illustrated, or combine some components, or split some components, or have different component arrangements. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.

[0337] The processor 110 may include one or more processing units, such as an access point (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a video codec, a DSP, a baseband processor, and / or an NPU. These different processing units may be independent devices or integrated into one or more processors.

[0338] The controller can generate operation control signals based on the instruction opcode and timing signals to complete the control of instruction fetching and execution.

[0339] The processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. This memory can store instructions or data that the processor 110 has just used or that are used repeatedly. If the processor 110 needs to use the instruction or data again, it can retrieve it directly from the memory. This avoids repeated accesses, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0340] The wireless communication function of electronic device 100 can be realized through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor, etc.

[0341] Antenna 1 and antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in electronic device 100 can be used to cover one or more communication frequency bands. Different antennas can also be multiplexed to improve antenna utilization. For example, antenna 1 can be multiplexed as a diversity antenna for a wireless local area network. In some other embodiments, the antennas can be used in conjunction with tuning switches.

[0342] The mobile communication module 150 can provide solutions for wireless communication, including 2G / 3G / 4G / 5G, applied to the electronic device 100. The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), etc. The mobile communication module 150 can receive electromagnetic waves via antenna 1, and perform filtering, amplification, and other processing on the received electromagnetic waves before transmitting them to a modem processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modem processor and convert it into electromagnetic waves for radiation via antenna 1. In some embodiments, at least some functional modules of the mobile communication module 150 may be housed in the processor 110. In some embodiments, at least some functional modules of the mobile communication module 150 and at least some modules of the processor 110 may be housed in the same device.

[0343] The modem processor may include a modulator and a demodulator. The modulator modulates the low-frequency baseband signal to be transmitted into a mid-to-high frequency signal. The demodulator demodulates the received electromagnetic wave signal into a low-frequency baseband signal. The demodulator then transmits the demodulated low-frequency baseband signal to the baseband processor for processing. After processing by the baseband processor, the low-frequency baseband signal is transmitted to the application processor. The application processor outputs sound signals through an audio device (not limited to a speaker, receiver, etc.) or displays images or videos through the display screen 194. In some embodiments, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110 and may be housed in the same device as the mobile communication module 150 or other functional modules.

[0344] The wireless communication module 160 can provide solutions for wireless communication applications on the electronic device 100, including wireless local area networks (WLANs) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication (NFC), and infrared (IR) technologies. The wireless communication module 160 can be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via antenna 2, demodulates and filters the electromagnetic wave signals, and sends the processed signal to processor 110. The wireless communication module 160 can also receive signals to be transmitted from processor 110, frequency modulate and amplify them, and then convert them into electromagnetic waves for radiation via antenna 2.

[0345] In some embodiments, antenna 1 of electronic device 100 is coupled to mobile communication module 150, and antenna 2 is coupled to wireless communication module 160, enabling electronic device 100 to communicate with networks and other devices via wireless communication technology. The wireless communication technology may include Global System for Mobile Communications (GSM), General Packet Radio Service (GPRS), Code Division Multiple Access (CDMA), Wideband Code Division Multiple Access (WCDMA), Time-Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM, and / or IR technologies, etc. The GNSS may include the Global Positioning System (GPS), the Global Navigation Satellite System (GLONASS), the BeiDou Navigation Satellite System (BDS), the Quasi-Zenith Satellite System (QZSS), and / or satellite-based augmentation systems (SBAS).

[0346] Electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, connected to the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations and for graphics rendering. Processor 110 may include one or more GPUs, which execute program instructions to generate or modify display information.

[0347] Display screen 194 is used to display images, videos, etc. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD). The display panel can also be manufactured using organic light-emitting diodes (OLEDs), active-matrix organic light-emitting diodes (AMOLEDs), flexible light-emitting diodes (FLEDs), miniled, microled, micro-OLEDs, quantum dot light-emitting diodes (QLEDs), etc. In some embodiments, the electronic device may include one or N displays 194, where N is a positive integer greater than 1.

[0348] Electronic device 100 can perform shooting functions through ISP, camera 193, video codec, GPU, display 194 and application processor.

[0349] The ISP (Image Signal Processor) is used to process data fed back from the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted through the lens to the camera's photosensitive element. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing, converting it into an image visible to the naked eye. The ISP can also perform algorithmic optimization on image noise and brightness. The ISP can also optimize parameters such as exposure and color temperature of the shooting scene. In some embodiments, the ISP can be set in the camera 193.

[0350] Camera 193 is used to capture still images or videos. An object is projected onto a photosensitive element by generating an optical image through the lens. The photosensitive element can be a charge-coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor. The photosensitive element converts the light signal into an electrical signal, which is then passed to an ISP for conversion into a digital image signal. The ISP outputs the digital image signal to a DSP for processing. The DSP converts the digital image signal into image signals in standard RGB, YUV, or other formats. In some embodiments, the electronic device 100 may include one or N cameras 193, where N is a positive integer greater than 1.

[0351] For details on the modules included in camera 193 and the function of each module, please refer to [link / reference]. Figure 12 and Figure 13 Related descriptions.

[0352] Digital signal processors (DSPs) are used to process digital signals. Besides digital image signals, they can also process other digital signals. For example, when electronic device 100 selects a frequency, the DSP can perform Fourier transforms on the frequency energy.

[0353] Video codecs are used to compress or decompress digital video. Electronic device 100 may support one or more video codecs. Thus, electronic device 100 can play or record videos in various encoding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0354] An NPU (Neural Processing Unit) is a computational processor for neural networks (NNs). By borrowing the structure of biological neural networks, such as the transmission patterns between neurons in the human brain, it can rapidly process input information and continuously learn on its own. NPUs enable intelligent cognitive applications in electronic devices, such as image recognition, facial recognition, speech recognition, and text understanding.

[0355] Internal memory 121 may include one or more random access memory (RAM) and one or more non-volatile memory (NVM).

[0356] Random access memory can include static random-access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), and double data rate synchronous dynamic random access memory (DDR SDRAM, such as fifth-generation DDR SDRAM, which is generally called DDR5 SDRAM). Non-volatile memory can include disk storage devices and flash memory.

[0357] Flash memory can be classified according to its operating principle, including NOR FLASH, NAND FLASH, 3D NAND FLASH, etc.; according to the level of the storage cell, including single-level cell (SLC), multi-level cell (MLC), triple-level cell (TLC), quad-level cell (QLC), etc.; and according to the storage specification, including universal flash storage (UFS) and embedded multimedia card (eMMC), etc.

[0358] The random access memory can be directly read and written by the processor 110. It can be used to store executable programs (such as machine instructions) of the operating system or other running programs, as well as user and application data.

[0359] Non-volatile memory can also store executable programs and user and application data, and can be pre-loaded into random access memory for direct reading and writing by the processor 110.

[0360] The external memory interface 120 can be used to connect to external non-volatile memory, thereby expanding the storage capacity of the electronic device 100. The external non-volatile memory communicates with the processor 110 through the external memory interface 120 to perform data storage functions. For example, music, video, and other files can be stored in the external non-volatile memory.

[0361] The internal memory 121 in this embodiment stores a computer program for implementing a gradient dimming method, and the processor 110 executes the computer program to implement the method performed by the electronic device in any of the embodiments described above.

[0362] The gyroscope sensor 180B can be used to determine the motion attitude of the electronic device 100. In some embodiments, the gyroscope sensor 180B can determine the angular velocity of the electronic device 100 about three axes (i.e., the x, y, and z axes). The gyroscope sensor 180B can be used for image stabilization. For example, when the shutter is pressed, the gyroscope sensor 180B detects the angle of the shake of the electronic device 100, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to counteract the shake of the electronic device 100 by moving in the opposite direction, thus achieving image stabilization. The gyroscope sensor 180B can also be used in navigation and motion-sensing game scenarios.

[0363] The 180E accelerometer can detect the magnitude of acceleration of electronic device 100 in various directions (typically three axes). When electronic device 100 is stationary, it can detect the magnitude and direction of gravity. It can also be used to identify the posture of electronic devices and applied to applications such as screen orientation switching and pedometers.

[0364] The software system of electronic device 100 can adopt a layered architecture, event-driven architecture, microkernel architecture, microservice architecture, or cloud architecture. This application embodiment uses a layered mobile operating system as an example to exemplify the software structure of electronic device 100.

[0365] Figure 15 This is a software structure block diagram of the electronic device 100 according to an embodiment of this application.

[0366] A layered architecture divides software into several layers, each with a clear role and function. Layers communicate with each other through software interfaces. In some embodiments, a mobile operating system is divided into four layers, from top to bottom: the application layer, the application framework / core service layer, the underlying libraries and runtime, and the kernel layer.

[0367] The application layer can include a series of application packages.

[0368] like Figure 15 As shown, the application package may include applications such as camera, gallery, calendar, call, map, navigation, WLAN, Bluetooth, music, video, and SMS.

[0369] The program framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The program framework layer includes some predefined functions.

[0370] like Figure 15 As shown, the program framework layer may include a window manager, content provider, view system, phone manager, resource manager, notification manager, etc.

[0371] The window manager is used to manage windowed applications. It can retrieve screen size, determine the presence of a status bar, lock the screen, and capture screenshots, among other things.

[0372] Content providers store and retrieve data, making that data accessible to applications. This data may include videos, images, audio, made and received phone calls, browsing history and bookmarks, phone books, etc.

[0373] A view system includes visual controls, such as controls for displaying text and controls for displaying images. View systems can be used to build applications. A display interface can consist of one or more views. For example, a display interface including a text notification icon could include views for displaying text and views for displaying images.

[0374] A phone manager is used to provide communication functions for electronic devices. For example, it manages call status (including connection and disconnection).

[0375] The file explorer provides applications with various resources, such as localized strings, icons, images, layout files, video files, and more.

[0376] The notification manager allows applications to display notifications in the status bar. These notifications can be used to deliver informational messages and can disappear automatically after a short pause, requiring no user interaction. For example, the notification manager can be used to notify users of completed downloads or message alerts. The notification manager can also display notifications as icons or scrolling text in the top status bar, such as notifications from background applications, or as dialog boxes on the screen. Examples include displaying text messages in the status bar, emitting sounds, vibrating electronic devices, and flashing indicator lights.

[0377] Runtime can refer to all the code libraries, frameworks, etc., required for a program to run. For example, for the C language, the runtime includes a series of function libraries required for C programs to run. For the Java language, in addition to the core libraries, the runtime also includes the virtual machine required for Java programs to run. The aforementioned core libraries can include the functionalities that the Java language needs to call.

[0378] The underlying library can include multiple functional modules. For example: surface manager, media libraries, 3D graphics processing libraries (e.g., OpenGL ES), 2D graphics engines (e.g., SGL), etc.

[0379] The Surface Manager is used to manage the display subsystem and provides the blending of 2D and 3D layers for multiple applications.

[0380] The media library supports playback and recording of various common audio and video formats, as well as still image files. It supports multiple audio and video encoding formats, such as MPEG4, H.264, MP3, AAC, AMR, JPG, and PNG.

[0381] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, compositing, and layer processing.

[0382] A 2D graphics engine is a graphics engine for 2D drawing.

[0383] The kernel layer is the layer between hardware and software. The kernel layer contains at least the display driver, camera driver, audio driver, and sensor driver.

[0384] It should be understood that each step in the above method embodiments can be completed by integrated logic circuits in the processor hardware or by instructions in software form. The method steps disclosed in the embodiments of this application can be directly manifested as being executed by a hardware processor, or being executed by a combination of hardware and software modules in the processor.

[0385] This application also provides an electronic device that may include a memory, a processor, and a computer program stored in the memory, wherein the processor executes the computer program to implement the method executed on the electronic device side as in any of the above embodiments.

[0386] This application also provides a chip system including at least one processor for implementing the methods executed on the electronic device side in any of the above embodiments. In one possible design, the chip system further includes a memory for storing program instructions and data, the memory being located within or outside the processor.

[0387] A chip system can consist of chips or include chips and other discrete components.

[0388] Optionally, there may be one or more processors in the chip system. The processor can be implemented in hardware or software. When implemented in hardware, the processor can be a logic circuit, integrated circuit, etc. When implemented in software, the processor can be a general-purpose processor, implemented by reading software code stored in memory.

[0389] Optionally, the chip system may contain one or more memories. These memories may be integrated with the processor or disposed separately; this application does not limit this. For example, the memory may be a non-transient processor, such as a read-only memory (ROM), which may be integrated with the processor on the same chip or disposed on different chips. This application does not specifically limit the type of memory or the arrangement of the memory and processor.

[0390] For example, the chip system may be a field programmable gate array (FPGA), an application specific integrated circuit (ASIC), a system on chip (SoC), a central processor unit (CPU), a network processor (NP), a digital signal processor (DSP), a micro controller unit (MCU), a programmable logic device (PLD), or other integrated chips.

[0391] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the method executed on the electronic device side in any of the above embodiments.

[0392] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the method executed on the electronic device side as in any of the above embodiments.

[0393] The various embodiments of this application can be combined arbitrarily to achieve different technical effects.

[0394] In the above embodiments, implementation can be achieved, in whole or in part, through software, hardware, firmware, or any combination thereof. When implemented in software, it can be implemented, in whole or in part, as a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in this application are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) means. The computer-readable storage medium can be any available medium accessible to a computer or a data storage device such as a server or data center that integrates one or more available media. The available medium can be a magnetic medium (e.g., floppy disk, hard disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid-state disk (SSD)).

[0395] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. This program can be stored in a computer-readable storage medium, and when executed, it can include the processes described in the above method embodiments. The aforementioned storage medium includes various media capable of storing program code, such as ROM or random access memory (RAM), magnetic disks, or optical disks.

[0396] In the description of the embodiments of this application, unless otherwise stated, " / " means "or". For example, A / B can mean A or B. The "and / or" in the text is merely a description of the relationship between related objects, indicating that there can be three relationships. For example, A and / or B can mean: A exists alone, A and B exist simultaneously, and B exists alone. In addition, in the description of the embodiments of this application, "multiple" means two or more.

[0397] The terms "first" and "second" are used for descriptive purposes only and should not be construed as implying or suggesting relative importance or implicitly indicating the number of indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the embodiments of this application, unless otherwise stated, "multiple" means two or more.

[0398] In summary, the above description is merely an embodiment of the technical solution of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, improvements, etc., made based on the disclosure of this application should be included within the scope of protection of this application.

Claims

1. A gradual light reduction method, characterized in that, The method is applied to an electronic device including a first camera, the first camera including a lens, a first light-reducing device, and a photosensitive element arranged in parallel, wherein the centers of the lens, the first light-reducing device, and the photosensitive element are all located on the optical axis, the first light-reducing device is a graduated neutral density (PDD) device, and the photosensitive element is used to convert light passing through the lens and the first PDD device into electrical signals to generate an image, the method including: Start the first camera; Based on the posture of the electronic device and / or the first image captured by the first camera, a first parameter is determined, the first parameter including one or more of the following: a first gradient mode, a first gradient direction, and a first position; Wherein, the first gradient mode is a positive gradient mode or an inverse gradient mode; if the first gradient mode is a positive gradient mode, the transmittance of the first light-reducing device decreases from one side to the other; the first position refers to the position of the gradient line in the first light-reducing device, and the first gradient direction is perpendicular to the gradient line. If the first gradient mode is an anti-gradient mode, then the first light-reducing device includes a first high-transmittance region, a second high-transmittance region, and a low-transmittance region, and the first high-transmittance region and the second high-transmittance region are respectively located on both sides of the low-transmittance region; the first position refers to the position of the center line of the low-transmittance region in the light-reducing device, and the first gradient direction is perpendicular to the center line; the first gradient direction refers to the direction from the high-transmittance region to the low-transmittance region in the first light-reducing device; Adjust the parameters of the first light-reducing device according to the first parameter.

2. The method according to claim 1, characterized in that, The first gradient mode is a positive gradient mode; The electronic device also includes an accelerometer to determine a first parameter based on the attitude of the electronic device, specifically including: The first direction is defined as the first gradient direction, which is the direction of the component of the acceleration detected by the accelerometer on the plane where the first dimming device is located.

3. The method according to claim 2, characterized in that, The gradient line passes through a preset first position point.

4. The method according to claim 1, characterized in that, The first parameter is determined based on the first image captured by the first camera, specifically including: Identify the bright and dark areas in the first image, and determine the first gradient mode based on the distribution of the bright and dark areas.

5. The method according to claim 4, characterized in that, Identifying the bright and dark regions in the first image specifically includes: Determine the grayscale value of each pixel in the first image; The regions of pixels in the first image with gray values ​​greater than the first value are identified as bright regions, and the regions of pixels in the first image with gray values ​​less than the first value are identified as dark regions.

6. The method according to claim 4 or 5, characterized in that, The first parameter is determined based on the first image captured by the first camera, specifically including: When the first image includes a bright area and a dark area, the first gradient mode is determined to be a positive gradient mode, and the direction from the dark area to the bright area is determined to be the first gradient direction. When the first image includes a first low-brightness area, a second low-brightness area, and a bright area, and the first low-brightness area and the second low-brightness area are respectively located on both sides of the bright area, the first gradient mode is determined to be an anti-gradient mode, and the direction from the first low-brightness area to the bright area and the direction from the second low-brightness area to the bright area are determined as the first gradient direction.

7. The method according to any one of claims 4-6, characterized in that, The first parameter also includes a first gradient width, which is determined based on the first image captured by the first camera, and specifically includes: When the first gradient mode is a positive gradient mode, a first straight line and a first region are determined based on the first image, wherein the first straight line is located in the middle position of the brightness distribution in the first image, and the first region is the region in the first image where the brightness change rate exceeds a first threshold. The first position is determined based on the position of the first straight line in the first image; The first gradient width is determined based on the width of the first region.

8. The method according to claim 7, characterized in that, Determining the first straight line based on the first image specifically includes: Based on the first fitting function and the value of the gray value of the pixel point mapped to the value range of the first fitting function, the distance corresponding to the pixel point in the first image is determined; The first straight line is determined based on the distances between pixels in the first image; The first fitting function includes one of the following: error function, sigmoid growth function, hyperbolic tangent function, and arctangent function.

9. The method according to claim 8, characterized in that, Before determining the first gradient width based on the width of the first region, the method further includes: A first curve is plotted with the distance from a pixel in the first image to the first straight line as the x-axis and the value of the gray value of the pixel mapped to the range of the first fitting function as the y-axis. The width of the portion of the first curve whose slope exceeds the second threshold is defined as the width of the first region.

10. The method according to any one of claims 4-6, characterized in that, The first parameter also includes a first gradient width, which is determined based on the first image captured by the first camera, and specifically includes: When the first gradient mode is the reverse gradient mode, a second straight line and a second region are determined based on the first image. The second straight line is located in the middle of the bright region. The second region includes the region where the brightness change rate from the first low-brightness region to the bright region exceeds a third threshold, the region where the brightness change rate from the second low-brightness region to the bright region exceeds the third threshold, and the region between the two regions. The first position is determined based on the position of the second straight line in the first image; The first gradient width is determined based on the width of the second region.

11. The method according to claim 10, characterized in that, Determining the second straight line based on the first image specifically includes: Based on the second fitting function and the gray value of the pixel, the distance corresponding to the pixel in the first image is determined; The second straight line is determined based on the distances between pixels in the first image; The first fitting function includes a Gaussian function.

12. The method according to claim 11, characterized in that, Before determining the first gradient width based on the width of the second region, the method further includes: A second curve is plotted with the distance from a pixel in the first image to the second straight line as the x-axis and the gray value of the pixel as the y-axis. The width of the second region is determined by the total width of the portion of the second curve whose slope exceeds the fourth threshold and the portion between the two aforementioned portions.

13. The method according to claim 6, characterized in that, The first image is captured by the first camera at a first moment. The first parameter is determined based on the posture of the electronic device and the first image captured by the first camera, specifically including: A third straight line is determined in the first image. When the first image includes a bright area and a low-brightness area, the third straight line is the boundary line between the bright area and the low-brightness area. When the first image includes a first low-brightness area, a second low-brightness area, and a bright area, the third straight line is the center line of the bright area. The third straight line is moved a first distance on the Y” axis to obtain the fourth straight line. The first distance is obtained according to the change of the pitch angle of the electronic device from the first moment to the second moment thereafter. The fourth straight line is moved a second distance on the X” axis to obtain the fifth straight line. The second distance is obtained according to the change of the yaw angle of the electronic device from the first time to the second time. The fifth straight line is rotated by a first angle around the Z axis in the X”Y” plane to obtain the sixth straight line. The first angle is obtained according to the change of the roll angle of the electronic device from the first moment to the second moment. The first position is determined based on the position of the sixth straight line in the first image; The X” axis and the Y” axis are perpendicular to each other and located on the plane where the photosensitive element is located, and the Z” axis is perpendicular to the plane where the photosensitive element is located.

14. The method according to claim 13, characterized in that, The electronic device further includes a gyroscope. Before determining the first parameter based on the attitude of the electronic device and the first image captured by the first camera, the method further includes: The attitude change of the electronic device from the first moment to the second moment is determined by the data collected by the gyroscope. The attitude change of the electronic device from the first moment to the second moment includes one or more of the following: pitch angle change, yaw angle change, and roll angle change.

15. The method according to claim 14, characterized in that, The first camera captures images at a first frame rate, and the gyroscope collects data at a second frame rate, which is greater than the first frame rate.

16. The method according to any one of claims 1-6 and 13-15, characterized in that, The width of the first gradient region is preset.

17. The method according to any one of claims 1-16, characterized in that, The method further includes: Adjust the parameters of the first light-reducing device according to the first light reduction level; The first light reduction level is determined by the electronic device based on the exposure parameters.

18. The method according to any one of claims 1-17, characterized in that, The first light-reducing device is an electroluminescent first light-reducing device, and the first camera also includes a microcontroller unit (MCU) and a driver integrated circuit. Adjusting the parameters of the first light-reducing device according to the first parameter specifically includes: sending a control signal to the driving integrated circuit through the MCU according to the first parameter, controlling the voltage output by the driving integrated circuit to the electro-induced first light-reducing device, so as to adjust the parameters of the first light-reducing device.

19. The method according to any one of claims 1-18, characterized in that, The first light-reducing device includes a medium gray density ND filter, and the first camera also includes a microcontroller unit (MCU), a driver integrated circuit, and a motor. Adjusting the parameters of the first light-reducing device according to the first parameter specifically includes: sending a control signal to the driving integrated circuit through the MCU according to the first parameter, controlling the driving integrated circuit to output current to the motor, and driving one or more ND mirrors to move on the plane where the first light-reducing device is located through the motor, so as to adjust the parameters of the first light-reducing device.

20. The method according to any one of claims 1-19, characterized in that, The first light-reducing device includes multiple polarizers, and the first camera also includes a microcontroller unit (MCU), a driver integrated circuit, and a motor. Adjusting the parameters of the first light-reducing device according to the first parameter specifically includes: sending a control signal to the driving integrated circuit through the MCU according to the first parameter, controlling the driving integrated circuit to output current to the motor, and driving one or more polarizers to rotate around the optical axis through the motor, so as to adjust the parameters of the first light-reducing device.

21. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored on the memory, wherein the processor executes the computer program to implement the method as described in any one of claims 1-20.

22. A computer-readable storage medium, characterized in that, It stores a computer program thereon, which, when executed by a processor, implements the method as described in any one of claims 1-20.

23. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, implements the method as described in any one of claims 1-20.