A target tracking method and related device

Through the target tracking method of electronic equipment, the original image collected by the camera and the target detection algorithm are used to achieve stable tracking and output of moving objects, solve the stability and jitter problems when shooting with the telephoto lens of mobile phones, and improve the stability of image flow. continuity and stability.

CN115278043BActive Publication Date: 2024-09-20HUAWEI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110486512.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-04-30
Publication Date
2024-09-20
Estimated Expiration
2041-04-30

AI Technical Summary

Technical Problem

When shooting moving objects with the telephoto lens of a mobile phone, it is difficult to align and maintain stability when shooting handheld, resulting in jittery images. Especially in preview scenes, electronic devices cannot output a stable cropping frame in real time to frame the moving subject.

Method used

Provide a target tracking method that collects original images through the camera of electronic devices, determines the target subject to be tracked, and displays the tracking picture in the display area. It uses target detection algorithms and smooth path processing to ensure that the target subject is displayed stably in the output picture. , taking into account both followability and smoothness.

Benefits of technology

It achieves stable tracking and output when shooting moving objects with a mobile phone, improves the continuity and stability of the image stream, and can track targets without moving the device or when the device is in motion, solving the problem of difficulty in tracking handheld shooting. Accuracy and screen jitter issues.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115278043B
    Figure CN115278043B
Patent Text Reader

Abstract

A target tracking method is disclosed, characterized in that the method includes: an electronic device turns on a target tracking mode; the electronic device determines a target subject to be tracked based on an original image captured by a camera of the electronic device; the electronic device displays a first tracking screen in a display area, the first tracking screen includes the target subject, and the target subject is located at a first position in the camera's framing area; when the target subject moves, the electronic device displays a second tracking screen in the display area, and the second tracking screen shows that the target subject is located at a second position in the camera's framing area. Here, the original image captured by the camera refers to all image data that can be captured by the camera. The embodiment of the present application tracks the target subject based on the image range of the original image, thereby achieving a larger tracking range.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of electronic technology, and in particular to a target tracking method and related devices. Background Art

[0002] When a mobile phone uses a telephoto lens to shoot a moving object, it is not easy to aim and shoot the moving subject when holding the phone. If the user moves the phone to follow the movement of the moving subject, it is not only easy to fail to follow the moving subject, but also causes the picture to shake. Especially in the preview scene, electronic devices cannot cache all video image information like offline programs and use the image frame motion path of future frames to give the most perfect (taking into account tracking and stabilization) output frame position for the current frame.

[0003] Therefore, how to ensure that the cropping frame output in real time can not only frame the moving subject well, but also make the output image stream continuous and sufficiently stable is a problem that technicians in this field are studying. Summary of the invention

[0004] The embodiments of the present application provide a target tracking method and related devices, which can stably track the target subject.

[0005] In a first aspect, the present application provides a target tracking method, the method comprising: an electronic device turns on a target tracking mode; the electronic device determines a target subject to be tracked based on an original image captured by a camera of the electronic device; the electronic device displays a first tracking screen in a display area, the first tracking screen includes the target subject, and the target subject is located at a first position in a framing area of ​​the camera; when the target subject moves, the electronic device displays a second tracking screen in the display area, the second tracking screen shows that the target subject is located at a second position in the framing area of ​​the camera.

[0006] In the embodiment of the present application, the electronic device can track the target of the collected original image. After the electronic device determines the target subject in the original image, when the target subject moves from the first position to the second position, the display area of ​​the electronic device always displays the target subject in the screen. Here, the original image collected by the camera refers to all image data that can be collected by the camera. The embodiment of the present application tracks the target subject based on the image range of the original image, thereby achieving a larger tracking range.

[0007] In a possible implementation, the electronic device does not move, and the camera's framing area remains unchanged. The tracking of the target subject in the embodiment of the present application may be to track the moving target subject while the electronic device is stationary, which can improve the stability of the target subject displayed in the output screen. Among them, the embodiment of the present application may also be to track the moving target subject while the electronic device is moving, and always display the target subject in the output screen; or it may be to track the non-moving target subject while the electronic device is moving, and always display the target subject in the output screen.

[0008] In a possible implementation, the original image is not subjected to anti-shake or deblurring processing, or the original image includes all objects within the camera's framing area. The embodiment of the present application tracks the target subject based on the image range of the original image, thereby achieving a larger tracking range. When the target subject is located at the edge area of ​​the original image, the electronic device can also track the target subject.

[0009] In a possible implementation, the method further includes: the electronic device displays the original image captured by the camera in a preview frame, and the preview frame occupies a part or all of the display area. The preview frame may be a picture-in-picture frame, which is superimposed on the display area so that the user can more intuitively see the comparison between the original image and the tracking picture of the display area. The preview frame may also occupy the entire screen of the display area, for example, the preview frame is first displayed in the entire screen of the display area, and then the preview frame is superimposed on the display area.

[0010] In a possible implementation, the electronic device determines the target subject to be tracked based on the original image captured by the camera of the electronic device, including: the electronic device receives a first operation of the user in the preview box, the first operation indicates the target subject selected by the user; the electronic device determines the target subject to be tracked based on the first operation. Wherein, the original image captured by the camera is displayed in the preview box, and the image displayed in the preview box includes the target subject. The electronic device can determine the target subject based on the first operation of the user on the preview box, where the first operation can be, for example, a click operation on the display position of the target subject. That is, the electronic device can determine the target subject based on the user's operation.

[0011] In a possible implementation, the electronic device determines the target subject to be tracked based on the original image captured by the camera of the electronic device, including: the electronic device automatically performs target detection on the original image captured by the camera of the electronic device based on a preset target detection algorithm to determine the target subject to be tracked. Here, the preset target detection algorithm can be for a specific category of objects, such as a target detection algorithm for detecting people, such as a target detection algorithm for detecting animals, such as a target detection algorithm for detecting objects, such as a target detection algorithm for detecting moving objects, and so on.

[0012] In a possible implementation, the preview box also includes an output box, and the image in the output box corresponds to the picture displayed in the display area. The output box is used to indicate which area of ​​the original image the picture currently displayed in the display area is.

[0013] In a possible implementation, the method further includes: the electronic device determines a guide point in the output frame, the guide point indicating the display position of the target subject; the electronic device displays the target subject at the first position in the first tracking screen, or displays the target subject at the second position in the second tracking screen according to the guide point. Here, the guide point is used to determine the display position of the target subject in the output frame. If the guide point is at the center point of the output frame, the target subject is displayed at the center position of the first tracking screen in the first tracking screen, and the target subject is displayed at the center position of the second tracking screen in the second tracking screen. In this way, the electronic device can stably display the target subject at the position where the guide point is located, thereby achieving a stable tracking effect.

[0014] In a possible implementation, the electronic device determines the guide point in the output box, including: the electronic device determines the guide point in the output box according to a default setting, or the electronic device receives a second operation of the user, the second operation of the user indicating the position of the guide point selected by the user in the output box. Here, a method is provided in which the electronic device can determine the guide point by default setting and user operation.

[0015] In a possible implementation, the electronic device displays the target subject at the first position on the first tracking screen or displays the target subject at the second position on the second tracking screen according to the guide point, including: the electronic device determines the motion path of the target subject; the electronic device determines the difference line between the target subject and the guide point based on the motion path of the target subject; the electronic device determines the motion path of the background in the original image; the electronic device determines the smooth path based on the motion path and the difference line of the background; the electronic device performs a wrap process on the original image based on the smooth path; the electronic device displays the warped image in the display area, and the image displayed in the display area corresponds to the image in the output frame. Here, the algorithm principle of the electronic device to achieve stable tracking of the target subject is described. Based on the idea of ​​foreground driving background, the electronic device drives the background movement through the movement of the target subject to move the target subject to the output screen. In the process of solving the smooth path of the background, the electronic device determines the difference line between the motion path of the target subject and the guide point, and uses the difference line as a guide reference item for background smoothing to obtain the smooth path of the background. Based on the smooth path, the original image collected by the electronic device is warped, so that the target subject can be stably displayed at the position of the guide point in the output frame. The electronic device solves the smooth path of the background at one time, taking into account both anti-shake smoothing and tracking. The tracking of the target subject and the path smoothing of the background can share the same widest cropping boundary (i.e. the boundary of the original image). It achieves tracking of the target subject while smoothing the background, taking into account the followability and smoothness of the tracking result.

[0016] In a possible implementation, the electronic device starts the target tracking mode including: the electronic device detects a third operation of the user, the third operation includes an operation of increasing the zoom ratio or the user directly turns on the switch of the target tracking mode. Here, a method for the electronic device to start the target tracking mode based on the user operation is provided.

[0017] In a possible implementation, the operation of increasing the zoom ratio indicates a display ratio selected by the user; the electronic device displays the first tracking picture or the second tracking picture in the display area according to the display ratio.

[0018] In a possible implementation, the camera is a telephoto camera. Generally speaking, at a high display magnification, the electronic device uses a telephoto camera to collect image data.

[0019] In a possible implementation, the increased zoom ratio is greater than a preset ratio, which may be 15 times, for example.

[0020] In a possible implementation, when the second position is the edge position of the camera's framing area, the second tracking image includes the target subject. Since the electronic device solves the smooth path of the background once, both anti-shake smoothing and tracking are taken into account simultaneously, and the tracking of the target subject and the path smoothing of the background can share the same widest cropping boundary (i.e., the boundary of the original image). In this way, even if the target subject is at the edge position of the original image, the electronic device can still track the target subject, solving the problem that the electronic device cannot track the target subject even if it has captured an image of the target subject because the target subject is at the edge of the shooting area of ​​the electronic device.

[0021] In a second aspect, an embodiment of the present application provides an electronic device, comprising: one or more processors, one or more memories; the one or more memories are coupled to one or more processors; the one or more memories are used to store computer program code, and the computer program code includes computer instructions; when the computer instructions run on the processor, the electronic device executes the target tracking method in any possible implementation of any of the above aspects.

[0022] In a third aspect, an embodiment of the present application provides a computer storage medium, including computer instructions, which, when executed on an electronic device, enables a communication device to execute a target tracking method in any possible implementation of any of the above aspects.

[0023] In a fourth aspect, an embodiment of the present application provides a target tracking method, the method comprising: starting target tracking; acquiring an original image; determining a target subject to be tracked based on the original image; outputting information of a first tracking screen, the first tracking screen including the target subject, the target subject being located at a first position of a framing area; outputting information of a second tracking screen, the second tracking screen showing that the target subject is located at a second position of the framing area.

[0024] In a fifth aspect, an embodiment of the present application provides a camera module, characterized in that it includes an input unit, an output unit and at least one camera;

[0025] The input unit is used to start target tracking according to the instruction of the electronic device;

[0026] At least one camera is used to collect original images and determine the target subject to be tracked based on the original images;

[0027] The output unit is used to output information of a first tracking picture, the first tracking picture includes a target subject, and the target subject is located at a first position of the framing area; and output information of a second tracking picture, the second tracking picture shows that the target subject is located at a second position of the framing area.

[0028] In some embodiments, at least one camera includes a processing unit, and at least one camera is also used to determine the motion path of the target subject through the processing unit; at least one camera is also used to determine the difference line between the target subject and the guide point based on the motion path of the target subject through the processing unit; at least one camera is also used to determine the motion path of the background in the original image through the processing unit; at least one camera is also used to determine a smooth path based on the motion path and the difference line of the background through the processing unit; at least one camera is also used to wrap the original image based on the smooth path through the processing unit; the output unit is also used to output the warped image in the display area, and the picture displayed in the display area corresponds to the image in the output box.

