Photographing method and electronic device
By generating different types of window matching in the focus frame, combining the quasi-focus position of the focus frame and sub-window, determining and pushing the focus horse to reach the target standard focus position, the problem of position deviation between the focus frame and the shooting subject is solved, and the focus effect and image quality are improved.
Patent Information
- Application Number
- PCT/CN2024/140884
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2024-01-10
- Filing Date
- 2024-12-20
- Publication Date
- 2025-07-17
AI Technical Summary
During the shooting of electronic devices, in the prior art, there is a deviation between the position of the focus frame and the shooting subject, resulting in poor focus effect.
By generating different types of windows in the focus frame, select the appropriate window arrangement according to the size of the focus frame, including the interior, interior and exterior or external window arrangement, combining the quasi-focus position of the focus frame and all sub-windows, determine the eye standard focus position, and push the focus horse to reach this position.
Improve the accuracy and effect of focus to ensure the quality of the captured image, especially when the focus frame area is large, the quasi-focus position is determined in a refined manner, or focus under the principle of close-up priority to meet the actual shooting needs.
Smart Images

Figure CN2024140884_17072025_PF_FP_ABST
Abstract
Description
Shooting method and electronic equipment
[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on January 10, 2024, with application number 202410040008.4 and invention name “A Shooting Method and Electronic Device”, the entire contents of which are incorporated by reference into this application. Technical Field
[0002] The present application relates to the technical field of terminal devices, and in particular to a shooting method and electronic equipment. Background Art
[0003] When a user uses an electronic device to shoot, the electronic device can use focus tracking to take pictures. However, during the capture of a frame, there is always a deviation between the focus frame and the subject, resulting in inaccurate focus and poor focusing effect. Summary of the Invention
[0004] The embodiments of the present application provide a shooting method and an electronic device, which can be used to improve the focusing effect.
[0005] In a first aspect, an embodiment of the present application provides a shooting method, which is applied to an electronic device, and the method includes: in response to a first operation, the electronic device displays a first interface, and displays a preview image captured by a camera on the first interface; the electronic device focuses on a first subject in the first preview image, and the first interface displays the first preview image; when the electronic device determines a target window based on a first focus frame, the electronic device determines a target standard focus position based on the in-focus position of all sub-windows in the target window and the first focus frame; the first focus frame includes the first subject; and the electronic device drives the focus motor to reach the target standard focus position.
[0006] The first subject may be a human portrait, a cat or dog, an object, an animal or plant, etc. The first operation may be a click to open the camera, and the target window includes multiple sub-windows.
[0007] In an embodiment of the present application, the electronic device can determine the target window based on the current focus frame, and determine the target standard focus position based on the sub-window and focus frame of the target window. The target focus position jointly determined by multiple sub-windows and focus frames can ensure the accuracy of the target standard focus position, thereby ensuring better focusing effect and better image quality.
[0008] In one possible implementation, the method further includes: the electronic device determining a focus ratio of the first focus frame; the focus ratio being the ratio of the size of the first focus frame to the size of the image captured by the camera; and the electronic device determining a target windowing based on the focus ratio. In this way, the size of the first focus frame can determine the target windowing, ensuring that different focus frames have different windowing conditions. The accuracy of the windowing affects the accuracy of the target focus position, ensuring a better focusing effect.
[0009] In one possible embodiment, determining a target window arrangement based on the focus ratio includes: determining the target window arrangement as a first type of window arrangement when the focus ratio is greater than or equal to a first threshold; determining the target window arrangement as a second type of window arrangement when the focus ratio is less than the first threshold and greater than or equal to a second threshold; determining the target window arrangement as a third type of window arrangement when the focus ratio is less than the second threshold and greater than or equal to a third threshold; and determining that the target window arrangement is not required when the focus ratio is less than the third threshold. The first type of window arrangement is a window arrangement form that subdivides the interior of the first focus frame using a first sub-window; the second type of window arrangement is a window arrangement form that subdivides the interior of the first focus frame using a second sub-window and expands the exterior of the first focus frame using a third sub-window; and the third type of window arrangement is a window arrangement form that expands the exterior of the first focus frame using a fourth sub-window. Thus, the larger the area of the focus frame, the more likely the focused subject is within the focus frame. Therefore, the electronic device can further refine the determination of the in-focus position by subdividing the first type of window arrangement into multiple sub-windows. When the focus frame is medium in size, it's unclear whether the subject is inside or outside the frame. The second type of windowing is used to further confirm the accuracy and range of focus. When the focus frame is small, the subject may be even more likely to be outside the frame. The third type of windowing is used to further confirm the situation outside the frame and further determine the accuracy and range of focus.
[0010] In one possible implementation, the first threshold is greater than the second threshold, and the second threshold is greater than the third threshold. This allows for different focus frame sizes to take into account possible deviations in the corresponding out-of-focus subject, and by selecting the appropriate window arrangement, the subject that should be in focus is located as accurately as possible, thereby ensuring focus accuracy.
[0011] In one possible implementation, the electronic device determines a target standard focus position based on the in-focus positions of all sub-windows in the target window and the first focus frame, including: if the first subject is a portrait, and if the difference between the in-focus position of the body frame and the in-focus position of the face frame in the first preview image is greater than a first depth of field threshold, the electronic device uses the in-focus position of the body frame as the target standard focus position. Thus, when focusing on a portrait, if the electronic device determines that the difference between the in-focus positions of the body frame and the face frame is greater than the first depth of field threshold, the in-focus position of the body frame is used for focusing. Since the body frame and the face frame generally have a similar object distance, and the body area of the body frame is larger, focus accuracy is higher, ensuring better photographic results for people.
[0012] In one possible implementation, the electronic device determines the target standard focus position based on the in-focus positions of all sub-windows in the target window and the first focus frame. Furthermore, if the first subject is a portrait, and the difference between the in-focus positions of the human frame and the face frame in the first preview image is less than or equal to a first depth of field threshold, the electronic device determines the target standard focus position based on a near-focus priority principle. In this way, if the in-focus positions of the focus frame and all sub-windows differ significantly, the closest subject can be selected for in-focus, satisfying the goal of near-focus priority. This shooting process also meets actual shooting needs and ensures that the subject in the middle of the focus is accurately captured.
[0013] In one possible implementation, the electronic device determines the target standard focus position based on the in-focus positions of all sub-windows in the target window and the first focus frame, and further includes: if the first subject is not a portrait, the electronic device determines the target standard focus position based on a near-focus priority principle. In this way, if the in-focus positions of the focus frame and all sub-windows differ significantly, the closest subject can be selected for in-focus, satisfying the near-focus priority goal. This shooting process also meets actual shooting needs and ensures that the subject in the middle of the focus is accurately captured.
[0014] In one possible implementation, the electronic device determines the target standard focus position based on the near-field priority principle, including: obtaining a pre-selected frame set; the pre-selected frame set includes the sub-windows in the target window, the first focus frame, and corresponding in-focus positions; and, if the difference between the maximum and minimum in-focus positions in the pre-selected frame set is greater than a second depth of field threshold, determining the in-focus position with the closest object distance as the target standard focus position. In this way, if the in-focus positions of the focus frame and all the windows differ significantly, the closest subject can be selected for in-focus, satisfying the goal of near-field priority photography. This shooting process also meets actual shooting needs and ensures that the in-focus subject is accurately captured.
[0015] In one possible embodiment, the electronic device determines the target standard focus position based on the near-field priority principle, further comprising: if the difference between the maximum and minimum in-focus positions in the set of pre-selected frames is less than or equal to a second depth of field threshold, and if focusing with the first focus frame is reliable, using the in-focus position of the first focus frame as the target standard focus position; if focusing with the first focus frame is unreliable, using the average of all in-focus positions in the set of pre-selected frames as the target standard focus position. In this way, if the difference is less than or equal to (less than) the second depth of field threshold and the in-focus (detection data) of the first focus frame is reliable, focusing is directly performed using the in-focus position corresponding to the first focus frame, thereby ensuring the reliability of the focus position and simplifying the method for determining the target standard focus position. If focusing with the first focus frame is unreliable, focusing is performed using the average of all in-focus positions corresponding to all pre-selected frames in the set of pre-selected frames, thereby ensuring the reliability of the focus position.
[0016] In a possible implementation, when the confidence of focusing with the first focus frame is greater than a second confidence threshold, focusing with the first focus frame is credible; when the confidence of focusing with the first focus frame is less than or equal to the second confidence threshold, focusing with the first focus frame is uncredible.
[0017] In one possible implementation, the focus confidence levels of all pre-selected frames in the pre-selected frame set are greater than or equal to a first confidence threshold; the pre-selected frames are sub-matched windows in the target matched window and / or the first focused frame. Matched windows and focused frames are screened to eliminate those with significant edge disparity, thereby ensuring the reliability and accuracy of subsequent determination of the target focus position.
[0018] In a second aspect, an embodiment of the present application provides an electronic device, comprising one or more processors and one or more memories; the one or more processors are coupled to the one or more memories, the one or more memories being used to store computer program code, the computer program code comprising computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes a shooting method described in the first aspect or any possible implementation method of the first aspect.
[0019] In a third aspect, an embodiment of the present application provides a computer program product comprising instructions, which, when run on an electronic device, enables the electronic device to execute a shooting method as described in the first aspect or any possible implementation of the first aspect.
[0020] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium comprising instructions, which, when executed on an electronic device, enables the electronic device to execute a shooting method as described in the first aspect or any possible implementation of the first aspect.
[0021] In the fifth aspect, an embodiment of the present application provides a chip system, which is applied to an electronic device, and the chip system includes one or more processors, which are used to call computer instructions to enable the electronic device to execute a shooting method as described in the first aspect or any possible implementation method of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] FIG1A is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application;
[0023] FIG1B is a schematic diagram of the software structure of an electronic device proposed in an embodiment of the present application;
[0024] 2A to 2E are schematic diagrams of a set of user interfaces proposed in an embodiment of the present application;
[0025] FIG3 is a schematic diagram of a focusing method process proposed in an embodiment of the present application;
[0026] FIG4 is a schematic diagram of a shooting screen proposed in an embodiment of the present application;
[0027] FIG5 is a schematic diagram of another focusing method process proposed in an embodiment of the present application;
[0028] FIG6 is a flow chart of a dynamic window matching method proposed in an embodiment of the present application;
[0029] FIG7 is a schematic diagram of five specific window configurations proposed in an embodiment of the present application;
[0030] 8A to 8C are schematic diagrams of several window configuration types proposed in the embodiments of the present application;
[0031] FIG9 is a flow chart of a method for selecting a second focus frame according to an embodiment of the present application;
[0032] FIG10 is a schematic flow chart of a method for determining a second focus frame according to an embodiment of the present application;
[0033] FIG11 is a schematic diagram of a face frame and a body frame proposed in an embodiment of the present application. DETAILED DESCRIPTION
[0034] The terms used in the following examples of the present application are for the purpose of describing specific embodiments only and are not intended to limit the present application. As used in the specification and appended claims of the present application, the singular expressions "a," "an," "said," "above," "the," and "this" are intended to include plural expressions as well, unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in the present application refers to and encompasses any or all possible combinations of one or more of the listed items.
[0035] The following first introduces the terms involved in the embodiments of this application.
[0036] 1. Focus:
[0037] Focusing is the process of changing the distance between the lens and the imaging surface (image sensor) through the camera's focusing mechanism to achieve a clear image of the subject. Common focus types can be divided into three types: phase detection auto focus (PDAF), contrast detection auto focus (CDAF), and laser detection auto focus (LDAF).
[0038] Phase Detection Auto-focus (PDAF) uses paired left and right pixels in the image sensor to measure the amount of light entering the scene. The corresponding values (PD values) on the left and right sides are compared. Based on the correspondence between the PD values and the in-focus position, the focus point corresponding to the current PD value is found, and the lens motor is moved to the corresponding position. Laser focus uses an infrared laser sensor next to the camera to emit a low-power laser at the object being photographed. After reflection, the sensor receives the reflected laser and calculates the distance to the object. Based on the correspondence between the object distance and the in-focus position, the focus point corresponding to the current object distance is found. The lens motor then directly moves the lens to the corresponding position to achieve focus. Contrast focus assumes that the contrast between adjacent pixels is maximized after successful focus. Based on this assumption, a focus point is determined during the focusing process. The contrast between this focus point and adjacent pixels is compared, and the voice coil motor is repeatedly moved to obtain a local gradient maximum to achieve focus.
[0039] Mobile phone autofocus utilizes the principle of light reflection from an object. The reflected light is received by the image sensor (CCD or CMOS) on the phone's camera, generating a raw image. This raw image is then processed to drive the electric focus mechanism for focus. This is essentially a data calculation method integrated into the phone's image signal processor (ISP). After the viewfinder captures the original image, the image data is transmitted to the ISP as raw data. The ISP then analyzes the image data, determines the distance at which the lens needs to be adjusted, and then drives the focus motor to adjust the distance for a clear image. This process, as seen by the phone user, is known as autofocus. In a mobile phone's autofocus system, the lens is locked in the focus motor, and driving the focus motor changes the lens' position.
[0040] The mobile phone can determine the target focus distance by using the drive code value of the motor in the target camera as the focus distance adjustment accuracy. The motor code value represents a quantized current magnitude, which can be converted into a corresponding motor thrust, thereby driving the camera motor to move. Typically, a camera motor is fixed to the lens assembly, thus driving the lens movement and thus changing the image distance. The camera motor code value corresponds to the image distance. Specifically, there are many types of camera motors, and the principles and mechanisms for converting these into motor position changes also vary, which are not limited here.
[0041] 2. Related concepts in the focusing process:
[0042] AF follows the imaging formula: 1 / f = 1 / u + 1 / v, where f is the focal length of the camera's imaging lens, u is the object distance, and v is the image distance. In a typical scene, the object distance u is fixed, and f is an optical property that essentially remains unchanged. AF's task is to control lens movement and change v to ensure that the above formula is satisfied as closely as possible.
[0043] Combining the above formulas, the focal length is the distance from the focal point to the optical center, the object distance is the distance from the object to the optical center of the convex lens, and the image distance is the distance from the image formed by the lens to the optical center. The point on the principal optical axis where light rays passing through the lens and parallel to the principal optical axis converge is called the focal point.
[0044] Depth of field refers to the range of distances in front of and behind the subject within which a sharp image can be obtained at the front edge of a camera lens or other imager. Objects within a certain range of distances before and after focus are clearly visible, and this range is recorded as the depth of field.
[0045] The electronic device in the embodiments of the present application can be a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, a smart bracelet, a super mobile personal computer, a netbook, a personal phone, a personal data assistant, an augmented reality (AR) / virtual reality (VR) and other touch screen devices. The present application does not limit the specific form of the electronic device.
[0046] The following describes the device involved in the embodiments of the present application.
[0047] FIG1A is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.
[0048] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.
[0049] It is understood that the structures illustrated in the embodiments of the present application do not constitute specific limitations on the electronic device. In other embodiments of the present application, the electronic device may include more or fewer components than shown, or may combine or separate certain components, or arrange the components differently. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
[0050] The processor 110 may include one or more processing units. For example, the processor 110 may include an application processor (AP), a modem processor, a graphics processing unit (GPU), an image signal processor (ISP), a controller, a memory, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU). The different processing units may be independent devices or integrated into one or more processors.
[0051] Processor 110 may also include a memory for storing instructions and data. In some embodiments, the memory in processor 110 is a cache memory. This memory can store instructions or data that have just been used or are being recycled by processor 110. If processor 110 needs to use the same instruction or data again, it can directly access the memory. This avoids duplicate accesses, reduces processor 110 latency, and thus improves system efficiency.
[0052] It is understood that the interface connection relationship between the modules illustrated in the embodiments of the present application is only for illustrative purposes and does not constitute a structural limitation on the electronic device. In other embodiments of the present application, the electronic device may also adopt different interface connection methods from the above embodiments, or a combination of multiple interface connection methods.
[0053] The charging management module 140 is configured to receive charging input from a charger. The charger can be either a wireless charger or a wired charger. In some wired charging embodiments, the charging management module 140 can receive charging input from the wired charger via the USB interface 130. In some wireless charging embodiments, the charging management module 140 can receive wireless charging input via the wireless charging coil of the electronic device 100. While charging the battery 142, the charging management module 140 can also provide power to the electronic device via the power management module 141.
[0054] The power management module 141 is used to connect the battery 142, the charging management module 140, and the processor 110. The power management module 141 receives input from the battery 142 and / or the charging management module 140 and provides power to the processor 110, the internal memory 121, the external memory, the display 194, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle count, and battery health status (leakage, impedance). In some other embodiments, the power management module 141 can also be set in the processor 110. In other embodiments, the power management module 141 and the charging management module 140 can also be set in the same device.
[0055] The wireless communication function of the electronic device can be implemented through antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, modem processor and baseband processor.
[0056] The electronic device implements display functionality through a GPU, display screen 194, and an application processor. A GPU is a microprocessor for image processing that connects display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or modify display information.
[0057] Display screen 194 is used to display images, videos, and the like. Display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), a MiniLED, a MicroLED, a Micro-oLed, or a quantum dot light-emitting diode (QLED). In some embodiments, electronic device 100 may include one or N display screens 194, where N is a positive integer greater than one.
[0058] The electronic device 100 can implement a shooting function through an ISP, a camera 193, a video codec, a GPU, a display screen 194, and an application processor.
[0059] The camera 193 is used to capture still images or videos. The object generates an optical image through the lens and projects it onto the photosensitive element. 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, and then passes the electrical signal to the ISP for conversion into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. The DSP converts the digital image signal into an image signal in a standard RGB, YUV or other format. In some embodiments, the electronic device 100 may include 1 or N cameras 193, where N is a positive integer greater than 1.
[0060] The ISP is used to process data fed back by the camera 193. For example, when taking a picture, the shutter is opened, and light is transmitted to the camera's photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera's photosensitive element transmits the electrical signal to the ISP for processing and converts it into an image visible to the naked eye. The ISP can also perform algorithm optimization on the noise, brightness, etc. of the image. 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. The digital signal processor is used to process digital signals. In addition to processing digital image signals, it can also process other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, etc. The ISP can also be used to automatically focus on the focus information determined by the focus subject.
[0061] The touch sensor 180K, also known as a "touch panel," can be mounted on the display screen 194. The touch sensor 180K and the display screen 194 form a touch screen, also known as a "touch screen." The touch sensor 180K is used to detect touch operations applied to or near the touch sensor.
[0062] In the embodiment of the present application, the electronic device 100 can detect user operations through the touch sensor 180K. The user operation may include a touch event from the user touching the display 194, for example, the user clicks on an object in the shooting preview screen to focus.
[0063] Optionally, the user operation may also be an air operation, a voice operation instruction, etc. For example, a gesture sensing sensor is installed in the electronic device, and the gesture sensing sensor can detect the user's air operation.
[0064] FIG1B is a schematic diagram of the software structure of an electronic device provided in an embodiment of the present application.
[0065] As shown in FIG1B , the software framework of the electronic device involved in the present application may include an application layer, an application framework layer (framework, FWK), a hardware abstraction layer (hardware abstract layer, HAL) hardware layer and a kernel layer (kernel).
[0066] The application layer may include a series of application packages, such as gallery, email, text messages, camera, call and other applications (also referred to as applications, some of which are not shown). In the embodiment of the present application, the application may be any application in the application layer, and the user may open or close the application, or perform operations in the application.
[0067] The application framework layer provides an application programming interface (API) and programming framework for applications in the application layer. The application framework layer includes some predefined functions.
[0068] The application framework layer includes some predefined functions. In an embodiment of the present application, the application framework layer may include a camera access interface, wherein the camera access interface may include camera management and camera devices. The camera access interface is used to provide an application programming interface and programming framework for camera applications.
[0069] The hardware abstraction layer is an interface layer located between the application framework layer and the driver layer, providing a virtual hardware platform for the operating system. In an embodiment of the present application, the hardware abstraction layer may include a camera hardware abstraction layer (camera HAL) and a camera algorithm library. The camera algorithm library may include algorithms such as automatic focus (AF) and automatic exposure (AE). The camera algorithm library may also include algorithms such as noise reduction, color correction, contrast adjustment, etc., which are not limited by this application.
[0070] The kernel layer is the foundation of the Android operating system, and all of the Android operating system's ultimate functionality is implemented through the kernel layer. The kernel layer includes at least the display driver. The display driver retrieves rendered and synthesized image frames from the buffer and controls the display to display them sequentially.
[0071] The hardware layer may include a display, graphics processing unit (GPU), touch sensor, image sensor, and focus motor. The touch sensor can detect jump events caused by user touch operations. The display can display the image frame of the startup window. The graphics processor can perform image rendering and compositing. The central processing unit (CPU) can draw the image.
[0072] It should be noted that the software structure diagram of the electronic device shown in FIG1B provided in this application is merely an example and does not limit the specific module divisions within the different layers of the Android operating system. For details, please refer to the introduction of the Android operating system software structure in conventional technology. In addition, the shooting method provided in this application can also be implemented based on other operating systems, and this application will not cite examples one by one.
[0073] In combination with the above software structure, the following exemplarily illustrates the software and hardware workflow of an embodiment of the present application when taking photos by using an electronic device.
[0074] In response to the user's operation of opening the camera application, for example, clicking the camera application icon (combined with the user operation in Figure 2A), the camera application calls the camera access interface of the application framework layer to start the camera application, and then sends an instruction to start the camera by calling the camera device in the camera HAL. The camera HAL sends this instruction to the camera device driver of the kernel layer. The camera device driver can start the image sensor of the corresponding camera and collect image light signals through the image sensor. A camera device in the camera hardware abstraction layer corresponds to an image sensor in the hardware layer. The image sensor can transmit the collected image light signal to the image signal processor for preprocessing to obtain an image electrical signal, and then transmit the above-mentioned original image to the camera HAL through the camera device driver. The camera HAL can send the original image to the camera algorithm library. The camera algorithm library stores the program code for implementing the focus-based method provided in the embodiment of the present application. The camera algorithm library can send the processed image to the camera HAL, and the camera HAL can display the processed image.
[0075] During the shooting process, the electronic device can calculate the focus position of the focus motor through the AF algorithm, and then the camera driver can control the focus motor to adjust the position to achieve focus. When the size and / or position of the focus frame needs to be adjusted, the camera driver can drive the focus motor, and the focus motor can push the lens to the corresponding in-focus position.
[0076] 2A to 2E are a set of user interface schematic diagrams exemplarily disclosed in an embodiment of the present application.
[0077] Figures 2A to 2E illustrate exemplary user interface diagrams for an electronic device during the focusing process. A user turns on their electronic device, causing the display to display the electronic device's desktop, i.e., user interface 210. As shown in Figure 2A , the user can tap camera control 211 in user interface 210. Upon receiving the manipulation of camera control 211, the electronic device can display the user interface shown in Figure 2B . Figure 2B illustrates an exemplary user interface for capturing a photo.
[0078] As shown in FIG2B , the electronic device is shooting a scene with multiple people. The user interface 220 includes a preview image 11, a shooting mode menu 12, an album 10A, a shooting control 10B, a camera switch control 10C, and a settings menu 13 (including a flash switch, a filter switch, and settings controls, etc.).
[0079] Among them, the preview image 11 is an image of the shooting scene captured by the electronic device 1 through the camera in real time. The preview image shows the image of the person captured by the electronic device through the camera. The shooting mode menu 12 may include options for various camera modes such as aperture, night scene, photo, portrait, video, professional, and more. Different camera modes can achieve different shooting functions. The camera mode pointed to by the "triangle" in the shooting mode menu 12 is used to indicate the initial or user-selected camera mode. As shown in Figure 2B, the "triangle" points to "photo", indicating that the current camera is in the photo shooting mode. The album 10A is used for users to view the pictures and videos that have been taken. The shooting control 10B responds to the user's operation to enable the electronic device to take pictures or videos. The conversion camera control 10C is used to switch the camera that captures the image between the front camera and the rear camera.
[0080] When the electronic device displays a preview screen, it can focus on the subject. The following describes the focusing process based on different types of focus:
[0081] 1. Autofocus on faces in portrait mode:
[0082] When the electronic device displays user interface 220 as shown in FIG2B , a user who wishes to take a photo of a person can tap the "Portrait" control in the shooting mode menu 12 to enter portrait mode. As shown in FIG2C , when the electronic device displays portrait mode, it can identify three faces in the image and focus on one of them. In user interface 230 , the left face is selected for focus, and a focus frame 14 is displayed in the preview image.
[0083] It should be noted that when an electronic device recognizes a face, it can focus on the face, so focusing on the face is not limited to portrait mode.
[0084] 2. Manual focus:
[0085] As shown in FIG2D , the electronic device displays a user interface 240 showing a shooting preview screen 15. If a user wishes to shoot a person, they can manually click on the person in the screen, and the electronic device can display a corresponding focus frame based on the clicked position. As shown in FIG2E , the electronic device can display a focus frame 16 in response to the focus operation in FIG2D , and the electronic device can focus at the position of focus frame 16.
[0086] 3. Automatic recognition and focus:
[0087] When the electronic device enters the autofocus mode, it can identify the subject in the preview image and focus on the subject. In the above process, the electronic device may display a focus frame or not, and this application does not limit it.
[0088] It should be noted that the above-mentioned focusing processes are all exemplary descriptions, and other focusing types are also possible, and this application is not limited to them.
[0089] FIG3 is a schematic diagram of a focusing method disclosed in an exemplary embodiment of the present application. As shown in FIG3 , the focusing method may include but is not limited to the following steps:
[0090] S301: The electronic device determines a first focus frame in response to a focus request.
[0091] When the electronic device displays a preview image of the camera, it can determine to perform a first focus frame.
[0092] In one possible implementation, when the electronic device displays the preview screen of the camera, it extracts semantic information from the screen and automatically focuses based on the semantic information. For example, as shown in FIG2C , when the electronic device recognizes that the current screen includes multiple faces, the electronic device can select the position of one of the faces as the first focus frame. For another example, the electronic device can extract voice information from the preview screen and determine that the subject is a kitten. The electronic device can automatically focus on the photographed kitten. The above-mentioned focus object is not limited.
[0093] In another possible implementation, when the electronic device displays a camera preview screen, the user can click on the first subject in the preview screen as the focus subject, and the electronic device can determine that the first focus frame includes the focus subject. In conjunction with the display screen shown in Figure 2C, when the electronic device turns on the camera and enters the shooting preview screen, the electronic device can focus the screen. The user can manually select the focus position and capture the screen. As shown in Figure 2D, the user clicks on a position in the preview screen to focus.
[0094] It should be noted that, in the actual shooting process, there are many ways to determine the focus frame. The above two embodiments of the present application are merely examples and are not limiting.
[0095] S302: The electronic device determines a focus position of a first focusing frame.
[0096] The in-focus position may be a target code corresponding to the focus motor position. After determining the first focus frame, the electronic device may determine the in-focus position based on the first focus frame.
[0097] As shown in FIG2E , during the shooting process, since the first focus frame is in a square shape, it includes not only the human face but also the background image of the human face. The code corresponding to the background image of the human face is different from the code value of the face image. When the electronic device needs to determine the target code value, it needs to refer to these code values and may choose an intermediate value between the code corresponding to the background image and the code value of the face image, and may not be able to effectively focus on the human face.
[0098] S303: The electronic device drives the focus motor to reach the focus position.
[0099] After determining the in-focus position of the first focus frame, the electronic device can drive the focus motor to the in-focus position through the camera to complete the focusing process. The specific focusing process can be referred to Figure 1B and the related description of focusing, which will not be repeated here.
[0100] In the above process, since the focus frame is square in shape and the focused subjects are of various shapes, the edge shape of the focused subject is almost impossible to coincide with the shape of the focus frame during the focusing process. Generally, the focus frame will at least include the focused subject, and often also include other background images outside the focus frame.
[0101] For example, FIG4 is a schematic diagram of a shooting screen shown as an example in an embodiment of the present application. As shown in FIG4 , the focus frame in the preview screen of the shot includes leaves, part of a human face and part of the background. The object distances of these three parts are inconsistent, and the corresponding focus codes are all different. The electronic device will make a balance and choice in the process of selecting the above three codes for focus. However, the subject that the user really wants to focus on often deviates from the subject that the user really wants to focus on when the electronic device is determining the code focus. For example, in the user interface 410, the subject that the user really wants to focus on is the leaves, not the human face or the background. In the user interface 250, the user wants to focus on the side face of the user, but the focus frame includes the background part. In the above case, since the focus frame does not only include the focus subject, the accuracy of the focus result is poor.
[0102] During the aforementioned shooting process, the autofocus performance was unsatisfactory in scenes with side faces, cutouts, and close-up subject detection. This is because AF can only capture the focus frame and cannot perceive any semantic information within it. This is especially true in scenes with cutouts or overly large focus frames, where it is extremely difficult for AF to focus on the user's desired focus area.
[0103] In response to the above-mentioned problem, an embodiment of the present application proposes a shooting method that can generate different types of windows based on the size of the focus frame. When the focus frame area is large, the window is arranged inside the focus frame; when the focus frame area is moderate, the window is arranged both inside and outside the focus frame; when the focus frame area is small, the window is mainly arranged outside the focus frame. Ensuring different types of windows can help the electronic device determine the subject that is more worthy of focus and ensure the accuracy of focus. After the window matching process, the electronic device can determine the target standard focus position based on the current focus frame, all the windows and the type of the focus subject, and push the focus motor to the target standard focus position to complete the focus. Among them, if the type of the focus subject is a portrait, the electronic device can tend to use the human body frame for focus. If it is not a portrait, the close-up priority focus is selected to ensure that nearby objects can be given priority focus processing, ensure the accuracy of focus, and better match the needs of the user's specific focus scene.
[0104] FIG5 is a schematic diagram of another focusing method disclosed in an embodiment of the present application. As shown in FIG5 , the focusing method may include but is not limited to the following steps:
[0105] S501: The electronic device determines a first focus frame in response to a focus request.
[0106] The electronic device may determine that the size of the first focus frame is x*y pixels.
[0107] The specific description of S501 can refer to the relevant content of S301 and will not be repeated here.
[0108] S502: The electronic device determines a window arrangement form based on the first focus frame and performs a window arrangement process.
[0109] The window arrangement refers to the position distribution of each focus frame. Different window arrangements can include multiple sub-window arrangements. The window arrangement can include three types of window arrangements, each of which can be formed by multiple sub-window arrangements. The electronic device can determine the window arrangement based on the size of the first focus frame and perform window arrangement processing. During the window arrangement processing, the electronic device can determine the position and size of each sub-window arrangement.
[0110] FIG6 is a flow chart of a dynamic window matching method disclosed in an embodiment of the present application. As shown in FIG6 , the dynamic window matching method may include but is not limited to the following steps:
[0111] S5021: The electronic device calculates the focus ratio of the first focus frame.
[0112] The focus ratio A is the ratio of the area of the first focus frame to the first area. The first area is the size of the image captured by the camera of the electronic device. Assume that the first area is M*N. The focus ratio can be A = x*y / M*N. Where M and N are both integers greater than 1, x is an integer from 1 to M, and y is an integer from 1 to N.
[0113] The electronic device may determine the target windowing based on the focus ratio, as described in detail in S5022 to S5028.
[0114] S5022: The electronic device determines whether the focus ratio is greater than (greater than or equal to) a first threshold. If the focus ratio is greater than (greater than or equal to) the first threshold, S5023 is executed; if the focus ratio is less than or equal to (less than) the first threshold, S5024 is executed.
[0115] The electronic device compares the focus ratio A with a first threshold value K1 and determines whether to execute S5023 or S5024 based on the relationship between A and K1. The range of K1 is 0-1.
[0116] For example, when K1 is 0.3 and A is 0.32, 0.32>0.3, and the electronic device executes S5023; when A is 0.28 and 0.28<0.3, the electronic device executes S5024. The above is merely an example and does not limit the specific values of K1 and A.
[0117] S5023: The electronic device determines the first type of window arrangement as the target window arrangement.
[0118] When the focus ratio is greater than (greater than or equal to) the first threshold, the electronic device may determine the first type of window matching as the target window matching.
[0119] The first type of window arrangement can be a window arrangement that subdivides the first focus frame using first sub-windows. Multiple first sub-windows can divide the area of the first focus frame. For example, the first type of window arrangement can be a "square-shaped window arrangement" or a "nine-square grid window arrangement." All sub-windows in the first type of window arrangement are within the area of the first focus frame.
[0120] Figure 7 is a schematic diagram of five specific window arrangement forms shown in the embodiments of this application. As shown in Figure 7 (a) and (b), respectively, they are "field window arrangement" and "nine-square window arrangement". Among them, the number of sub-windows in the "field window arrangement" is 4; the number of sub-windows in the "nine-square window arrangement" is 9. The division of the "nine-square window arrangement" is more refined. It should be noted that Figure 7 is merely an exemplary description, and this application does not limit the specific form of window arrangement.
[0121] Figures 8A to 8C are schematic diagrams of several window arrangement types exemplarily described in the embodiments of the present application. In conjunction with the window arrangement logic of Figure 6, several different window arrangement types are described respectively, as follows:
[0122] As shown in FIG8A , in user interface 810, the square-shaped matching window 811 has four sub-matching windows (all located within the first focus frame). The upper left sub-matching window includes a small portion of leaves and most of the background; the upper right sub-matching window contains mostly a face and a small portion of leaves; the lower left sub-matching window contains mostly background and a small portion of leaves; and the lower right sub-matching window contains only leaves. It should be noted that during the actual shooting process, the user interface can display only the first focus frame without the matching windows. The matching windows are only used for calculations. Of course, the matching windows can also be displayed. This application does not limit the specific shooting display situation.
[0123] S5024: The electronic device determines whether the focus ratio is greater than (greater than or equal to) a second threshold value. If it is greater than (greater than or equal to) the second threshold value, execute S5025; otherwise, execute S5026.
[0124] The electronic device compares the focus ratio A with the second threshold K2, and determines whether to execute S5025 or S5026 based on the relationship between A and K2. The range of K2 is 0 to 1. K2 <K1。
[0125] For example, if K2 is 0.2 and A is 0.22, 0.22>0.2, and the electronic device executes S5025; if A is 0.19 and 0.19<0.2, the electronic device executes S5026. The above is merely an example and does not limit the specific values of K2 and A.
[0126] S5025: The electronic device determines the second type of window arrangement as the target window arrangement.
[0127] The second type of windowing is a windowing form in which the interior of the first focusing frame is subdivided by a second sub-window, and the exterior of the first focusing frame is expanded by a third sub-window. In the second type of windowing, at least one second sub-window is located inside the first focusing frame, and at least one third sub-window includes the first focusing frame and the area outside the first focusing frame. Exemplarily, the second type of windowing can be a circular windowing. As shown in (c) in Figure 7, the circular windowing includes a sub-window (window 1) located inside the first focusing frame and another sub-window (window 2) including the first focusing frame and having an area larger than the first focusing frame.
[0128] As shown in FIG8B , in user interface 820, a back-shaped window 821 includes two sub-windows: one sub-window is within the first focus frame, and the other includes the first focus frame, displaying as two nested frames. The inner sub-window contains a human face, while the outer sub-window contains a human face, part of the background, and part of the human body.
[0129] S5026: The electronic device determines whether the focus ratio is greater than (greater than or equal to) a third threshold. If it is greater than (greater than or equal to) the third threshold, execute S5027; otherwise, execute S5028.
[0130] The electronic device compares the focus ratio A with the second threshold K3, and determines whether to execute S5027 or S5028 based on the relationship between A and K3. The range of K3 is 0 to 1. <K2<K1。
[0131] The focus frame corresponding to the third threshold can be between 100*100 and 120*120 pixels. That is, the third threshold can be between 100*100 / x*y and 120*120 / x*y. The specific size of the third threshold is not limited.
[0132] For example, if K3 is 0.1 and A is 0.12, 0.12>0.1, and the electronic device executes S5025; if A is 0.09 and 0.09<0.1, the electronic device executes S5026. The above is merely an example and does not limit the specific values of K3 and A.
[0133] S5027: The electronic device determines the third type of window arrangement as the target window arrangement.
[0134] The third type of windowing is a form of windowing that expands the outside of the first focusing frame through a fourth sub-window. At least one fourth sub-window in the third type of windowing includes an area outside the first focusing frame. For example, the third type of windowing is a cross windowing. As shown in Figure 7 (d) and (e), they are both cross windows. The windowing type in Figure 7 (d) includes 4 sub-windows, and the windowing type in Figure 7 (e) includes 8 sub-windows. It should be noted that the sub-windows of the cross windowing can all be outside the first focusing frame; or they can be partially outside the first focusing frame and partially inside the first focusing frame, which is not limited in this application.
[0135] Among them, the number of the first sub-window, the second sub-window, the third sub-window and the fourth sub-window in the first type of window, the second type of window and the third type of window is greater than or equal to 1, which is not limited in this application.
[0136] As shown in FIG8C , in the user interface 830 , the cross window 831 includes eight sub-windows, with each side of the first focus frame adjacent to a sub-window, forming four outer windows. The interior of the first focus frame includes another four sub-windows.
[0137] S5028: The electronic device maintains the first focus frame.
[0138] The electronic device may determine that the target window is not required and maintain the first focus frame.
[0139] Among them, the first threshold>the second threshold>the third threshold.
[0140] When the focus ratio is less than or equal to (less than) the third threshold, the electronic device may keep the first focus frame unchanged.
[0141] In the embodiment of FIG6 above, the larger the area of the focus frame, the more likely the focused subject is to be inside the focus frame. Therefore, the electronic device can further refine the determination of the focus position by subdividing the first type of window into multiple sub-windows. In the case of a medium-sized focus frame, it is impossible to determine whether the focused subject is inside or outside the focus frame. The second type of window is used to further determine the accuracy and range of the focus. In the case of a very small focus frame, the focused subject may be more likely to be outside the focus frame. The third type of window is used to further determine the situation outside the focus frame, and further determine the accuracy and range of the focus. In this way, for different focus frame sizes, the possible deviation of the corresponding out-of-focus subject can be taken into account. By selecting the corresponding window form, the subject that should be focused can be found as accurately as possible to ensure the accuracy of the focus.
[0142] S503: The electronic device calculates the in-focus positions of all sub-windows in the target window and the first focus frame.
[0143] When the in-focus position is focused on the corresponding area (sub-window or first focus frame) described above, the electronic device's in-focus is the code value corresponding to the focus motor. The first focus frame corresponds to code A. The target window includes S sub-windows, and the codes corresponding to each sub-window are, in order: code 1, code 2, code 3, ..., code S. S is an integer greater than 1. The electronic device can calculate the above codes A, code 1, code 2, code 3, ..., code S respectively through autofocus.
[0144] 8A , the electronic device may calculate that the first diagonal frame corresponds to code A, the upper left sub-window corresponds to code 1, the upper right sub-window corresponds to code 2, the lower left sub-window corresponds to code 3, and the lower right sub-window corresponds to code 4.
[0145] Among them, the electronic device calculates the focus position of the focus frame or the matching window by laser focusing, that is, obtaining the corresponding object distance, determining the corresponding code based on the mapping relationship between the object distance and the code, and can also be calculated by phase focusing, etc. The specific calculation method of the focus position is not limited in this application.
[0146] It should be noted that the code value is positively correlated with the image distance during the focusing process. However, the larger the code value (the larger the image distance), the smaller the corresponding object distance, and the closer the subject is to the camera.
[0147] S504: The electronic device determines a target standard focus position based on the target alignment window and the first focus frame.
[0148] The second focus frame is the focus frame determined for the motor-driven target in S505 .
[0149] FIG9 is a flow chart of a method for selecting a second focus frame according to an exemplary embodiment of the present application. As shown in FIG9 , the method for selecting a second focus frame may include but is not limited to the following steps:
[0150] S5041: The electronic device calculates the confidence of all sub-windows and the first focus frame in the target window, and filters them according to the confidence to obtain a pre-selected frame set.
[0151] The electronic device can obtain the confidence of all sub-windows and the first focus frame in a target window. Determine whether each confidence is greater than the first confidence threshold. When the confidence of the corresponding sub-window or the first focus frame is greater than (greater than or equal to) the first confidence threshold, the sub-window or focus frame corresponding to the confidence is retained; when the confidence is less than or equal to (less than) the first confidence threshold, the sub-window or focus frame corresponding to the confidence is eliminated. The confidence is the confidence corresponding to all sub-windows and the first focus frame in the target window in turn. After the above comparison is completed, the retained windows or focus frames are determined as the pre-selected frame set. Among them, the pre-selected frame is the sub-window and / or the first focus frame in the target window, and the focus confidence of all pre-selected frames in the pre-selected frame set is greater than or equal to (greater than) the first confidence threshold.
[0152] During this process, the electronic device uses the confidence level to screen focus frames and windows with poor focus reliability. This ensures the reliability and accuracy of the data when the code of the pre-selected frame set is subsequently used. Data with large deviations is eliminated to ensure precise focus and better focusing results.
[0153] S5042: The electronic device sorts the in-focus positions of the pre-selected frame set to obtain first sequence information.
[0154] The electronic device can sort the in-focus positions of all matching windows and focus frames in the pre-selected frame set, for example, by sorting them in ascending order of code (shooting object distance from far to near), or by sorting them in descending order of code (shooting object distance from near to far). The focus frames or matching windows in the pre-selected frame set can be sorted in sequence according to the order of code values to obtain first sequence information.
[0155] S5043: The electronic device determines whether the first focus frame is focused on a portrait. If it is focused on a portrait, S5044 is executed; if it is not focused on a portrait, S5045 is executed.
[0156] During S501, the electronic device can extract semantic information and determine whether the current subject (the subject of the first focus frame) is a person, and can also determine whether the first focus frame is focused on a portrait. If the portrait is focused, S5044 is executed; if not, S5045 is executed.
[0157] In the above embodiment, different focusing methods are used for different focus subjects. Subjects are divided into portrait and other types. Portrait types use the human frame to ensure focus accuracy and reliability. For other types, focus is performed based on the close-up priority principle to ensure accurate and reliable image focus.
[0158] S5044: The electronic device determines whether the difference between the in-focus position of the human frame and the in-focus position of the face frame is greater than (greater than or equal to) a first depth of field threshold. If greater than the first depth of field threshold, the electronic device executes S5045; if less than or equal to the first depth of field threshold, the electronic device executes S5046.
[0159] When focusing on a portrait, the electronic device can determine the in-focus positions (code values) of the face frame and the body frame of the focused subject (the first person). If the difference between the two in-focus positions is greater than (greater than or equal to) the first depth of field threshold, the electronic device can execute S5046; if the difference is less than or equal to (less than) the first depth of field threshold, the electronic device can execute S5045.
[0160] The first depth of field threshold can be set to a fixed value or a variable value. When the first depth of field threshold is a variable value, the second depth of field threshold th2 is w times the current depth of field length. The range of the second depth of field threshold is 0.5 and the depth of field length to 1.5 depth of field lengths. For example, the second depth of field threshold is a depth of field length, for example, 30 codes, and the above example is not limited. The electronic device can obtain the current depth of field length during the focusing process and calculate the first depth of field threshold.
[0161] Figure 11 is a schematic diagram illustrating a face frame and a body frame according to an embodiment of the present application. As shown in Figure 11, when the electronic device is focusing on a first person, user interface 1110 may display a focus frame 1111, and the electronic device may determine the first person's face and define a face frame 1113, as well as the first person's body and define a body frame 1112. During the actual shooting process, the electronic device may not display the face frame and body frame, but only the focus frame.
[0162] Among them, the method for determining the quasi-focus position of the human body frame and the face frame can refer to phase focus and laser focus, etc., which will not be described in detail.
[0163] S5045: The electronic device determines the target focus position based on the near view priority principle.
[0164] The electronic device can give priority to focusing on the window with a closer shooting distance.
[0165] FIG10 is a flow chart of a method for determining a second focus frame according to an exemplary embodiment of the present application. As shown in FIG10 , the specific description of S5045 may include at least the contents of S1001 to S1005, which are described in detail below:
[0166] S1001: The electronic device obtains the maximum and minimum in-focus positions in the pre-selected frame set and determines whether the difference between the maximum and minimum values is greater than a second depth of field threshold. If the difference is greater than (greater than or equal to) the second depth of field threshold, the electronic device executes S1003. If the difference is less than or equal to (less than) the second depth of field threshold, the electronic device executes S1002.
[0167] The second depth of field threshold can be a fixed value or a variable value. The second depth of field threshold can be equal to the first depth of field threshold. When the second depth of field threshold is a variable value, the second depth of field threshold th2 is m times the current depth of field length. The range of the second depth of field threshold is 0.5 and the depth of field length to 1.5 depth of field lengths. For example, the second depth of field threshold is a depth of field length, for example, 30 codes, and the above example is not limited. The first depth of field threshold can be equal to the second depth of field threshold, and the first depth of field threshold can also not be equal to the second depth of field threshold.
[0168] The electronic device may determine that if code(max)-code(min)>(≥)th2, then execute S1003. If code(max)-code(min)≤(<)th2, then execute S1002.
[0169] S1002: The electronic device determines whether focusing with the first focus frame is reliable. If reliable, execute S1005; if not, execute S1004.
[0170] The electronic device determines that the confidence level during the focusing process of the first focus frame is greater than (greater than or equal to) the second confidence threshold; if the confidence level during the focusing process of the first focus frame is greater than (greater than or equal to) the second confidence threshold, executes S1005; if the confidence level (detection data) during the focusing process of the first focus frame is less than or equal to (less than) the second confidence threshold, executes S1004.
[0171] The second confidence threshold is greater than or equal to the first confidence threshold.
[0172] S1003: The electronic device determines the in-focus position of the pre-selected frame with the closest object distance in the pre-selected frame set as the target standard in-focus position.
[0173] The electronic device can determine that the largest code in the pre-selected frame set corresponds to the closest object distance, i.e., the largest code is the target code (the target standard focus position). In this way, if the focus frame and the in-focus positions of all matching windows differ significantly, the closest subject can be selected for in-focus, meeting the goal of prioritizing close-up shots. This shooting process also meets actual shooting needs and ensures that the subject in the middle of the focus is accurately captured.
[0174] S1004: The electronic device determines the average of all in-focus positions in the pre-selected frame set as the target standard focus position.
[0175] When the depth of field is less than or equal to (less than) the second depth of field threshold and the focus using the first focus frame is unreliable, the average of all codes corresponding to all pre-selected frames in the pre-selected frame set is used for focusing to ensure the reliability of the focus position.
[0176] S1005: The electronic device determines the target standard focus position according to the in-focus position corresponding to the first focus frame.
[0177] When the depth of field is less than or equal to (less than) the second depth of field threshold and the first focus frame is reliable, the focus position corresponding to the first focus frame is directly used for focusing, which ensures the reliability of the focus position while simplifying the target code determination method and improving processing efficiency.
[0178] S5046: The electronic device determines the quasi-focus position of the human body frame as the target standard focus position.
[0179] If the electronic device determines that the difference between the in-focus positions of the body frame and the face frame is greater than (greater than or equal to) a first depth of field threshold, the electronic device may focus based on the body frame. In this case, the body frame is farther from the camera, while the face frame is closer. When both the body frame and the face frame are within the captured image, users tend to take full-body photos. The position of the body frame ensures overall image clarity, and the body occupies a large proportion of the body frame, making focus more accurate. Therefore, the decision to use the body frame for focusing can be made to ensure a better focusing effect.
[0180] S505: The electronic device drives the focus motor to reach the target standard focus position.
[0181] In S504, after the electronic device determines the target code, it can drive the focus motor to reach the target code.
[0182] In the above-mentioned implementation method, the electronic device can select different windowing forms based on the size of the first focus frame. After the windowing is performed, the electronic device can use different focusing methods for different types of shooting subjects. When using portrait focus, the electronic device can prioritize human body focus to ensure the accuracy of focusing on people. In the case of non-portrait focus, close-up focus can be prioritized to ensure that nearby objects are prioritized for shooting and clearing. For example, in Figure 8A, the electronic device will prioritize focusing on leaves. In Figure 8C, the electronic device is more inclined to focus on faces.
[0183] As used in the above embodiments, the term “when…” may be interpreted to mean “if…” or “after…” or “in response to determining…” or “in response to detecting…”, depending on the context. Similarly, the phrases “upon determining…” or “if (stated condition or event) is detected” may be interpreted to mean “if determining…” or “in response to determining…” or “upon detecting (stated condition or event)” or “in response to detecting (stated condition or event)”, depending on the context.
[0184] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of 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, the process or function described in the embodiment of the present application is generated in whole or in part. 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 computer-readable storage medium. 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 a wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that includes one or more available media integrations. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk).
[0185] Those skilled in the art will appreciate that all or part of the process steps in the above-described method embodiments can be implemented by a computer program instructing the relevant hardware. The program can be stored in a computer-readable storage medium, and when executed, the program can include the process steps in the above-described 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.
Claims
1. A shooting method, characterized in that, The method is applied to an electronic device, and the method includes: In response to a first operation, the electronic device displays a first interface, and a preview image captured by a camera is displayed on the first interface; The electronic device focuses on a first subject in the first preview image, and the first preview image is displayed on the first interface; When the electronic device determines a target window based on the first focus frame, the electronic device determines a target focus position based on all sub-windows in the target window and the focus position of the first focus frame; the first focus frame includes the first subject; The electronic device drives the focus motor to the target focus position.
2. The method according to claim 1, wherein The method further includes: The electronic device determines the focus ratio of the first focus frame; the focus ratio is the ratio of the size of the first focus frame to the size of the image captured by the camera; The electronic device determines a target window based on the focus ratio.
3. The method according to claim 2, wherein The determining the target window based on the focus ratio includes: When the focus ratio is greater than or equal to a first threshold, determining that the target window is a first type of window; when the focus ratio is less than the first threshold and greater than or equal to a second threshold, determining that the target window is a second type of window; when the focus ratio is less than the second threshold and greater than or equal to a third threshold, determining that the target window is a third type of window; when the focus ratio is less than the third threshold, determining that the target window is not required; Wherein, the first type of window is a window form that subdivides the inside of the first focus frame through a first sub-window; the second type of window is a window form that subdivides the inside of the first focus frame through a second sub-window and expands the outside of the first focus frame through a third sub-window; the third type of window is a window form that expands the outside of the first focus frame through a fourth sub-window.
4. The method according to claim 3, characterized in that, The first threshold is greater than the second threshold, and the second threshold is greater than the third threshold.
5. The method according to any one of claims 1-4, characterized in that, The electronic device determines the target focus position based on all sub-windows in the target window and the focus position of the first focus frame, including: When the first subject is a portrait, if the difference between the focus position of the human body frame and the focus position of the face frame in the first preview screen is greater than a first depth-of-field threshold, the electronic device uses the focus position of the human body frame as the target focus position.
6. The method according to claim 5, characterized in that The electronic device determines the target focus position based on all sub-windows in the target window and the focus position of the first focus frame, and further includes: When the first subject is a portrait, if the difference between the focus position of the human body frame and the focus position of the face frame in the first preview screen is less than or equal to the first depth-of-field threshold, the electronic device determines the target focus position according to the principle of foreground priority.
7. The method according to claim 5 or 6, characterized in that The electronic device determines the target focus position based on all sub-windows in the target window and the focus position of the first focus frame, and further includes: When the first subject is not a portrait, the electronic device determines the target focus position according to the principle of foreground priority.
8. The method according to claim 6 or 7, characterized in that The electronic device determines the target focal position according to the near view priority principle, including: The electronic device acquires a pre-selected frame set; the pre-selected frame set includes the sub-matched window in the target matched window and the first focusing frame and the corresponding quasi-focus position; When the difference between the maximum value and the minimum value of the in-focus position in the pre-selection frame set is greater than the second depth of field threshold, the in-focus position with the shortest object distance is determined as the target in-focus position.
9. The method according to claim 8, characterized in that The electronic device determines the target focal position according to the near view priority principle, and further includes: When the difference between the maximum and minimum values of the in-focus position in the pre-selected frame set is less than or equal to a second depth of field threshold, if the focusing with the first focus frame is credible, the in-focus position of the first focus frame is used as the target standard focus position; if the focusing with the first focus frame is not credible, the average of all in-focus positions in the pre-selected frame set is used as the target standard focus position.
10. The method according to claim 9, wherein When the confidence of focusing with the first focus frame is greater than the second confidence threshold, focusing with the first focus frame is credible; when the confidence of focusing with the first focus frame is less than or equal to the second confidence threshold, focusing with the first focus frame is uncredible.
11. The method according to claim 8, characterized in that The focus confidence of all pre-selected frames in the pre-selected frame set is greater than or equal to a first confidence threshold; the pre-selected frames are sub-matched windows in the target matched window and / or the first focus frame.
12. An electronic device, characterized in that, include: One or more processors and one or more memories; the one or more processors are coupled to the one or more memories, the one or more memories are used to store computer program codes, the computer program codes include computer instructions, and when the one or more processors execute the computer instructions, the electronic device executes the method as described in any one of claims 1 to 11.
13. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 11 is implemented.
Citation Information
Patent Citations
Focusing processing method, mobile terminal and computer storage medium
CN112135060A
Shooting focusing method and related equipment
CN113572957A
Automatic focusing method and electronic equipment
CN117135449A
Imaging apparatus, display position correcting method, and display position correcting program
JP2009267592A