Focus processing method, electronic device and storage medium
By correcting the motion detection information of the focus frame, the problem of poor focusing effect of electronic devices in shooting moving objects is solved, the focus accuracy and image clarity are improved, and high-quality moving image shooting is achieved.
Patent Information
- Application Number
- CN202310216184.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-02-27
- Publication Date
- 2024-10-01
- Estimated Expiration
- 2043-02-27
AI Technical Summary
When electronic devices are used to shoot moving objects, there are problems such as poor focus tracking and unsatisfactory image clarity.
By correcting the initial focus frame based on the motion detection information for the focus frame between previous image frames, the focus shooting effect is improved, including determining the translation and zoom motion information of the image frame span, and adjusting the focus frame along the movement direction and rate. Make sure the focus area adapts to the movement of your target subject.
It effectively improves the focus accuracy and processing speed, reduces image blur, improves image shooting quality, and enables high-quality sports image shooting without the need for an auxiliary focus module under conventional camera hardware conditions.
Smart Images

Figure CN117135451B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of terminal equipment, and in particular to a focusing processing method and an image acquisition device. Background Art
[0002] With the improvement of computing power and hardware capabilities, electronic devices support more and more diverse shooting scene requirements.
[0003] Currently, when electronic devices are shooting moving objects, there are problems such as poor tracking effect and unsatisfactory image clarity. Summary of the invention
[0004] In order to solve the above technical problems, the present application provides a focus processing method and an image acquisition device. In the method, the initial focus frame for the target object is corrected according to the motion detection information for the focus frame between the previous image frames, which can effectively improve the focus shooting effect for the target object and the image shooting quality.
[0005] In a first aspect, an embodiment of the present application provides a focus processing method. The method includes: determining motion detection information for a focus frame between a first image frame and a second image frame, the motion detection information indicating change information between a first focus frame in the first image frame and a second focus frame in the second image frame, the first focus frame and the second focus frame indicating the same target object; according to the motion detection information, correcting the second focus frame to obtain a third focus frame; focusing on the target object in the third image frame based on the third focus frame. The first image frame is a preceding image frame based on the second image frame in an image sequence, and the second image frame is a preceding image frame adjacent to the third image frame in an image sequence. It can effectively improve the accuracy of focus and the speed of focus processing, is conducive to reducing the blur of the image, and can effectively improve the image capture quality.
[0006] According to the first aspect, motion detection information for a focus frame between a first image frame and a second image frame is determined, including: determining first translation motion information based on an image frame span from the first focus frame to the second focus frame as motion detection information, the image frame span indicating a frame sequence difference or a time difference between the first image frame and the second image frame.
[0007] The motion detection information of the focus frame indicates the change information of the focus area in the first image frame and the second image frame, and also indicates the motion trend information of the target object in the first image frame and the second image frame. According to the motion detection information, the second focus frame in the second image frame is corrected, which is conducive to adapting to the motion of the target object and quickly adjusting to the appropriate focus parameters.
[0008] According to the first aspect, or any implementation of the first aspect above, the first translation motion information includes a focus frame motion direction and a focus frame motion rate. According to the motion detection information, the second focus frame is corrected to obtain a third focus frame, including: based on the focus frame motion rate in the first translation motion information, the second focus frame is moved along the focus frame motion direction to correct the focus frame position of the second focus frame to obtain the third focus frame.
[0009] The first translational motion information between the first focus frame and the second focus frame can reflect the motion trend information of the target object in the first image frame and the second image frame. Correcting the second focus frame according to the first translational motion information is conducive to improving the focusing accuracy of the target object.
[0010] According to the first aspect, or any implementation of the first aspect above, based on the focus frame motion rate in the first translational motion information, the second focus frame is moved along the focus frame motion direction to obtain the third focus frame, including: according to the first segmented interval to which the focus frame motion rate in the first translational motion information belongs, determining the first focus frame movement ratio that matches the first segmented interval; according to the first focus frame movement ratio, moving the second focus frame along the focus frame motion direction to correct the focus frame position of the second focus frame to obtain the third focus frame.
[0011] By correcting the focus frame position of the second focus frame, it can be effectively ensured that the corrected focus area can better reflect the target object in the shooting picture, which is beneficial to improving the focusing accuracy during the photo shooting process.
[0012] According to the first aspect, or any implementation of the first aspect above, determining motion detection information for a focus frame between a first image frame and a second image frame includes: determining scaling motion information based on an image frame span from the first focus frame to the second focus frame as the motion detection information. The image frame span includes a frame sequence difference or a time difference between the first image frame and the second image frame.
[0013] When the visual size of the target object changes, scaling and correcting the focus frame size of the second focus frame can help ensure that the edge of the scaled focus area fits the contour of the moving subject, thereby improving the focus tracking effect for fast-moving subjects.
[0014] According to the first aspect, or any implementation of the first aspect above, the zoom motion information includes a focus frame zoom type and a focus frame zoom rate. According to the motion detection information, the second focus frame is corrected to obtain a third focus frame, including: according to the focus frame zoom type and the focus frame zoom rate, the second focus frame is zoomed to correct the focus frame size of the second focus frame to obtain the third focus frame. Accurate focus on the target object can be achieved, which is conducive to improving the clarity of image capture.
[0015] According to the first aspect, or any implementation of the first aspect above, the second focus frame is scaled according to the focus frame scaling type and the focus frame scaling rate to obtain a third focus frame, including: determining a focus frame scaling ratio that matches the second segmented interval according to the second segmented interval to which the focus frame scaling rate belongs; scaling the second focus frame according to the focus frame scaling type and the focus frame scaling ratio to correct the focus frame size of the second focus frame to obtain a third focus frame. Motion image shooting can be performed based on conventional camera hardware conditions, and there is no need to set an auxiliary focus module, and the focusing cost is low.
[0016] According to the first aspect, or any implementation of the first aspect above, the first focus frame and the second focus frame include corresponding focus frame feature points, and the zoom motion information includes the focus frame zoom type and the focus frame zoom rate; according to the motion detection information, the second focus frame is corrected to obtain a third focus frame, including: according to the focus frame zoom type and the focus frame zoom rate, the focus frame feature points in the second focus frame are moved to correct the focus frame size of the second focus frame to obtain the third focus frame. The focus frame feature points can be any points in the focus frame, for example, the corner points, vertices, and boundary points of the focus frame can be selected as feature points.
[0017] According to the first aspect, or any implementation of the first aspect above, the focus frame feature points in the second focus frame are moved according to the focus frame zoom type and the focus frame zoom rate to correct the focus frame size of the second focus frame to obtain a third focus frame, including: determining the feature point movement direction of the focus frame feature points according to the focus frame zoom type, and determining the feature point movement ratio matching the second segmented interval according to the second segmented interval to which the focus frame zoom rate belongs; according to the feature point movement direction and the feature point movement ratio, the focus frame feature points in the second focus frame are moved to obtain a third focus frame composed of the moved focus frame feature points. This is conducive to achieving tracking focus or stable focus on a moving subject, and is conducive to improving the clarity of image capture.
[0018] According to the first aspect, or any implementation of the first aspect above, the zoom motion information includes the focus frame zoom type and the focus frame zoom rate; according to the motion detection information, the second focus frame is corrected to obtain the third focus frame, including: according to the focus frame zoom type and the focus frame zoom rate, the second focus frame is zoomed to obtain the middle focus frame; the second translation motion information based on the image frame span from the first focus frame to the middle focus frame is determined, and the second translation motion information includes the focus frame movement direction and the focus frame movement rate; based on the focus frame movement rate in the second translation motion information, the middle focus frame is moved along the focus frame movement direction to obtain the third focus frame. By correcting the focus frame position and focus frame size of the second focus frame, it is beneficial to improve the accuracy and efficiency of focusing, and can effectively improve the image capture quality.
[0019] According to the first aspect, or any implementation of the first aspect above, the second focus frame is scaled according to the focus frame scaling type and the focus frame scaling rate to obtain an intermediate focus frame, including: determining a focus frame scaling ratio that matches the second segmented interval according to the second segmented interval to which the focus frame scaling rate belongs, and scaling the second focus frame according to the focus frame scaling type and the focus frame scaling ratio to obtain an intermediate focus frame. Based on the focus frame motion rate in the second translation motion information, the intermediate focus frame is moved along the focus frame motion direction to obtain a third focus frame, including: determining a second focus frame movement ratio that matches the third segmented interval according to the third segmented interval to which the focus frame motion rate in the second translation motion information belongs, and moving the intermediate focus frame along the focus frame motion direction according to the second focus frame movement ratio to obtain a third focus frame.
[0020] According to the first aspect, or any implementation of the first aspect above, contour detection is performed on the target object in the second image frame to obtain a contour detection result; based on the contour detection result, edge adjustment is performed on the size-corrected second focus frame so that the edge of the adjusted second focus frame fits the contour of the target object, and the edge-adjusted second focus frame constitutes a third focus frame.
[0021] By performing contour detection on the target object, the edge of the second focus frame after size correction is adjusted again according to the contour detection result, so that the edge of the adjusted second focus frame fits the contour of the target object. This is conducive to timely capturing the motion state of the target object, can effectively improve the accuracy and efficiency of focusing, and is conducive to improving the clarity of motion image shooting and improving user experience.
[0022] According to the first aspect, or any implementation of the first aspect above, before correcting the second focus frame according to the motion detection information, it also includes: determining the position change degree and size change degree between the first focus frame and the second focus frame indicated by the motion detection information; when the position change degree or size change degree meets the preset degree threshold, performing a correction operation on the second focus frame. This is conducive to improving the efficiency of the focus processing and can effectively reduce the computing resource consumption and time consumption of the focus processing.
[0023] In a second aspect, an embodiment of the present application provides a focus processing method. The focus processing method includes: determining motion detection information for a focus frame based on N preceding image frames adjacent to a fourth image frame, where N is an integer greater than 2, and the focus frames in the N preceding image frames are for the same target object; based on the motion detection information, correcting the fourth focus frame in the fifth image frame to obtain a fifth focus frame, where the fifth image frame is the previous image frame adjacent to the fourth image frame in the N preceding image frames; and focusing on the target object in the fourth image frame based on the fifth focus frame.
[0024] According to a second aspect, determining motion detection information for a focus frame based on N preceding image frames includes: determining focus frame motion information based on each target image frame pair for at least one target image frame pair in the N preceding image frames; and determining motion statistics information for the focus frame based on the N preceding image frames as motion detection information based on the focus frame motion information matched with each target image frame pair. The target image frame pair includes any image frame pair in the N preceding image frames.
[0025] According to the second aspect, or any implementation of the second aspect above, based on the focus frame motion information matching each target image frame pair, determining motion statistics for the focus frame based on N preceding image frames, including: determining a weight parameter for each target image frame pair based on an image frame span between each target image frame pair and a fourth image frame; and performing weighted integration on the focus frame motion information matching each target image frame pair based on the weight parameter for each target image frame pair to obtain motion statistics based on the weighted integration result. The image frame span indicates a frame sequence difference or time difference between the corresponding target image frame pair and the fourth image frame.
[0026] According to the second aspect, or any implementation method of the second aspect above, based on the focus frame motion information matching each target image frame pair, the motion statistical information for the focus frame based on N preceding image frames is determined, including: averaging and integrating the focus frame motion information matching each target image frame pair to obtain motion statistical information based on the averaging and integration result.
[0027] According to the second aspect, or any implementation method of the second aspect above, the focus frame motion information includes third translation motion information of the focus frame in the target image frame pair, and the third translation motion information includes the translation motion rate and the translation motion direction; according to the focus frame motion information matching each target image frame pair, determine the motion statistical information for the focus frame based on N previous image frames as motion detection information, including: according to the translation motion rate and the translation motion direction of the focus frame in each target image frame pair, determine the translation statistical rate and the translation statistical direction for the focus frame based on N previous image frames as motion detection information.
[0028] According to the second aspect, or any implementation method of the second aspect above, the fourth focus frame in the fifth image frame is corrected according to the motion detection information to obtain the fifth focus frame, including: based on the translation statistical rate, moving the fourth focus frame along the translation statistical direction to correct the focus frame position of the fourth focus frame to obtain the fifth focus frame.
[0029] According to the second aspect, or any implementation method of the second aspect above, based on the translation statistical rate, the fourth focus frame is moved along the translation statistical direction to correct the focus frame position of the fourth focus frame to obtain the fifth focus frame, including: according to the fourth segmented interval to which the translation statistical rate belongs, determining the movement ratio of the third focus frame that matches the fourth segmented interval; according to the third focus frame movement ratio, moving the fourth focus frame along the translation statistical direction to obtain the fifth focus frame.
[0030] According to the second aspect, or any implementation of the second aspect above, the focus frame motion information includes zoom motion information of the focus frame in the target image frame pair, and the zoom motion information includes zoom motion rate and zoom motion type; according to the focus frame motion information matching each target image frame pair, determine the motion statistical information for the focus frame based on N previous image frames as motion detection information, including: according to the zoom motion rate and zoom motion type of the focus frame in each target image frame pair, determine the zoom statistical rate and zoom statistical type for the focus frame based on N previous image frames as motion detection information.
[0031] According to the second aspect, or any implementation of the second aspect above, the fourth focus frame in the fifth image frame is corrected according to the motion detection information to obtain the fifth focus frame, including: scaling the fourth focus frame according to the zoom statistic type and the zoom statistic rate to correct the focus frame size of the fourth focus frame to obtain the fifth focus frame.
[0032] According to the second aspect, or any implementation method of the second aspect above, the fourth focus frame is scaled according to the zoom statistic type and the zoom statistic rate to correct the focus frame size of the fourth focus frame to obtain the fifth focus frame, including: determining the zoom statistic ratio that matches the fifth segmented interval to which the zoom statistic rate belongs; scaling the fourth focus frame according to the zoom statistic type and the zoom statistic ratio to obtain the fifth focus frame.
[0033] According to the second aspect, or any implementation of the second aspect above, after the focus frame size of the fourth focus frame is corrected, it also includes: performing contour detection on the target object in the fifth image frame to obtain a contour detection result; based on the contour detection result, performing edge adjustment on the size-corrected fourth focus frame so that the edge of the adjusted fourth focus frame fits the contour of the target object, and the edge-adjusted fourth focus frame constitutes the fifth focus frame.
[0034] In a third aspect, an embodiment of the present application provides an electronic device, characterized in that it includes: one or more processors; a memory; and one or more computer programs, wherein the one or more computer programs are stored in the memory, and when the computer programs are executed by the one or more processors, the electronic device performs the focus processing method described in the first aspect or the second aspect.
[0035] In a fourth aspect, an embodiment of the present application provides a computer program, which includes instructions for executing the method in the first aspect or any possible implementation of the first aspect.
[0036] In a fifth aspect, an embodiment of the present application provides a chip, the chip comprising a processing circuit and a transceiver pin, wherein the transceiver pin and the processing circuit communicate with each other through an internal connection path, and the processing circuit executes the method in the first aspect or any possible implementation of the first aspect to control the transmitting pin to send a signal. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 A schematic diagram of an application scenario is shown as an example;
[0038] Figure 2 A schematic diagram of a fully focused scene is shown as an example;
[0039] Figure 3 A schematic diagram showing an example of a scene that is not fully focused;
[0040] Figure 4 is a schematic diagram showing another fully focused scene by way of example;
[0041] Figure 5is a schematic diagram showing another scene that is not fully focused;
[0042] Figure 6 Shown is a schematic diagram of the structure of an electronic device;
[0043] Figure 7 The following is a block diagram showing the software structure of an electronic device by way of example;
[0044] Figure 8 A schematic diagram of the imaging process of an image sequence provided in an embodiment of the present application;
[0045] Figure 9a A schematic diagram of the interaction flow of each module provided in the embodiment of the present application;
[0046] Figure 9b A schematic diagram of the interaction flow of each module provided in the embodiment of the present application;
[0047] Fig.10 A schematic diagram of the interaction flow of each module provided in the embodiment of the present application;
[0048] Fig.11 A schematic diagram of a focusing process provided in an embodiment of the present application;
[0049] Fig.12 A schematic diagram of a focusing process provided in an embodiment of the present application;
[0050] Fig.13 A schematic diagram of a focusing process provided in an embodiment of the present application;
[0051] Fig.14 A schematic diagram of a focusing process provided in an embodiment of the present application;
[0052] Fig.15a A schematic diagram of a target image frame pair provided in an embodiment of the present application;
[0053] Fig.15b A schematic diagram of a target image frame pair provided in an embodiment of the present application. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0055] The term "and / or" in this article is merely a description of the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone.
[0056] The terms "first" and "second" in the description and claims of the embodiments of the present application are used to distinguish different objects rather than to describe a specific order of objects. For example, a first target object and a second target object are used to distinguish different target objects rather than to describe a specific order of target objects.
[0057] In the embodiments of the present application, the words "exemplarily" or "for example" are used to indicate examples, illustrations or explanations. Any embodiment or design described as "exemplarily" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplarily" or "for example" is intended to present related concepts in a specific way.
[0058] In the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" refers to two or more than two. For example, multiple processing units refer to two or more processing units; multiple systems refer to two or more systems.
[0059] With the improvement of computing power and hardware capabilities, electronic devices support increasingly diverse shooting scene requirements. For example, more and more electronic devices support tracking shooting of moving subjects. When performing tracking shooting of moving subjects, electronic devices can use autofocus technology to select the focus area, complete focus based on the focus area, and shoot image frames. Whether the focus area falls on the moving subject is an important factor affecting the quality of the image frame. Since the moving subject may continue to move during the focusing process of the electronic device, inaccurate focus and poor image quality are prone to occur during the photo shooting process.
[0060] The above-mentioned electronic device can be a mobile phone, a tablet computer, a wearable device, a vehicle-mounted device, an augmented reality (AR) / virtual reality (VR) device, a laptop computer, an ultra-mobile personal computer (UMPC), a netbook, a personal digital assistant (PDA) or a dedicated camera (such as a SLR camera, a card camera), etc. This application does not impose any restrictions on the specific types of the above-mentioned electronic devices.
[0061] like Figure 1 To illustrate an application scenario schematic diagram, refer to Figure 1 Exemplarily, in response to a trigger operation to shoot a target object, the electronic device shoots and displays an image within a preset range. The preset range may be, for example, a shooting range of a camera of the electronic device.
[0062] When the target object is a moving subject, the electronic device needs to perform a focus operation on the moving subject. When the moving subject moves at a high speed, the electronic device may lose focus when performing a focus operation on the high-speed moving subject, and the moving subject image obtained by the out-of-focus shooting is not good.
[0063] like Figure 2 FIG. 1 is a schematic diagram showing a fully focused scene. Figure 2 As shown, when the moving subject moves in the horizontal direction, the greater the movement rate, the faster the position of the moving subject changes over time. Based on the preset viewing angle along the moving direction of the moving subject, the visual size of the moving subject does not change.
[0064] For example, the motion type of the moving subject can be divided into low-speed motion, medium-speed motion and high-speed motion based on a preset classification standard. In the process of the moving subject moving from time t1 to time t2, the greater the motion rate of the moving subject, the faster its position changes over time, that is, the faster the distance between time t1 and time t2 changes. In addition, the visual size of the moving subject based on time t1 and time t2 remains unchanged.
[0065] When shooting a moving subject, the electronic device needs to perform a focus operation on the moving subject. In a fully focused scene, regardless of whether the moving subject is moving at a slow, medium or high speed, the focus frame for the moving subject can be kept in sync with the moving subject, that is, the edge of the focus frame can be kept in sync with the outline of the moving subject.
[0066] When using electronic devices to perform focus tracking on moving subjects, such as Figure 2 As shown, in the fully focused scenario, the electronic device's focus frame 101 for the moving subject at time t1 and the focus frame 102 for the moving subject at time t2 can both remain synchronously aligned with the moving subject, that is, the edges of the focus frames 101 and 102 can remain aligned with the contour of the moving subject.
[0067] like Figure 3 FIG. 1 is a schematic diagram showing an example of a scene in which the image is not completely focused. Figure 3As shown, when the moving subject moves in the horizontal direction, the greater the movement rate, the faster the position of the moving subject changes over time. In the process of photographing the moving subject, the electronic device needs to perform a focus operation on the moving subject. When the movement rate of the moving subject is high, the electronic device may lose focus when performing a focus operation on the fast-moving subject.
[0068] The greater the speed of the moving subject, the greater the lag of the focus frame relative to the moving subject, that is, the greater the lag of the focus frame position relative to the moving subject position. For example, the focus frame lags relative to the moving subject at time t2, and the greater the speed of the moving subject, the greater the lag of the focus frame position relative to the moving subject position at time t2, and the worse the tracking effect.
[0069] When using electronic devices to perform focus tracking on moving subjects, such as Figure 3 As shown, in the incomplete focus scenario, the electronic device has a lag phenomenon of the focus frame 102 for the moving subject relative to the moving subject at time t2. The greater the movement speed of the moving subject, the greater the lag of the focus frame 102 position relative to the moving subject position.
[0070] like Figure 4 FIG. 2 is a schematic diagram showing another fully focused scene. Figure 4 As shown, in the case where the mobile subject moves along the front-to-back direction, based on the observation from a preset viewing angle along the front-to-back direction, the greater the movement rate of the mobile subject, the faster its visual size changes over time.
[0071] For example, the motion type of the moving subject can be divided into low-speed motion, medium-speed motion and high-speed motion based on a preset classification standard. In the process of the moving subject moving from time t3 to time t4, based on the preset viewing angle along the front-back direction, the greater the motion rate of the moving subject, the faster its position and visual size change over time. That is, the faster the distance change and visual size change of the moving subject between time t1 and time t2.
[0072] When shooting a moving subject, the electronic device needs to perform a focus operation on the moving subject. In a fully focused scene, regardless of whether the moving subject is moving at a slow, medium or high speed, the focus frame for the moving subject can be kept in sync with the moving subject, that is, the edge of the focus frame can be kept in sync with the outline of the moving subject.
[0073] When using electronic devices to perform focus tracking on moving subjects, such as Figure 4As shown, in the fully focused scenario, the electronic device's focus frame 103 for the moving subject at time t3 and the focus frame 104 for the moving subject at time t4 can both remain synchronously aligned with the moving subject, that is, the edges of the focus frames 103 and 104 can remain aligned with the contour of the moving subject.
[0074] like Figure 5 FIG. 2 is a schematic diagram showing another scene that is not completely focused. Figure 5 As shown, when the moving subject moves in the front-to-back direction, based on the preset viewing angle in the front-to-back direction, the greater the movement rate, the faster the visual size of the moving subject changes over time. In the process of photographing the moving subject, the electronic device needs to perform a focus operation on the moving subject. When the moving subject moves at a high speed, the electronic device may lose focus when performing a focus operation on the fast-moving subject.
[0075] like Figure 5 As shown, the greater the movement rate of the moving subject, the higher the hollowing ratio of the focus frame relative to the moving subject, that is, the higher the hollowing ratio of the focus frame size relative to the visual size of the moving subject. Exemplarily, the focus frame is too large relative to the moving subject at time t4. The greater the movement rate of the moving subject, the higher the hollowing ratio of the focus frame size relative to the visual size of the moving subject at time t4, and the worse the tracking effect.
[0076] When using electronic devices to perform focus tracking on moving subjects, such as Figure 5 As shown, in the incomplete focus scenario, the focus frame 104 of the electronic device for the moving subject at time t4 is too large relative to the moving subject. The greater the movement rate of the moving subject, the higher the hollowing ratio of the focus frame 104 size relative to the visual size of the moving subject.
[0077] like Figure 6 The figure shows a schematic diagram of the structure of the electronic device 100. Optionally, the electronic device 100 can be called a terminal or a terminal device. The electronic device 100 can be a terminal device with a camera function. The specific product form can be a smart terminal, such as a mobile phone, a tablet, a DV, a camcorder, a camera, a portable computer, a laptop computer, a smart speaker, and other products equipped with a camera. Specifically, the functional modules involved in the present application can be deployed on the DSP chip of the relevant equipment, and specifically can be an application program or software therein. A focus processing function can be provided through software installation or upgrade, as well as through the call and coordination of hardware, aiming to improve the accuracy of focusing of the moving subject, which is conducive to shooting high-quality and clear images in scenes where the moving subject moves rapidly.
[0078] It should be understood that Figure 6The electronic device 100 shown is only one example of an electronic device, and the electronic device 100 may have more or fewer components than shown in the figure, may combine two or more components, or may have a different configuration of components. Figure 6 The various components shown in the EMBODIMENTS 2000 may be implemented in hardware, software, or a combination of hardware and software, including one or more signal processing and / or application specific integrated circuits.
[0079] 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 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, a gyroscope sensor, an acceleration sensor, a temperature sensor, a motion sensor, an air pressure sensor, a magnetic sensor, a distance sensor, a proximity light sensor, a fingerprint sensor, a touch sensor, an ambient light sensor, a bone conduction sensor, etc.
[0080] 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 processor (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), etc. Different processing units may be independent devices or integrated into one or more processors.
[0081] The controller may be the nerve center and command center of the electronic device 100. The controller may generate an operation control signal according to the instruction operation code and the timing signal to complete the control of fetching and executing instructions.
[0082] A memory may also be provided in the processor 110 for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory.
[0083] The USB interface 130 is an interface that complies with USB standard specifications, and specifically may be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc.
[0084] The charging management module 140 is used to receive charging input from a charger. The charger can be a wireless charger or a wired charger. While the charging management module 140 is charging the battery 142, it can also power the electronic device through the power management module 141. 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 powers the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.
[0085] The wireless communication function of the electronic device 100 can be implemented through the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modem processor, the baseband processor, and the like.
[0086] 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 a single or multiple communication frequency bands. Different antennas can also be reused to improve the utilization of the antennas.
[0087] The mobile communication module 150 may provide solutions for wireless communications including 2G / 3G / 4G / 5G, etc., applied to the electronic device 100. The mobile communication module 150 may include at least one filter, a switch, a power amplifier, a low noise amplifier (LNA), etc.
[0088] The wireless communication module 160 can provide wireless communication solutions for application in the electronic device 100, including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), Bluetooth (BT), global navigation satellite system (GNSS), frequency modulation (FM), near field communication technology (NFC), infrared technology (IR), etc.
[0089] 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, so that electronic device 100 can communicate with the network and other devices through wireless communication technology.
[0090] The electronic device 100 implements display functions through a GPU, a display screen 194, and an application processor, etc. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.
[0091] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.
[0092] The electronic device 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
[0093] The ISP is used to process the data fed back by the camera 193. For example, when taking a photo, the shutter is opened, and the light is transmitted to the camera photosensitive element through the lens. The light signal is converted into an electrical signal, and the camera 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, and skin color of the image. The ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, the ISP can be set in the camera 193.
[0094] 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 to be converted 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.
[0095] Among them, the camera 193 can be located in the edge area of the electronic device, can be an under-screen camera, or can be a liftable camera. The camera 193 can include a rear camera, and can also include a rear camera. The embodiment of the present application does not limit the specific position and form of the camera 193. The electronic device 100 can include cameras of one or more focal lengths. For example, cameras of different focal lengths can include a telephoto camera, a wide-angle camera, an ultra-wide-angle camera, or a panoramic camera.
[0096] The external memory interface 120 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the electronic device 100. The external memory card communicates with the processor 110 via the external memory interface 120 to implement a data storage function.
[0097] The internal memory 121 can be used to store computer executable program codes, which include instructions. The processor 110 executes various functional applications and data processing of the electronic device 100 by running the instructions stored in the internal memory 121, such as enabling the electronic device 100 to implement the focus processing method in the embodiment of the present application. The internal memory 121 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system, an application required for at least one function (such as a sound playback function, an image playback function, etc.), etc. The data storage area may store data (such as audio data, a phone book, etc.) created during the use of the electronic device 100, etc. In addition, the internal memory 121 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, a universal flash storage (UFS), etc.
[0098] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170 and the application processor.
[0099] The audio module 170 is used to convert digital audio information into analog audio signal output, and is also used to convert analog audio input into digital audio signals. The audio module 170 can also be used to encode and decode audio signals. In some embodiments, the audio module 170 can be arranged in the processor 110, or some functional modules of the audio module 170 can be arranged in the processor 110.
[0100] The touch sensor is also called a "touch panel". The touch sensor can be set on the display screen 194. The touch sensor and the display screen 194 form a touch screen, also called a "touch screen". The touch sensor is used to detect a touch operation acting on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output related to the touch operation can be provided through the display screen 194.
[0101] The pressure sensor is used to sense the pressure signal and can convert the pressure signal into an electrical signal. In some embodiments, the pressure sensor can be arranged on the display screen 194. The electronic device 100 can also calculate the touch position according to the detection signal of the pressure sensor.
[0102] The gyro sensor may be used to determine the motion posture of the electronic device 100. In some embodiments, the angular velocity of the electronic device 100 around three axes (ie, x, y, and z axes) may be determined by the gyro sensor.
[0103] The accelerometer can detect the magnitude of the acceleration of the electronic device 100 in all directions (generally three axes). When the electronic device 100 is stationary, the accelerometer can detect the magnitude and direction of gravity. The accelerometer can also be used to identify the posture of the electronic device, and is applied to applications such as horizontal and vertical screen switching and pedometers.
[0104] The key 190 includes a power key (or power key), a volume key, etc. The key 190 may be a mechanical key or a touch key. The electronic device 100 may receive key input and generate key signal input related to user settings and function control of the electronic device 100.
[0105] The software system of the electronic device 100 may adopt a layered architecture, an event-driven architecture, a micro-core architecture, a micro-service architecture or a cloud architecture. The embodiment of the present application takes the Android system of the layered architecture as an example to exemplify the software structure of the electronic device 100.
[0106] like Figure 7 FIG. 1 is a block diagram showing an exemplary software structure of the electronic device 100 .
[0107] The layered architecture of the electronic device 100 divides the software into several layers, each with clear roles and division of labor. The layers communicate with each other through software interfaces. In some embodiments, the Android system is divided into five layers, from top to bottom, namely, the application layer, the application framework layer, the Android runtime (Android Runtime) and the system library, the HAL layer, and the kernel layer.
[0108] The application layer can include a series of application packages. Figure 7As shown, the application package may include camera, calendar, map, WLAN, music, short message, gallery, call, navigation, Bluetooth, video and other applications.
[0109] The application framework layer provides an application programming interface (API) and a programming framework for the applications in the application layer. The application framework layer includes some predefined functions.
[0110] like Figure 7 As shown, the application framework layer may include a window manager, a content provider, a resource manager, a notification manager, a camera service, a multimedia management module, and the like.
[0111] The window manager is used to manage window programs. The window manager can obtain the display screen size, determine whether there is a status bar, lock the screen, capture the screen, etc.
[0112] Content providers are used to store and retrieve data and make it accessible to applications. The data may include videos, images, audio, calls made and received, browsing history and bookmarks, phone books, etc.
[0113] The resource manager provides various resources for applications, such as localized strings, icons, images, layout files, video files, and so on.
[0114] The notification manager allows applications to display notification information in the status bar. It can be used to convey notification-type messages and can disappear automatically after a short stay without user interaction. For example, notification information is used to inform the completion of downloads, message reminders, etc. Notification information can also appear in the system top status bar in the form of icons or scroll bar text, such as notifications of applications running in the background, or in the form of dialog windows on the screen. For example, text messages are displayed in the status bar, prompts sound, electronic devices vibrate, indicator lights flash, etc.
[0115] The camera service is used to call the camera (including the rear camera and / or the back camera) in response to a request from an application.
[0116] The multimedia management module is used to process the image based on the configuration of the camera service, and the specific processing process will be described in the following embodiments.
[0117] Android Runtime includes core libraries and virtual machines. Android Runtime is responsible for scheduling and management of the Android system.
[0118] The core library consists of two parts: one part is the function that needs to be called by the Java language, and the other part is the Android core library.
[0119] The application layer and the application framework layer run in a virtual machine. The virtual machine executes the Java files of the application layer and the application framework layer as binary files. The virtual machine is used to perform functions such as object life cycle management, stack management, thread management, security and exception management, and garbage collection.
[0120] The system library may include multiple functional modules, such as surface manager, media library, 3D graphics processing library (such as OpenGL ES), 2D graphics engine (such as SGL), etc.
[0121] The surface manager is used to manage the display subsystem and provide the fusion of 2D and 3D layers for multiple applications.
[0122] The media library supports playback and recording of a variety of commonly used audio and video formats, as well as static image files, etc. The media library can support a variety of audio and video encoding formats, such as: MPEG4, H.264, MP3, AAC, AMR, JPG, PNG, etc.
[0123] The 3D graphics processing library is used to implement 3D graphics drawing, image rendering, synthesis and layer processing.
[0124] A 2D graphics engine is a drawing engine for 2D drawings.
[0125] The HAL layer is an interface layer between the operating system kernel and the hardware circuit. The HAL layer includes but is not limited to: the audio hardware abstraction layer (Audio HAL) and the camera hardware abstraction layer (Camera HAL). Among them, the Audio HAL is used to process the audio stream, for example, to perform noise reduction, directional enhancement, etc. on the audio stream, and the camera HAL is used to process the image stream.
[0126] The kernel layer is the layer between the hardware and the above software layer. The kernel layer includes at least display driver, camera driver, audio driver, and sensor driver. The hardware may include devices such as camera, display, microphone, processor, and memory.
[0127] In the embodiments of the present application, the display screen in the hardware can display the shooting preview interface, the video preview interface and the shooting interface during the video recording. The camera in the hardware can be used to collect images. The microphone in the hardware can be used to collect sound signals and generate analog audio electrical signals.
[0128] Understandably, Figure 7The layers in the software structure shown and the components included in each layer do not constitute a specific limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may include more or fewer layers than shown, and each layer may include more or fewer components, which is not limited in the present application.
[0129] It is understandable that in order to implement the focus processing method in the embodiment of the present application, the electronic device includes hardware and / or software modules corresponding to the execution of each function. In combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of the present application.
[0130] The embodiment of the present application provides a focus processing method, which determines motion detection information for a focus frame based on a previous image frame adjacent to a current image frame, wherein the focus frame in the previous image frame is for the same target object. Based on the motion detection information, the focus frame in the previous image frame adjacent to the current image frame is corrected to obtain a corrected focus frame. Based on the corrected focus frame, the target object in the current image frame is focused.
[0131] This solution uses motion detection information for the focus frame to provide parameter support for the focusing process, which can adapt to the motion of the moving subject and quickly adjust to the appropriate focus parameters, thereby improving the accuracy of the focus parameters and the focusing processing speed. In particular, when the moving subject moves at high speed, it can achieve more accurate and fast focus, which is conducive to reducing the blur of the picture and improving the quality of video shooting. In addition, this solution can be based on conventional camera hardware conditions for motion image shooting, and there is no need to set up an auxiliary focus module, so the focusing cost is low.
[0132] Combine the following Figure 8 to Figure 15b , the specific implementation method of the embodiment of the present application is described in detail.
[0133] like Figure 8 The figure shows the imaging process of the image sequence. Figure 8As shown, the camera driver outputs a corresponding current according to the first current motor position to drive the focus motor to generate a corresponding displacement. After generating the corresponding displacement, the focus motor drives the lens focus assembly in the camera to focus. The camera images the moving subject image captured by the focus on the chip, and outputs the moving subject image to the camera HAL to obtain a first input image 201. The first input image 201 includes a first focus frame 202 for the moving subject, and the first focus frame 202 is determined based on the object detection result for the moving subject. The object detection result includes, for example, a face detection result, a limb detection result, a torso detection result, etc. for the moving subject.
[0134] The camera HAL generates a first RAW image (original image) 203 of the current state based on the first input image 201, and calculates a first depth of field value of the first RAW image 203, where the first depth of field value can indicate the distance of a clear image presented in the front and rear range of the focus position. The camera HAL calculates a first motor push difference value based on the first depth of field value, and determines a first updated motor position based on the first motor push difference value and the first current motor position.
[0135] The camera driver uses the first updated motor position as the second current motor position, and outputs a corresponding current according to the second current motor position to drive the focus motor to generate a corresponding displacement. After generating the corresponding displacement, the focus motor drives the lens focus assembly in the camera to focus. The camera images the moving subject image captured by the focus on the chip to obtain a second input image 204. The second input image 204 includes a second focus frame 205 for the moving subject, and the second focus frame 205 is determined according to the object detection result for the moving subject.
[0136] The camera HAL generates a second RAW image 206 of the current state based on the second input image 204, and calculates a second depth value of the first RAW image 206. The camera HAL calculates a second motor push difference value according to the second depth value, and determines a second updated motor position according to the second motor push difference value and the second current motor position. The second updated motor position can be used as a third current motor position for capturing a next image frame.
[0137] There may be a delay in the object detection process for a moving subject, as well as a delay in the process of transmitting the object detection results through different modules and determining the focus frame based on the object detection results. Therefore, the focus frame determined based on the object detection results may lag behind or have a hollowing ratio problem relative to the moving subject.
[0138] For example, when the moving subject moves in the horizontal direction, based on the preset viewing angle along the horizontal direction, the position of the moving subject changes over time, and its visual size does not change. In this scenario, the greater the moving speed of the moving subject, the greater the lag of the focus frame relative to the moving subject. When the moving subject moves in the front-to-back direction, based on the preset viewing angle along the front-to-back direction, the visual size of the moving subject changes over time. In this scenario, the greater the moving speed of the moving subject, the greater the hollowing ratio of the focus frame size relative to the visual size of the moving subject.
[0139] After determining the initial focus frame for the moving subject based on the object detection result, if the initial focus frame can be corrected according to the motion state information of the moving subject, the focusing accuracy and focusing processing efficiency can be effectively improved. The motion state information of the moving subject is indicated by, for example, the focus frame motion information between the imaged preceding image frames. Therefore, the initial focus frame for the moving subject can be corrected according to the focus frame motion information between the preceding image frames to obtain a corrected focus frame. Automatically focusing and imaging based on the corrected focus frame is conducive to improving the focusing accuracy for the moving subject and can effectively improve the clarity of motion image capture.
[0140] The process of an application (such as a camera application) calling a camera can be divided into two parts. The first part is the creation process, which can also be understood as a preparation process. The creation process is mainly the process in which each module creates a corresponding instance and interacts with the control information. The second part is the recording process, that is, the process in which each module or the instance in each module processes the image collected by the camera. It should be noted that the "instance" described in the embodiments of the present application can also be understood as a program code or process code running in a process.
[0141] Combine the following Figure 9a The interactive flow diagram of each module shown in the figure describes in detail the creation process of the camera application in the process of calling the camera. Figure 9a , specifically including:
[0142] S101: The camera application calls the camera service, and the camera service performs corresponding processing.
[0143] Exemplarily, after the camera application is started, it calls the camera service. For example, the camera application sends a request message to the camera service. The request message may include but is not limited to: the application ID of the camera application (for example, it can be the application package name), PID (Process Identification), configuration information of the camera application (also called requirement information), etc.
[0144] Optionally, the request message may not include the application ID, and the camera service may obtain the application ID and PID corresponding to the received request message through an interface with the application layer.
[0145] S102: The camera service calls the camera hardware abstraction layer (camera HAL).
[0146] S103: The camera HAL calls the camera driver in the kernel layer.
[0147] Exemplarily, the object detection module in the camera HAL collects object detection results for the moving subject, and determines the focus frame information for the moving subject based on the object detection results. The object detection results include, for example, facial detection results, limb detection results, and trunk detection results for the moving subject. The object detection module outputs the focus frame information to the AF (Auto Focus) algorithm module. The AF algorithm module calculates the best focus position for the moving subject based on the focus frame information, and outputs the best focus position to the focus module. The focus module calculates the focus motor position based on the best focus position, and outputs the focus motor position to the camera driver in the kernel layer to call the camera driver. For example, the focus module can calculate the motor push difference based on the focus frame information and the current motor position, and calculate the focus motor position for autofocus based on the motor push difference and the current motor position.
[0148] S104: The camera driver calls the camera.
[0149] For example, the camera driver outputs a corresponding current according to the position of the focus motor to drive the focus motor to generate a corresponding displacement, and the focus motor after generating the corresponding displacement can drive the lens focus assembly in the camera to focus. The camera responds to the call of the camera driver to capture the image of the moving subject and images the captured image of the moving subject on the chip.
[0150] There may be a delay in the object detection process of the object detection module for the moving subject, and there may also be a delay in the process of transmitting the object detection results through different modules and determining the focus frame based on the object detection results. Therefore, the focus frame determined based on the object detection results may lag behind or have a hollowing ratio problem relative to the moving subject.
[0151] Combine the following Figure 9b The interactive flow diagram of each module shown in FIG. 1 is a detailed description of the recording process of the camera application in the process of calling the camera. Figure 9b , specifically including:
[0152] S201: The camera outputs the collected image to the camera driver.
[0153] S202: The camera driver outputs the image to the camera HAL.
[0154] Exemplarily, the camera driver obtains the image captured by the camera and outputs the image to the camera HAL. Figure 8 As shown, during the imaging process of the image sequence, before focusing on the moving subject to obtain the next image frame, the focus motor position for shooting the next image frame can be determined by the camera HAL, and the focus motor position is determined based on the focus frame for the moving subject in the current image frame. The camera HAL can generate a RAW image of the current state based on the input current image frame, and calculate the depth of field value of the RAW image of the current state. The camera HAL calculates the motor push difference based on the depth of field value, and calculates the next motor position for shooting the next image frame based on the motor push difference and the current motor position.
[0155] S203: The camera HAL outputs the image to the camera service.
[0156] The camera HAL outputs the images captured by the camera to the camera service.
[0157] S204: The camera service outputs the image to the camera application.
[0158] It should be noted that in the embodiments of the present application, when each module or instance interacts with each other, ACK information can be fed back to inform the other end that the information or data has been successfully received. For example, after the camera application sends a call request to the camera service, the camera service feeds back ACK information to the camera application after receiving the request to indicate that the camera service has successfully received the request. The schematic diagram of the interaction of each module in the embodiments of the present application only shows the flow of data or information (mainly request or control information), and does not show the flow of ACK information, which will not be repeated below.
[0159] Combine the following Fig.10 The interactive flow diagram of each module shown in FIG. 1 is a detailed description of the process of the camera application calling the camera to capture an image. The camera HAL performs focus frame correction during the image capture process. Fig.10 , specifically including:
[0160] S301: The camera application calls the camera service, and the camera service performs corresponding processing.
[0161] S302: The camera service calls the camera hardware abstraction layer (camera HAL).
[0162] S303: The camera HAL calls the camera driver in the kernel layer.
[0163] Exemplarily, during the shooting process of the current image frame, before using the AF algorithm module in the camera HAL to calculate the optimal focus position for the moving subject, the focus frame correction module can be used to correct the initial focus frame for the moving subject. The initial focus frame can be the focus frame for the same moving subject in the previous image frame.
[0164] like Fig.10 As shown, the first image frame 301 and the second image frame 303 are the preceding image frames based on the current image frame in the image sequence, and the second image frame 303 is the previous image frame adjacent to the current image frame in the image sequence. The motion detection information for the focus frame between the first image frame 301 and the second image frame 303 is determined, specifically, the focus frame motion information between the first focus frame 302 in the first image frame 301 and the second focus frame 304 in the second image frame 303 is determined. The second focus frame 304 is corrected according to the focus frame motion information to obtain a third focus frame 305.
[0165] The AF algorithm module is used to calculate the best focus position for the moving subject based on the third focus frame 305, and the best focus position is output to the focus module. The focus module calculates the focus motor position according to the best focus position, and outputs the focus motor position to the camera driver in the kernel layer to call the camera driver.
[0166] S304: The camera driver calls the camera.
[0167] It should be noted that the principles and implementation processes of operations S301 , S302 , and S304 are similar to the principles and implementation processes of operations S101 , S102 , and S104 , respectively, and are not described in detail in this embodiment.
[0168] like Fig.11 FIG. 1 is a schematic diagram of the focusing process. During the focusing process, the camera HAL is used to correct the focus frame for the moving subject (i.e., the target object to be focused). Fig.11 As shown, the focusing process may include operations S401 to S403, specifically:
[0169] S401: The camera HAL determines first translation motion information between a first focus frame in a first image frame and a second focus frame in a second image frame.
[0170] Exemplarily, the camera HAL determines motion detection information for a focus frame between a first image frame and a second image frame, the motion detection information indicating change information between a first focus frame in the first image frame and a second focus frame in the second image frame, and the first focus frame and the second focus frame indicate the same target object. For example, the camera HAL determines first translation motion information between the first focus frame and the second focus frame, and the first translation motion information may indicate position change information between corresponding focus frames.
[0171] like Fig.11 As shown, the first image frame 401 is a preceding image frame based on the second image frame 403 in the image sequence. The first image frame 401 may be an adjacent image frame located before the second image frame 403 in the image sequence, that is, the frame sequence difference between the first image frame 401 and the second image frame 403 is 1 frame. The first image frame 401 may also be a non-adjacent frame image located before the second image frame 403 in the image sequence. Exemplarily, the frame sequence difference between the first image frame 401 and the second image frame 403 may be determined based on the focus processing time. For example, assuming that the focus processing time is 100ms, the frame rate of the video is 30fps, and a single focus processing requires a duration of 30fps*0.1s=3 frames, therefore, the frame sequence difference between the first image frame 401 and the second image frame 403 may be 3 frames or more.
[0172] The target object is a person or object that needs to be presented clearly in the video, and the purpose of focusing is to make the focus fall on the target object. In an exemplary manner, the moving object in the second image frame 403 can be used as the target object, and the moving object can be detected by comparing the second image frame 403 with the previous frame (the frame before the first image frame in the image sequence) and detecting the optical flow from the previous frame to the second image frame 403 as the target object to be focused, or the foreground object in the second image frame 403 can be used as the target object to be focused, or the object specified by the user can be used as the target object to be focused.
[0173] The camera HAL determines first translational motion information between a first focus frame 402 in a first image frame 401 and a second focus frame 404 in a second image frame 403. As an example, the camera HAL determines the first translational motion information based on an image frame span from the first focus frame 402 to the second focus frame 404, where the image frame span indicates a frame sequence difference or a time difference between the first image frame 401 and the second image frame 403. The first translational motion information may include a focus frame motion direction and a focus frame motion rate.
[0174] Specifically, the first focus frame 402 includes a focus frame center O1, and the second focus frame 404 includes a focus frame center O2. The focus frame center movement rate and the focus frame center movement direction can be determined based on the image frame span between the first image frame 401 and the second image frame 403, and based on the position information of the focus frame centers O1 and O2. The focus frame center movement rate and the focus frame center movement direction can constitute the first translational motion information between the first focus frame 402 and the second focus frame 404.
[0175] S402: The camera HAL corrects the second focus frame according to the first translation motion information to obtain a third focus frame.
[0176] Exemplarily, when the visual size of the target object does not change over time, only the focus frame position in the second image frame may be corrected without correcting the focus frame size. For example, the camera HAL may move the second focus frame 404 along the focus frame movement direction based on the focus frame movement rate in the first translational motion information to correct the focus frame position of the second focus frame 404 to obtain the third focus frame 405.
[0177] As an implementable manner, the camera HAL may determine the predicted motion type of the target object according to the focus frame motion rate between the first image frame 401 and the second image frame 403. Based on the predicted motion type of the target object, the second focus frame 404 is moved along the focus frame motion direction to obtain the third focus frame 405.
[0178] For example, when the focus frame motion rate is greater than or equal to the first preset threshold, the predicted motion type of the target object is determined to be high-speed motion, and the second focus frame 404 is moved along the focus frame motion direction by the pixel amount of the first preset value, and the first preset value may be, for example, 100 pixels. When the focus frame motion rate is less than or equal to the second preset threshold, the predicted motion type of the target object is determined to be low-speed motion, and the second focus frame 404 is moved along the focus frame motion direction by the pixel amount of the second preset value, and the second preset value may be, for example, 10 pixels. When the focus frame motion rate is greater than the second preset threshold and less than the first preset threshold, the predicted motion type of the target object is determined to be medium-speed motion, and the second focus frame 404 is moved along the focus frame motion direction by the pixel amount of the third preset value, and the third preset value may be, for example, 50 pixels. The first preset value, the second preset value, and the third preset value may be set according to actual conditions or experience, and this embodiment does not limit this.
[0179] As another achievable method, based on a preset mapping relationship, according to the first segmented interval to which the focus frame motion rate belongs, a first focus frame movement ratio matching the first segmented interval can be determined. According to the first focus frame movement ratio, the second focus frame 404 is moved along the focus frame motion direction to obtain a third focus frame 405.
[0180] S403: The camera HAL focuses on the target object in the third image frame based on the third focus frame.
[0181] Exemplarily, the second image frame 403 is a previous image frame adjacent to the third image frame 406 in the image sequence, and the third image frame 406 is a current image frame to be imaged. The camera HAL can determine the focus motor position for focusing on the target object based on the third focus frame 405, so as to focus on the target object in the third image frame 406.
[0182] like Fig.12 The following is a schematic diagram of the focusing process. Fig.12 As shown, the focusing process may include operations S501 to S503, specifically:
[0183] S501: The camera HAL determines zoom motion information between a first focus frame in a first image frame and a second focus frame in a second image frame.
[0184] Exemplarily, the camera HAL determines motion detection information for a focus frame between a first image frame and a second image frame, the motion detection information indicating change information between a first focus frame in the first image frame and a second focus frame in the second image frame, and the first focus frame and the second focus frame indicate the same target object. For example, the camera HAL determines zoom motion information between the first focus frame and the second focus frame, and the first translation motion information may indicate size change information between corresponding focus frames.
[0185] In the case where the visual size of the target object changes, the focus frame size for the target object may be different. The closer the distance between the target object and the camera, the larger the visual size of the target object based on the camera's perspective, and the larger the focus frame size for the target object during the focus process. The smaller the distance between the target object and the camera, the smaller the visual size of the target object based on the camera's perspective, and the smaller the focus frame size for the target object during the focus process.
[0186] like Fig.12As shown, the camera HAL may determine zoom motion information based on the image frame span from the first focus frame 502 to the second focus frame 504, where the image frame span includes a frame sequence difference or a time difference between the first image frame 501 and the second image frame 503. The zoom motion information may include a focus frame zoom type and a focus frame zoom rate, where the focus frame zoom type may include a focus frame zoom-in type and a focus frame zoom-out type, and the focus frame zoom rate may be represented by a focus frame zoom ratio, for example.
[0187] S502: The camera HAL corrects the second focus frame according to the zoom motion information to obtain a third focus frame.
[0188] Exemplarily, the camera HAL may scale 504 the second focus frame according to the focus frame scaling type and the focus frame scaling rate to correct the focus frame size of the second focus frame 504 to obtain a third focus frame 505 .
[0189] As an implementable manner, the camera HAL may determine the predicted motion type of the target object according to the focus frame zoom rate between the first image frame 501 and the second image frame 503. Based on the predicted motion type of the target object, the second focus frame 504 is zoomed according to the focus frame zoom type and the focus frame zoom rate to obtain a third focus frame 505.
[0190] For example, when the zoom rate of the focus frame is greater than or equal to the third preset threshold, the predicted motion type of the target object is determined to be high-speed motion, and the size of the second focus frame 504 is reduced or enlarged by a first preset multiple. When the zoom rate of the focus frame is less than or equal to a fourth preset threshold, the predicted motion type of the target object is determined to be low-speed motion, and the size of the second focus frame 504 is reduced or enlarged by a second preset multiple. When the zoom rate of the focus frame is greater than the fourth preset threshold and less than the third preset threshold, the predicted motion type of the target object is determined to be medium-speed motion, and the size of the second focus frame 504 is reduced or enlarged by a third preset multiple.
[0191] When the focus frame zoom type is the focus frame enlargement type, the size of the second focus frame 504 is enlarged, and when the focus frame zoom type is the focus frame reduction type, the size of the second focus frame 504 is reduced. The first preset multiple, the second preset multiple, and the third preset multiple can be set according to actual conditions or experience, and this embodiment does not limit this.
[0192] As another possible implementation, the camera HAL can determine the focus frame zoom ratio that matches the second segmented interval according to the second segmented interval to which the focus frame zoom rate belongs based on a preset mapping relationship. According to the focus frame zoom type and the focus frame zoom ratio, the second focus frame 504 is zoomed to obtain a third focus frame 505.
[0193] As another implementable manner, when the first focus frame 502 and the second focus frame 504 include corresponding focus frame feature points, the camera HAL may move the focus frame feature points in the second focus frame 504 according to the focus frame zoom type and the focus frame zoom rate to correct the focus frame size of the second focus frame 504 to obtain the third focus frame 505. The focus frame feature points may be any points in the focus frame, for example, the corner points, vertices, and boundary points of the focus frame may be selected as feature points.
[0194] like Fig.12 As shown, the first focus frame 502 includes focus frame feature points M1, M2, M3, and M4, and the second focus frame 504 includes focus frame feature points N1, N2, N3, and N4. The focus frame feature points M1, M2, M3, and M4 correspond to the focus frame feature points N1, N2, N3, and N4, respectively. The camera HAL can move the focus frame feature points N1, N2, N3, and N4 in the second focus frame 504 according to the focus frame zoom type and the focus frame zoom rate to correct the focus frame size of the second focus frame 504. The moved focus frame feature points N1 , 、N2 , 、N3 , 、N4 , A third focusing frame 505 is formed.
[0195] In addition, after correcting the focus frame size of the second focus frame 504, the camera HAL can also perform contour detection on the target object in the second image frame 503 to obtain a contour detection result. And, according to the contour detection result, the edge of the second focus frame 504 after the size correction is adjusted so that the edge of the adjusted second focus frame 504 fits the contour of the target object, and the second focus frame 504 after the edge adjustment constitutes a third focus frame 505.
[0196] S503: The camera HAL focuses on the target object in the third image frame based on the third focus frame.
[0197] Exemplarily, the second image frame 503 is a previous image frame in the image sequence that is adjacent to the third image frame 506, and the third image frame 506 is a current image frame to be imaged. The camera HAL can determine the focus motor position for focusing on the target object based on the third focus frame 505, so as to focus on the target object in the third image frame 506.
[0198] like Fig.13 The following is a schematic diagram of the focusing process. Fig.12 As shown, the focusing process may include operations S601 to S604, specifically:
[0199] S601: The camera HAL determines zoom motion information between a first focus frame in a first image frame and a second focus frame in a second image frame.
[0200] For example, when both the position and visual size of the target object change over time, the focus frame for the target object during the focusing process may lag behind the position of the target object and may have a hollowing-out ratio relative to the visual size of the target object. Therefore, when performing a correction operation on the focus frame, both the position and size of the focus frame may need to be corrected.
[0201] like Fig.13 As shown, the camera HAL may determine zoom motion information based on the image frame span from the first focus frame 602 to the second focus frame 604, where the image frame span includes a frame sequence difference or a time difference between the first image frame 601 and the second image frame 603. The zoom motion information may include a focus frame zoom type and a focus frame zoom rate, where the focus frame zoom type may include a focus frame zoom-in type and a focus frame zoom-out type, and the focus frame zoom rate may be represented by a focus frame zoom ratio, for example.
[0202] S602: The camera HAL corrects the second focus frame according to the zoom motion information to obtain a middle focus frame.
[0203] Exemplarily, the camera HAL may scale the second focus frame 604 according to the focus frame scaling type and the focus frame scaling rate to correct the focus frame size of the second focus frame 604 to obtain the middle focus frame 605 .
[0204] As an implementable manner, the camera HAL can determine the focus frame zoom ratio that matches the second segmented interval according to the second segmented interval to which the focus frame zoom rate belongs based on a preset mapping relationship. According to the focus frame zoom type and the focus frame zoom ratio, the second focus frame 604 is zoomed to obtain the middle focus frame 605.
[0205] S603: The camera HAL determines second translation motion information from the first focus frame to the middle focus frame based on the image frame span, where the second translation motion information includes a focus frame motion direction and a focus frame motion rate.
[0206] Exemplarily, the first focus frame 602 includes the focus frame center O3, and the middle focus frame 605 includes the focus frame center O4. The camera HAL can determine the focus frame center movement rate and the focus frame center movement direction according to the image frame span between the first image frame 401 and the second image frame 403, and according to the position information of the focus frame centers O3 and O4. The focus frame center movement rate constitutes the focus frame movement rate in the second translation motion information, and the focus frame center movement direction constitutes the focus frame movement direction in the second translation motion information.
[0207] S604: Based on the focus frame movement rate in the second translational motion information, move the middle focus frame along the focus frame movement direction to obtain a third focus frame.
[0208] Exemplarily, the camera HAL can determine the second focus frame movement ratio that matches the third segmented interval to which the focus frame motion rate in the second translation motion information belongs, and move the middle focus frame 605 along the focus frame movement direction according to the second focus frame movement ratio to obtain the third focus frame 606.
[0209] S605: The camera HAL focuses on the target object in the third image frame based on the third focus frame.
[0210] Exemplarily, the second image frame 603 is a previous image frame adjacent to the third image frame 607 in the image sequence, and the third image frame 607 is a current image frame to be imaged. The camera HAL can focus on the target object in the third image frame 607 based on the third focus frame 606.
[0211] As an optional embodiment, before the second focus frame is corrected using the camera HAL according to the motion detection information, the position change degree and size change degree between the first focus frame and the second focus frame indicated by the motion detection information may be determined. When the position change degree or size change degree meets the preset degree threshold, a correction operation is performed on the second focus frame. When both the position change degree and the size change degree do not meet the preset degree threshold, it is determined that the motion rate of the target object to be focused is small, and no correction operation is required for the second focus frame.
[0212] like Fig.14 The following is a schematic diagram of the focusing process. Fig.14 As shown, the focusing process may include operations S701 to S703, specifically:
[0213] S701. The camera HAL determines, according to N preceding image frames adjacent to a fourth image frame, motion detection information for a focus frame based on the N preceding image frames.
[0214] Exemplarily, the fourth image frame 701 is a current image frame to be imaged, and the N preceding image frames adjacent to the fourth image frame 701 include, for example, the fifth image frame 702, other image frames 703, ... other image frames 70(N+1), where N is an integer greater than 2. The fifth image frame 702 is a previous image frame adjacent to the fourth image frame 701 among the N preceding image frames, and the focus frames in the N preceding image frames are for the same target object.
[0215] Determine motion detection information for a focus frame based on N preceding image frames. Specifically, for at least one target image frame pair in the N preceding image frames, determine focus frame motion information based on each target image frame pair. According to the focus frame motion information matched with each target image frame pair, determine motion statistics information for a focus frame based on the N preceding image frames as motion detection information. The target image frame pair includes any image frame pair in the N preceding image frames.
[0216] In an exemplary manner, the camera HAL may determine a weight parameter for each target image frame pair according to an image frame span between each target image frame pair and the fourth image frame 701. According to the weight parameter for each target image frame pair, the focus frame motion information matching each target image frame pair is weightedly integrated to obtain motion statistics information based on the weighted integration result as motion detection information. The image frame span indicates a frame sequence difference or a time difference between the corresponding target image frame pair and the fourth image frame.
[0217] In another example, the camera HAL may perform mean integration on the focus frame motion information matching each target image frame pair, and obtain motion statistics information based on the mean integration result as motion detection information.
[0218] like Fig.15a The following is a schematic diagram of a target image frame pair. Fig.15a As shown, the N preceding image frames adjacent to the fourth image frame 701 include preceding image frames 801 , 802 , and 803 , where N=3.
[0219] The preceding image frames 801 and 802 constitute one target image frame pair, and the preceding image frames 802 and 803 constitute another target image frame pair. Focus frame motion information 1 between the preceding image frames 801 and 802 is determined, and focus frame motion information 2 between the preceding image frames 802 and 803 is determined.
[0220] The camera HAL can determine the weight parameter for each target image frame pair according to the image frame span between each target image frame pair and the fourth image frame 701. According to the weight parameter for each target image frame pair, the focus frame motion information 1 and the focus frame motion information 2 are weighted and integrated to obtain motion statistics information based on the weighted integration result as motion detection information. Alternatively, the focus frame motion information 1 and the focus frame motion information 2 can also be averaged and integrated to obtain motion statistics information based on the averaged integration result as motion detection information.
[0221] like Fig.15b The following is a schematic diagram of a target image frame pair. Fig.15bAs shown, the N preceding image frames adjacent to the fourth image frame 701 include preceding image frames 804 , 805 , 806 , and 807 , where N=4.
[0222] The preceding image frames 804 and 805 constitute one of the target image frame pairs, and the preceding image frames 806 and 807 constitute another target image frame pair. Focus frame motion information 3 between the preceding image frames 804 and 805 is determined, and focus frame motion information 4 between the preceding image frames 806 and 807 is determined. Alternatively, the preceding image frames 804 and 806 constitute one of the target image frame pairs, and the preceding image frames 805 and 807 constitute another target image frame pair. Focus frame motion information 5 between the preceding image frames 804 and 806 is determined, and focus frame motion information 6 between the preceding image frames 805 and 807 is determined.
[0223] The weight parameter for each target image frame pair can be determined according to the image frame span between each target image frame pair and the fourth image frame 701. According to the weight parameter for each target image frame pair, the focus frame motion information 3 and the focus frame motion information 4 (or the focus frame motion information 5 and the focus frame motion information 6) are weighted and integrated to obtain motion statistics information based on the weighted integration result as motion detection information. Alternatively, the focus frame motion information 3 and the focus frame motion information 4 (or the focus frame motion information 5 and the focus frame motion information 6) can also be averaged and integrated to obtain motion statistics information based on the averaged integration result as motion detection information.
[0224] It should be noted that the target image frame pair includes any image frame pair among the N preceding image frames, and the target image frame pair can be composed of any two preceding image frames among the N preceding image frames, which is not limited in this embodiment.
[0225] The focus frame motion information may include third translation motion information of the focus frame in the target image frame pair, and the third translation motion information includes a translation motion rate and a translation motion direction. In the process of determining the motion detection information, a translation statistical rate and a translation statistical direction for the focus frame based on N preceding image frames may be determined according to the translation motion rate and the translation motion direction of the focus frame in each target image frame pair as the motion detection information.
[0226] In addition, the focus frame motion information may also include zoom motion information of the focus frame in the target image frame pair, and the zoom motion information includes a zoom motion rate and a zoom motion type. In the process of determining the motion detection information, the zoom statistic rate and zoom statistic type for the focus frame based on the N preceding image frames may be determined according to the zoom motion rate and zoom motion type of the focus frame in each target image frame pair as the motion detection information.
[0227] S702: The camera HAL corrects the fourth focus frame in the fifth image frame according to the motion detection information to obtain a fifth focus frame.
[0228] Exemplarily, when the focus frame motion information includes the third translation motion information of the focus frame, the camera HAL can move the fourth focus frame 70a along the translation statistical direction based on the translation statistical rate to correct the focus frame position of the fourth focus frame 70a to obtain the fifth focus frame 70b.
[0229] Specifically, the camera HAL can determine the third focus frame movement ratio matching the fourth segmented interval according to the fourth segmented interval to which the translation statistical rate belongs, and move the fourth focus frame 70a along the translation statistical direction according to the third focus frame movement ratio to obtain the fifth focus frame 70b.
[0230] As another example, when the focus frame motion information includes zoom motion information of the focus frame, the camera HAL can scale the fourth focus frame 70a according to the zoom statistic type and the zoom statistic rate to correct the focus frame size of the fourth focus frame 70a to obtain the fifth focus frame 70b.
[0231] Specifically, the camera HAL can determine the zoom statistic ratio that matches the fifth segmented interval according to the fifth segmented interval to which the zoom statistic rate belongs. According to the zoom statistic type and the zoom statistic ratio, the fourth focus frame is zoomed 70a to correct the focus frame size of the fourth focus frame 70a to obtain the fifth focus frame 70b.
[0232] Optionally, after the focus frame size of the fourth focus frame 70a is corrected, the contour detection of the target object in the fifth image frame 702 may be performed to obtain a contour detection result. According to the contour detection result, the edge of the fourth focus frame 70a after the size correction is adjusted so that the edge of the adjusted fourth focus frame 70a fits the contour of the target object. The fourth focus frame 70a after the edge adjustment constitutes the fifth focus frame 70b.
[0233] S703: The camera HAL focuses on the target object in the fourth image frame based on the fifth focus frame.
[0234] Exemplarily, the camera HAL may focus on the target object in the fourth image frame 701 based on the fifth focus frame 70b.
[0235] It is understandable that, in order to realize the above functions, the electronic device includes hardware and / or software modules corresponding to the execution of each function. In combination with the algorithm steps of each example described in the embodiments disclosed herein, the present application can be implemented in the form of hardware or a combination of hardware and computer software. Whether a function is executed in the form of hardware or computer software driving hardware depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application in combination with the embodiments, but such implementation should not be considered to be beyond the scope of the present application.
[0236] This embodiment further provides a computer storage medium, in which computer instructions are stored. When the computer instructions are executed on an electronic device, the electronic device executes the above-mentioned related method steps to implement the focus processing method in the above-mentioned embodiment.
[0237] This embodiment further provides a computer program product. When the computer program product is run on a computer, the computer is enabled to execute the above-mentioned related steps to implement the focus processing method in the above-mentioned embodiment.
[0238] In addition, an embodiment of the present application also provides a device, which may specifically be a chip, a component or a module, and the device may include a connected processor and a memory; wherein the memory is used to store computer-executable instructions, and when the device is running, the processor may execute the computer-executable instructions stored in the memory so that the chip executes the focus processing method in the above-mentioned method embodiments.
[0239] Among them, the electronic device, computer storage medium, computer program product or chip provided in this embodiment is used to execute the corresponding method provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding method provided above and will not be repeated here.
[0240] Through the description of the above implementation methods, technical personnel in the relevant field can understand that for the convenience and simplicity of description, only the division of the above-mentioned functional modules is used as an example. In actual applications, the above-mentioned functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above.
[0241] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another device, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0242] The units described as separate components may or may not be physically separated, and the components shown as units may be one physical unit or multiple physical units, that is, they may be located in one place or distributed in multiple different places. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0243] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0244] Any content of each embodiment of the present application, as well as any content of the same embodiment, can be freely combined. Any combination of the above content is within the scope of the present application.
[0245] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a readable storage medium. Based on this understanding, the technical solution of the embodiment of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium, including several instructions to enable a device (which can be a single-chip microcomputer, chip, etc.) or a processor (processor) to perform all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0246] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
[0247] The steps of the method or algorithm described in conjunction with the disclosure of the embodiments of the present application can be implemented in a hardware manner, or can be implemented by a processor executing a software instruction. The software instruction can be composed of corresponding software modules, and the software module can be stored in a random access memory (Random Access Memory, RAM), a flash memory, a read-only memory (Read Only Memory, ROM), an erasable programmable read-only memory (Erasable Programmable ROM, EPROM), an electrically erasable programmable read-only memory (Electrically EPROM, EEPROM), a register, a hard disk, a mobile hard disk, a read-only compact disk (CD-ROM) or any other form of storage medium known in the art. An exemplary storage medium is coupled to a processor so that the processor can read information from the storage medium and can write information to the storage medium. Of course, the storage medium can also be a component of the processor. The processor and the storage medium can be located in an ASIC.
[0248] Those skilled in the art should be aware that in one or more of the above examples, the functions described in the embodiments of the present application can be implemented with hardware, software, firmware, or any combination thereof. When implemented using software, these functions can be stored in a computer-readable medium or transmitted as one or more instructions or codes on a computer-readable medium. Computer-readable media include computer storage media and communication media, wherein the communication media include any media that facilitates the transmission of a computer program from one place to another. The storage medium can be any available medium that a general or special-purpose computer can access.
[0249] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A focusing processing method, applied to an electronic device, comprising: Determining motion detection information for a focus frame between a first image frame and a second image frame, the motion detection information indicating change information between a first focus frame in the first image frame and a second focus frame in the second image frame, the first focus frame and the second focus frame indicating the same target object; Correcting the second focus frame according to the motion detection information to obtain a third focus frame; focusing on the target object in the third image frame based on the third focusing frame, The first image frame is a preceding image frame based on the second image frame in the image sequence, and the second image frame is a previous image frame adjacent to the third image frame in the image sequence; Before correcting the second focus frame according to the motion detection information, the method further includes: determining a degree of position change and a degree of size change between the first focus frame and the second focus frame indicated by the motion detection information; When the position change degree or the size change degree satisfies a preset degree threshold, a correction operation is performed on the second focus frame.
2. The method according to claim 1, wherein: The determining of motion detection information for a focus frame between the first image frame and the second image frame includes: determining first translation motion information based on an image frame span from the first focus frame to the second focus frame as the motion detection information, The image frame span indicates a frame sequence difference or a time difference between the first image frame and the second image frame.
3. The method according to claim 2, wherein: The first translation motion information includes a focus frame motion direction and a focus frame motion speed; The step of correcting the second focus frame according to the motion detection information to obtain a third focus frame includes: Based on the focus frame movement rate in the first translation motion information, the second focus frame is moved along the focus frame movement direction to correct the focus frame position of the second focus frame to obtain the third focus frame.
4. The method according to claim 3, wherein: The step of moving the second focus frame along the focus frame movement direction based on the focus frame movement rate in the first translational motion information to correct the focus frame position of the second focus frame to obtain the third focus frame includes: Determining, according to a first segmented interval to which the focus frame motion rate in the first translation motion information belongs, a first focus frame movement ratio matching the first segmented interval; According to the movement ratio of the first focus frame, the second focus frame is moved along the movement direction of the focus frame to obtain the third focus frame.
5. The method according to claim 1, wherein: The determining of motion detection information for a focus frame between the first image frame and the second image frame includes: determining scaling motion information based on an image frame span from the first focus frame to the second focus frame as the motion detection information, The image frame span includes a frame sequence difference or a time difference between the first image frame and the second image frame.
6. The method according to claim 5, wherein: The zoom motion information includes a focus frame zoom type and a focus frame zoom rate; The step of correcting the second focus frame according to the motion detection information to obtain a third focus frame includes: The second focus frame is scaled according to the focus frame scaling type and the focus frame scaling rate to correct the focus frame size of the second focus frame to obtain the third focus frame.
7. The method according to claim 6, wherein: Scaling the second focus frame according to the focus frame scaling type and the focus frame scaling rate to correct the focus frame size of the second focus frame to obtain the third focus frame includes: Determining a focus frame zoom ratio matching the second segmented interval according to the second segmented interval to which the focus frame zoom rate belongs; The second focus frame is scaled according to the focus frame scaling type and the focus frame scaling ratio to obtain the third focus frame.
8. The method according to claim 5, wherein: The first focus frame and the second focus frame include corresponding focus frame feature points, and the zoom motion information includes a focus frame zoom type and a focus frame zoom rate; The step of correcting the second focus frame according to the motion detection information to obtain a third focus frame includes: According to the focus frame zoom type and the focus frame zoom rate, the focus frame feature point in the second focus frame is moved to correct the focus frame size of the second focus frame to obtain the third focus frame.
9. The method according to claim 8, wherein: The step of moving the focus frame feature point in the second focus frame according to the focus frame zoom type and the focus frame zoom rate to correct the focus frame size of the second focus frame to obtain the third focus frame includes: Determining a feature point movement direction of the focus frame feature point according to the focus frame zoom type, and determining a feature point movement ratio matching the second segmentation interval according to the second segmentation interval to which the focus frame zoom rate belongs; The focus frame feature points in the second focus frame are moved according to the feature point moving direction and the feature point moving ratio to obtain the third focus frame formed by the moved focus frame feature points.
10. The method according to claim 5, wherein: The zoom motion information includes a focus frame zoom type and a focus frame zoom rate; The step of correcting the second focus frame according to the motion detection information to obtain a third focus frame includes: Scaling the second focus frame according to the focus frame scaling type and the focus frame scaling rate to obtain an intermediate focus frame; Determine second translation motion information from the first focus frame to the middle focus frame based on the image frame span, the second translation motion information including a focus frame motion direction and a focus frame motion rate; Based on the focus frame movement rate in the second translation motion information, the middle focus frame is moved along the focus frame movement direction to obtain the third focus frame.
11. The method according to claim 10, wherein: Scaling the second focus frame according to the focus frame scaling type and the focus frame scaling rate to obtain an intermediate focus frame includes: Determining, according to a second segmented interval to which the focus frame zoom rate belongs, a focus frame zoom ratio that matches the second segmented interval, and scaling the second focus frame according to the focus frame zoom type and the focus frame zoom ratio to obtain the intermediate focus frame; The step of moving the intermediate focus frame along the focus frame movement direction based on the focus frame movement rate in the second translational motion information to obtain the third focus frame includes: According to the third segmented interval to which the focus frame motion rate in the second translation motion information belongs, determine the second focus frame movement ratio that matches the third segmented interval, and according to the second focus frame movement ratio, move the middle focus frame along the focus frame movement direction to obtain the third focus frame.
12. The method according to claim 6 or 8, wherein: After the focus frame size of the second focus frame is corrected, the method further includes: Performing contour detection on the target object in the second image frame to obtain a contour detection result; According to the contour detection result, edge adjustment is performed on the size-corrected second focus frame so that the edge of the adjusted second focus frame fits the contour of the target object, and the edge-adjusted second focus frame constitutes the third focus frame.
13. A focusing processing method, applied to an electronic device, comprising: Determining, according to N preceding image frames adjacent to the fourth image frame, motion detection information for a focus frame based on the N preceding image frames, wherein N is an integer greater than 2, and the focus frames in the N preceding image frames are for the same target object; According to the motion detection information, a fourth focus frame in a fifth image frame is corrected to obtain a fifth focus frame, wherein the fifth image frame is a previous image frame adjacent to the fourth image frame in the N preceding image frames; Focusing the target object in the fourth image frame based on the fifth focusing frame; Before correcting the fourth focus frame in the fifth image frame according to the motion detection information, the method further includes: Determining a degree of position change and a degree of size change between focus frames in the N preceding image frames indicated by the motion detection information; When the position change degree or the size change degree meets a preset degree threshold, a correction operation is performed on the fourth focus frame.
14. The method according to claim 13, wherein: The determining of the motion detection information for the focus frame based on the N preceding image frames includes: For at least one target image frame pair among the N preceding image frames, determining focus frame motion information based on each of the target image frame pairs; According to the focus frame motion information matched with each of the target image frame pairs, motion statistics information for the focus frame based on the N preceding image frames is determined as the motion detection information, The target image frame pair includes any image frame pair among the N preceding image frames.
15. The method according to claim 14, wherein: The determining, according to the focus frame motion information matched with each of the target image frame pairs, motion statistics information for the focus frame based on the N preceding image frames comprises: Determining a weight parameter for each of the target image frame pairs according to an image frame span between each of the target image frame pairs and the fourth image frame; According to the weight parameter for each of the target image frame pairs, weighted integration is performed on the focus frame motion information matching each of the target image frame pairs to obtain the motion statistical information based on the weighted integration result, The image frame span indicates a frame sequence difference or a time difference between the corresponding target image frame pair and the fourth image frame.
16. The method according to claim 14, wherein: The determining, according to the focus frame motion information matched with each of the target image frame pairs, motion statistics information for the focus frame based on the N preceding image frames comprises: The focus frame motion information matching each of the target image frame pairs is averaged and integrated to obtain the motion statistics information based on the averaged integration result.
17. The method according to claim 14, wherein: The focus frame motion information includes third translation motion information of the focus frame in the target image frame pair, and the third translation motion information includes a translation motion rate and a translation motion direction; The step of determining, according to the focus frame motion information matched with each of the target image frame pairs, motion statistics information for the focus frame based on the N preceding image frames as the motion detection information, includes: According to the translation motion rate and the translation motion direction of the focus frame in each of the target image frame pairs, a translation statistical rate and a translation statistical direction for the focus frame based on the N preceding image frames are determined as the motion detection information.
18. The method according to claim 17, wherein: The step of correcting the fourth focus frame in the fifth image frame according to the motion detection information to obtain a fifth focus frame includes: Based on the translation statistical rate, the fourth focus frame is moved along the translation statistical direction to correct the focus frame position of the fourth focus frame to obtain the fifth focus frame.
19. The method according to claim 18, wherein: The step of moving the fourth focus frame along the translation statistical direction based on the translation statistical rate to correct the focus frame position of the fourth focus frame to obtain the fifth focus frame includes: Determining, according to a fourth segmented interval to which the translation statistical rate belongs, a third focus frame movement ratio matching the fourth segmented interval; According to the movement ratio of the third focus frame, the fourth focus frame is moved along the translation statistical direction to obtain the fifth focus frame.
20. The method according to claim 14, wherein: The focus frame motion information includes zoom motion information of the focus frame in the target image frame pair, and the zoom motion information includes a zoom motion rate and a zoom motion type; The step of determining, according to the focus frame motion information matched with each of the target image frame pairs, motion statistics information for the focus frame based on the N preceding image frames as the motion detection information, includes: According to the zoom motion rate and the zoom motion type of the focus frame in each of the target image frame pairs, the zoom statistic rate and the zoom statistic type for the focus frame based on the N preceding image frames are determined as the motion detection information.
21. The method according to claim 20, wherein: The step of correcting the fourth focus frame in the fifth image frame according to the motion detection information to obtain a fifth focus frame includes: The fourth focus frame is scaled according to the scaling statistic type and the scaling statistic rate to correct the focus frame size of the fourth focus frame to obtain the fifth focus frame.
22. The method according to claim 21, wherein: Scaling the fourth focus frame according to the zoom statistic type and the zoom statistic rate to correct the focus frame size of the fourth focus frame to obtain the fifth focus frame includes: Determining, according to the fifth segmented interval to which the scaling statistical rate belongs, a scaling statistical ratio matching the fifth segmented interval; The fourth focus frame is scaled according to the scaling statistics type and the scaling statistics ratio to obtain the fifth focus frame.
23. The method according to claim 21 or 22, wherein: After the focus frame size of the fourth focus frame is corrected, the method further includes: Performing contour detection on the target object in the fifth image frame to obtain a contour detection result; According to the contour detection result, edge adjustment is performed on the size-corrected fourth focus frame so that the edge of the adjusted fourth focus frame fits the contour of the target object, and the edge-adjusted fourth focus frame constitutes the fifth focus frame.
24. An electronic device, characterized in that: include: one or more processors; Memory; And one or more computer programs, wherein the one or more computer programs are stored in the memory, and when the computer programs are executed by the one or more processors, the electronic device performs the focus processing method as described in any one of claims 1 to 12 or any one of claims 13 to 23.
25. A computer-readable storage medium comprising a computer program, characterized in that: When the computer program is executed on an electronic device, the electronic device is enabled to execute the focus processing method as claimed in any one of claims 1 to 12 or any one of claims 13 to 23.