[0029] In a sixth aspect, an embodiment of the present application provides a computer program product, which, when executed on a computer, enables the computer to execute a target tracking method in any possible implementation of any of the above aspects. BRIEF DESCRIPTION OF THE DRAWINGS

[0030] Figure 1a and Figure 1b A schematic diagram of the principle of a target tracking method provided in an embodiment of the present application;

[0031] Figure 2 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application;

[0032] Figure 3a and Figure 3b A set of application interface schematic diagrams provided for embodiments of the present application;

[0033] Figures 4a to 4f Another set of application interface schematic diagrams provided for embodiments of the present application;

[0034] Figure 5a and Figure 5b Another set of application interface schematic diagrams provided for embodiments of the present application;

[0035] Figure 6a and Figure 6b Another set of application interface schematic diagrams provided for embodiments of the present application;

[0036] Figures 7a to 7d Another set of application interface schematic diagrams provided for embodiments of the present application;

[0037] Figures 8a to 8d Another set of application interface schematic diagrams provided for embodiments of the present application;

[0038] Fig. 9 A method flow chart of a target tracking method provided in an embodiment of the present application;

[0039] Fig.10 A schematic diagram of the principle of another target tracking method provided in an embodiment of the present application;

[0040] Fig.11 A schematic diagram of the principle of another target tracking method provided in an embodiment of the present application;

[0041] Fig.12a and Figure 12b A schematic diagram of the principle of another target tracking method provided in an embodiment of the present application;

[0042] Fig.13 A method flow chart of another target tracking method provided in an embodiment of the present application;

[0043] Fig.14 A method flow chart of another target tracking method provided in an embodiment of the present application. DETAILED DESCRIPTION

[0044] The technical solution in the embodiment of the present application will be described below in conjunction with the accompanying drawings. In the description of the embodiment of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in the text is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiment of the present application, "multiple" means two or more than two.

[0045] In the following, the terms "first" and "second" are used for descriptive purposes only and shall not be understood as suggesting or implying relative importance or implicitly indicating the number of technical features indicated. Thus, the features defined as "first" and "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, the meaning of "multiple" is two or more. The orientation or positional relationship indicated by the terms "middle", "left", "right", "upper", "lower", etc. is based on the orientation or positional relationship shown in the accompanying drawings, and is only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore shall not be understood as a limitation on the present application.

[0046] In the embodiment of the present application, anti-shake and tracking are two major technologies for achieving stable tracking of targets in real-time captured images. Among them, anti-shake is to crop the captured image based on a target point or target area, so that the target point or target area always moves in a certain area of ​​the picture in a smooth manner, so as to stabilize the displayed picture; tracking is to determine the target subject in the real-time captured image through algorithms such as subject detection and recognition or feature matching. In order to facilitate presentation, the captured image can be cropped so that the target subject is always displayed in the output picture (for example, the center position).

[0047] Anti-shake and tracking are separate algorithms. If tracking is implemented first and then anti-shake, at high magnification, even slight hand shaking will be magnified into a huge jump in the preview image. Therefore, executing the subject detection algorithm on the original input image without anti-shake will greatly reduce the accuracy of detecting the target subject, making it difficult to accurately identify the same subject in the previous and next frames based on the position on the original input image.

[0048] If anti-shake is implemented first and then tracking is implemented, the subject detection algorithm can be executed on the image that has been anti-shake, which can improve the detection accuracy. However, since the original input image is cropped during anti-shake, the detection and movable range during tracking are limited, and it is difficult to use the larger boundary of the original input image. Moreover, after the second cropping of tracking, the path of the target subject becomes unsmooth again due to the jump of the cropping frame, and it needs to be smoothed again, which makes the peak lag further and causes delay.

[0049] like Figure 1a As shown, the outermost image frame ① is the original image captured by the electronic device 100 through the camera. Since the electronic device 100 is not directly shooting the photographed object most of the time when capturing images, the electronic device 100 needs to first perform image projection transformation (image warp) on the captured original image to make the image appear straight. For example, the camera of the electronic device 100 captures a QR code image in a side direction. The electronic device 100 needs to first perform warp transformation on the captured QR code image, and then a QR code image in the positive direction can be obtained, thereby realizing the recognition of the QR code.

[0050] Figure 1a In FIG. 1 , the dotted frame ② is an image obtained by the electronic device 100 by warping the original image. The electronic device 100 performs anti-shake processing on the wrapped image, and the image frame after anti-shake cropping is Figure 1a③ in the image frame. It can be seen that after the electronic device 100 performs anti-shake processing on the original image, the image range that can be used for tracking processing becomes the range shown in image frame ③. When the target subject is at position one, even if the electronic device 100 captures the image of the target subject, it cannot track the target subject, that is, the target subject visible in the original image cannot be tracked because the image range becomes smaller after the anti-shake processing; when the target subject is at position two, the electronic device 100 can track the target subject. It can be seen that the electronic device 100 cannot use the larger range provided by the original image when tracking and detecting the target subject.

[0051] Furthermore, the electronic device 100 needs to further crop the area where the target subject is located when tracking the target subject. Since the subject recognition of different image frames generally has position deviation, the cropped area will be shaken. In order to prevent the adjacent image frames after cropping from jumping due to the difference in cropped areas, the cropped image needs to be smoothed for the second time. Figure 1b As shown, Figure 1b In the figure, path 1 is the motion path of the displayed image after secondary cropping relative to the original image, path 2 is the anti-shake smoothing path of the displayed image after secondary cropping in an ideal situation, and path 3 is the anti-shake smoothing path of the displayed image after secondary cropping in an actual situation. It can be seen that in fact, such a processing method will cause peak hysteresis, resulting in image display delay and poor user experience.

[0052] In an embodiment of the present application, a target tracking method based on path optimization is proposed. Based on the idea of ​​foreground driving background, the electronic device 100 drives the background movement through the movement of the target subject (foreground) to move the target subject to the output screen. In the process of solving the smooth path of the background, the electronic device 100 uses the target subject motion path as a guiding reference item for background smoothing to obtain the smooth path of the background. The electronic device 100 warps the original image collected by the electronic device based on the smooth path, so that the target subject can be stably displayed in the output screen. The electronic device 100 solves the smooth path of the background at one time, and simultaneously considers the two aspects of anti-shake smoothing and tracking, so that the tracking of the target subject and the path smoothing of the background can share the same widest cropping boundary (i.e., the boundary of the original image). It is achieved that the target subject is tracked while the background is smoothed, and the followability and smoothness of the tracking result are taken into account.

[0053] The embodiments of the present application can track the target of the image data collected in real time. Tracking can refer to tracking the moving object when the shooting device is stationary and displaying the moving object in the output screen all the time; it can also refer to tracking the moving object when the shooting device is moving and displaying the moving object in the output screen all the time; it can also refer to tracking the non-moving object when the shooting device is moving and displaying the non-moving object in the output screen all the time. For example, in the preview interface of the camera application, the target subject can be tracked in real time without moving the shooting device, and a picture or video containing the target subject can be obtained.

[0054] The following first introduces the electronic device 100 involved in the embodiment of the present application, and the electronic device 100 includes a shooting device.

[0055] See also Figure 2 , Figure 2 A schematic structural diagram of an exemplary electronic device 100 provided in an embodiment of the present application is shown.

[0056] The electronic device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (USB) interface 130, a charging management module 140, a power management module 141, a battery 142, an antenna 1, an antenna 2, a mobile communication module 150, a wireless communication module 160, an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, a sensor module 180, a button 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195, etc. The sensor module 180 may include a pressure sensor 180A, a gyroscope sensor 180B, an air pressure sensor 180C, a magnetic sensor 180D, an acceleration sensor 180E, a distance sensor 180F, a proximity light sensor 180G, a fingerprint sensor 180H, a temperature sensor 180J, a touch sensor 180K, an ambient light sensor 180L, a bone conduction sensor 180M, etc.

[0057] It is to be understood that the structure illustrated in the embodiment of the present application does 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 components than shown in the figure, or combine some components, or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0058] 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.

[0059] 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.

[0060] The processor 110 may also be provided with a memory for storing instructions and data. In some embodiments, the memory in the processor 110 is a cache memory. The memory may store instructions or data that the processor 110 has just used or cyclically used. If the processor 110 needs to use the instruction or data again, it may be directly called from the memory. This avoids repeated access, reduces the waiting time of the processor 110, and thus improves the efficiency of the system.

[0061] In some embodiments, the processor 110 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an inter-integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a subscriber identity module (SIM) interface, and / or a universal serial bus (USB) interface, etc.

[0062] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the electronic device 100. In other embodiments of the present application, the electronic device 100 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.

[0063] The charging management module 140 is used to receive charging input from the charger. 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 to power the processor 110, the internal memory 121, the external memory, the display screen 194, the camera 193, and the wireless communication module 160.

[0064] 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 and the baseband processor.

[0065] The electronic device 100 implements the display function through a GPU, a display screen 194, and an application processor. The GPU is a microprocessor for image processing, which connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. The processor 110 may include one or more GPUs that execute program instructions to generate or change display information.

[0066] The display screen 194 is used to display images, videos, etc. The display screen 194 includes a display panel. The display panel can be a liquid crystal display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode or an active-matrix organic light-emitting diode (AMOLED), a flexible light-emitting diode (FLED), Miniled, MicroLed, Micro-oLed, a quantum dot light-emitting diode (QLED), etc. In some embodiments, the electronic device 100 may include 1 or N display screens 194, where N is a positive integer greater than 1.

[0067] In some embodiments of the present application, the interface content currently output by the system is displayed on the display screen 194. For example, the interface content is a preview interface provided by a camera application, and the preview interface can display an image captured by the camera 193 in real time, and the preview interface can also display an image captured by the camera 193 in real time and processed by the GPU.

[0068] The electronic device 100 can realize the shooting function through ISP, camera 193, video codec, GPU, display screen 194 and application processor.

[0069] ISP is used to process the data fed back by 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 ISP for processing and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on the noise, brightness, and skin color of the image. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In some embodiments, ISP can be set in camera 193.

[0070] 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 optical 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.

[0071] In some embodiments, the camera 193 may include a telephoto camera, a wide-angle camera, an ultra-wide-angle camera, and the like. The electronic device 100 collects images in real time through the camera 193. Different cameras can be used to collect images at different magnifications. For example, at a magnification of 0.5x to 1x, an ultra-wide-angle camera can be used, and the original image collected by the ultra-wide-angle camera is an image with a magnification of 0.5x, and the displayed image at a magnification of 0.5x to 1x is obtained by cropping the original image (the image with a magnification of 0.5x); at a magnification of 1x to 3.5x, a wide-angle camera can be used, and the original image collected by the wide-angle camera is an image with a magnification of 1x, and the displayed image at a magnification of 1x to 3.5x is obtained by cropping the original image (the image with a magnification of 1x); at a magnification of more than 3.5x, a telephoto camera can be used, and the original image collected by the telephoto camera is an image with a magnification of 3.5x, and the displayed image at a magnification of more than 3.5x is obtained by cropping the original image (the image with a magnification of 3.5x).

[0072] Optionally, regardless of using a telephoto camera, a wide-angle camera, or an ultra-wide-angle camera, the electronic device 100 can obtain a display image of any magnification by cropping the original image.

[0073] The digital signal processor is used to process digital signals, and can process not only digital image signals but also other digital signals. For example, when the electronic device 100 is selecting a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy.

[0074] Video codecs are used to compress or decompress digital videos. The electronic device 100 may support one or more video codecs. Thus, the electronic device 100 may play or record videos in a variety of coding formats, such as Moving Picture Experts Group (MPEG) 1, MPEG2, MPEG3, MPEG4, etc.

[0075] NPU is a neural network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transmission mode between neurons in the human brain, it can quickly process input information and can also continuously self-learn. Through NPU, applications such as intelligent cognition of electronic device 100 can be realized, such as image recognition, face recognition, voice recognition, text understanding, etc.

[0076] 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 through the external memory interface 120 to implement a data storage function, such as storing music, video and other files in the external memory card.

[0077] 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. 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 created during the use of the electronic device 100 (such as audio data, a phone book, etc.), 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.

[0078] The electronic device 100 can implement audio functions such as music playing and recording through the audio module 170, the speaker 170A, the receiver 170B, the microphone 170C, the headphone jack 170D, and the application processor.

[0079] 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 speaker 170A, also called "speaker", is used to convert audio electrical signals into sound signals. The receiver 170B, also called "earpiece", is used to convert audio electrical signals into sound signals. The microphone 170C, also called "microphone", "microphone", is used to convert sound signals into electrical signals. The headphone interface 170D is used to connect wired headphones.

[0080] The pressure sensor 180A is used to sense pressure signals and convert the pressure signals into electrical signals.

[0081] The gyro sensor 180B can 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 (the X-axis, Y-axis, and Z-axis of the electronic device) can be determined by the gyro sensor 180B. The gyro sensor 180B can be used for anti-shake shooting. For example, when the shutter is pressed, the gyro sensor 180B detects the angle of the electronic device 100 shaking, calculates the distance that the lens module needs to compensate based on the angle, and allows the lens to offset the shaking of the electronic device 100 through reverse movement to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenes.

[0082] The air pressure sensor 180C is used to measure air pressure.

[0083] The magnetic sensor 180D includes a Hall sensor.

[0084] The acceleration sensor 180E can detect the magnitude of the acceleration of the electronic device 100 in various directions (generally three axes). When the electronic device 100 is stationary, the magnitude and direction of gravity can be detected. It can also be used to identify the posture of the electronic device, and is applied to applications such as horizontal and vertical screen switching, pedometers, etc. In some optional embodiments of the present application, the acceleration sensor 180E can be used to capture the acceleration value generated when the user's finger contacts the display screen (or the user's finger taps the rear side frame of the rear shell of the electronic device 100), and transmit the acceleration value to the processor so that the processor can identify which finger part the user uses to input the user operation.

[0085] The distance sensor 180F is used to measure the distance. The electronic device 100 can measure the distance by infrared or laser. In some embodiments, when shooting a scene, the electronic device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.

[0086] The proximity light sensor 180G may include, for example, a light emitting diode (LED) and a light detector such as a photodiode.

[0087] The ambient light sensor 180L is used to sense the brightness of ambient light.

[0088] The fingerprint sensor 180H is used to collect fingerprints.

[0089] The temperature sensor 180J is used to detect the temperature.

[0090] The touch sensor 180K is also called a “touch panel.” The touch sensor 180K may be disposed on the display screen 194 , and the touch sensor 180K and the display screen 194 form a touch screen, also called a “touch screen.”

[0091] Bone conduction sensor 180M can obtain vibration signals.

[0092] The buttons 190 include a power button, a volume button, etc. The motor 191 can generate a vibration prompt. The indicator 192 can be an indicator light, which can be used to indicate the charging status, power change, messages, missed calls, notifications, etc. The SIM card interface 195 is used to connect a SIM card. The SIM card can be connected to and separated from the electronic device 100 by inserting the SIM card interface 195 or pulling it out from the SIM card interface 195.

[0093] The following introduces an implementation form of a target tracking method provided in the present application on the display interface of the electronic device 100 in combination with an application scenario.

[0094] First, the display interface of the electronic device 100 for starting the target tracking function is introduced.

[0095] like Figure 3a As shown, Figure 3a An exemplary user interface for displaying a list of applications on an electronic device is shown. Figure 3a The electronic device includes a status bar 201 and a display interface 202, wherein the status bar 201 may include: one or more signal strength indicators 203 of a mobile communication signal (also referred to as a cellular signal), one or more signal strength indicators 204 of a wireless fidelity (Wi-Fi) signal, a Bluetooth indicator 205, a battery status indicator 206, and a time indicator 207. When the Bluetooth module of the electronic device is turned on (i.e., the electronic device supplies power to the Bluetooth module), the Bluetooth indicator 205 is displayed on the display interface of the electronic device.

[0096] The display interface 202 displays a plurality of application icons, including an application icon of a camera 208. When the electronic device detects a user operation on the application icon of the camera 208, the electronic device displays an application interface provided by the camera application.

[0097] refer to Figure 3b , Figure 3b FIG. 208 shows a possible user interface provided by a camera application. Figure 4b As shown, the application interface may include: a display area 210 , a magnification adjustment area 211 , a function bar 212 , a mode selection area 213 , a gallery icon 214 , a shooting icon 215 , and a switching icon 216 .

[0098] The display screen of the display area 210 is an image collected in real time by the electronic device through the camera. At this time, the display screen in the display area 210 includes a partial body of a person, a tree, and a bell on the tree. The camera currently used by the electronic device may be a default camera set by the camera application, or the camera currently used by the electronic device may be the camera used when the camera application was closed last time.

[0099] The magnification adjustment area 211, which may also be referred to as the focal length adjustment area, is used to adjust the shooting focal length of the camera, thereby adjusting the display magnification of the display screen of the display area 210. The magnification adjustment area 211 includes an adjustment slider 211A, which is used to indicate the display magnification. The adjustment slider 211A is currently 5x, indicating that the current display magnification is 5x. The user can zoom in or out of the display screen of the display area 210 by sliding the adjustment slider 211A in the magnification adjustment area 211. For example, by sliding the adjustment slider 211A upward, the display magnification of the display screen of the display area 210 is magnified, so that the person currently at 5x is not in the display area; by sliding the adjustment slider 211A downward, the display magnification of the display screen of the display area 210 is reduced, so that the person currently at 5x can be fully displayed in the display area.

[0100] In some embodiments, the display magnification of the display screen of the display area 210 is not limited to being adjusted through the magnification adjustment area 211, and the user can also use other shortcuts to adjust the display magnification of the display screen of the display area 210. For example, in the display area 210, spreading two fingers apart can enlarge the display magnification, and closing two fingers together can reduce the display magnification.

[0101] Function bar 212 is used to provide shortcut functions of the camera application, including, for example, turning on smart vision (icon 212A), switching the flash (icon 212B), turning on AI photography master (icon 212C), switching color mode (icon 212D), turning on the camera settings interface (icon 212E), etc.

[0102] The mode selection area 213 is used to provide different shooting modes. Depending on the shooting mode selected by the user, the camera and shooting parameters activated by the electronic device are also different, including night scene mode, portrait mode, photo mode, video mode, professional mode and more. Figure 3b The icon of the photo mode is marked to remind the user that the current mode is the photo mode.

[0103] In night scene mode, the electronic device 100 can enhance the detail presentation capability of bright and dark parts, control noise, and present more picture details. In photo mode, the electronic device 100 adapts to most shooting scenes and can automatically adjust the photography parameters according to the current environment. In video recording mode, the electronic device 100 can be used to shoot a video. When a user operation acting on "more" is detected, in response to the operation, the electronic device may display other selection modes, such as panoramic mode (to achieve automatic stitching, the electronic device stitches multiple photos taken continuously into one photo to achieve the effect of expanding the viewing angle of the picture), HDR mode (automatically taking three photos of underexposure, normal exposure, and overexposure in succession, and selecting the best part to synthesize into one photo), and the like.

[0104] When a user operation is detected for an application icon of any mode in the mode selection area 303 (e.g., night scene mode, photo mode, video mode, etc.), the electronic device 100 can enter the corresponding mode in response to the operation. Accordingly, the image displayed in the display area 210 is the processed image in the current mode.

[0105] The mode icons in the mode selection area 213 are not limited to virtual icons, and the mode selection can also be performed through physical buttons deployed on the shooting device / electronic device, so that the shooting device enters the corresponding mode.

[0106] Gallery icon 214, when a user operation acting on gallery icon 214 is detected, in response to the operation, the electronic device can enter the gallery of electronic device 100, and the gallery can include photos and videos that have been taken. Gallery icon 214 can be displayed in different forms. For example, when the electronic device saves the image currently captured by the camera, the gallery icon 214 displays a thumbnail of the image.

[0107] The shooting icon 215, when a user operation (such as a touch operation, a voice operation, a gesture operation, etc.) acting on the shooting icon 215 is detected, in response to the operation, the electronic device 100 obtains the image currently displayed in the display area 210 and saves it in the gallery. The gallery can be entered through a user operation (such as a touch operation, a gesture operation, etc.) on the gallery icon 214.

[0108] The switching icon 216 can be used to switch between the front camera and the rear camera. The shooting direction of the front camera is the same as the display direction of the screen of the electronic device used by the user, and the shooting direction of the rear camera is opposite to the display direction of the screen of the electronic device used by the user.

[0109] Based on the above Figure 3b When the electronic device 100 receives a user operation on the user interface, the electronic device 100 triggers the target tracking mode, and an exemplary display is shown as follows: Figure 4a The interface shown.

[0110] The user operation may be that the user slides up the adjustment slider 211A in the magnification adjustment area 211, and the display magnification of the display screen of the display area 210 is magnified. When the display magnification of the electronic device 100 is magnified to not less than the preset magnification, the electronic device 100 triggers the target tracking mode, and the exemplary display is as follows: Figure 4a The interface shown in FIG. 10 shows a preset magnification ratio of 15 times.

[0111] Optionally, the user operation may be that the user separates two fingers in the display area 210 to enlarge the display magnification. When the display magnification of the electronic device 100 is enlarged to not less than a preset magnification, the electronic device 100 triggers the target tracking mode, and an exemplary display is as follows: Figure 4a The interface shown.

[0112] The method of triggering the target tracking mode is not limited to the above method. In the embodiment of the present application, the electronic device 100 may also trigger the target tracking mode in other ways.

[0113] Optional, Figure 3b The target tracking mode may also include a shortcut icon for triggering the target tracking mode. The user operation may be a click operation on the shortcut icon. The electronic device 100 receives the click operation and triggers the target tracking mode. The exemplary display is as follows Figure 4a The interface shown.

[0114] like Figure 4a As shown, Figure 4a An example of an application interface for triggering the electronic device 100 to start the target tracking mode is shown. When the display magnification of the electronic device 100 is not less than the preset magnification, the application interface displayed by the electronic device 100 can be Figure 4a In the application interface, the adjustment slider 211A in the magnification adjustment area 211 is currently 15x, indicating that the current display magnification is 15x.

[0115] Figure 4a The application interface shown includes a display area 220, a preview box 221, and a guide slogan 222. Since the current display magnification is 15 times, the display screen of the display area 220 is larger than that of the display area 220. Figure 3b The display screen of the display area 210 is magnified 15 times.

[0116] The image displayed in the preview frame 221 is the original image captured by the camera in real time. The preview frame 221 is a display area in the display area 220, and is generally suspended on the display image in the display area 220. It can be seen that the image displayed in the preview frame 211 is larger than the image range displayed at 5 times the magnification (such as Figure 3b In general, when the display magnification is 5 times, the image displayed is not the original image captured by the camera, but the image displayed after the original image captured by the camera is cropped. Here, the image displayed in the preview box is the original image captured by the camera in real time, indicating that the tracking range in the embodiment of the present application is the range of the original image captured by the camera.

[0117] Figure 4a, the picture displayed in the preview box 221 at this time includes a person (complete), a tree and a bell on the tree. The picture in the dotted box 221B in the preview box 221 is the picture displayed in the display area 220, indicating which part of the picture currently displayed in the display area 220 is the picture captured by the camera in real time. Since the current display magnification is 15 times, the image displayed in the display area 220 at this time includes trees and bells on the trees, but no people. The exit icon 221A is used to close the preview box 221. When the electronic device 100 detects a user operation on the exit icon 221A, the electronic device 100 closes the preview box 221. Optionally, the electronic device 100 closes the preview box 221 and the guide slogan 222 at the same time.

[0118] The guide slogan 222 provides an exemplary way of starting the target tracking mode, displaying the text "Click the virtual box to track the target" to prompt the user, and the virtual box is the dotted line box 221B.

[0119] In some embodiments, the dotted frame 221B can indicate different information based on different display forms (display color, display shape). For example, when the display color of the dotted frame 221B is the first color, it means that the current electronic device 100 has not detected the target subject, and optionally, the guide slogan 222 can display the text "No target detected" to prompt the user; when the display color of the dotted frame 221B is the second color, it means that the current electronic device 100 has detected the target subject, and optionally, the guide slogan 222 can display the text "Click the dotted frame to track the target" to prompt the user.

[0120] Among them, clicking the virtual box (dashed line box 221B) to track the target is only a way to start the target tracking mode, and has nothing to do with the display screen in the dashed line box 221B. Figure 3b In the example, when the target subject detected by the electronic device 100 is a person, there is no picture of the person in the dotted frame 221B. When the user clicks the dotted frame 221B, the electronic device 100 tracks the person.

[0121] In some embodiments, when the electronic device 100 detects the target subject, the electronic device 100 may highlight the target subject in the preview frame 221 , for example, by displaying another dotted frame to frame the target subject, so as to prompt the user that the electronic device 100 has detected the target subject.

[0122] Based on the above Figure 4a , the electronic device 100 can start the target tracking mode. Figure 4b , Figure 4b An example of an application interface of a target tracking mode is shown.

[0123] In some embodiments, when the electronic device 100 detects a user operation on the dotted frame 221B, the electronic device 100 turns on the target tracking mode. In some embodiments, when the electronic device 100 detects a user operation on the target subject in the preview frame 221, the electronic device 100 turns on the target tracking mode. Figure 4a The target tracking mode may also be activated by a shortcut icon. When the electronic device 100 receives a click operation on the shortcut icon, the target tracking mode is activated. The exemplary display is as follows: Figure 4b The application interface shown.

[0124] Figure 4b The application interface shown includes a display area 230, a preview box 221 and a guide slogan 223, wherein:

[0125] The picture displayed in the preview frame 221 is the original image captured by the camera in real time. The electronic device 100 turns on the target tracking mode, and the electronic device 100 identifies the target subject in the image currently captured by the camera (that is, the person in the image displayed in the preview frame 211), and displays a solid line frame 221C in the preview frame 221, wherein the picture in the solid line frame 221C is the picture displayed in the display area 230, indicating which part of the picture currently displayed in the display area 230 is the picture captured by the camera in real time. In the embodiment of the present application, the solid line frame can also be called a picture output frame. Figure 4b At this time, the person is displayed in the left area of ​​the display area 230. Here, since the target subject is at the left edge of the picture displayed in the preview frame 211, the solid line frame 221C is selected at the left edge of the preview frame 221. In the solid line frame 211C, the target subject is in the left area of ​​the solid line frame 221C. When the target subject moves, the display position of the solid line frame 221C moves with the target subject.

[0126] The guidance slogan 223 provides a way to exit the target tracking mode, prompting the user to "click the solid box to exit tracking", and the solid box is the solid line box 221C. When the electronic device 100 detects the user operation on the solid line box 221C, the electronic device 100 exits the target tracking mode. Optionally, at this time, the electronic device 100 displays the following Figure 4a Optionally, at this time, the electronic device 100 simultaneously closes the preview frame 221 and the guide slogan 223, and displays the following in the display area 230: Figure 4a The display screen of the display area 220 in FIG.

[0127] It can be seen that Figure 4aThe display area 220 in the image shows an image that is magnified 15 times the image captured by the camera, and the portion captured is the most central portion of the image captured by the camera. At this time, when a click operation on the shooting icon 215 is detected, the electronic device 100 obtains the image currently displayed in the display area 220. Figure 4b The target tracking mode is turned on in the image captured by the camera. Figure 4a and Figure 4b In the case where the image in the preview box 221 is the same image), the image displayed in the display area 230 is the part of the image captured by the camera that includes the target subject. At this time, when a click operation on the shooting icon 215 is detected, the electronic device 100 obtains the image currently displayed in the display area 230. In this way, the effect of obtaining the image / video of the target subject without moving the electronic device 100 can be achieved, and the tracking of the target subject is realized.

[0128] The above describes the display interface for starting the target tracking function of the electronic device 100. The embodiment of the present application does not limit the display interface and user operation for starting the target tracking function.

[0129] In the target tracking mode, the electronic device 100 does not move, the target body moves, and the electronic device 100 can track the target body. Figure 4c As shown, in Figure 4c In the preview box 221, the picture displayed is the original image captured by the camera in real time. Figure 4b In the image captured in the preview frame 221, since the electronic device 100 does not move, the background (trees) in the preview frame 221 does not change. Figure 4c Compared to the characters in Figure 4b 221D and 221C are at the same position relative to the preview frame 221. The picture in the solid-line frame 221D is the picture displayed in the display area 240, indicating which part of the picture currently displayed in the display area 240 is the picture collected by the camera in real time. At this time, the person is displayed in the middle area of ​​the display area 240. Here, the solid-line frame 221D is selected at the left edge of the preview frame 221, and the target subject is in the middle area of ​​the solid-line frame 221D.

[0130] When the electronic device 100 does not move, the target body continues to move, such as Figure 4d As shown, in Figure 4d In comparison with Figure 4c In the image captured in the preview frame 221, since the electronic device 100 does not move, the background (trees) in the preview frame 221 does not change. Figure 4d Compared to the characters in Figure 4cThe solid-line frame 221E moves to the right for a distance, and the solid-line frame 221E moves along with the target subject (person), that is, the target subject is still in the middle area in the solid-line frame 221E. The picture in the solid-line frame 221E is the picture displayed in the display area 250, and the person is displayed in the middle area of ​​the display area 250.

[0131] When the electronic device 100 does not move, the target body continues to move, such as Figure 4e As shown, in Figure 4e In comparison with Figure 4d In the image captured in the preview frame 221, since the electronic device 100 does not move, the background (trees) in the preview frame 221 does not change. Figure 4e Compared to the characters in Figure 4d The solid-line frame 221F moves a distance to the upper right, and the solid-line frame 221F moves along with the target subject (person), that is, the target subject is still in the middle area in the solid-line frame 221F. The picture in the solid-line frame 221F is the picture displayed in the display area 260, and the person is displayed in the middle area of ​​the display area 260.

[0132] When the electronic device 100 does not move, the target body continues to move, such as Figure 4f As shown, in Figure 4f In comparison with Figure 4e In the image captured in the preview frame 221, since the electronic device 100 does not move, the background (trees) in the preview frame 221 does not change. Figure 4f Compared to the characters in Figure 4e The target subject (the person) moves to the right for a distance in the preview frame 211. At this time, the person has moved to the edge of the shooting range of the electronic device 100. The solid-line frame 221G moves along with the target subject (the person). Since the target subject is at the right edge of the picture displayed in the preview frame 211, the solid-line frame 221G is selected at the right edge of the preview frame 221. In the solid-line frame 211G, the target subject is in the right area of ​​the solid-line frame 221G. The picture in the solid-line frame 221G is the picture displayed in the display area 270. At this time, the person is displayed in the right area of ​​the display area 270.

[0133] Based on the above Figure 4b to Figure 4f It can be seen that in the target tracking mode, even if the electronic device 100 does not move (the position of the tree in the preview frame has not changed), the electronic device 100 can automatically track the target subject and always display the image data containing the target subject in the display area.

[0134] It can be seen that for Figure 4b to Figure 4fGenerally speaking, the electronic device 100 tends to always display the target subject in the area exactly in the middle of the display area. Here, the electronic device 100 uses the center coordinates of the output frame as the guide point. After the electronic device 100 determines the guide point, it always displays the guidance of the target subject at the position of the guide point, so as to achieve the effect of displaying the target subject in the area exactly in the middle of the display area. The center and proportion of the output frame are fixed relative to the original image captured by the electronic device 100. The size of the output frame is related to the display magnification of the electronic device 100. The larger the display magnification of the electronic device 100, the smaller the output frame is relative to the original image; the smaller the display magnification of the electronic device 100, the larger the output frame is relative to the original image.

[0135] In some embodiments, the guide point is a pixel coordinate point of the original image collected by the electronic device 100. If the guide point is selected in the output frame, the electronic device 100 can always display the target subject at the position of the guide point in the output frame.

[0136] exist Figure 4b to Figure 4f In, due to Figure 4b The target subject is at the left edge of the shooting range of the electronic device 100. Considering the current display magnification (15 times) and the display ratio of the display area, the target subject cannot be displayed in the middle of the display area. At this time, the target subject is displayed at the left edge of the display area. When the target subject continues to move to the right within the shooting range of the electronic device 100, for example Figure 4c to Figure 4e , the electronic device 100 tracks the target subject and displays the target subject in the middle of the display area. When the target subject continues to move to the right, it moves to the right edge of the shooting range of the electronic device 100, such as Figure 4f , combined with the current display magnification (15 times) and the display ratio size of the display area, the target subject cannot be displayed in the center of the display area. At this time, the target subject is displayed at the right edge of the display area.

[0137] It is understandable that the electronic device 100 tends to always display the target subject in the middle of the display area. In actual situations, due to factors such as the fast movement speed of the target subject, the large shaking degree of the electronic device 100, and the slow data processing speed of the electronic device 100, the actual display situation may not be as good as the display area. Figure 4b to Figure 4f The idealization shown, for example, is Figure 4c to Figure 4e In this case, the target subject may not be stably displayed in the center of the display area. The target subject may be displayed in the upper, lower, left, and right areas around the center within a certain error range.

[0138] In some embodiments, Figure 5aAs shown, when the electronic device 100 detects a user operation on the solid line frame 221G, the electronic device 100 exits the target tracking mode. Optionally, the electronic device 100 displays the following Figure 5b The user interface shown. Figure 5b , the electronic device 100 exits the target tracking mode, and the picture displayed in the preview frame 221 is the original image captured by the camera in real time. Since the current display magnification is 15 times, the display picture of the display area 280 is magnified 15 times compared with the display picture in the preview frame 221. The picture in the dotted frame 221H in the preview frame 221 is the picture displayed in the display area 280, indicating which part of the image captured by the camera in real time is the picture currently displayed in the display area 220. Figure 5b The guiding slogan 224 in the figure is “Click on the virtual box to track the target”, and the virtual box is a dotted line box 221H.

[0139] In some embodiments, Figure 6a As shown, when the electronic device 100 detects a user operation on the exit icon 221K, the electronic device 100 closes the preview box 221. Optionally, at this time, the electronic device 100 displays the following Figure 6b The user interface shown. Figure 6b In comparison with Figure 6a The electronic device 100 closes the preview frame 221 and the guide slogan 224 at the same time, and displays the following in the display area 290: Figure 6a The display screen of the display area 280 in FIG.

[0140] For the above Figure 4b to Figure 4f For example, the electronic device 100 tends to always display the target subject in the middle of the display area. In the embodiment of the present application, the target subject is not limited to the middle area. The electronic device 100 can also limit the target subject to any area of ​​the display area. The electronic device 100 can use any coordinate point in the display area as a guide point, and always guide the movement of the target subject to the guide point, so as to achieve the effect of displaying the target subject in any area of ​​the display area.

[0141] In some embodiments, the electronic device 100 may determine a guide point based on a received user operation. For example, the electronic device 100 provides a setting input box for the guide point, and the electronic device 100 receives a pixel coordinate point input by the user as the guide point; for another example, the electronic device 100 receives a click operation on the display area, and the electronic device 100 determines that the click position corresponding to the click operation is the position of the guide point.

[0142] Below Figure 7a to Figure 7d For example, the display interface of the electronic device 100 when the target subject is limited to the left area of ​​the display area is exemplified.

[0143] For example, in Figure 4a When the electronic device 100 detects a user operation on the dotted box 221B, the electronic device 100 turns on the target tracking mode, and the electronic device 100 displays the following Figure 7a The user interface shown. Figure 7a In the embodiment, the electronic device 100 determines a guide point in the display area 310, and always guides the movement of the target subject to the guide point, and the guide point is located in the left area of ​​the display area. The picture displayed in the preview box 311 is the image captured by the camera in real time, and the display magnification is 5 times. The electronic device 100 turns on the target tracking mode, and the electronic device 100 identifies the target subject in the image currently captured by the camera (that is, the person in the image displayed in the preview box 311), and determines the position of the solid line box 331A in the preview box 311. The solid line box 331A includes the target subject identified by the electronic device 100. Since the electronic device 100 limits the target subject to the left area of ​​the display area (the position of the guide point), the target subject is in the left area of ​​the solid line box 331A. The picture in the solid line box 331A is the picture displayed in the display area 310. At this time, the person is displayed at the position of the guide point in the display area 320. Among them, Figure 7a The user interface shown and Figure 4b Same, so Figure 7a For the description of the user interface, please refer to the above Figure 4b The description is not repeated here.

[0144] In the target tracking mode, the electronic device 100 does not move, the target body moves, and the electronic device 100 tracks the target body. Figure 7b As shown, it can be seen Figure 7b Compared to the characters in Figure 7a The solid line frame 311B moves a distance to the upper right, and the solid line frame 311B moves along with the target subject (person), that is, the target subject is still in the left area in the solid line frame 311B. The picture in the solid line frame 311B is the picture displayed in the display area 320, and the person is displayed at the position of the guide point in the display area 320.

[0145] When the electronic device 100 does not move, the target body continues to move, such as Figure 7c As shown, it can be seen Figure 7c Compared to the characters in Figure 7b The solid line frame 311C moves a distance to the lower right, and the solid line frame 311C moves along with the target subject (person), that is, the target subject is still in the left area in the solid line frame 311C. The picture in the solid line frame 311C is the picture displayed in the display area 330, and the person is displayed at the position of the guide point in the display area 330.

[0146] When the electronic device 100 does not move, the target body continues to move, such as Figure 7d As shown, it can be seen Figure 7d Compared to the characters in Figure 7c The target subject (the person) has moved to the right upper edge of the shooting range of the electronic device 100. The solid line frame 311D moves along with the target subject (the person). The solid line frame 311D is located at the right edge of the preview frame 211. The target subject is displayed in the right area of ​​the solid line frame 311D. Figure 7d The target subject is at the right edge of the shooting range of the electronic device 100. Considering the current display magnification (15 times) and the display ratio of the display area, the target subject cannot be displayed in the left area of ​​the display area (the location of the guide point). At this time, the target subject is displayed at the right edge of the display area. The picture in the solid line frame 311D is the picture displayed in the display area 340. At this time, the person is displayed in the right edge area of ​​the display area 340.

[0147] In summary, the electronic device 100 can use any coordinate point in the display area as a guide point, and always guide the movement of the target subject to the guide point, so as to achieve the effect of displaying the target subject in any area of ​​the display area.

[0148] The above describes how the electronic device 100 tracks a target object when the electronic device 100 identifies the target object as a target subject. The following describes how the electronic device 100 determines a target subject when the image captured by the camera includes multiple target objects.

[0149] Optionally, the electronic device 100 may determine a unique target subject among the multiple target objects according to a preset rule, wherein the preset rule may be the target object at the most central position in the currently captured image; the preset rule may also be the target object occupying the largest image area in the currently captured image; and so on.

[0150] Optionally, when the electronic device 100 recognizes that the image captured by the camera includes multiple target objects, the electronic device 100 may provide selection icons for the multiple target objects. The electronic device 100 receives a user operation on the selection icons for the multiple target objects, parses the click position of the user operation, and determines the target subject among the multiple target objects.

[0151] like Figure 8a As shown, Figure 8a A possible user interface provided by a camera application is shown. The display screen of the display area 400 is an image collected in real time by the electronic device through the camera. At this time, the display screen in the display area 400 includes a part of the body of person 1, person 2, a tree and a bell on the tree.

[0152] Based on the above Figure 8a When the electronic device 100 receives a user operation on the user interface, the electronic device 100 triggers the target tracking mode, and an exemplary display is shown as follows: Figure 8b The interface shown.

[0153] Optionally, the user operation may be that the user separates two fingers in the display area 400 to enlarge the display magnification. When the display magnification of the electronic device 100 is enlarged to not less than a preset magnification, the electronic device 100 triggers the target tracking mode, and an exemplary display is as follows: Figure 4a The interface shown in FIG. 10 shows a preset magnification ratio of 15 times.

[0154] Optional, Figure 8a The target tracking mode may also include a shortcut icon for triggering the target tracking mode. The user operation may be a click operation on the shortcut icon. The electronic device 100 receives the click operation and triggers the target tracking mode. The exemplary display is as follows Figure 8b The interface shown.

[0155] like Figure 8b As shown, the picture displayed in the preview frame 411 is the image captured by the camera in real time. It can be seen that the image displayed in the preview frame 411 is larger than the image range displayed at 5 times the magnification (such as Figure 8b The image displayed in the preview frame 411 is larger. At this time, the picture displayed in the preview frame 411 includes person 1 (complete), person 2, a tree, and a bell on the tree. The picture in the dotted frame 411A in the preview frame 411 is the picture displayed in the display area 410, indicating which part of the picture currently displayed in the display area 410 is the picture collected by the camera in real time. Since the current display magnification is 15 times, the image displayed in the display area 410 at this time includes the tree and the bell on the tree, as well as the upper half of the body of person 2.

[0156] When the electronic device 100 detects a user operation on the dotted frame 411A, the electronic device 100 turns on the target tracking mode, and the electronic device 100 identifies the target subject in the image currently captured by the camera (that is, the image displayed in the preview frame 411). Figure 8c As shown, at this time, the electronic device 100 identifies two target objects, namely person 1 and person 2. The electronic device 100 displays area 411B and area 411C, where area 411B indicates one target object, person 1, and area 411C indicates another target object, person 2. The electronic device 100 displays a guide slogan 412 to prompt the user to "click on the target object to determine the tracking subject." When the user clicks on area 411B, the electronic device 100 determines person 1 as the target subject; when the user clicks on area 411C, the electronic device 100 determines person 2 as the target subject.

[0157] Exemplarily, when the user clicks on area 411B, the electronic device 100 determines that person 1 is the target subject and displays the following Figure 8d The user interface shown. The picture displayed in the preview frame 411 is the original image captured by the camera in real time. The preview frame 411 includes a solid-line frame 411D, and the solid-line frame 411D includes the target subject (person 1) recognized by the electronic device 100. It can be considered that the solid-line frame 411D indicates the tracking of the target subject by the electronic device 100. When the target subject moves, the solid-line frame 411D moves with the target subject. Among them, the picture in the solid-line frame 411D is the picture displayed in the display area 430, indicating which part of the picture captured by the camera in real time is the picture currently displayed in the display area 430.

[0158] It can be seen that Figure 8c The display area 420 in the image shows an image after the image captured by the camera is magnified to 15 times, and the portion of the most central position of the image captured by the camera is intercepted. At this time, when a click operation acting on the shooting icon 215 is detected, the electronic device 100 obtains the image currently displayed in the display area 420. Figure 8d The target tracking mode is turned on in the image captured by the camera. Figure 8c and Figure 8d In the case where the image in the preview box 411 is the same image), the image displayed in the display area 430 is the part of the image captured by the camera that includes the target subject (person 1). At this time, when a click operation on the shooting icon 215 is detected, the electronic device 100 obtains the image currently displayed in the display area 430. In this way, the effect of obtaining a picture / video of the target subject without moving the electronic device 100 can be achieved, and the tracking of the target subject is realized.

[0159] In some embodiments, based on the above Figure 8a When the electronic device 100 receives a user operation for the user interface, the electronic device 100 triggers the target tracking mode, and the electronic device 100 can directly display the following Figure 8c The interface shown.

[0160] It can be understood that the manner in which the electronic device 100 determines the target subject from multiple target objects is not limited to the above exemplary manner, and the present application does not impose any limitation on this.

[0161] The above describes the display interface involved in a target tracking method in an embodiment of the present application. The following describes the implementation principle of a target tracking method provided by the present application. Fig. 9 As shown, Fig. 9A method flow chart of a target tracking method provided in an embodiment of the present application, the target tracking method steps may include:

[0162] S101. The electronic device 100 acquires image data and determines a target subject in the image data.

[0163] The electronic device 100 acquires image data, wherein the electronic device 100 may acquire image data collected in real time by a camera, for example Figure 4a The display screen in the preview box 221 in is the image data collected in real time by the electronic device 100 through the camera. The electronic device 100 can also obtain image data sent by other devices, or it can be image data stored by the electronic device 100. Then, the electronic device 100 performs subject recognition on the acquired image data based on the target detection algorithm (which can also be a target recognition, tracking or feature matching algorithm) and determines the target subject, or the electronic device 100 can also determine the target subject in the image data based on the received user operation.

[0164] In some embodiments, the electronic device 100 displays a first interface. The first interface displays an image captured by the electronic device 100 through a camera. Optionally, the first interface may be a preview interface of a camera application. The electronic device 100 receives a first operation on the first interface. In response to the first operation, the electronic device 100 triggers a target tracking mode to determine a target subject in the acquired image data. The first operation may be a touch operation, a voice operation, a floating gesture operation, etc., which are not limited here. For example, the first interface is as follows Figure 3b The preview interface of the camera application shown in FIG. 1 may be a user operation of increasing the display magnification, and then the electronic device 100 displays the following Figure 4a In the interface shown, the electronic device 100 determines the target subject in the acquired image data, for example Figure 4a The person in the preview frame 211 is the target subject.

[0165] In some embodiments, the electronic device 100 collects image data in real time through a camera and performs subject recognition on the collected image data. Among them, the electronic device 100 performs target detection on the collected image through a target detection algorithm to obtain one or more target objects in the image, and the one or more target objects can be people, animals, objects, buildings, etc. The electronic device 100 determines the target subject among the one or more target objects. It should be noted that the electronic device 100 performs subject recognition on the collected image data, and the remaining part of the collected image data except for the target subject is considered to be the background part.

[0166] In some embodiments, after the electronic device 100 detects one or more target objects in the image, it determines the target subject in the one or more target objects according to a preset rule. The preset rule may be the target object at the most central position in the currently acquired image; the preset rule may also be the target object occupying the largest image area in the currently acquired image; and so on.

[0167] In some embodiments, when the electronic device 100 performs target detection on the acquired image through the target detection algorithm, the electronic device 100 analyzes and processes the multiple frames of images to determine the moving objects in the multiple frames of images, that is, the one or more target objects are moving objects. It should be noted that, except for the one or more target objects in the acquired image data, the rest is considered to be the background part.

[0168] In some embodiments, after the electronic device 100 detects one or more target objects in the image, it provides the user with selection icons for the one or more target objects on the display interface, and the electronic device 100 receives a user operation on the one or more target objects, analyzes the click position of the user operation, and determines the target subject in the one or more target objects. Figure 8c As shown in , the electronic device 100 detects two target objects (person 1 and person 2) in the image, the electronic device 100 receives a user operation on the display area of ​​person 1, analyzes the click position of the user operation, and the electronic device 100 determines that the target subject is person 1.

[0169] S102: The electronic device 100 determines a motion path of the target subject.

[0170] After the electronic device 100 performs subject recognition and determines the target subject, it tracks the motion path formed by the target subject based on multi-frame image analysis, and the motion path is also called the subject motion path.

[0171] Generally speaking, the image frames collected by the electronic device 100 are N+2 frames, and the screen displayed in the display area by the electronic device 100 in real time is the Nth frame image collected by the electronic device 100, where N is a positive integer. The multi-frame image here refers to the N+2 frame image, and the electronic device 100 determines the motion path of the target subject based on the collected N+2 frame image.

[0172] A target subject motion path is described by a motion path in the X-axis direction and a motion path in the Y-axis direction. The present application embodiment takes the motion path in the X-axis direction as an example. Fig.10 As shown, Fig.10 A line graph of the motion paths of the target subject and the background is shown. Fig.10 In , the ordinate is the pixel coordinate in the x-axis direction, and the abscissa is the number of image frames in the order of time t. Fig.10 The path ① in the figure is the motion path of the target subject in the x-axis direction, and the motion path of the target subject can be drawn based on a target point on the target subject. The electronic device 100 obtains the pixel coordinates of the target point on each frame of the original image, and the electronic device 100 determines the motion path of the target point in the x-axis direction in different image frames based on the pixel coordinates of the target point in the x-axis direction in different image frames as the motion path of the target subject in the x-axis direction.

[0173] Optionally, the motion path of the target subject can also be drawn based on an area on the original image, where the area is of fixed size and the image of the target subject is always within the area. The electronic device 100 obtains the pixel coordinates of a target point in the area on each frame of the image (the center point of the area is taken as an example below), and the electronic device 100 determines the motion path of the center point in the x-axis direction in different image frames based on the pixel coordinates of the center point of the area in the x-axis direction on different image frames as the motion path of the target subject.

[0174] Optionally, the motion path of the target subject may also be drawn based on multiple target points on the target subject. The electronic device 100 obtains the pixel coordinates of the multiple target points on each frame of the original image, and the electronic device 100 determines the motion path of each of the multiple target points in the x-axis direction in different image frames based on the pixel coordinates of the multiple target points in the x-axis direction on different image frames. The electronic device 100 weights the motion paths of the multiple target points and determines at least one motion path as the motion path of the target subject.

[0175] It should be noted that the above describes the motion path of the target subject in the x-axis direction, wherein the principle description of the motion path of the target subject in the y-axis direction is the same as the principle description of the motion path in the x-axis direction, and will not be repeated here.

[0176] S103: The electronic device 100 determines a moving path of the background.

[0177] The electronic device 100 performs subject recognition on the collected image data, and the remaining part of the collected image data except for the target subject is considered as the background part.

[0178] The electronic device 100 analyzes and tracks a motion path formed by the background based on multiple frame images, and the motion path is also called a background motion path, wherein the multiple frame images here refer to N+2 frame images.

[0179] A background motion path is described by a motion path in the X-axis direction and a motion path in the Y-axis direction. The present application embodiment takes the motion path in the X-axis direction as an example. Fig.10 As shown, Fig.10 Path ② in the figure is the motion path of the background in the x-axis direction. The motion path of the background can be drawn based on a target point in the background. The electronic device 100 obtains the pixel coordinates of the target point in each frame of the image. Based on the pixel coordinates of the target point in the x-axis direction in different image frames, the electronic device 100 determines the motion path of the target point in the x-axis direction in different image frames as the motion path of the background in the x-axis direction.

[0180] Optionally, the motion path of the background can also be drawn based on multiple target points in the background. The electronic device 100 obtains the pixel coordinates of the multiple target points on each frame of the image, and the electronic device 100 determines the motion path of each of the multiple target points in the x-axis direction in different image frames based on the pixel coordinates of the multiple target points in the x-axis direction on different image frames. The electronic device 100 weights the motion paths of the multiple target points and determines at least one motion path as the motion path of the background.

[0181] Optionally, the motion path of the background can also be drawn based on the posture difference data of the previous frame and the current frame. The electronic device 100 measures the posture transformation of the electronic device 100 based on the 6-degree-of-freedom (DFO) technology or the 3DOF technology, and the electronic device 100 converts the spatial position change into the pixel coordinate change of the background motion path, thereby describing the motion path of the background.

[0182] The above describes the movement path of the background in the x-axis direction, wherein the principle description of the movement path of the background in the y-axis direction is the same as the principle description of the movement path in the x-axis direction, and is not repeated here.

[0183] It should be noted that step S104 and step S105 have no sequence.

[0184] S104: The electronic device 100 determines a smooth path of the background based on the motion path of the target subject and the motion path of the background.

[0185] The electronic device 100 determines a smooth path of the background based on the motion path of the target subject and the motion path of the background. The electronic device 100 drives the background to move based on the smooth path, thereby achieving stable tracking of the target subject.

[0186] First, the electronic device 100 determines the difference line between the target subject and the guide point based on the motion path of the target subject. The difference line can also be called a displacement guide line, which is used to indicate the displacement of the target subject from the guide point. Here, the guide point is the position where the electronic device 100 wants the target subject to be displayed in the output box. Generally speaking, the electronic device 100 defaults the guide point to the center point of the output box; in some embodiments, the electronic device 100 can determine the guide point based on the received user operation.

[0187] Among them, the center and proportion of the output box are fixed relative to the original image captured by the electronic device 100. The electronic device 100 sets the guide point in the output box. Based on the difference line between the target subject and the guide point, the electronic device 100 can display the target point of the target subject on the guide point, and the target subject is displayed in the area where the guide point is located.

[0188] The target point of the target body may be any point on the target body. The preset guide point of the electronic device 100 may be any point of the output frame.

[0189] For example, the electronic device 100 can set the guide point at the center point of the output frame. Based on the difference line between the target point of the target subject and the center point of the output frame, the electronic device 100 guides the target point of the target subject to be displayed at the center point of the output frame, so as to achieve the effect of always displaying the target subject in the middle area of ​​the output frame. In the embodiment of the present application, the electronic device 100 can use any coordinate point in the output frame as the guide point, and always display the target point of the target subject at the guide point, so as to achieve the effect of displaying the target subject at any position in the display area.

[0190] The difference polyline between the target subject and the preset guide point is the difference in pixel coordinates between the target point of the target subject and the preset guide point, such as Fig.11 As shown, Fig.11 Path ③ in the figure is a pixel difference polyline between the target point of the target subject and the preset guide point in the X-axis direction. The electronic device 100 obtains the pixel coordinates of the target point on each frame image, and the electronic device 100 determines the difference polyline between the target subject and the preset guide point as shown in path ③ based on the pixel coordinate difference between the target point and the preset guide point in the X-axis direction on different image frames.

[0191] Then, the electronic device 100 determines a smooth path of the background based on the difference polyline and the motion path of the background. Fig.11As shown, path ② is an exemplary motion path of the background. The electronic device 100 determines the smooth path of the background based on the difference polyline (path ③) and the motion path of the background (path ②). The smooth path must be smooth and tend to the midpoint. It can be seen that at points f0 and f9, the points on the smooth path are the midpoints of paths ③ and ②; and at point f16, if the midpoint of paths ③ and ② is taken as the point on the smooth path, the smooth path will be uneven. Therefore, in order to ensure smoothness, the smooth path of point f16 is not taken at the midpoint. That is, the points on the smooth path are determined on the basis of smoothness and then tend to the midpoint of paths ③ and ②.

[0192] The electronic device 100 drives the background movement based on the smooth path, and can achieve stable tracking of the target subject.

[0193] It should be noted that the smooth path of the background includes a path in the X-axis direction and a path in the Y-axis direction. The above solution process is described using the movement in the X-axis direction as an example, and the smooth path obtained is the smooth path in the X-axis direction. In the Y-axis direction, the electronic device determines the movement path of the target subject and the movement path of the background, and then determines the smooth path in the Y-axis direction based on the movement path of the target subject and the movement path of the background in the Y-axis direction. This is the same principle as solving the smooth path in the X-axis direction, and will not be repeated here.

[0194] In some embodiments, since the smooth path is solved in the X-axis direction, the electronic device 100 further optimizes the smooth path based on the left boundary line of the output image and the right boundary line of the output image, such as Fig.11 As shown, Fig.11 Path ④ in the figure is the left boundary line of the output image, and path ⑤ is the right boundary line of the output image. Path ④ and path ⑤ are pixel coordinates of the left boundary and the right boundary of the output frame on each frame image after the electronic device 100 performs warp processing on the original image data. When determining the smooth path of the background, the electronic device 100 always limits the smooth path of the background to between the left boundary line of the output image and the right boundary line of the output image, so as to avoid making the boundary of the output frame outside the boundary of the background.

[0195] Similarly, when solving the smooth path in the Y-axis direction, the electronic device 100 further optimizes the smooth path based on the upper boundary line of the output graph and the lower boundary line of the output graph.

[0196] In this implementation, based on the smooth path determined by the above method, the electronic device 100 drives the background to warp through the smooth path, which can simultaneously achieve anti-shake and tracking.

[0197] S105: The electronic device 100 warps the acquired image based on the smooth path and outputs the warped image.

[0198] After the electronic device 100 determines the smooth path of the background, it calculates the transformation matrix from the original motion path of the background to the smooth path obtained based on the smooth path, warps the original image onto the smooth path, and outputs the warped image. The output image is an image that achieves stable tracking of the target subject. At this time, the electronic device 100 achieves anti-shake of the background and tracking of the target subject.

[0199] like Fig.12a As shown, Fig.12a , shows the effect of moving an image frame (Nth frame) collected by the electronic device 100 according to the smooth path. Among them, the electronic device 100 collects an original image frame (Nth frame), and the original image frame includes a person (indicated by a solid line). At this time, when there is no displacement guide line (difference line) involved in background smoothing, the background smoothing path is near the original path, and the person cannot be displayed in the output frame. When the electronic device 100 enters the target tracking mode, the electronic device 100 tracks the person based on the collected original image frame. When the electronic device receives an instruction to track the person, the electronic device 100 warps the original image frame. The dotted frame is an image frame after the original image frame is warped, wherein the dotted frame also includes a person (indicated by a dotted line), corresponding to the person in the original image frame. The electronic device 100 moves the image frame indicated by the dotted frame based on the smooth path obtained by solving step S104, and can move the person to the output frame to achieve smooth tracking of the person.

[0200] Similarly, if Figure 12b As shown, the electronic device 100 captures the N+1th frame image, and the electronic device 100 performs warp processing on the N+1th frame image. The dotted box is the image frame after the N+1th frame image is warped. The electronic device 100 moves the image frame indicated by the dotted box based on the smooth path solved in step S104, and can move the person into the output box to achieve smooth tracking of the person. Fig.12a and Figure 12b It can be seen that the positions of the characters in the Nth frame image and the N+1th frame image in the output frame are the same, that is, the preset guide point of the electronic device 100 is the position of the current character in the output frame.

[0201] In the embodiment of the present application, the electronic device 100 drives the background to move by the movement of the target subject so that the target subject moves to the output screen. In the process of solving the smooth path of the background, the two aspects of anti-shake smoothing and tracking are taken into account simultaneously, and the tracking of the target subject and the path smoothing of the background can share the same widest cropping boundary (i.e., the boundary of the original image data). In this way, the anti-shake space is not limited, and the tracking effect can also be provided at a lower field of view, avoiding the problem that the subject visible in the original image is difficult to track due to the reduction of the cropping boundary.

[0202] Furthermore, as a method that needs to run in real time on a mobile phone, we cannot obtain a lot of future frame information and combine the image flow motion path of the future frame to give the best path for the current frame. In particular, in the camera application's photo preview mode, only a limited number (e.g., two) of future frame image information can be obtained.

[0203] Generally speaking, the image frames collected by the electronic device 100 are N+2 frames, and the picture displayed in real time in the display area by the electronic device 100 is the Nth frame of image collected by the electronic device 100, where N is a positive integer. At present, since anti-shake and target tracking are two separate algorithms, if the electronic device 100 wants to perform anti-shake and target tracking, the electronic device 100 first implements anti-shake processing on the Nth frame of image based on the N+2 frame of image, and then the electronic device 100 can only track the target subject based on the Nth frame of image, that is, the electronic device 100 can only use the Nth frame of image to track the target subject, which will cause the output picture to be unable to display to the Nth frame, resulting in a delay in the output picture.

[0204] The embodiment of the present application directly solves the target subject tracking and background path anti-shake in parallel, so that the smooth windows of anti-shake and tracking can share future frame information, thereby better balancing tracking and stability.

[0205] In some embodiments, the electronic device 100 can collect original images based on a telephoto camera, or can collect images based on a wide-angle camera, that is, the image collected by the electronic device 100 is a wide-angle image with a larger field of view. Based on the wide-angle image, the electronic device 100 uses a target detection algorithm to perform subject recognition on the collected image and determine the target subject. In this way, by obtaining a wide-angle image with a larger field of view, tracking in a larger range can be achieved.

[0206] The above embodiment describes the method of tracking the target subject by the electronic device 100 when the electronic device 100 recognizes a target subject. The following embodiment of the present application describes the method of tracking the multiple target subjects when the electronic device 100 recognizes that the image captured by the camera includes multiple target subjects. Fig.13 As shown, Fig.13A method flow chart of another target tracking method provided in an embodiment of the present application, the target tracking method steps may include:

[0207] S201. The electronic device 100 performs subject recognition on the acquired image data and determines N target subjects, where N is a positive integer greater than 1.

[0208] The electronic device 100 acquires image data, wherein the electronic device 100 may acquire image data collected in real time by a camera, may acquire image data sent by other devices, or may acquire image data stored by the electronic device 100. Then, the electronic device 100 performs subject recognition on the acquired image data based on a target detection algorithm and determines N target subjects, or the electronic device 100 may also determine N target subjects based on received user operations.

[0209] In some embodiments, the electronic device 100 collects image data in real time through a camera and performs subject recognition on the collected image data. Among them, the electronic device 100 performs target detection on the collected image through a target detection algorithm, and obtains multiple target objects in the image. The multiple target objects can be people, animals, objects, buildings, etc. The electronic device 100 determines N target subjects from these multiple target objects. Among them, the electronic device 100 can determine N target subjects from multiple target objects according to preset rules. For example, the preset rule can be the target object closest to the center position and the second closest to the center position in the currently collected image; the preset rule can also be the target objects occupying the largest and second largest image area in the currently collected image; and so on.

[0210] In some embodiments, after the electronic device 100 detects multiple target objects in the image, it provides the user with selection icons of the multiple target objects on the display interface, and the electronic device 100 receives the user's operation on the selection icons of the multiple target objects, analyzes the click position of the user operation, and determines N target subjects. For example, when the user clicks the selection icons corresponding to two target objects respectively, the electronic device 100 determines that the two objects are two target subjects.

[0211] It should be noted that the electronic device 100 performs subject recognition on the collected image data, and the remaining part of the collected image data except for the target subject is considered as the background part.

[0212] S202: The electronic device 100 determines a set of motion paths of N target entities.

[0213] After the electronic device 100 performs subject recognition and determines N target subjects, it determines the motion path of each of the N target subjects. For how to determine the motion path of the target subject, please refer to the relevant description in the above step S102, which will not be repeated here.

[0214] The electronic device 100 determines a motion path of each target subject among the N target subjects, and acquires a motion path set of the target subjects, wherein the motion path set includes a motion path of each target subject among the N target subjects.

[0215] S203: The electronic device 100 determines a moving path of the background.

[0216] Here, the relevant description of step S203 can refer to the description of the above step S103, which will not be repeated here.

[0217] S204: The electronic device 100 determines a smooth path of the background based on the motion path sets of the N target subjects and the motion path of the background.

[0218] The electronic device 100 determines a smooth path of the background based on the motion path set of the N target subjects and the motion path of the background. The electronic device 100 drives the background to move based on the smooth path, thereby achieving stable tracking of the N target subjects.

[0219] First, the electronic device 100 determines a difference polyline between each target subject and a preset guide point based on a set of motion paths of the N target subjects, that is, determines N difference polylines. In some embodiments, the electronic device 100 performs weighted averaging on the N difference polylines to obtain a difference polyline that optimizes the average distance between each target subject and the preset guide point.

[0220] In some embodiments, the electronic device 100 estimates the output image score of the N difference polylines by composition score or aesthetic score, for example, the closer the position of the target subject in the output image is to the center, the higher the score is. The electronic device 100 selects the one with the highest score from the N difference polylines as the determined difference polyline.

[0221] In some embodiments, the electronic device 100 scores the N difference polylines based on the position and size of each target subject on the input image and the size of the final output image. For example, the closer the size of the target subject on the input image and the size of the output image are, the higher the score is. The electronic device 100 selects the one with the highest score from the N difference polylines as the determined difference polyline.

[0222] Then the electronic device 100 determines a smooth path based on the difference line and the background motion path. Here, how the electronic device 100 determines a smooth path based on the difference line and the background motion path can refer to the relevant description in the above step S104, which will not be repeated here.

[0223] S205: The electronic device 100 warps the acquired image based on the smooth path and outputs the warped image.

[0224] Here, the relevant description of step S205 can refer to the description of the above step S105, which will not be repeated here.

[0225] The embodiment of the present application realizes joint tracking of multiple target subjects by identifying multiple target subjects.

[0226] Fig.14 A step flow of a target tracking method provided in an embodiment of the present application.

[0227] Step S301, the electronic device 100 turns on the target tracking mode;

[0228] The method for enabling the target tracking mode of the electronic device 100 can refer to the above Figure 3b and Figure 4a Related description.

[0229] Step S302: the electronic device 100 determines a target subject to be tracked according to an original image captured by a camera of the electronic device 100;

[0230] The electronic device 100 may determine the target subject through a target detection algorithm, or may determine the target subject through a received user operation. Figure 4a and Figure 4b Related description.

[0231] Step S303: the electronic device 100 displays a first tracking picture in the display area, wherein the first tracking picture includes a target subject, and the target subject is located at a first position in a framing area of ​​the camera;

[0232] The first tracking picture may be, for example, Figure 4b In the picture shown, the target subject (person) is located at the left edge (first position) of the camera's framing area (the picture displayed in the preview frame 221).

[0233] Step S304: When the target subject moves, the electronic device 100 displays a second tracking picture in the display area, and the second tracking picture shows that the target subject is located at a second position of the camera's framing area.

[0234] The second tracking screen may be, for example, Figure 4c In the picture shown, the target subject (person) has moved to the right relative to 4b, and the second position is different from the first position.

[0235] In the embodiment of the present application, the electronic device 100 can track the target of the collected original image. After the electronic device 100 determines the target subject in the original image, when the target subject moves from the first position to the second position, the display area of ​​the electronic device 100 always displays the target subject in the screen. Here, the original image collected by the camera refers to all image data that can be collected by the camera. The embodiment of the present application tracks the target subject based on the image range of the original image, thereby achieving a larger tracking range.

[0236] In a possible implementation, the electronic device 100 does not move, and the camera's framing area remains unchanged. The tracking of the target subject in the embodiment of the present application may be to track the moving target subject while the electronic device 100 is stationary, which can improve the stability of the target subject displayed in the output screen. Among them, the embodiment of the present application may also be to track the moving target subject while the electronic device 100 is moving, and always display the target subject in the output screen; or it may be to track the non-moving target subject while the electronic device 100 is moving, and always display the target subject in the output screen.

[0237] In a possible implementation, the original image is not subjected to anti-shake or deblurring processing, or the original image includes all objects within the camera's framing area. The embodiment of the present application tracks the target subject based on the image range of the original image, thereby achieving a larger tracking range. When the target subject is located at the edge area of ​​the original image, the electronic device 100 can also track the target subject.

[0238] In a possible implementation, the method further includes: the electronic device 100 displays the original image captured by the camera in a preview frame, and the preview frame occupies a part or all of the display area. The preview frame can be a picture-in-picture frame, which is superimposed on the display area so that the user can more intuitively see the comparison between the original image and the tracking picture of the display area. The preview frame can also occupy the entire screen of the display area, for example, the preview frame is first displayed in the entire screen of the display area, and then the preview frame is superimposed on the display area. For example, the preview frame can be Figure 4a to Figure 4f The preview box 221 shown in FIG.

[0239] In a possible implementation, the electronic device 100 determines the target subject to be tracked based on the original image captured by the camera of the electronic device 100, including: the electronic device 100 receives the first operation of the user in the preview box, the first operation indicates the target subject selected by the user; the electronic device 100 determines the target subject to be tracked based on the first operation. Wherein, the original image captured by the camera is displayed in the preview box, and the image displayed in the preview box includes the target subject. The electronic device 100 can determine the target subject based on the first operation of the user on the preview box, where the first operation can be, for example, a click operation on the display position of the target subject. That is, the electronic device 100 can determine the target subject based on the user's operation.

[0240] In a possible implementation, the electronic device 100 determines the target subject to be tracked based on the original image captured by the camera of the electronic device 100, including: the electronic device 100 automatically detects the original image captured by the camera of the electronic device 100 based on a preset target detection algorithm to determine the target subject to be tracked. Here, the preset target detection algorithm can be a target detection algorithm for a specific category of objects, such as a target detection algorithm for detecting people, such as a target detection algorithm for detecting animals, such as a target detection algorithm for detecting objects, such as a target detection algorithm for detecting moving objects, and so on.

[0241] In a possible implementation, the preview box also includes an output box, and the image in the output box corresponds to the picture displayed in the display area. The output box is used to indicate which area of ​​the original image the picture currently displayed in the display area is. For example, the output box can be Figure 4a The dashed box 221B in the figure may be Figure 4b The solid line box 221C in the figure may be Figure 4c The solid line frame 221D in the figure may be Figure 4d The solid line box 221E in the figure can be Figure 4e The solid line box 221F in the figure can be Figure 4f The solid line frame 221G in FIG.

[0242] In a possible implementation, the method further includes: the electronic device 100 determines a guide point in the output frame, the guide point indicating the display position of the target subject; the electronic device 100 displays the target subject at the first position in the first tracking screen, or displays the target subject at the second position in the second tracking screen according to the guide point. Here, the guide point is used to determine the display position of the target subject in the output frame. If the guide point is at the center point of the output frame, the target subject is displayed at the center position of the first tracking screen in the first tracking screen, and is displayed at the center position of the second tracking screen in the second tracking screen. In this way, the electronic device 100 can stably display the target subject at the position where the guide point is located, thereby achieving a stable tracking effect. For example Figure 4a to Figure 4f The middle guide point is the center point of the output box. Figure 7a to Figure 7d The middle guide point is a point slightly to the left of the output box.

[0243] In a possible implementation, the electronic device 100 determines the guide point in the output box, including: the electronic device 100 determines the guide point in the output box according to a default setting, or the electronic device 100 receives a second operation of the user, the second operation of the user indicating the position of the guide point selected by the user in the output box. Here, a method is provided in which the electronic device 100 can determine the guide point by default setting and user operation.

[0244] In a possible implementation, the electronic device 100 displays the target subject at the first position on the first tracking screen or displays the target subject at the second position on the second tracking screen according to the guide point, including: the electronic device 100 determines the motion path of the target subject; the electronic device 100 determines the difference line between the target subject and the guide point based on the motion path of the target subject; the electronic device 100 determines the motion path of the background in the original image; the electronic device 100 determines the smooth path based on the motion path and the difference line of the background; the electronic device 100 wraps the original image based on the smooth path; the electronic device 100 displays the warped image in the display area, and the image displayed in the display area corresponds to the image in the output frame. Here, the algorithm principle of the electronic device 100 to achieve stable tracking of the target subject is described. Based on the idea of ​​foreground driving background, the electronic device 100 drives the background movement through the movement of the target subject to move the target subject to the output screen. In the process of solving the smooth path of the background, the electronic device 100 determines the difference line between the motion path of the target subject and the guide point, and uses the difference line as a guide reference item for background smoothing to obtain the smooth path of the background. Based on the smooth path, the original image collected by the electronic device 100 is warped, so that the target subject can be stably displayed at the position of the guide point in the output frame. The electronic device 100 solves the smooth path of the background at one time, and simultaneously considers the two aspects of anti-shake smoothing and tracking. The tracking of the target subject and the path smoothing of the background can share the same widest cropping boundary (i.e., the boundary of the original image). It is achieved that the target subject can be tracked while the background is smoothed, and the followability and smoothness of the tracking result are taken into account.

[0245] In a possible implementation, the electronic device 100 starts the target tracking mode including: the electronic device 100 detects a third operation of the user, the third operation includes an operation of increasing the zoom ratio or the user directly turns on a switch of the target tracking mode. Here, a method for the electronic device 100 to start the target tracking mode based on the user operation is provided.

[0246] In a possible implementation, the operation of increasing the zoom ratio indicates a display ratio selected by the user; the electronic device 100 displays the first tracking picture or the second tracking picture in the display area according to the display ratio.

[0247] In a possible implementation, the camera is a telephoto camera. Generally speaking, at a high display magnification, the electronic device 100 uses a telephoto camera to collect image data.

[0248] In a possible implementation, the increased zoom ratio is greater than a preset ratio, which may be 15 times, for example.

[0249] In a possible implementation, when the second position is the edge position of the camera's framing area, the second tracking image includes the target subject. Since the electronic device 100 solves the smooth path of the background once, both anti-shake smoothing and tracking are taken into account simultaneously, and the tracking of the target subject and the path smoothing of the background can share the same widest cropping boundary (i.e., the boundary of the original image). In this way, even if the target subject is at the edge position in the original image, the electronic device 100 can still track the target subject, solving the problem that the electronic device 100 cannot track the target subject even if it has captured an image of the target subject because the target subject is at the edge of the shooting area of ​​the electronic device 100.

[0250] In the above embodiments, it can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, the process or function described in the embodiment of the present application is generated in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in a computer-readable storage medium, or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from a website site, computer, server or data center by wired (e.g., coaxial cable, optical fiber, digital subscriber line) or wireless (e.g., infrared, wireless, microwave, etc.) mode to another website site, computer, server or data center. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server or data center that contains one or more available media integration. The available medium can be a magnetic medium, (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state hard disk), etc.

[0251] Those skilled in the art can understand that to implement all or part of the processes in the above-mentioned embodiments, the processes can be completed by computer programs to instruct related hardware, and the programs can be stored in computer-readable storage media. When the programs are executed, they can include the processes of the above-mentioned method embodiments. The aforementioned storage media include: ROM or random access memory RAM, magnetic disk or optical disk and other media that can store program codes.

Claims

1. A target tracking method, characterized in that: The method comprises: The electronic device turns on the target tracking mode; The electronic device determines a target subject to be tracked according to an original image captured by a camera of the electronic device; The electronic device displays a first tracking picture in a display area, wherein the first tracking picture includes the target subject, and the target subject is located at a first position in a framing area of ​​the camera; The electronic device displays the original image captured by the camera in a preview frame, the preview frame occupies a part or all of the display area, the preview frame also includes an output frame, and the image in the output frame corresponds to the picture displayed in the display area; The electronic device determines a guide point in the output frame, the guide point indicating a display position of the target subject; The electronic device displays the target subject located at the first position on the first tracking screen according to the guide point; When the target subject moves, the electronic device displays a second tracking screen in the display area, and the second tracking screen shows that the target subject is located at a second position of the camera's framing area, and according to the guide point, the target subject at the second position is displayed on the second tracking screen.

2. The method according to claim 1, characterized in that The electronic device does not move, and the viewing area of ​​the camera remains unchanged.

3. The method according to claim 1, characterized in that The original image has not been subjected to anti-shake or deblurring processing, or the original image includes all objects within the viewing area of ​​the camera.

4. The method according to claim 1, characterized in that: The electronic device determines the target subject to be tracked according to the original image collected by the camera of the electronic device, including: The electronic device receives a first operation of a user in the preview box, where the first operation indicates the target subject selected by the user; and the electronic device determines the target subject to be tracked according to the first operation.

5. The method according to claim 1, characterized in that The electronic device determines the target subject to be tracked according to the original image collected by the camera of the electronic device, including: The electronic device performs automatic target detection on the original image captured by the camera of the electronic device based on a preset target detection algorithm to determine the target subject to be tracked.

6. The method according to claim 1, characterized in that The electronic device determining the guidance point in the output frame includes: The electronic device determines the guide point in the output frame according to a default setting, or the electronic device receives a second operation of a user, wherein the second operation of the user indicates a position of the guide point selected by the user in the output frame.

7. The method according to claim 1, characterized in that The electronic device displays the target subject located at the first position on the first tracking screen or displays the target subject located at the second position on the second tracking screen according to the guide point, including: The electronic device determines the motion path of the target subject; The electronic device determines a difference polyline between the target body and the guide point based on the motion path of the target body; The electronic device determines a motion path of the background in the original image; The electronic device determines a smooth path based on the motion path of the background and the difference polyline; The electronic device performs wrap processing on the original image based on the smooth path; The electronic device displays the warped image in the display area, and the picture displayed in the display area corresponds to the image in the output frame.

8. The method according to claim 1, characterized in that The electronic device starting the target tracking mode includes: The electronic device detects a third operation of the user, where the third operation includes an operation of increasing the zoom ratio or a switch of the user directly turning on a target tracking mode.

9. The method according to claim 8, characterized in that The operation of increasing the zoom ratio indicates a display ratio selected by the user; the electronic device displays the first tracking screen or the second tracking screen in the display area according to the display ratio.

10. The method according to claim 9, characterized in that The camera is a telephoto camera.

11. The method according to claim 8, characterized in that The increased zoom ratio is greater than the preset ratio.

12. The method according to any one of claims 1 to 11, characterized in that: When the second position is an edge position of the framing area of ​​the camera, the second tracking picture includes the target subject.

13. An electronic device, characterized in that: include: One or more processors, one or more memories; the one or more memories are respectively coupled to the one or more processors; the one or more memories are used to store computer program codes, the computer program codes include computer instructions; when the computer instructions are executed on the processor, the electronic device executes the method as described in any one of claims 1 to 12.

14. A computer-readable medium for storing one or more programs, wherein the one or more programs are configured to be executed by the one or more processors, the one or more programs comprising instructions for executing the method according to any one of claims 1-12.

15. A target tracking method, characterized in that: The method comprises: Start target tracking; Collect original images; Determining a target subject to be tracked according to the original image; Outputting information of a first tracking picture, wherein the first tracking picture includes the target subject, and the target subject is located at a first position in a framing area; Outputting information of the original image, outputting information of an output frame displayed on the original image, wherein the image in the output frame corresponds to the output tracking screen; Determining a guide point in the output frame, the guide point indicating a display position of the target subject; outputting information of the target subject at the first position displayed in the first tracking screen, wherein the position of the target subject at the first position displayed in the first tracking screen is determined according to the guide point; Outputting information of a second tracking screen, wherein the second tracking screen shows that the target subject is located at a second position of a framing area, outputting information of the target subject at the second position displayed in the second tracking screen, wherein the position of the target subject at the second position displayed in the second tracking screen is determined according to the guide point.

16. A camera module, characterized in that: comprising an input unit, an output unit and at least one camera; The input unit is used to start target tracking according to the instruction of the electronic device; The at least one camera is used to collect an original image, and determine a target subject to be tracked according to the original image; The output unit is used to output information of the original image and information of an output frame displayed on the original image, wherein the image in the output frame corresponds to an output tracking screen; The at least one camera is further used to determine a guide point in the output frame, the guide point indicating a display position of the target subject; The output unit is used to output information of a first tracking screen, the first tracking screen includes the target subject, the target subject is located at a first position of a framing area, and information displayed on the first tracking screen of the target subject at the first position is output, and the position of the target subject located at the first position in the first tracking screen is determined according to the guide point; and output information of a second tracking screen, the second tracking screen displays that the target subject is located at a second position of the framing area, and information displayed on the second tracking screen of the target subject at the second position is output, and the position of the target subject located at the second position in the second tracking screen is determined according to the guide point.