WO2022062985A1 - Method and apparatus for adding special effect in video, and terminal device - Google Patents

Method and apparatus for adding special effect in video, and terminal device Download PDF

Info

Publication number
WO2022062985A1
WO2022062985A1 PCT/CN2021/118451 CN2021118451W WO2022062985A1 WO 2022062985 A1 WO2022062985 A1 WO 2022062985A1 CN 2021118451 W CN2021118451 W CN 2021118451W WO 2022062985 A1 WO2022062985 A1 WO 2022062985A1
Authority
WO
WIPO (PCT)
Prior art keywords
sliding
screen
area
special effect
finger
Prior art date
Application number
PCT/CN2021/118451
Other languages
French (fr)
Chinese (zh)
Inventor
吴霞
张硕
Original Assignee
荣耀终端有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 荣耀终端有限公司 filed Critical 荣耀终端有限公司
Publication of WO2022062985A1 publication Critical patent/WO2022062985A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/14Systems for two-way working
    • H04N7/141Systems for two-way working between two video terminals, e.g. videophone
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/01Input arrangements or combined input and output arrangements for interaction between user and computer
    • G06F3/048Interaction techniques based on graphical user interfaces [GUI]
    • G06F3/0487Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser
    • G06F3/0488Interaction techniques based on graphical user interfaces [GUI] using specific features provided by the input device, e.g. functions controlled by the rotation of a mouse with dual sensing arrangements, or of the nature of the input device, e.g. tap gestures based on pressure sensed by a digitiser using a touch-screen or digitiser, e.g. input of commands through traced gestures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/41Structure of client; Structure of client peripherals
    • H04N21/426Internal components of the client ; Characteristics thereof
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/41Structure of client; Structure of client peripherals
    • H04N21/426Internal components of the client ; Characteristics thereof
    • H04N21/42653Internal components of the client ; Characteristics thereof for processing graphics
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/431Generation of visual interfaces for content selection or interaction; Content or additional data rendering
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/43Processing of content or additional data, e.g. demultiplexing additional data from a digital video stream; Elementary client operations, e.g. monitoring of home network or synchronising decoder's clock; Client middleware
    • H04N21/431Generation of visual interfaces for content selection or interaction; Content or additional data rendering
    • H04N21/4312Generation of visual interfaces for content selection or interaction; Content or additional data rendering involving specific graphical features, e.g. screen layout, special fonts or colors, blinking icons, highlights or animations
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/478Supplemental services, e.g. displaying phone caller identification, shopping application
    • H04N21/4788Supplemental services, e.g. displaying phone caller identification, shopping application communicating with other users, e.g. chatting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/14Systems for two-way working
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Definitions

  • the present application relates to the field of mobile communications, and in particular, to a method, apparatus and terminal device for adding special effects to video.
  • special effects icons are usually displayed on the incoming call interface, and the user can click on the special effects icons to expand the special effects menu or the beauty adjustment bar.
  • users need to apply special effects, they need to click the special effect icon to expand the special effect editing menu, and then click to select the special effect thumbnail or slide in the menu to adjust the beauty level.
  • the user interaction process the user needs at least two clicks to activate the specified special effect, the interaction process is cumbersome, the entire process takes a long time, and the click area of the icon is relatively small, which is inconvenient to operate quickly. Therefore, it cannot meet the purpose of quickly enabling special effects in the state of incoming calls.
  • embodiments of the present application provide a method, apparatus and terminal device for adding special effects to a video, so as to solve the technical problem in the prior art that it is inconvenient and fast for a user to add special effects during a video call.
  • an embodiment of the present application provides a method for adding special effects to a video.
  • the method includes the following steps: capturing a user's gesture action, and obtaining sliding information of the gesture action; and adding special effects according to the sliding information of the gesture action.
  • the material is applied to the screen.
  • the solution provided by this embodiment is different from the problem in the prior art that the user needs at least two clicks to activate special effects during a video call, and the interaction process is cumbersome.
  • the sliding information of the action is captured and processed, which can achieve the effect of adding special effects wherever the user's finger slides.
  • the step of capturing the gesture action of the user and acquiring the sliding information of the gesture action includes: capturing and recording in real time the starting point of the user's finger sliding in the two-dimensional xy coordinate system of the screen The starting point coordinate information and the ending point coordinate information of the sliding end point; according to the starting point coordinate information and the ending point coordinate information of the finger, judge the sliding direction and sliding speed of the finger; according to the sliding direction of the finger, judge the sliding gesture adopted by the user; Wherein, the sliding information includes the starting point coordinate information of the sliding start point, the end point coordinate information of the sliding end point, the sliding gesture, the sliding direction and the sliding speed.
  • the coordinate information of the starting point of the sliding start and the coordinate information of the end point of the sliding end provide the basis for judging the sliding gesture, the sliding direction and the sliding speed.
  • the sliding gesture Provides the way the user's finger slides on the screen, the sliding direction provides the path the user's finger slides on the screen, and the sliding speed provides the speed at which the user's finger slides on the screen. Combining these sliding information can accurately know that the screen needs to be replaced The area of effect material.
  • the sliding gesture when the sliding gesture is an edge sliding gesture, the following steps are performed: according to the coordinate information of the starting point and the coordinate information of the end point of the finger, determine the coordinate displacement D of the finger on the screen The size relationship with the preset minimum distance Dmin , and the size relationship between the sliding speed V and the preset minimum speed Vmin ; when D> Dmin and V> Vmin , start the special effect material.
  • the minimum distance D min and the minimum speed V min are preset as the criteria for judging whether the user's finger slides effectively, and the coordinate displacement D and sliding speed V of the finger on the screen are calculated to determine the user's Whether the finger is really performing a gesture operation to avoid the problem of adding special effects materials by mistake due to the user's mistaken touch on the screen.
  • the sliding gesture when the sliding gesture is a corner sliding gesture, the following steps are performed: preset a starting point area; wherein, the maximum value of the abscissa of the starting point area is X max , and the maximum value of the abscissa is Y max ; according to the coordinate information of the starting point of the finger, it is judged whether the sliding starting point of the finger falls within the starting point area; if the abscissa X s ⁇ X max and the ordinate Y s ⁇ Y max of the sliding starting point of the finger, it is judged as The sliding starting point of the finger is located in the preset starting point area; according to the starting point coordinate information and the ending point coordinate information of the finger, determine the size relationship between the coordinate displacement D of the finger on the screen and the preset minimum distance D min , and the magnitude relationship between the sliding speed V and the preset minimum speed V min ; when D> Dmin , V> Vmin and the range of the slope k of the connecting line between the sliding start point
  • the starting point area and the sliding area are preset, the starting point area is used as the judgment condition for judging whether the user's finger can trigger the sliding gesture recognition, and the sliding area is used as the judgment condition for judging whether the user's finger can trigger the application of special effects material , set two judgment conditions to accurately judge whether the user's finger has a sliding gesture at the corner of the screen and the size of the area where the finger slides.
  • the sliding area set at the four corners of the screen has an edge inclination of 15° Within the range of 75°, when the user's finger performs the corner sliding gesture, it will cover part or all of the sliding area, which can meet the judgment requirements of the corner sliding gesture, and then can adaptively apply special effects materials.
  • the step of applying the special effect material on the screen according to the sliding information of the gesture action includes: dividing the screen into a first area according to the sliding information of the gesture action and the second area; perform portrait segmentation on the portrait displayed on the screen, and replace the part of the background in the first area on the screen with special effects material; wherein, the first area is the same as the gesture action
  • the area of the screen swept by the connecting line between the sliding starting point and the sliding end point and passing through the dividing line of the sliding end point, the second area is the area on the screen except the first area;
  • the sliding information includes the starting point coordinate information of the sliding start point, the end point coordinate information of the sliding end point, the sliding gesture, the sliding direction and the sliding speed.
  • first perform portrait segmentation and screen segmentation extract the portrait, and divide the screen into a first area where the finger slides and a second area that is not slid, and only the background of the first area is segmented.
  • Replacement of special effects material The method can capture the position of the finger in the sliding process in real time, so as to determine the first area that needs to replace the background.
  • the area occupied by the portrait still displays the portrait, and will not be replaced with the background, resulting in the effect that the foreground portrait remains unchanged and the background changes in the rear, so as to realize the real-time capture of the user's sliding gesture and real-time calculation of the user's finger sliding.
  • Area the ability to replace the background of the area where the user's finger slides in real time.
  • the step of dividing the screen into a first area and a second area according to the sliding information of the gesture action includes: starting point coordinate information of the sliding start point of the gesture action and the end point coordinate information of the sliding end point to create the dividing line; according to the dividing line and the sliding direction, divide the area of the screen swept by the dividing line along the sliding direction into the first area .
  • the function of the dividing line used to divide the first area and the second area in the xy coordinate system can be determined through simple operations by using the coordinate information of the starting point of the sliding start point and the coordinate information of the end point of the sliding end point, so that The first area swept by the finger can be determined on the screen.
  • the method occupies less computing resources and has a faster processing speed, and can adapt to the addition of special effects materials in a scene where the sliding speed of the gesture action is faster.
  • the step of performing portrait segmentation on the portrait displayed on the screen, and performing special effect material replacement on the part of the background in the first area on the screen includes: The original image of the portrait is down-sampled using a bilinear interpolation algorithm to obtain a down-sampled image; the outline of the person in the down-sampled image is calculated, and the outline of the person is up-sampled using a bilinear interpolation algorithm to obtain the result. the outline of the original image; segment the portrait from the original image based on the outline of the original image to obtain a first layer; replace the part of the background in the first area with special effects materials to obtain the first layer two images; superimposing the first image and the second image.
  • the original image is down-sampled, thereby greatly reducing the computational and power consumption overhead of portrait segmentation, thereby allowing the deep learning portrait segmentation model algorithm that requires a large amount of computation to run On mobile terminals with limited computing power and power consumption, it can meet the frame rate requirements of video playback.
  • the adding level of the special effect material is selected according to the area of the first area or the screen ratio of the first area to the screen.
  • the user in the process of adding special effect materials, can choose the amount of special effect materials to be added, which is reflected in the operation application, that is, the level of adding special effect materials can be selected according to the size of the area where the user's finger slides across the screen , such an operation method can meet the user's more and more complex special effects adding needs.
  • the addition level of the special effect material is correspondingly increased by one level.
  • the entire background of the screen is replaced with special effects material .
  • the method of this preferred embodiment can facilitate the user's operation and enhance the user experience.
  • the step before the step of dividing the screen into a first area and a second area according to the sliding information of the gesture action, the step includes: judging the gesture action according to the sliding speed Whether the sliding speed is valid; if the sliding speed is greater than the first speed, the background of the screen will be replaced by the overall special effect material; if the sliding speed is less than the second speed, the sliding information according to the gesture action will not be executed, The step of applying special effect material on the screen; wherein, the first speed is greater than the second speed.
  • two judgment conditions for judging the sliding speed are preset.
  • the sliding speed is greater than the first speed, it can be considered that the user needs to replace the entire background, and when the sliding speed is less than the second speed, it can be considered that the user There is no swipe gesture performed, so there is no need to initiate the step of applying the special effect material.
  • the method includes: judging The sliding direction of the gesture action; if the sliding direction is a forward direction away from the starting point of the finger sliding on the screen, a new special effect material is added; if the sliding direction is the sliding direction toward the finger on the screen When the starting point is reversed, the previous special effect material is restored.
  • the user is provided with a backtracking operation by recognizing the sliding direction, so that the user can freely select a preferred special effect material among multiple special effect materials, instead of sliding over the favorite special effect material. And worry, enhance the user experience.
  • the step of applying the special effect material on the screen according to the sliding information of the gesture action includes: according to the sliding information of the gesture action, when the gesture action is on the screen Pull out the control panel along with the sliding direction of the user at the sliding starting point on the control panel, and prevent multiple special effect materials on the control panel; apply the special effect materials on the screen.
  • the user is provided with a control panel with selectivity.
  • the special effect material is replaced, the user's visual experience is better, and the special effect material that better meets the user's needs can be selected.
  • the method before the step of applying the special effect material on the screen according to the sliding information of the gesture action, the method includes: detecting the use frequency of each special effect material, and determining the frequency of use according to the frequency of use. Sort the presentation order of the special effect materials at least.
  • the list order of the user's commonly used special effect materials can be customized according to the user's habits, so that the special effect material can be added to the background of the screen more quickly every time the user uses it, so that the user's use is more convenient and experience. better.
  • the number of special effect materials is less than 10.
  • an upper limit of the number of materials is set for the backup library of special effect materials, and these special effect materials appear cyclically when swiping, so as to avoid that it is difficult for the user to restore the original state after sliding due to too many special effect materials.
  • an embodiment of the present application provides an apparatus for adding special effects to a video.
  • the apparatus includes: an information acquisition module for capturing a user's gesture action and acquiring sliding information of the gesture action; a special effect application module for For the sliding information of the gesture action, the special effect material is applied on the screen.
  • the solution provided by this embodiment is different from the problem in the prior art that the user needs at least two clicks to activate special effects during a video call, which is a cumbersome interaction process.
  • the solution provided by this embodiment uses the information acquisition module.
  • the special effect application module captures and processes the sliding information of the user's gesture action, which can achieve the effect of adding the special effect wherever the user's finger slides.
  • the information acquisition module includes: a recording unit, configured to capture and record in real time the coordinate information of the starting point of the sliding start point and the end point of the sliding end point in the two-dimensional xy coordinate system of the screen by the user's finger Coordinate information; a calculation unit for judging the sliding direction and sliding speed of the finger according to the starting point coordinate information and the end point coordinate information of the finger; the judging unit for judging the sliding gesture adopted by the user according to the sliding direction of the finger .
  • the recording unit is used to record the sliding information generated when the user's finger slides on the screen, and the computing unit determines the addition of special effects materials on the screen by the coordinates of the sliding start point and the sliding end point of the user's finger when the user slides
  • the judging unit judges the sliding trajectory of the user's finger when the user uses different sliding gestures, so as to meet the needs of adding special effects materials in real time.
  • the special effect application module includes: a segmentation unit, for dividing the screen into a first area and a second area according to the sliding information of the gesture action; an application unit for dividing the screen into a first area and a second area; The portrait displayed on the screen is segmented, and the part of the background in the first area on the screen is replaced with special effects material.
  • the segmentation unit first calculates the size of the area that the user's finger slides over, performs screen segmentation, and divides the screen into the first area where the finger slides and the second area that is not slid over, and the application unit first performs portrait Segmentation, and then replacing the background of the first area with special effects materials, realizes the functions of capturing the user's sliding gesture in real time, calculating the area where the user's finger slides in real time, and replacing the background of the area where the user's finger slides in real time.
  • an embodiment of the present application provides a terminal device, including the apparatus for adding video special effects as described in the second aspect.
  • an embodiment of the present application provides a computer-readable storage medium, including a program or an instruction, and when the program or the instruction is run on a computer, the method according to the first aspect is executed.
  • the method, device, and terminal device for adding video special effects disclosed in the embodiments of the present application use gesture actions to replace the original method of opening special effects by clicking buttons, which can reduce the complexity of user operations and enable special effects quickly when a video call is incoming. It can perform regional portrait segmentation and background replacement or blurring according to the area or screen ratio that the user's finger slides over to improve the fun, playability and interactivity of the product. It can also downsample the original image before doing portrait segmentation, thereby greatly reducing the computational and power consumption overhead of portrait segmentation, thus allowing the deep learning portrait segmentation model algorithm that requires a large amount of computation to run in computing power and power consumption. On limited mobile terminals, it meets the frame rate requirements for video playback.
  • FIG. 1 is a schematic structural diagram of a terminal device provided in Embodiment 1 of the present application.
  • FIG. 2 is a schematic diagram of steps of a method for adding special effects to a video provided by Embodiment 2 of the present application;
  • Step 100 is a schematic diagram of the steps of Step 100 in the method for adding special effects to a video provided in Embodiment 2 of the present application;
  • Fig. 4a is a Cartesian coordinate system when a side sliding gesture is used in step Step100 of the video special effect adding method provided in Embodiment 2 of the present application
  • Fig. 4b is a side sliding gesture in step Step100 of the video special effect adding method provided by Embodiment 2 of the present application. Schematic diagram of the operation during gestures;
  • FIG. 5a is a schematic diagram of the starting point area when a corner sliding gesture is used in step Step 100 of the video special effect adding method provided in Embodiment 2 of the present application
  • FIG. 5b is a video special effect adding method provided in Embodiment 2 of the present application.
  • Step 100 adopts corner sliding in step 100 Operation principle diagram during gesture
  • FIG. 5c is a diagram of the effective sliding range when corner sliding gesture is adopted in step Step 100 of the video special effect adding method provided in Embodiment 2 of the present application;
  • Step 200 is a schematic diagram of the steps of Step 200 in the method for adding special effects to a video provided in Embodiment 2 of the present application;
  • Step 7 is a schematic diagram of the steps of Step 210 in the video special effect adding method provided in Embodiment 2 of the present application;
  • Step 8 is a schematic diagram of the steps of Step 220 in the video special effect adding method provided in Embodiment 2 of the present application;
  • FIG. 9 is a schematic diagram of a contour image after being cared for by portrait segmentation in step Step 220 in the video special effect adding method provided in Embodiment 2 of the present application;
  • Step 10 is a schematic diagram of steps before Step 210 in the video special effect adding method provided in Embodiment 2 of the present application;
  • FIG. 11 is a schematic diagram of the operation of switching special effects materials when a user's finger slides multiple times in the method for adding special effects to a video provided in Embodiment 2 of the present application;
  • Step 12 is a schematic diagram of steps of another implementation of Step 200 in the method for adding special effects to a video provided in Embodiment 2 of the present application;
  • FIG. 13a and 13b are operational schematic diagrams of another implementation manner of Step 200 in the video special effect adding method provided in Embodiment 2 of the present application;
  • Step 14 is a schematic diagram of steps before Step 200 in the video special effect adding method provided in Embodiment 2 of the present application;
  • FIG. 15 is a schematic diagram of a module of a device for adding special effects to a video provided by Embodiment 3 of the present application;
  • FIG. 16 is a schematic diagram of a module of an information acquisition module in the video special effect adding device provided in Embodiment 3 of the present application;
  • FIG. 17 is a schematic block diagram of a special effect application module in the video special effect adding apparatus provided in Embodiment 3 of the present application.
  • the terminal device may be a mobile phone (also known as a smart terminal device), a tablet (personal computer), a personal digital assistant (personal digital assistant), an e-book Reader (e-book reader) or virtual reality interactive device (virtual reality interactive device), etc.
  • the terminal device can be connected to various types of communication systems, such as: long term evolution (long term evolution, LTE) system, future The fifth generation (5th Generation, 5G) system, a new generation of wireless access technology (new radio access technology, NR), and future communication systems, such as 6G systems; can also be wireless local area networks (wireless local area networks, WLAN), etc.
  • LTE long term evolution
  • 5G fifth generation
  • 5G new generation of wireless access technology
  • 6G systems can also be wireless local area networks (wireless local area networks, WLAN), etc.
  • an intelligent terminal device is used as an example for description.
  • the terminal device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus) , USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195 and the like.
  • SIM subscriber identification module
  • 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, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
  • the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the terminal device 100 .
  • the terminal device 100 may include more or less components than those shown in the drawings, or combine some components, or separate some components, or arrange different components.
  • the illustrated components may be implemented in hardware, software, or a combination of software and hardware.
  • the processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor ( image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (neural-network processing unit, NPU), etc. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
  • application processor application processor, AP
  • modem processor graphics processor
  • image signal processor image signal processor
  • ISP image signal processor
  • controller video codec
  • digital signal processor digital signal processor
  • baseband processor baseband processor
  • neural-network processing unit neural-network processing unit
  • the controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
  • a memory may also be provided in the processor 110 for storing instructions and data.
  • the memory in the processor 110 is a cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
  • the processor 110 may include one or more interfaces.
  • the interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuitsound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver (universal asynchronous receiver/transmitter) transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and/or general-purpose Serial bus (universal serial bus, USB) interface, etc.
  • I2C integrated circuit
  • I2S integrated circuit built-in audio
  • PCM pulse code modulation
  • PCM pulse code modulation
  • UART universal asynchronous receiver
  • MIPI mobile industry processor interface
  • GPIO general-purpose input/output
  • SIM subscriber identity module
  • USB universal serial bus
  • the I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL).
  • the processor 110 may contain multiple sets of I2C buses.
  • the processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flash, the camera 193 and the like through different I2C bus interfaces.
  • the processor 110 may couple the touch sensor 180K through the I2C interface, so that the processor 110 and the touch sensor 180K communicate with each other through the I2C bus interface, so as to realize the touch function of the terminal device 100 .
  • the I2S interface can be used for audio communication.
  • the processor 110 may contain multiple sets of I2S buses.
  • the processor 110 may be coupled with the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170 .
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface, so as to realize the function of answering calls through the Bluetooth headset.
  • the PCM interface can also be used for audio communications, sampling, quantizing and encoding analog signals.
  • the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface.
  • the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
  • the UART interface is a universal serial data bus used for asynchronous communication.
  • the bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication.
  • a UART interface is typically used to connect the processor 110 with the wireless communication module 160 .
  • the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function.
  • the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface, so as to realize the function of playing music through the Bluetooth headset.
  • the MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 .
  • MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc.
  • the processor 110 communicates with the camera 193 through a CSI interface, so as to realize the shooting function of the terminal device 100 .
  • the processor 110 communicates with the display screen 194 through the DSI interface to implement the display function of the terminal device 100 .
  • the GPIO interface can be configured by software.
  • the GPIO interface can be configured as a control signal or as a data signal.
  • the GPIO interface may be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like.
  • the GPIO interface can also be configured as I2C interface, I2S interface, UART interface, MIPI interface, etc.
  • the USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like.
  • the USB interface 130 can be used to connect a charger to charge the terminal device 100, and can also be used to transmit data between the terminal device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones. This interface can also be used to connect other terminal devices, such as AR devices.
  • the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration, and does not constitute a structural limitation of the terminal device 100 .
  • the terminal device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
  • the charging management module 140 is used to receive charging input from the charger.
  • the charger may be a wireless charger or a wired charger.
  • the charging management module 140 may receive the charging input of the wired charger through the USB interface 130 .
  • the charging management module 140 may receive wireless charging input through the wireless charging coil of the terminal device 100 . While the charging management module 140 charges the battery 142 , it can also supply power to the terminal device through the power management module 141 .
  • the power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 .
  • the power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160.
  • the power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, battery health status (leakage, impedance).
  • the power management module 141 may also be provided in the processor 110 .
  • the power management module 141 and the charging management module 140 may also be provided in the same device.
  • the wireless communication function of the terminal device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
  • Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals.
  • Each antenna in terminal device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization.
  • the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
  • the mobile communication module 150 may provide a wireless communication solution including 2G/3G/4G/5G, etc. applied on the terminal device 100 .
  • the mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), and the like.
  • the mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation.
  • the mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 .
  • at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 .
  • at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
  • the modem processor may include a modulator and a demodulator.
  • the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal.
  • the demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing.
  • the low frequency baseband signal is processed by the baseband processor and passed to the application processor.
  • the application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 .
  • the modem processor may be a separate device.
  • the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
  • the wireless communication module 160 can provide applications on the terminal device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions.
  • WLAN wireless local area networks
  • BT wireless fidelity
  • GNSS global navigation satellite system
  • frequency modulation frequency modulation, FM
  • NFC near field communication technology
  • infrared technology infrared, IR
  • the wireless communication module 160 may be one or more devices integrating at least one communication processing module.
  • the wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 .
  • the wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves
  • the antenna 1 of the terminal device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the terminal device 100 can communicate with the network and other devices through wireless communication technology.
  • the wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM , and/or IR technology, etc.
  • the GNSS may include a global positioning system (global positioning system, GPS), a global navigation satellite system (GLONASS), a Beidou satellite navigation system (beidounavigation satellite system, BDS), a quasi-zenith satellite system (quasi- zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
  • GPS global positioning system
  • GLONASS global navigation satellite system
  • BDS Beidou satellite navigation system
  • BDS Beidounavigation satellite system
  • QZSS quasi-zenith satellite system
  • SBAS satellite based augmentation systems
  • the terminal device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like.
  • the GPU is a microprocessor for image processing, and connects the display screen 194 and the application processor.
  • the GPU is used to perform mathematical and geometric calculations for graphics rendering.
  • Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
  • the display screen 194 is used to display images, videos, etc., wherein the display screen 194 includes a display panel, and the display screen may specifically include a folding screen, a special-shaped screen, etc.
  • the display panel may use a liquid crystal display (LCD), an organic light-emitting diode (organic light-emitting diode, OLED), active matrix organic light emitting diode or active matrix organic light emitting diode (active-matrix organic light emitting diode, AMOLED), flexible light emitting diode (flex light-emitting diode, FLED) ), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diode (quantum dot light emitting diodes, QLED), etc.
  • the terminal device 100 may include one or N display screens 194 , where N is a positive integer greater than one.
  • the terminal device 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
  • the ISP is used to process the data fed back by the camera 193 .
  • the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye.
  • ISP can also perform algorithm optimization on image noise, brightness, and skin tone. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene.
  • the ISP may be provided in the camera 193 .
  • Camera 193 is used to capture still images or video.
  • the object is projected through the lens to generate an optical image onto the photosensitive element.
  • the photosensitive element may be a charge coupled device (CCD) or a complementary metal-oxide-semiconductor (CMOS) phototransistor.
  • CMOS complementary metal-oxide-semiconductor
  • the photosensitive element converts the optical signal into an electrical signal, and then transmits the electrical signal to the ISP to convert it into a digital image signal.
  • the ISP outputs the digital image signal to the DSP for processing.
  • DSP converts digital image signals into standard RGB, YUV and other formats of image signals.
  • the terminal device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
  • a digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the terminal device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, and the like.
  • Video codecs are used to compress or decompress digital video.
  • the terminal device 100 may support one or more video codecs.
  • the terminal device 100 can play or record videos in various encoding formats, for example, moving picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
  • MPEG moving picture experts group
  • the NPU is a neural-network (NN) computing processor.
  • NN neural-network
  • Applications such as intelligent cognition of the terminal device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
  • 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 terminal device 100 .
  • the external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example to save files like music, video etc in external memory card.
  • Internal memory 121 may be used to store computer executable program code, which includes instructions.
  • the internal memory 121 may include a storage program area and a storage data area.
  • the storage program area can store the operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), and the like.
  • the storage data area may store data (such as audio data, phone book, etc.) created during the use of the terminal device 100 and the like.
  • the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), and the like.
  • the processor 110 executes various functional applications and data processing of the terminal device 100 by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
  • the terminal device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playback, recording, etc.
  • the audio module 170 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 170 may also be used to encode and decode audio signals. In one embodiment, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
  • Speaker 170A also referred to as a "speaker" is used to convert audio electrical signals into sound signals.
  • the terminal device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
  • the receiver 170B also referred to as "earpiece" is used to convert audio electrical signals into sound signals.
  • the terminal device 100 answers a call or a voice message, the voice can be answered by placing the receiver 170B close to the human ear.
  • the microphone 170C also called “microphone” or “microphone” is used to convert sound signals into electrical signals.
  • the user can make a sound by approaching the microphone 170C through a human mouth, and input the sound signal into the microphone 170C.
  • the terminal device 100 may be provided with at least one microphone 170C.
  • the terminal device 100 may be provided with two microphones 170C, which may implement a noise reduction function in addition to collecting sound signals.
  • the terminal device 100 may further be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.
  • the earphone jack 170D is used to connect wired earphones.
  • the earphone interface 170D can be the USB interface 130, or can be a 3.5mm open mobile terminal platform (open mobile terminal platform, OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
  • OMTP open mobile terminal platform
  • CTIA cellular telecommunications industry association of the USA
  • the pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals.
  • the pressure sensor 180A may be provided on the display screen 194 .
  • the capacitive pressure sensor may be comprised of at least two parallel plates of conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes.
  • the terminal device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the terminal device 100 detects the intensity of the touch operation according to the pressure sensor 180A.
  • the terminal device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A.
  • touch operations that act on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example, when a touch operation whose intensity is less than the first pressure threshold acts on the short message application icon, the instruction for viewing the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.
  • the gyro sensor 180B may be used to determine the motion attitude of the terminal device 100 .
  • the angular velocity of the terminal device 100 about three axes ie, the x, y and z axes
  • the gyro sensor 180B can be used for image stabilization.
  • the gyro sensor 180B detects the shaking angle of the terminal device 100, calculates the distance to be compensated by the lens module according to the angle, and allows the lens to offset the shaking of the terminal device 100 through reverse motion to achieve anti-shake.
  • the gyro sensor 180B can also be used for navigation and somatosensory game scenarios.
  • the air pressure sensor 180C is used to measure air pressure.
  • the terminal device 100 calculates the altitude by using the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
  • the magnetic sensor 180D includes a Hall sensor.
  • the terminal device 100 can detect the opening and closing of the flip holster using the magnetic sensor 180D.
  • the terminal device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Further, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, characteristics such as automatic unlocking of the flip cover are set.
  • the acceleration sensor 180E can detect the magnitude of the acceleration of the terminal device 100 in various directions (generally three axes).
  • the magnitude and direction of gravity can be detected when the terminal device 100 is stationary. It can also be used to identify the posture of terminal devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
  • the terminal device 100 can measure the distance through infrared or laser. In one embodiment, when shooting a scene, the terminal device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
  • Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes.
  • the light emitting diodes may be infrared light emitting diodes.
  • the terminal device 100 emits infrared light to the outside through the light emitting diode.
  • the terminal device 100 detects infrared reflected light from nearby objects using a photodiode. When sufficient reflected light is detected, it can be determined that there is an object near the terminal device 100 . When insufficient reflected light is detected, the terminal device 100 may determine that there is no object near the terminal device 100 .
  • the terminal device 100 can use the proximity light sensor 180G to detect that the user holds the terminal device 100 close to the ear to talk, so as to automatically turn off the screen to save power.
  • Proximity light sensor 180G can also be used in holster mode, pocket mode automatically unlocks and locks the screen.
  • the ambient light sensor 180L is used to sense ambient light brightness.
  • the terminal device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness.
  • the ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures.
  • the ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the terminal device 100 is in a pocket, so as to prevent accidental touch.
  • the fingerprint sensor 180H is used to collect fingerprints.
  • the terminal device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, accessing application locks, taking photos with fingerprints, answering incoming calls with fingerprints, and the like.
  • the temperature sensor 180J is used to detect the temperature.
  • the terminal device 100 uses the temperature detected by the temperature sensor 180J to execute the temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the terminal device 100 reduces the performance of the processor located near the temperature sensor 180J, so as to reduce power consumption and implement thermal protection.
  • the terminal device 100 when the temperature is lower than another threshold, the terminal device 100 heats the battery 142 to avoid abnormal shutdown of the terminal device 100 caused by the low temperature.
  • the terminal device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
  • Touch sensor 180K also called “touch device”.
  • 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”.
  • the touch sensor 180K is used to detect a touch operation on or near it.
  • the touch sensor can pass the detected touch operation to the application processor to determine the type of touch event.
  • Visual output associated with touch operations may be provided via display screen 194.
  • the touch sensor 180K may also be disposed on the surface of the terminal device 100 , which is different from the position where the display screen 194 is located.
  • the touch screen composed of the touch sensor 180K and the display screen 194 may be located in the side area or the folded area of the terminal device 100 to determine the position touched by the user when the user's hand touches the touch screen and touch gestures; for example, when the user holds the terminal device, he can click any position on the touch screen with his thumb, then the touch sensor 180K can detect the user's click operation, and transmit the click operation to the processor, The processor determines, according to the click operation, that the click operation is used to wake up the screen.
  • the bone conduction sensor 180M can acquire vibration signals.
  • the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human voice.
  • the bone conduction sensor 180M can also contact the pulse of the human body and receive the blood pressure beating signal.
  • the bone conduction sensor 180M can also be disposed in the earphone, and combined with the bone conduction earphone.
  • the audio module 170 can analyze the voice signal based on the vibration signal of the vocal vibration bone block obtained by the bone conduction sensor 180M, so as to realize the voice function.
  • the application processor can analyze the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M, and realize the function of heart rate detection.
  • the keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key.
  • the terminal device 100 may receive key input and generate key signal input related to user settings and function control of the terminal device 100 .
  • Motor 191 can generate vibrating cues.
  • the motor 191 can be used for vibrating alerts for incoming calls, and can also be used for touch vibration feedback.
  • touch operations acting on different applications can correspond to different vibration feedback effects.
  • the motor 191 can also correspond to different vibration feedback effects for touch operations on different areas of the display screen 194 .
  • Different application scenarios for example: time reminder, receiving information, alarm clock, games, etc.
  • the touch vibration feedback effect can also support customization.
  • the indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.
  • the SIM card interface 195 is used to connect a SIM card.
  • the SIM card can be contacted and separated from the terminal device 100 by inserting into the SIM card interface 195 or pulling out from the SIM card interface 195 .
  • the terminal device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1.
  • the SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card and so on. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different.
  • the SIM card interface 195 can also be compatible with different types of SIM cards.
  • the SIM card interface 195 is also compatible with external memory cards.
  • the terminal device 100 interacts with the network through the SIM card to realize functions such as calls and data communication.
  • the terminal device 100 adopts an eSIM, that is, an embedded SIM card.
  • the eSIM card can be embedded in the terminal device 100 and cannot be separated from the terminal device 100 .
  • the touch display screen of the terminal device may include multiple touch display areas.
  • the folding screen of the terminal device includes a folding area in a folded state, and the folding area can also realize touch control. response.
  • the operation of a terminal device on a specific touch display area is relatively limited, and there is no relevant operation specifically for a specific touch display area. Based on this, an embodiment of the present application provides a gesture interaction method.
  • the terminal device can obtain the input event of the touch response area, and in response to the input event, trigger the terminal device to execute the input event
  • the corresponding operation instructions are used to implement gesture operations on the side area or the folded area of the terminal device to improve the control experience of the terminal device.
  • the memory is used to store a computer program
  • the processor is used to execute the computer program stored in the memory, so that the terminal device executes the method described in Embodiment 2 of the present application.
  • Embodiment 2 of the present application discloses a method for adding special effects to a video, which can be applied to an incoming call state, and the method includes the following steps:
  • Step100 Capture the user's gesture action, and obtain the sliding information of the gesture action
  • Step 200 Apply the special effect material to the screen according to the sliding information of the gesture action.
  • the method for adding video special effects in this embodiment is different from the problem in the prior art that the user needs at least two clicks to activate special effects during a video call, and the interaction process is cumbersome.
  • the sliding information of the gesture action is captured and processed, which can achieve the effect of adding special effects wherever the user's finger slides.
  • Step 100 capturing a user's gesture action, and acquiring the sliding information of the gesture action, including:
  • Step110 Capture and record in real time the coordinate information of the starting point of the sliding start point and the coordinate information of the end point of the sliding end point in the two-dimensional xy coordinate system of the screen by the user's finger;
  • Step120 According to the starting point coordinate information and the ending point coordinate information of the finger, determine the sliding direction and sliding speed of the finger;
  • Step 130 Determine the sliding gesture adopted by the user according to the sliding direction of the finger.
  • the sliding information includes the starting point coordinate information of the sliding start point, the end point coordinate information of the sliding end point, the sliding gesture, the sliding direction and the sliding speed.
  • the coordinate information of the starting point of the sliding start and the coordinate information of the end point of the sliding end provide the basis for judging the sliding gesture, the sliding direction and the sliding speed.
  • Gestures provide the way that the user's finger slides on the screen, the sliding direction provides the path that the user's finger slides on the screen, and the sliding speed provides the speed of the user's finger sliding on the screen. Combining these sliding information can accurately know the needs of the screen. The area to replace the special effect material.
  • the user's sliding gestures are divided into side sliding gestures and corner sliding gestures.
  • the side sliding gesture is to slide horizontally or vertically from the four sides of the mobile phone to the center of the screen;
  • the corner sliding gesture is a corner sliding gesture.
  • the center of the screen slides.
  • swipe gesture is an edge swipe gesture
  • Step140 According to the coordinate information of the starting point and the coordinate information of the end point of the finger, determine the size relationship between the coordinate displacement D of the finger on the screen and the preset minimum distance D min , and the size relationship between the sliding speed V and the preset minimum speed V min ;
  • step Step180 is executed.
  • the core idea is to capture and record the movement trajectory and speed of the user's finger on the screen at the coordinate position (x, y) of the two-dimensional coordinate axis in real time (as shown in Figure 4a to Figure 4b).
  • the abscissa X s of the sliding starting point is 0 (preferably, a fault-tolerant space of 10 pixels can be reserved, and the specific value of the fault-tolerant space is determined according to actual needs), and the ordinate Y s is the range of the middle point of the screen ( The maximum length of the vertical axis is Y max +200 pixels); the abscissa X e of the sliding end point is greater than X s , and the coordinate displacement
  • the above determination process is to determine the lateral pulling action of the finger shown in FIG. 4a to FIG. 4b; based on the above idea, the area of the area where the user is known to pull laterally can be expanded, so as to facilitate the subsequent steps of applying special effects materials.
  • swipe gesture action may be the default Home button (start button) function of the system, so in this scenario, attention should be paid to system-level gesture monitoring and capture.
  • the minimum distance D min and the minimum speed V min are preset as the criteria for judging whether the user's finger slides effectively, and the user is judged by calculating the coordinate displacement D and sliding speed V of the finger on the screen. Whether the finger of the user is really performing the gesture operation, to avoid the problem of adding special effects material by mistake due to the user's mistaken touch on the screen.
  • swipe gesture Take the upper right corner of the screen moving toward the center of the screen as an example.
  • swipe gesture is an edge swipe gesture, perform the following steps:
  • Step150 preset a starting point area; wherein, the maximum value of the abscissa of the starting point area is X max , and the maximum value of the abscissa is Y max ;
  • Step160 According to the coordinate information of the starting point of the finger, determine whether the sliding starting point of the finger falls within the starting point area;
  • step Step170 If the abscissa X s ⁇ X max and the ordinate Y s ⁇ Y max of the sliding starting point of the finger, it is determined that the sliding starting point of the finger is located within the preset starting point area; thus step Step170 is executed.
  • Step170 According to the coordinate information of the starting point of the finger and the coordinate information of the end point, determine the relationship between the coordinate displacement D of the finger on the screen and the preset minimum distance D min , and the size of the sliding speed V and the preset minimum speed V min relation;
  • Step 180 Start the special effect material.
  • the trigger condition for the recognition of its angular centripetal movement action is that the starting point O must be within the starting point area of the box shape in Fig. 5b, and 50 is a reference value, which can be determined according to Adjust the size of the starting point area according to actual needs or screen sensitivity.
  • Angular centripetal sliding action recognition is a judgment rule obtained after appropriate optimization based on the judgment conditions of the side sliding gesture shown in Figure 4a to Figure 4c. Taking the point A in Figure 5c as the end point as an example, the A coordinate is set as (X (A ), Y(A)), and the starting point is (X(O), Y(O)).
  • the judgment rules are as follows:
  • the slope k of the straight line AO is in the range of (0.268, 3.73), that is, the angle corresponding to the movement offset is between 15° and 75°, as shown in the OAB triangle area in Figure 4c. (The scope of the triangle area can be appropriately adjusted according to actual needs).
  • Sliding area recognition ie, isosceles right-angled triangle area recognition: Based on the sliding end point of finger sliding, the following processing is performed: Take point A in Figure 5c as an example, set A as the sliding end point of the user's sliding, and make a line through point A with a slope of -1 , then the triangle area enclosed by the line and the coordinate axis is the sliding area, because the slope of the line is -1, so the interior angle with the coordinate axis is 45°, as shown in Figure 5c, the isosceles right triangle , in preparation for the background replacement of the triangle area in the figure.
  • Figure 5c only exemplifies the situation of one corner of the terminal device, the judgment rules at the other three corners can be inferred from the situation exemplified in Figure 5c, and the final judgment rule is 0.268 ⁇
  • the starting point area and the sliding area are preset, the starting point area is used as the judgment condition for judging whether the user's finger can trigger the recognition of the sliding gesture, and the sliding area is used as the judgment for judging whether the user's finger can trigger the application of the special effect material.
  • Condition set two judgment conditions to accurately judge whether the user's finger has a sliding gesture at the corner of the screen and the size of the area where the finger slides.
  • the sliding area set at the four corners of the screen has an edge inclination of 15 In the range from ° to 75°, when the user's finger performs the corner sliding gesture, it will cover part or all of the sliding area, which can meet the judgment requirements of the corner sliding gesture, and then can adaptively apply special effects materials.
  • step Step 200 applying the special effect material to the screen according to the sliding information of the gesture action, including:
  • Step210 According to the sliding information of the gesture action, the screen is divided into a first area and a second area;
  • Step 220 Segment the portrait displayed on the screen, and replace the part of the background in the first area on the screen with special effects material.
  • the first area is the area of the screen that is perpendicular to the connecting line between the sliding start point and the sliding end point of the gesture action and passes through the dividing line of the sliding end point
  • the second area is the area on the screen except the first area;
  • the sliding information includes the starting point coordinate information of the sliding start point, the end point coordinate information of the sliding end point, the sliding gesture, the sliding direction and the sliding speed.
  • portrait segmentation and screen segmentation are performed first, the portrait is extracted, and the screen is divided into a first area that the finger slides over and a second area that is not slid over, and only the background of the first area is Replace the effect material.
  • the method can capture the position of the finger in the sliding process in real time, so as to determine the first area that needs to replace the background.
  • the area occupied by the portrait still displays the portrait, and will not be replaced with the background, resulting in the effect that the portrait in the front remains unchanged, and the background changes in the rear, so as to realize the real-time capture of the user's sliding gesture and real-time calculation of the user's finger sliding.
  • Area the ability to replace the background of the area where the user's finger slides in real time.
  • Step 210 according to the sliding information of the gesture action, divide the screen into a first area and a second area, including:
  • Step211 Create a dividing line according to the coordinate information of the starting point of the sliding start point of the gesture action and the coordinate information of the end point of the sliding end point;
  • Step 212 According to the dividing line and the sliding direction, divide the area of the screen swept by the dividing line along the sliding direction into a first area.
  • the size of the area that the user's finger slides over is calculated first, and then the screen is divided, and the screen is divided into a first area that the finger slides over and a second area that does not slide over.
  • the background of the area is replaced with special effects material, which realizes the functions of capturing the user's sliding gesture in real time, calculating the area where the user's finger slides in real time, and replacing the background of the area where the user's finger slides in real time.
  • Step 220 perform portrait segmentation on the portrait displayed on the screen, and replace the part of the screen where the background is located in the first area with special effects material, including:
  • Step 221 down-sampling the original image of the portrait using a bilinear interpolation algorithm to obtain a down-sampled image
  • Step222 Calculate the outline of the person in the down-sampled image (Portrait Mask), and use the bilinear interpolation algorithm to upsample the outline of the person to obtain the outline of the original image;
  • Step223 Segment the portrait from the original image based on the contour of the original image to obtain the first layer
  • Step224 Replace the part of the background in the first area with special effects material to obtain the second layer;
  • Step225 Overlay the first layer with the second layer.
  • the frame data format can be Common formats such as YUV-NV21 or RGB.
  • a bilinear interpolation algorithm for example, downsample the original 1920 x 1080 resolution image to a 320 x 180 resolution image to obtain a downsampled image;
  • the deep learning model used for portrait segmentation here is not limited in the embodiments of the present invention, and common models such as CNN, FCN/FCN+/UNet, etc. may be used.
  • the data with the outline (Mask) of the person will be output, which is essentially a frame of image, as shown in Figure 9, but it should be noted that the resolution of the outline is temporarily 320x180. contour, which greatly reduces the computational complexity and power consumption of portrait segmentation.
  • the portrait is "keyed out” from the original image to obtain the first layer, which is then layered and rendered on the GPU with the second layer replaced by the special effect material of the background, and finally the background replacement is obtained. After effects.
  • the bilinear interpolation method is used to downsample the original image frame by frame, so that the resolution is proportionally reduced, and the computing power consumption is reduced, and then the portrait is segmented, the outline of the portrait is output, and then the double Linear interpolation upsamples the contour to the resolution of the original image.
  • the power consumption and processing delay of portrait segmentation on mobile terminal devices are greatly reduced, and the frame rate requirements of 30FPS video calls are met.
  • This method down-samples the original image before doing portrait segmentation, thereby greatly reducing the computational and power consumption overhead of portrait segmentation, thus allowing the deep learning portrait segmentation model algorithm that requires a large amount of computation to run in computing power and power consumption. On limited mobile terminals, it meets the frame rate requirements for video playback.
  • the adding level of the special effect material is selected according to the area of the first area or the screen ratio of the first area on the screen.
  • the user in the process of adding special effect materials, the user can choose the amount of special effect materials to be added.
  • the user In the operation application, the user can select the addition of special effect materials according to the size of the area where the user's finger slides across the screen. This method of operation can meet the needs of users for more and more complex special effects additions.
  • the addition level of the special effect material is correspondingly increased by one level for every 10% of the gesture action.
  • the method for adding video special effects in this embodiment can provide users with a smoother experience of adding video special effects.
  • the beautification algorithm can be triggered by the capture method of the side sliding gesture described in Figures 4a to 4c along the horizontal/vertical direction of the screen, and the ratio of the sliding area to the entire screen is used as the beauty level.
  • the ten-level beauty as an example: for example, start sliding from the left or the top, when the sliding area accounts for 10%, the first-level beauty is turned on, when all the slides to the right, the ten-level beauty is turned on, and so on.
  • edge swipe gesture capture trigger method Since beauty is a level-implemented special effect, it is recommended to use the edge swipe gesture capture trigger method, but if there are factors such as business requirements or product design, the corner swipe gesture capture method can also be used to trigger the trigger.
  • the corner swipe gesture capture method can also be used to trigger the trigger. The two implementation ideas are similar.
  • the method of this preferred embodiment can facilitate user operations and enhance user experience.
  • step Step210 before the step of dividing the screen into a first area and a second area according to the sliding information of the gesture action, it includes:
  • Step201 Determine whether the sliding of the gesture action is valid according to the sliding speed
  • step 202 replace the background of the screen with the overall special effect material
  • step Step 200 is not executed; wherein, the first speed is greater than the second speed.
  • two judgment conditions for judging the sliding speed are preset, and whether the current sliding is effective is judged in combination with the sliding speed of the user. If the sliding speed is fast and the sliding speed is greater than the first speed, it can be considered that the user If the entire background needs to be replaced, the complete replacement or blurring of the background is enabled. When the sliding speed is less than the second speed, it can be considered that the user has not performed the sliding gesture, and the step of applying the special effect material does not need to be started.
  • Step 220 segmenting the portrait displayed on the screen, and replacing the part of the screen with the background in the first area after the special effect material is replaced, including:
  • Step230 Determine the sliding direction of the gesture action
  • step 240 is performed: adding a new special effect material
  • step 250 the last special effect material is restored.
  • the special effect material can be switched by sliding multiple times.
  • the method for adding video special effects in this embodiment provides the user with a retrospective operation by recognizing the sliding direction, and can cancel the background replacement/blur of the screen, for example, slide your finger to the left to enable background replacement/blur; Swipe left to change to another background material; swipe right (that is, reverse operation) to restore the previous background material/real background.
  • the user can freely select the preferred special effect material from among multiple special effect materials, without worrying about sliding over the favorite special effect material, which enhances the user experience.
  • Step 200 applies the special effect material to the screen according to the sliding information of the gesture action, including:
  • Step210' According to the sliding information of the gesture action, pull out the control panel along with the sliding direction of the user at the sliding starting point of the gesture action on the screen, and prevent multiple special effects materials on the control panel;
  • Step220 Apply the special effect material to the screen.
  • the purpose of the method for adding video special effects in this embodiment is to realize subregional background replacement/blurring. It is not limited to triggering by the above-mentioned capture methods of edge sliding gestures and corner sliding gestures.
  • the core of this method is to use sliding gestures to quickly activate special effects.
  • the area of the sliding area of edge sliding/corner sliding can be used as the range of background replacement/blurring, providing users with a selective control panel.
  • users have a better visual experience and can choose Special effects materials that are more in line with user needs.
  • Step 200 before applying the special effect material on the screen according to the sliding information of the gesture action, the method further includes:
  • Step200' Detect the frequency of use of each special effect material, and sort the presentation order of the special effect material according to the frequency of use.
  • the method for adding video special effects in this embodiment can customize the list order of the user's commonly used special effect materials according to the user's habits, for example, the last used special effect materials are displayed first, or they are sorted according to the frequency of use, so that when the user uses each time It can add special effects materials to the background of the screen more quickly, making the user's use more convenient and the experience better.
  • the number of special effect materials is less than 10.
  • the video special effect adding method of this embodiment sets the upper limit of the number of materials for the backup library of special effect materials, and these special effect materials appear cyclically when swiping, so as to avoid that it is difficult for the user to restore the original state after sliding due to too many special effect materials.
  • a sliding gesture is used to replace the original interaction design of opening special effects by clicking a button.
  • the area or screen ratio of the area where the user's finger slides on the screen perform regional portrait segmentation and background replacement/blur to realize regional background replacement/blur.
  • the area can be divided according to the position of the user's finger on the screen and the angle of the swipe gesture, and part of the video stream of the replaced area is not transmitted, thus saving the time of the video stream. data transmission.
  • the beauty level can be adjusted based on the area of the area where the user's finger slides/screen ratio. It is also possible to switch the material, beauty material, 3D-Animoji or sticker material with the complete user's finger sliding motion as the background replacement.
  • this method also uses the capture and analysis method of angular centripetal swipe gesture.
  • FIG. 15 is a video special effect adding device provided by Embodiment 3 of the present application, and the device includes:
  • the information acquisition module 10 is used to capture the gesture action of the user and acquire the sliding information of the gesture action;
  • the special effect application module 20 is configured to apply the special effect material to the area where the gesture action slides on the screen according to the sliding information of the gesture action.
  • the device for adding video special effects in this embodiment is different from the problem in the prior art that the user needs at least two clicks to activate special effects during a video call, and the interaction process is cumbersome.
  • the solution provided in this embodiment is obtained by using information
  • the module 10 and the special effect application module 20 capture and process the sliding information of the user's gesture, so as to achieve the effect of adding the special effect wherever the user's finger slides.
  • the information acquisition module 10 includes:
  • the recording unit 11 is used to capture and record the starting point coordinate information of the user's finger and the end point coordinate information of the sliding end point in the two-dimensional xy coordinate system of the screen in real time;
  • the calculation unit 12 is used to judge the sliding direction and sliding speed of the finger according to the starting point coordinate information and the ending point coordinate information of the finger;
  • the determining unit 13 is configured to determine the sliding gesture adopted by the user according to the sliding direction of the finger.
  • the recording unit 11 is used to record the sliding information generated when the user's finger slides on the screen, and the calculation unit 12 determines the coordinates of the sliding starting point and the sliding end point of the user's finger when the user slides on the screen.
  • the judgment unit 13 respectively judges the sliding trajectories of the user's fingers when the user uses different sliding gestures, so as to meet the requirement of adding special effect materials in real time.
  • the special effect application module 2 includes:
  • the dividing unit 21 is used for dividing the screen into a first area and a second area according to the sliding information of the gesture action;
  • the application unit 22 is configured to perform portrait segmentation on the portrait displayed on the screen, and perform special effect material replacement on the part of the background located in the first area on the screen.
  • the segmentation unit 21 first calculates the size of the area that the user's finger slides over, performs screen segmentation, and divides the screen into a first area that the finger slides over and a second area that is not slid over, and the application unit 22 First perform portrait segmentation, and then replace the background of the first area with special effects materials, realizing the functions of capturing the user's sliding gesture in real time, calculating the area where the user's finger slides in real time, and replacing the background of the area where the user's finger slides in real time.
  • Embodiment 4 of the present application provides a terminal device, including the apparatus for adding video special effects as described in Embodiment 2 of the present application.
  • Embodiment 5 of the present application provides a computer-readable storage medium, including a program or an instruction, and when the program or instruction is run on a computer, the method described in Embodiment 1 of the present application is executed.
  • the above-mentioned embodiments it may be implemented in whole or in part by software, hardware, firmware or any combination thereof.
  • 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 instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated.
  • the computer may be a general purpose computer, special purpose computer, computer network, or other programmable device.
  • the computer instructions may be stored in or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server or data center Transmission to another website site, computer, server or data center via wired (eg coaxial cable, optical fiber, Digital Subscriber Line, DSL) or wireless (eg infrared, wireless, microwave, etc.) means.
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes an integration of one or more available media.
  • the available media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, high-density digital video discs (DVDs)), or semiconductor media (eg, solid state disks, SSD)) etc.
  • the method, device, and terminal device for adding video special effects disclosed in the embodiments of the present application use gesture actions to replace the original method of opening special effects by clicking buttons, which can reduce the complexity of user operations and enable special effects quickly when a video call is incoming. It can perform regional portrait segmentation and background replacement or blurring according to the area or screen ratio that the user's finger slides over to improve the fun, playability and interactivity of the product. It can also downsample the original image before doing portrait segmentation, thereby greatly reducing the computational and power consumption overhead of portrait segmentation, thus allowing the deep learning portrait segmentation model algorithm that requires a large amount of computation to run in computing power and power consumption. On limited mobile terminals, it meets the frame rate requirements for video playback.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Graphics (AREA)
  • User Interface Of Digital Computer (AREA)

Abstract

A method and apparatus for adding a special effect in a video, and a terminal device, for enabling the special effect by replacing button click with a gesture action, to reduce complexity of user operations and quickly enable the special effect during a video call. Regional portrait segmentation and background replacement or blurring are carried out according to an area of region where a user finger slides or a screen ratio, to improve interestingness, playability and interactivity of the product. Before portrait segmentation, down-sampling processing is performed on an original image, to greatly reduce portrait segmentation calculation and power consumption, such that a deep learning portrait segmentation model algorithm requiring a large amount of calculation can run in a mobile terminal of limited computation power and power consumption, thereby satisfying frame rate requirements for video playback.

Description

视频特效添加方法、装置及终端设备Video special effect adding method, device and terminal device
本申请要求于2020年09月25日提交中国专利局、申请号为202011021330.0、申请名称为视频特效添加方法、装置及终端设备的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number of 202011021330.0 and the application title of video special effect adding method, device and terminal equipment, which was submitted to the Chinese Patent Office on September 25, 2020, the entire contents of which are incorporated into this application by reference .
技术领域technical field
本申请涉及移动通信术领域,尤其涉及一种视频特效添加方法、装置及终端设备。The present application relates to the field of mobile communications, and in particular, to a method, apparatus and terminal device for adding special effects to video.
背景技术Background technique
目前许多视频通话产品都已支持在视频通话的过程中添加美颜、滤镜或背景替换等特效功能,这些特效功能深受用户的欢迎。在支持这些特效功能的视频通话产品中,当用户想添加特效时,需要先调起特效菜单,再点击选择,操作步骤比较繁琐。尤其在来电场景中,用户需要同时处理接听电话和调整特效菜单两种任务,操作很不方便。故亟需一种添加特效的快捷操作。At present, many video calling products already support adding special effects such as beauty, filters or background replacement during video calls, which are very popular among users. In the video call products that support these special effects, when users want to add special effects, they need to call up the special effects menu first, and then click to select, and the operation steps are rather cumbersome. Especially in the incoming call scenario, the user needs to deal with the two tasks of answering the call and adjusting the special effect menu at the same time, which is very inconvenient to operate. Therefore, a shortcut operation for adding special effects is urgently needed.
现有技术中的视频通话产品,通常在来电界面中显示特效图标,用户点击特效图标就能展开特效菜单或美颜调节条。当用户需要应用特效时,需要先点击特效图标,展开特效编辑菜单,再点击选择特效缩略图或在菜单内滑动调节美颜级别。在用户交互过程中,用户需要至少两次点击才能开启指定的特效,交互过程繁琐,整个流程耗时较长,并且图标的点击区域比较小,不方便快捷操作。故无法满足在来电状态下快速达到开启特效的目的。In the video call products in the prior art, special effects icons are usually displayed on the incoming call interface, and the user can click on the special effects icons to expand the special effects menu or the beauty adjustment bar. When users need to apply special effects, they need to click the special effect icon to expand the special effect editing menu, and then click to select the special effect thumbnail or slide in the menu to adjust the beauty level. In the user interaction process, the user needs at least two clicks to activate the specified special effect, the interaction process is cumbersome, the entire process takes a long time, and the click area of the icon is relatively small, which is inconvenient to operate quickly. Therefore, it cannot meet the purpose of quickly enabling special effects in the state of incoming calls.
发明内容SUMMARY OF THE INVENTION
有鉴于此,本申请实施例提供了一种视频特效添加方法、装置及终端设备,用以解决现有技术中用户在视频通话时添加特效不方便、不快捷的技术问题。In view of this, embodiments of the present application provide a method, apparatus and terminal device for adding special effects to a video, so as to solve the technical problem in the prior art that it is inconvenient and fast for a user to add special effects during a video call.
第一方面,本申请实施例提供了一种视频特效添加方法,所述方法包括以下步骤:捕捉用户的手势动作,获取所述手势动作的滑动信息;根据所述手势动作的滑动信息,将特效素材应用于屏幕上。In a first aspect, an embodiment of the present application provides a method for adding special effects to a video. The method includes the following steps: capturing a user's gesture action, and obtaining sliding information of the gesture action; and adding special effects according to the sliding information of the gesture action. The material is applied to the screen.
通过本实施例提供的方案,有别于现有技术中用户在视频通话过程中开启特效需要至少两次点击的操作而导致的交互过程繁琐的问题,本实施例提供的方案通过对用户的手势动作的滑动信息进行捕捉和处理,能够达到用户的手指滑动到哪里特效就加到哪里的效果。The solution provided by this embodiment is different from the problem in the prior art that the user needs at least two clicks to activate special effects during a video call, and the interaction process is cumbersome. The sliding information of the action is captured and processed, which can achieve the effect of adding special effects wherever the user's finger slides.
在一种优选的实施方案中,所述捕捉用户的手势动作,获取所述手势动作的滑动信息的步骤,包括:实时捕捉和记录用户的手指在所述屏幕的二维xy坐标系中滑动起点的起点坐标信息和滑动终点的终点坐标信息;根据手指的所述起点坐标信息和所述终点坐标信息,判断手指的滑动方向以及滑动速度;根据手指的滑动方向,判断用户 所采用的滑动手势;其中,所述滑动信息包括滑动起点的起点坐标信息、滑动终点的终点坐标信息、滑动手势、滑动方向和滑动速度。In a preferred embodiment, the step of capturing the gesture action of the user and acquiring the sliding information of the gesture action includes: capturing and recording in real time the starting point of the user's finger sliding in the two-dimensional xy coordinate system of the screen The starting point coordinate information and the ending point coordinate information of the sliding end point; according to the starting point coordinate information and the ending point coordinate information of the finger, judge the sliding direction and sliding speed of the finger; according to the sliding direction of the finger, judge the sliding gesture adopted by the user; Wherein, the sliding information includes the starting point coordinate information of the sliding start point, the end point coordinate information of the sliding end point, the sliding gesture, the sliding direction and the sliding speed.
通过本实施例提供的方案,用户滑动时手指滑过屏幕会留下滑动信息,滑动起点的起点坐标信息和滑动终点的终点坐标信息提供了判断滑动手势、滑动方向和滑动速度的依据,滑动手势提供用户的手指在屏幕上滑动的方式,滑动方向提供用户的手指在屏幕上滑动的路径,滑动速度提供用户的手指在屏幕上滑动的快慢,综合这些滑动信息就能够准确得知屏幕上需要替换特效素材的区域。With the solution provided in this embodiment, when the user slides his finger across the screen, sliding information will be left. The coordinate information of the starting point of the sliding start and the coordinate information of the end point of the sliding end provide the basis for judging the sliding gesture, the sliding direction and the sliding speed. The sliding gesture Provides the way the user's finger slides on the screen, the sliding direction provides the path the user's finger slides on the screen, and the sliding speed provides the speed at which the user's finger slides on the screen. Combining these sliding information can accurately know that the screen needs to be replaced The area of effect material.
在一种优选的实施方案中,当所述滑动手势为边滑动手势时,执行以下步骤:根据手指的所述起点坐标信息和所述终点坐标信息,判断手指在所述屏幕上的坐标位移D与预设的最小距离D min的大小关系,以及所述滑动速度V与预设的最小速度V min的大小关系;当D>D min且V>V min时,启动所述特效素材。 In a preferred embodiment, when the sliding gesture is an edge sliding gesture, the following steps are performed: according to the coordinate information of the starting point and the coordinate information of the end point of the finger, determine the coordinate displacement D of the finger on the screen The size relationship with the preset minimum distance Dmin , and the size relationship between the sliding speed V and the preset minimum speed Vmin ; when D> Dmin and V> Vmin , start the special effect material.
通过本实施例提供的方案,预先设定最小距离D min和最小速度V min作为判断用户的手指是否有效滑动的标准,通过计算手指在屏幕上的坐标位移D和滑动速度V,来判断用户的手指是否真的在进行手势操作,避免发生错误相应用户在屏幕上的误触碰而错误添加特效素材的问题。 Through the solution provided in this embodiment, the minimum distance D min and the minimum speed V min are preset as the criteria for judging whether the user's finger slides effectively, and the coordinate displacement D and sliding speed V of the finger on the screen are calculated to determine the user's Whether the finger is really performing a gesture operation to avoid the problem of adding special effects materials by mistake due to the user's mistaken touch on the screen.
在一种优选的实施方案中,当所述滑动手势为角滑动手势时,执行以下步骤:预设起点区域;其中,所述起点区域的横坐标的最大值为X max,横坐标的最大值为Y max;根据手指的所述起点坐标信息,判断手指的滑动起点是否落在起点区域内;若手指的滑动起点的横坐标X s<X max且纵坐标Y s<Y max,则判断为手指的滑动起点位于预设的起点区域内;根据手指的所述起点坐标信息和所述终点坐标信息,判断手指在所述屏幕上的坐标位移D与预设的最小距离D min的大小关系,以及所述滑动速度V与预设的最小速度V min的大小关系;当D>D min、V>V min且所述滑动起点与所述滑动终点的连线的斜率k的范围满足0.268<|k|<3.73或0.268<|k -1|<3.73时,启动所述特效素材。 In a preferred embodiment, when the sliding gesture is a corner sliding gesture, the following steps are performed: preset a starting point area; wherein, the maximum value of the abscissa of the starting point area is X max , and the maximum value of the abscissa is Y max ; according to the coordinate information of the starting point of the finger, it is judged whether the sliding starting point of the finger falls within the starting point area; if the abscissa X s <X max and the ordinate Y s <Y max of the sliding starting point of the finger, it is judged as The sliding starting point of the finger is located in the preset starting point area; according to the starting point coordinate information and the ending point coordinate information of the finger, determine the size relationship between the coordinate displacement D of the finger on the screen and the preset minimum distance D min , and the magnitude relationship between the sliding speed V and the preset minimum speed V min ; when D> Dmin , V> Vmin and the range of the slope k of the connecting line between the sliding start point and the sliding end point satisfies 0.268<| When k|<3.73 or 0.268<|k -1 |<3.73, the special effect material is activated.
通过本实施例提供的方案,预先设定起点区域和滑动区域,起点区域作为判定用户的手指是否能够触发滑动手势识别的判断条件,滑动区域作为判定用户的手指是否能够触发应用特效素材的判断条件,设定两个判断条件从而准确地判断用户的手指在屏幕的角落处是否存在滑动手势以及手指所滑动的区域大小,在屏幕的四个角落处设置的滑动区域,其边缘的倾角在15°到75°的范围内,用户的手指在执行角滑动手势时,就会覆盖滑动区域的部分或者全部,能够满足角滑动手势的判断要求,进而能够适应性地应用特效素材。With the solution provided in this embodiment, the starting point area and the sliding area are preset, the starting point area is used as the judgment condition for judging whether the user's finger can trigger the sliding gesture recognition, and the sliding area is used as the judgment condition for judging whether the user's finger can trigger the application of special effects material , set two judgment conditions to accurately judge whether the user's finger has a sliding gesture at the corner of the screen and the size of the area where the finger slides. The sliding area set at the four corners of the screen has an edge inclination of 15° Within the range of 75°, when the user's finger performs the corner sliding gesture, it will cover part or all of the sliding area, which can meet the judgment requirements of the corner sliding gesture, and then can adaptively apply special effects materials.
在一种优选的实施方案中,所述根据所述手势动作的滑动信息,将特效素材应用于屏幕上的步骤,包括:根据所述手势动作的滑动信息,将所述屏幕分割成第一区域和第二区域;对所述屏幕中显示的人像进行人像分割,对所述屏幕中背景位于所述第一区域中的部分进行特效素材替换;其中,所述第一区域为与所述手势动作的滑动起点与滑动终点的连线相垂直且穿过所述滑动终点的分割线所扫过的屏幕的区域,所述第二区域为所述屏幕上除所述第一区域外的区域;所述滑动信息包括滑动起点的起点坐标信息、滑动终点的终点坐标信息、滑动手势、滑动方向和滑动速度。In a preferred embodiment, the step of applying the special effect material on the screen according to the sliding information of the gesture action includes: dividing the screen into a first area according to the sliding information of the gesture action and the second area; perform portrait segmentation on the portrait displayed on the screen, and replace the part of the background in the first area on the screen with special effects material; wherein, the first area is the same as the gesture action The area of the screen swept by the connecting line between the sliding starting point and the sliding end point and passing through the dividing line of the sliding end point, the second area is the area on the screen except the first area; the The sliding information includes the starting point coordinate information of the sliding start point, the end point coordinate information of the sliding end point, the sliding gesture, the sliding direction and the sliding speed.
通过本实施例提供的方案,先进行人像分割和屏幕分割,将人像提取出,将屏幕分割为手指滑过的第一区域和未滑过的第二区域,并仅对第一区域的背景进行特效素 材的替换。该方法能够实时捕捉手指在滑动中的位置,从而确定所需要替换背景的第一区域。在替换背景时,人像所占区域依旧显示人像,不会被替换成背景,形成前景人像不变,后方背景变化的效果,从而实现了实时捕捉用户的滑动手势、实时计算用户的手指滑过的区域、实时替换用户的手指滑过的区域的背景的功能。With the solution provided in this embodiment, first perform portrait segmentation and screen segmentation, extract the portrait, and divide the screen into a first area where the finger slides and a second area that is not slid, and only the background of the first area is segmented. Replacement of special effects material. The method can capture the position of the finger in the sliding process in real time, so as to determine the first area that needs to replace the background. When replacing the background, the area occupied by the portrait still displays the portrait, and will not be replaced with the background, resulting in the effect that the foreground portrait remains unchanged and the background changes in the rear, so as to realize the real-time capture of the user's sliding gesture and real-time calculation of the user's finger sliding. Area, the ability to replace the background of the area where the user's finger slides in real time.
在一种优选的实施方案中,所述根据所述手势动作的滑动信息,将所述屏幕分割成第一区域和第二区域的步骤,包括:根据所述手势动作的滑动起点的起点坐标信息和滑动终点的终点坐标信息,创建所述分割线;根据所述分割线和所述滑动方向,将所述分割线沿所述滑动方向扫过的所述屏幕的区域分割为所述第一区域。In a preferred embodiment, the step of dividing the screen into a first area and a second area according to the sliding information of the gesture action includes: starting point coordinate information of the sliding start point of the gesture action and the end point coordinate information of the sliding end point to create the dividing line; according to the dividing line and the sliding direction, divide the area of the screen swept by the dividing line along the sliding direction into the first area .
通过本实施例提供的方案,利用滑动起点的起点坐标信息和滑动终点的终点坐标信息能够通过简单的运算确定用于分割第一区域和第二区域的分割线在xy坐标系下的函数,从而能够在屏幕上确定手指扫过的第一区域。该方法占用的计算资源较少,处理速度较快,能够适应手势动作的滑动速度较快的场景下的特效素材添加。With the solution provided in this embodiment, the function of the dividing line used to divide the first area and the second area in the xy coordinate system can be determined through simple operations by using the coordinate information of the starting point of the sliding start point and the coordinate information of the end point of the sliding end point, so that The first area swept by the finger can be determined on the screen. The method occupies less computing resources and has a faster processing speed, and can adapt to the addition of special effects materials in a scene where the sliding speed of the gesture action is faster.
在一种优选的实施方案中,所述对所述屏幕中显示的人像进行人像分割,对所述屏幕中背景位于所述第一区域中的部分进行特效素材替换的步骤,包括:对所述人像的原始图像使用双线性插值算法进行下采样,得到下采样图像;计算所述下采样图像中的人物的轮廓,并对所述人物的轮廓使用双线性插值算法进行上采样,得到所述原始图像的轮廓;基于所述原始图像的轮廓从所述原始图像中将所述人像分割出来,得到第一图层;将背景位于所述第一区域中的部分进行特效素材替换,得到第二图像;将所述第一图像与所述第二图像进行叠加。In a preferred embodiment, the step of performing portrait segmentation on the portrait displayed on the screen, and performing special effect material replacement on the part of the background in the first area on the screen, includes: The original image of the portrait is down-sampled using a bilinear interpolation algorithm to obtain a down-sampled image; the outline of the person in the down-sampled image is calculated, and the outline of the person is up-sampled using a bilinear interpolation algorithm to obtain the result. the outline of the original image; segment the portrait from the original image based on the outline of the original image to obtain a first layer; replace the part of the background in the first area with special effects materials to obtain the first layer two images; superimposing the first image and the second image.
通过本实施例提供的方案,在做人像分割之前,对原始图像进行下采样处理,从而大幅度降低人像分割的计算和功耗开销,从而允许需要大计算量的深度学习人像分割模型算法能够运行在算力和功耗受限的移动终端上,满足视频播放的帧率要求。With the solution provided in this embodiment, before performing portrait segmentation, the original image is down-sampled, thereby greatly reducing the computational and power consumption overhead of portrait segmentation, thereby allowing the deep learning portrait segmentation model algorithm that requires a large amount of computation to run On mobile terminals with limited computing power and power consumption, it can meet the frame rate requirements of video playback.
在一种优选的实施方案中,根据所述第一区域的区域面积或所述第一区域占所述屏幕的屏幕占比,选择所述特效素材的添加等级。In a preferred embodiment, the adding level of the special effect material is selected according to the area of the first area or the screen ratio of the first area to the screen.
通过本实施例提供的方案,在添加特效素材的过程中,用户可以自行选择添加特效素材的量,体现在操作应用中就是可以根据用户的手指滑过屏幕的区域大小来选择特效素材的添加等级,这样的操作方法能够满足用户更多、更复杂的特效添加需求。With the solution provided in this embodiment, in the process of adding special effect materials, the user can choose the amount of special effect materials to be added, which is reflected in the operation application, that is, the level of adding special effect materials can be selected according to the size of the area where the user's finger slides across the screen , such an operation method can meet the user's more and more complex special effects adding needs.
在一种优选的实施方案中,所述第一区域的屏幕占比每增加10%,所述特效素材的添加等级对应提升一级。In a preferred embodiment, for every 10% increase in the screen ratio of the first area, the addition level of the special effect material is correspondingly increased by one level.
通过本实施例提供的方案,能够给用户提供更加平滑的视频特效添加体验。With the solution provided in this embodiment, a smoother video special effect adding experience can be provided to the user.
在一种优选的实施方案中,当所述第一区域的屏幕占比大于50%且所述手势动作的滑动终点的终点坐标信息不再变化时,将所述屏幕的整个背景进行特效素材替换。In a preferred embodiment, when the screen ratio of the first area is greater than 50% and the coordinate information of the end point of the sliding end point of the gesture action no longer changes, the entire background of the screen is replaced with special effects material .
通过本实施例提供的方案,由于用户在手指滑动大半的情况下往往就代表着有全部替换背景的需求,故采用本优选实施方案的方法能够便于用户操作,增强用户体验。With the solution provided by this embodiment, since the user often needs to replace all backgrounds when the user slides most of their fingers, the method of this preferred embodiment can facilitate the user's operation and enhance the user experience.
在一种优选的实施方案中,在所述根据所述手势动作的滑动信息,将所述屏幕分割成第一区域和第二区域的步骤之前,包括:根据所述滑动速度判断所述手势动作的滑动是否有效;若所述滑动速度大于第一速度,则将所述屏幕的背景进行整体特效素材替换;若所述滑动速度小于第二速度,则不执行根据所述手势动作的滑动信息,将特效素材应用于屏幕上的步骤;其中,所述第一速度大于所述第二速度。In a preferred embodiment, before the step of dividing the screen into a first area and a second area according to the sliding information of the gesture action, the step includes: judging the gesture action according to the sliding speed Whether the sliding speed is valid; if the sliding speed is greater than the first speed, the background of the screen will be replaced by the overall special effect material; if the sliding speed is less than the second speed, the sliding information according to the gesture action will not be executed, The step of applying special effect material on the screen; wherein, the first speed is greater than the second speed.
通过本实施例提供的方案,预设两个用于判断滑动速度的判断条件,滑动速度大于第一速度时,可以认为用户需要对整个背景进行替换,滑动速度小于第二速度时,可以认为用户并没有执行滑动手势,也就不用启动应用特效素材的步骤。Through the solution provided in this embodiment, two judgment conditions for judging the sliding speed are preset. When the sliding speed is greater than the first speed, it can be considered that the user needs to replace the entire background, and when the sliding speed is less than the second speed, it can be considered that the user There is no swipe gesture performed, so there is no need to initiate the step of applying the special effect material.
在一种优选的实施方案中,在所述对所述屏幕中显示的人像进行人像分割,对所述屏幕中背景位于所述第一区域中的部分进行特效素材替换的步骤之后,包括:判断所述手势动作的滑动方向;若所述滑动方向为远离手指在所述屏幕上的滑动起点的正向时,添加新的特效素材;若所述滑动方向为朝向手指在所述屏幕上的滑动起点的反向时,恢复上一个特效素材。In a preferred embodiment, after the steps of performing portrait segmentation on the portrait displayed on the screen and replacing the special effect material for the part of the background in the first area on the screen, the method includes: judging The sliding direction of the gesture action; if the sliding direction is a forward direction away from the starting point of the finger sliding on the screen, a new special effect material is added; if the sliding direction is the sliding direction toward the finger on the screen When the starting point is reversed, the previous special effect material is restored.
通过本实施例提供的方案,通过对滑动方向的识别,给用户提供回溯的操作,这样用户可以在多个特效素材中自由地选择更喜欢的特效素材,而不会为滑过喜欢的特效素材而担心,增强用户体验。With the solution provided in this embodiment, the user is provided with a backtracking operation by recognizing the sliding direction, so that the user can freely select a preferred special effect material among multiple special effect materials, instead of sliding over the favorite special effect material. And worry, enhance the user experience.
在一种优选的实施方案中,所述根据所述手势动作的滑动信息,将特效素材应用于屏幕上的步骤,包括:根据所述手势动作的滑动信息,在所述手势动作在所述屏幕上的滑动起点处随着用户的滑动方向拉出控制面板,所述控制面板上防止多个特效素材;将所述特效素材应用于所述屏幕上。In a preferred embodiment, the step of applying the special effect material on the screen according to the sliding information of the gesture action includes: according to the sliding information of the gesture action, when the gesture action is on the screen Pull out the control panel along with the sliding direction of the user at the sliding starting point on the control panel, and prevent multiple special effect materials on the control panel; apply the special effect materials on the screen.
通过本实施例提供的方案,给用户提供了具有选择性的控制面板,在进行特效素材替换的时候,用户的视觉体验更佳,能够选择出更符合用户需求的特效素材。With the solution provided in this embodiment, the user is provided with a control panel with selectivity. When the special effect material is replaced, the user's visual experience is better, and the special effect material that better meets the user's needs can be selected.
在一种优选的实施方案中,在所述根据所述手势动作的滑动信息,将特效素材应用于屏幕上的步骤之前,包括:检测每个所述特效素材的使用频率,根据使用频率由多到少对所述特效素材的呈现顺序进行排序。In a preferred embodiment, before the step of applying the special effect material on the screen according to the sliding information of the gesture action, the method includes: detecting the use frequency of each special effect material, and determining the frequency of use according to the frequency of use. Sort the presentation order of the special effect materials at least.
通过本实施例提供的方案,能够根据用户习惯,定制用户常用特效素材的列表顺序,从而在用户每次使用时能够更加快速地添加特效素材至屏幕的背景中,使用户的使用更方便,体验更好。With the solution provided in this embodiment, the list order of the user's commonly used special effect materials can be customized according to the user's habits, so that the special effect material can be added to the background of the screen more quickly every time the user uses it, so that the user's use is more convenient and experience. better.
在一种优选的实施方案中,所述特效素材的素材数量小于10。In a preferred embodiment, the number of special effect materials is less than 10.
通过本实施例提供的方案,为特效素材的备用库设定素材数量的上限,这些特效素材在划动时循环出现,避免由于特效素材太多而导致用户滑动后很难恢复到原始状态。With the solution provided in this embodiment, an upper limit of the number of materials is set for the backup library of special effect materials, and these special effect materials appear cyclically when swiping, so as to avoid that it is difficult for the user to restore the original state after sliding due to too many special effect materials.
第二方面,本申请实施例提供了一种视频特效添加装置,所述装置包括:信息获取模块,用于捕捉用户的手势动作,获取所述手势动作的滑动信息;特效应用模块,用于根据所述手势动作的滑动信息,将特效素材应用于屏幕上。In a second aspect, an embodiment of the present application provides an apparatus for adding special effects to a video. The apparatus includes: an information acquisition module for capturing a user's gesture action and acquiring sliding information of the gesture action; a special effect application module for For the sliding information of the gesture action, the special effect material is applied on the screen.
通过本实施例提供的方案,有别于现有技术中用户在视频通话过程中开启特效需要至少两次点击的操作而导致的交互过程繁琐的问题,本实施例提供的方案通过使用信息获取模块和特效应用模块对用户的手势动作的滑动信息进行捕捉和处理,能够达到用户的手指滑动到哪里特效就加到哪里的效果。The solution provided by this embodiment is different from the problem in the prior art that the user needs at least two clicks to activate special effects during a video call, which is a cumbersome interaction process. The solution provided by this embodiment uses the information acquisition module. And the special effect application module captures and processes the sliding information of the user's gesture action, which can achieve the effect of adding the special effect wherever the user's finger slides.
在一种优选的实施方案中,所述信息获取模块包括:记录单元,用于实时捕捉和记录用户的手指在所述屏幕的二维xy坐标系中滑动起点的起点坐标信息和滑动终点的终点坐标信息;计算单元,用于根据手指的所述起点坐标信息和所述终点坐标信息,判断手指的滑动方向以及滑动速度;判断单元,用于根据手指的滑动方向,判断用户所采用的滑动手势。In a preferred embodiment, the information acquisition module includes: a recording unit, configured to capture and record in real time the coordinate information of the starting point of the sliding start point and the end point of the sliding end point in the two-dimensional xy coordinate system of the screen by the user's finger Coordinate information; a calculation unit for judging the sliding direction and sliding speed of the finger according to the starting point coordinate information and the end point coordinate information of the finger; the judging unit for judging the sliding gesture adopted by the user according to the sliding direction of the finger .
通过本实施例提供的方案,记录单元用于记录用户的手指在屏幕上滑动时产生的滑动信息,计算单元通过用户滑动时手指的滑动起点和滑动终点的坐标,来确定在屏幕上添加特效素材的区域,判断单元在用户使用不同的滑动手势时分别对用户的手指的滑动轨迹进行判断,以便满足实时添加特效素材的需求。With the solution provided in this embodiment, the recording unit is used to record the sliding information generated when the user's finger slides on the screen, and the computing unit determines the addition of special effects materials on the screen by the coordinates of the sliding start point and the sliding end point of the user's finger when the user slides The judging unit judges the sliding trajectory of the user's finger when the user uses different sliding gestures, so as to meet the needs of adding special effects materials in real time.
在一种优选的实施方案中,所述特效应用模块包括:分割单元,用于根据所述手势动作的滑动信息,将所述屏幕分割成第一区域和第二区域;应用单元,用于对所述屏幕中显示的人像进行人像分割,对所述屏幕中背景位于所述第一区域中的部分进行特效素材替换。In a preferred embodiment, the special effect application module includes: a segmentation unit, for dividing the screen into a first area and a second area according to the sliding information of the gesture action; an application unit for dividing the screen into a first area and a second area; The portrait displayed on the screen is segmented, and the part of the background in the first area on the screen is replaced with special effects material.
通过本实施例提供的方案,分割单元先计算用户的手指滑过的区域大小,进行屏幕分割,将屏幕分割为手指滑过的第一区域和未滑过的第二区域,应用单元先进行人像分割,再对第一区域的背景进行特效素材的替换,实现了实时捕捉用户的滑动手势、实时计算用户的手指滑过的区域、实时替换用户的手指滑过的区域的背景的功能。With the solution provided in this embodiment, the segmentation unit first calculates the size of the area that the user's finger slides over, performs screen segmentation, and divides the screen into the first area where the finger slides and the second area that is not slid over, and the application unit first performs portrait Segmentation, and then replacing the background of the first area with special effects materials, realizes the functions of capturing the user's sliding gesture in real time, calculating the area where the user's finger slides in real time, and replacing the background of the area where the user's finger slides in real time.
第三方面,本申请实施例提供了一种终端设备,包括如第二方面所述的视频特效添加装置。In a third aspect, an embodiment of the present application provides a terminal device, including the apparatus for adding video special effects as described in the second aspect.
第四方面,本申请实施例提供了一种计算机可读存储介质,包括程序或指令,当所述程序或指令在计算机上运行时,如第一方面所述的方法被执行。In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, including a program or an instruction, and when the program or the instruction is run on a computer, the method according to the first aspect is executed.
与现有技术相比,本技术方案至少具有如下有益效果:Compared with the prior art, the technical solution at least has the following beneficial effects:
本申请实施例所公开的视频特效添加方法、装置及终端设备,用手势动作替代原有通过按键点击的方式开启特效,能够减少用户操作的复杂度,在视频通话来电时快速开启特效。能够根据用户手指滑过的区域面积或屏幕占比,做区域性的人像分割以及背景替换或虚化,提升产品的趣味性、可玩性和交互性。还能够在做人像分割之前,对原始图像进行下采样处理,从而大幅度降低人像分割的计算和功耗开销,从而允许需要大计算量的深度学习人像分割模型算法能够运行在算力和功耗受限的移动终端上,满足视频播放的帧率要求。The method, device, and terminal device for adding video special effects disclosed in the embodiments of the present application use gesture actions to replace the original method of opening special effects by clicking buttons, which can reduce the complexity of user operations and enable special effects quickly when a video call is incoming. It can perform regional portrait segmentation and background replacement or blurring according to the area or screen ratio that the user's finger slides over to improve the fun, playability and interactivity of the product. It can also downsample the original image before doing portrait segmentation, thereby greatly reducing the computational and power consumption overhead of portrait segmentation, thus allowing the deep learning portrait segmentation model algorithm that requires a large amount of computation to run in computing power and power consumption. On limited mobile terminals, it meets the frame rate requirements for video playback.
附图说明Description of drawings
为了更清楚地说明本申请实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to illustrate the technical solutions of the embodiments of the present application more clearly, the following briefly introduces the accompanying drawings used in the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained from these drawings without any creative effort.
图1是本申请实施例1所提供的终端设备的结构示意图;FIG. 1 is a schematic structural diagram of a terminal device provided in Embodiment 1 of the present application;
图2是本申请实施例2所提供的视频特效添加方法的步骤示意图;2 is a schematic diagram of steps of a method for adding special effects to a video provided by Embodiment 2 of the present application;
图3是本申请实施例2所提供的视频特效添加方法中步骤Step100的步骤示意图;3 is a schematic diagram of the steps of Step 100 in the method for adding special effects to a video provided in Embodiment 2 of the present application;
图4a是本申请实施例2所提供的视频特效添加方法中步骤Step100中采用边滑动手势时的直角坐标系,图4b本申请实施例2所提供的视频特效添加方法中步骤Step100中采用边滑动手势时的操作原理图;Fig. 4a is a Cartesian coordinate system when a side sliding gesture is used in step Step100 of the video special effect adding method provided in Embodiment 2 of the present application, and Fig. 4b is a side sliding gesture in step Step100 of the video special effect adding method provided by Embodiment 2 of the present application. Schematic diagram of the operation during gestures;
图5a是本申请实施例2所提供的视频特效添加方法中步骤Step100中采用角滑动手势时起点区域示意图,图5b是本申请实施例2所提供的视频特效添加方法中步骤Step100中采用角滑动手势时的操作原理图,图5c是本申请实施例2所提供的视频特 效添加方法中步骤Step100中采用角滑动手势时的有效滑动范围图;5a is a schematic diagram of the starting point area when a corner sliding gesture is used in step Step 100 of the video special effect adding method provided in Embodiment 2 of the present application, and FIG. 5b is a video special effect adding method provided in Embodiment 2 of the present application. Step 100 adopts corner sliding in step 100 Operation principle diagram during gesture, FIG. 5c is a diagram of the effective sliding range when corner sliding gesture is adopted in step Step 100 of the video special effect adding method provided in Embodiment 2 of the present application;
图6是本申请实施例2所提供的视频特效添加方法中步骤Step200的步骤示意图;6 is a schematic diagram of the steps of Step 200 in the method for adding special effects to a video provided in Embodiment 2 of the present application;
图7是本申请实施例2所提供的视频特效添加方法中步骤Step210的步骤示意图;7 is a schematic diagram of the steps of Step 210 in the video special effect adding method provided in Embodiment 2 of the present application;
图8是本申请实施例2所提供的视频特效添加方法中步骤Step220的步骤示意图;8 is a schematic diagram of the steps of Step 220 in the video special effect adding method provided in Embodiment 2 of the present application;
图9是本申请实施例2所提供的视频特效添加方法中步骤Step220中经人像分割护理后的轮廓图像的示意图;9 is a schematic diagram of a contour image after being cared for by portrait segmentation in step Step 220 in the video special effect adding method provided in Embodiment 2 of the present application;
图10是本申请实施例2所提供的视频特效添加方法中步骤Step210之前的步骤示意图;10 is a schematic diagram of steps before Step 210 in the video special effect adding method provided in Embodiment 2 of the present application;
图11是本申请实施例2所提供的视频特效添加方法中用户的手指在多次滑动时特效素材切换的操作示意图;11 is a schematic diagram of the operation of switching special effects materials when a user's finger slides multiple times in the method for adding special effects to a video provided in Embodiment 2 of the present application;
图12是本申请实施例2所提供的视频特效添加方法中步骤Step200的另一种实施方式的步骤示意图;12 is a schematic diagram of steps of another implementation of Step 200 in the method for adding special effects to a video provided in Embodiment 2 of the present application;
图13a和图13b是本申请实施例2所提供的视频特效添加方法中步骤Step200的另一种实施方式的操作示意图;13a and 13b are operational schematic diagrams of another implementation manner of Step 200 in the video special effect adding method provided in Embodiment 2 of the present application;
图14是本申请实施例2所提供的视频特效添加方法中步骤Step200之前的步骤示意图;14 is a schematic diagram of steps before Step 200 in the video special effect adding method provided in Embodiment 2 of the present application;
图15是本申请实施例3所提供的视频特效添加装置的模块示意图;15 is a schematic diagram of a module of a device for adding special effects to a video provided by Embodiment 3 of the present application;
图16是本申请实施例3所提供的视频特效添加装置中信息获取模块的模块示意图;16 is a schematic diagram of a module of an information acquisition module in the video special effect adding device provided in Embodiment 3 of the present application;
图17是本申请实施例3所提供的视频特效添加装置中特效应用模块的模块示意图。FIG. 17 is a schematic block diagram of a special effect application module in the video special effect adding apparatus provided in Embodiment 3 of the present application.
具体实施方式detailed description
为了更好的理解本申请的技术方案,下面结合附图对本申请实施例进行详细描述。In order to better understand the technical solutions of the present application, the embodiments of the present application are described in detail below with reference to the accompanying drawings.
应当明确,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。It should be clear that the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
以下描述终端设备和终端设备的实现方法的实施例,其中,该终端设备可以是移动电话(又称智能终端设备)、平板电脑(tablet personal computer)、个人数字助理(personal digital assistant)、电子书阅读器(e-book reader)或虚拟现实交互设备(virtual reality interactive device)等,该终端设备可以接入各种类型的通信***中,例如:长期演进(long term evolution,LTE)***,未来的第五代(5th Generation,5G)***,新一代无线接入技术(new radio access technology,NR),及未来的通信***,如6G***;还可以是无线局域网(wireless local area networks,WLAN)等。The following describes the terminal device and the implementation method of the terminal device, wherein the terminal device may be a mobile phone (also known as a smart terminal device), a tablet (personal computer), a personal digital assistant (personal digital assistant), an e-book Reader (e-book reader) or virtual reality interactive device (virtual reality interactive device), etc., the terminal device can be connected to various types of communication systems, such as: long term evolution (long term evolution, LTE) system, future The fifth generation (5th Generation, 5G) system, a new generation of wireless access technology (new radio access technology, NR), and future communication systems, such as 6G systems; can also be wireless local area networks (wireless local area networks, WLAN), etc. .
为了方便说明,在以下实施例中,以智能终端设备为例进行说明。For convenience of description, in the following embodiments, an intelligent terminal device is used as an example for description.
实施例1Example 1
如图1所示的是本申请实施例1公开了一种终端设备的结构示意图,其中,终端设备100可以包括处理器110,外部存储器接口120,内部存储器121,通用串行总线(universal serial bus,USB)接口130,充电管理模块140,电源管理模块141,电池142,天线1,天线2,移动通信模块150,无线通信模块160,音频模块170,扬声器170A, 受话器170B,麦克风170C,耳机接口170D,传感器模块180,按键190,马达191,指示器192,摄像头193,显示屏194,以及用户标识模块(subscriber identification module,SIM)卡接口195等。其中传感器模块180可以包括压力传感器180A,陀螺仪传感器180B,气压传感器180C,磁传感器180D,加速度传感器180E,距离传感器180F,接近光传感器180G,指纹传感器180H,温度传感器180J,触摸传感器180K,环境光传感器180L,骨传导传感器180M等。1 is a schematic structural diagram of a terminal device disclosed in Embodiment 1 of the present application, wherein the terminal device 100 may include a processor 110, an external memory interface 120, an internal memory 121, a universal serial bus (universal serial bus) , USB) interface 130, charging management module 140, power management module 141, battery 142, antenna 1, antenna 2, mobile communication module 150, wireless communication module 160, audio module 170, speaker 170A, receiver 170B, microphone 170C, headphone jack 170D, a sensor module 180, a key 190, a motor 191, an indicator 192, a camera 193, a display screen 194, and a subscriber identification module (SIM) card interface 195 and the like. 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, and ambient light. Sensor 180L, bone conduction sensor 180M, etc.
可以理解的是,本发明实施例示意的结构并不构成对终端设备100的具体限定。在本申请另一些实施例中,终端设备100可以包括比图示更多或更少的部件,或者组合某些部件,或者拆分某些部件,或者不同的部件布置。图示的部件可以以硬件,软件或软件和硬件的组合实现。It can be understood that, the structures illustrated in the embodiments of the present invention do not constitute a specific limitation on the terminal device 100 . In other embodiments of the present application, the terminal device 100 may include more or less components than those shown in the drawings, or combine some components, or separate some components, or arrange different components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
处理器110可以包括一个或多个处理单元,例如:处理器110可以包括应用处理器(application processor,AP),调制解调处理器,图形处理器(graphics processingunit,GPU),图像信号处理器(image signal processor,ISP),控制器,视频编解码器,数字信号处理器(digital signal processor,DSP),基带处理器,和/或神经网络处理器(neural-network processing unit,NPU)等。其中,不同的处理单元可以是独立的器件,也可以集成在一个或多个处理器中。The processor 110 may include one or more processing units, for example, the processor 110 may include an application processor (application processor, AP), a modem processor, a graphics processor (graphics processing unit, GPU), an image signal processor ( image signal processor, ISP), controller, video codec, digital signal processor (digital signal processor, DSP), baseband processor, and/or neural-network processing unit (neural-network processing unit, NPU), etc. Wherein, different processing units may be independent devices, or may be integrated in one or more processors.
控制器可以根据指令操作码和时序信号,产生操作控制信号,完成取指令和执行指令的控制。The controller can generate an operation control signal according to the instruction operation code and timing signal, and complete the control of fetching and executing instructions.
处理器110中还可以设置存储器,用于存储指令和数据。在一种实施例中,处理器110中的存储器为高速缓冲存储器。该存储器可以保存处理器110刚用过或循环使用的指令或数据。如果处理器110需要再次使用该指令或数据,可从所述存储器中直接调用。避免了重复存取,减少了处理器110的等待时间,因而提高了***的效率。A memory may also be provided in the processor 110 for storing instructions and data. In one embodiment, the memory in the processor 110 is a cache memory. This memory may hold instructions or data that have just been used or recycled by the processor 110 . If the processor 110 needs to use the instruction or data again, it can be called directly from the memory. Repeated accesses are avoided and the latency of the processor 110 is reduced, thereby increasing the efficiency of the system.
在一种实施例中,处理器110可以包括一个或多个接口。接口可以包括集成电路(inter-integrated circuit,I2C)接口,集成电路内置音频(inter-integrated circuitsound,I2S)接口,脉冲编码调制(pulse code modulation,PCM)接口,通用异步收发传输器(universal asynchronousreceiver/transmitter,UART)接口,移动产业处理器接口(mobile industry processor interface,MIPI),通用输入输出(general-purposeinput/output,GPIO)接口,用户标识模块(subscriber identity module,SIM)接口,和/或通用串行总线(universal serial bus,USB)接口等。In one embodiment, the processor 110 may include one or more interfaces. The interface may include an integrated circuit (inter-integrated circuit, I2C) interface, an integrated circuit built-in audio (inter-integrated circuitsound, I2S) interface, a pulse code modulation (pulse code modulation, PCM) interface, a universal asynchronous receiver (universal asynchronous receiver/transmitter) transmitter, UART) interface, mobile industry processor interface (MIPI), general-purpose input/output (GPIO) interface, subscriber identity module (SIM) interface, and/or general-purpose Serial bus (universal serial bus, USB) interface, etc.
I2C接口是一种双向同步串行总线,包括一根串行数据线(serial data line,SDA)和一根串行时钟线(derail clock line,SCL)。在一种实施例中,处理器110可以包含多组I2C总线。处理器110可以通过不同的I2C总线接口分别耦合触摸传感器180K,充电器,闪光灯,摄像头193等。例如:处理器110可以通过I2C接口耦合触摸传感器180K,使处理器110与触摸传感器180K通过I2C总线接口通信,实现终端设备100的触摸功能。The I2C interface is a bidirectional synchronous serial bus that includes a serial data line (SDA) and a serial clock line (SCL). In one embodiment, the processor 110 may contain multiple sets of I2C buses. The processor 110 can be respectively coupled to the touch sensor 180K, the charger, the flash, the camera 193 and the like through different I2C bus interfaces. For example, the processor 110 may couple the touch sensor 180K through the I2C interface, so that the processor 110 and the touch sensor 180K communicate with each other through the I2C bus interface, so as to realize the touch function of the terminal device 100 .
I2S接口可以用于音频通信。在一种实施例中,处理器110可以包含多组I2S总线。处理器110可以通过I2S总线与音频模块170耦合,实现处理器110与音频模块170之间的通信。在一种实施例中,音频模块170可以通过I2S接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。The I2S interface can be used for audio communication. In one embodiment, the processor 110 may contain multiple sets of I2S buses. The processor 110 may be coupled with the audio module 170 through an I2S bus to implement communication between the processor 110 and the audio module 170 . In one embodiment, the audio module 170 can transmit audio signals to the wireless communication module 160 through the I2S interface, so as to realize the function of answering calls through the Bluetooth headset.
PCM接口也可以用于音频通信,将模拟信号抽样,量化和编码。在一种实施例中,音频模块170与无线通信模块160可以通过PCM总线接口耦合。在一种实施例中,音频模块170也可以通过PCM接口向无线通信模块160传递音频信号,实现通过蓝牙耳机接听电话的功能。所述I2S接口和所述PCM接口都可以用于音频通信。The PCM interface can also be used for audio communications, sampling, quantizing and encoding analog signals. In one embodiment, the audio module 170 and the wireless communication module 160 may be coupled through a PCM bus interface. In one embodiment, the audio module 170 can also transmit audio signals to the wireless communication module 160 through the PCM interface, so as to realize the function of answering calls through the Bluetooth headset. Both the I2S interface and the PCM interface can be used for audio communication.
UART接口是一种通用串行数据总线,用于异步通信。该总线可以为双向通信总线。它将要传输的数据在串行通信与并行通信之间转换。在一种实施例中,UART接口通常被用于连接处理器110与无线通信模块160。例如:处理器110通过UART接口与无线通信模块160中的蓝牙模块通信,实现蓝牙功能。在一种实施例中,音频模块170可以通过UART接口向无线通信模块160传递音频信号,实现通过蓝牙耳机播放音乐的功能。The UART interface is a universal serial data bus used for asynchronous communication. The bus may be a bidirectional communication bus. It converts the data to be transmitted between serial communication and parallel communication. In one embodiment, a UART interface is typically used to connect the processor 110 with the wireless communication module 160 . For example, the processor 110 communicates with the Bluetooth module in the wireless communication module 160 through the UART interface to implement the Bluetooth function. In one embodiment, the audio module 170 can transmit audio signals to the wireless communication module 160 through the UART interface, so as to realize the function of playing music through the Bluetooth headset.
MIPI接口可以被用于连接处理器110与显示屏194,摄像头193等***器件。MIPI接口包括摄像头串行接口(camera serial interface,CSI),显示屏串行接口(displayserial interface,DSI)等。在一种实施例中,处理器110和摄像头193通过CSI接口通信,实现终端设备100的拍摄功能。处理器110和显示屏194通过DSI接口通信,实现终端设备100的显示功能。The MIPI interface can be used to connect the processor 110 with peripheral devices such as the display screen 194 and the camera 193 . MIPI interfaces include camera serial interface (CSI), display serial interface (DSI), etc. In an embodiment, the processor 110 communicates with the camera 193 through a CSI interface, so as to realize the shooting function of the terminal device 100 . The processor 110 communicates with the display screen 194 through the DSI interface to implement the display function of the terminal device 100 .
GPIO接口可以通过软件配置。GPIO接口可以被配置为控制信号,也可被配置为数据信号。在一种实施例中,GPIO接口可以用于连接处理器110与摄像头193,显示屏194,无线通信模块160,音频模块170,传感器模块180等。GPIO接口还可以被配置为I2C接口,I2S接口,UART接口,MIPI接口等。The GPIO interface can be configured by software. The GPIO interface can be configured as a control signal or as a data signal. In one embodiment, the GPIO interface may be used to connect the processor 110 with the camera 193, the display screen 194, the wireless communication module 160, the audio module 170, the sensor module 180, and the like. The GPIO interface can also be configured as I2C interface, I2S interface, UART interface, MIPI interface, etc.
USB接口130是符合USB标准规范的接口,具体可以是Mini USB接口,Micro USB接口,USB Type C接口等。USB接口130可以用于连接充电器为终端设备100充电,也可以用于终端设备100与***设备之间传输数据。也可以用于连接耳机,通过耳机播放音频。该接口还可以用于连接其他终端设备,例如AR设备等。The USB interface 130 is an interface that conforms to the USB standard specification, and may specifically be a Mini USB interface, a Micro USB interface, a USB Type C interface, and the like. The USB interface 130 can be used to connect a charger to charge the terminal device 100, and can also be used to transmit data between the terminal device 100 and peripheral devices. It can also be used to connect headphones to play audio through the headphones. This interface can also be used to connect other terminal devices, such as AR devices.
可以理解的是,本发明实施例示意的各模块间的接口连接关系,只是示意性说明,并不构成对终端设备100的结构限定。在本申请另一些实施例中,终端设备100也可以采用上述实施例中不同的接口连接方式,或多种接口连接方式的组合。It can be understood that the interface connection relationship between the modules illustrated in the embodiment of the present invention is only a schematic illustration, and does not constitute a structural limitation of the terminal device 100 . In other embodiments of the present application, the terminal device 100 may also adopt different interface connection manners in the foregoing embodiments, or a combination of multiple interface connection manners.
充电管理模块140用于从充电器接收充电输入。其中,充电器可以是无线充电器,也可以是有线充电器。在一种有线充电的实施例中,充电管理模块140可以通过USB接口130接收有线充电器的充电输入。在一种无线充电的实施例中,充电管理模块140可以通过终端设备100的无线充电线圈接收无线充电输入。充电管理模块140为电池142充电的同时,还可以通过电源管理模块141为终端设备供电。The charging management module 140 is used to receive charging input from the charger. The charger may be a wireless charger or a wired charger. In an embodiment of wired charging, the charging management module 140 may receive the charging input of the wired charger through the USB interface 130 . In an embodiment of wireless charging, the charging management module 140 may receive wireless charging input through the wireless charging coil of the terminal device 100 . While the charging management module 140 charges the battery 142 , it can also supply power to the terminal device through the power management module 141 .
电源管理模块141用于连接电池142,充电管理模块140与处理器110。电源管理模块141接收电池142和/或充电管理模块140的输入,为处理器110,内部存储器121,显示屏194,摄像头193,和无线通信模块160等供电。电源管理模块141还可以用于监测电池容量,电池循环次数,电池健康状态(漏电,阻抗)等参数。在一种实施例中,电源管理模块141也可以设置于处理器110中。在另一种实施例中,电源管理模块141和充电管理模块140也可以设置于同一个器件中。The power management module 141 is used for connecting the battery 142 , the charging management module 140 and the processor 110 . The power management module 141 receives input from the battery 142 and/or the charging management module 140, and supplies power to the processor 110, the internal memory 121, the display screen 194, the camera 193, and the wireless communication module 160. The power management module 141 can also be used to monitor parameters such as battery capacity, battery cycle times, battery health status (leakage, impedance). In one embodiment, the power management module 141 may also be provided in the processor 110 . In another embodiment, the power management module 141 and the charging management module 140 may also be provided in the same device.
终端设备100的无线通信功能可以通过天线1,天线2,移动通信模块150,无线通信模块160,调制解调处理器以及基带处理器等实现。The wireless communication function of the terminal device 100 may be implemented by the antenna 1, the antenna 2, the mobile communication module 150, the wireless communication module 160, the modulation and demodulation processor, the baseband processor, and the like.
天线1和天线2用于发射和接收电磁波信号。终端设备100中的每个天线可用于覆盖单个或多个通信频带。不同的天线还可以复用,以提高天线的利用率。例如:可以将天线1复用为无线局域网的分集天线。在另外一些实施例中,天线可以和调谐开关结合使用。 Antenna 1 and Antenna 2 are used to transmit and receive electromagnetic wave signals. Each antenna in terminal device 100 may be used to cover a single or multiple communication frequency bands. Different antennas can also be reused to improve antenna utilization. For example, the antenna 1 can be multiplexed as a diversity antenna of the wireless local area network. In other embodiments, the antenna may be used in conjunction with a tuning switch.
移动通信模块150可以提供应用在终端设备100上的包括2G/3G/4G/5G等无线通信的解决方案。移动通信模块150可以包括至少一个滤波器,开关,功率放大器,低噪声放大器(lownoise amplifier,LNA)等。移动通信模块150可以由天线1接收电磁波,并对接收的电磁波进行滤波,放大等处理,传送至调制解调处理器进行解调。移动通信模块150还可以对经调制解调处理器调制后的信号放大,经天线1转为电磁波辐射出去。在一种实施例中,移动通信模块150的至少部分功能模块可以被设置于处理器110中。在一种实施例中,移动通信模块150的至少部分功能模块可以与处理器110的至少部分模块被设置在同一个器件中。The mobile communication module 150 may provide a wireless communication solution including 2G/3G/4G/5G, etc. applied on the terminal device 100 . The mobile communication module 150 may include at least one filter, switch, power amplifier, low noise amplifier (LNA), and the like. The mobile communication module 150 can receive electromagnetic waves from the antenna 1, filter and amplify the received electromagnetic waves, and transmit them to the modulation and demodulation processor for demodulation. The mobile communication module 150 can also amplify the signal modulated by the modulation and demodulation processor, and then turn it into an electromagnetic wave for radiation through the antenna 1 . In one embodiment, at least part of the functional modules of the mobile communication module 150 may be provided in the processor 110 . In one embodiment, at least part of the functional modules of the mobile communication module 150 and at least part of the modules of the processor 110 may be provided in the same device.
调制解调处理器可以包括调制器和解调器。其中,调制器用于将待发送的低频基带信号调制成中高频信号。解调器用于将接收的电磁波信号解调为低频基带信号。随后解调器将解调得到的低频基带信号传送至基带处理器处理。低频基带信号经基带处理器处理后,被传递给应用处理器。应用处理器通过音频设备(不限于扬声器170A,受话器170B等)输出声音信号,或通过显示屏194显示图像或视频。在一种实施例中,调制解调处理器可以是独立的器件。在另一些实施例中,调制解调处理器可以独立于处理器110,与移动通信模块150或其他功能模块设置在同一个器件中。The modem processor may include a modulator and a demodulator. Wherein, the modulator is used to modulate the low frequency baseband signal to be sent into a medium and high frequency signal. The demodulator is used to demodulate the received electromagnetic wave signal into a low frequency baseband signal. Then the demodulator transmits the demodulated low-frequency baseband signal to the baseband processor for processing. The low frequency baseband signal is processed by the baseband processor and passed to the application processor. The application processor outputs sound signals through audio devices (not limited to the speaker 170A, the receiver 170B, etc.), or displays images or videos through the display screen 194 . In one embodiment, the modem processor may be a separate device. In other embodiments, the modem processor may be independent of the processor 110, and may be provided in the same device as the mobile communication module 150 or other functional modules.
无线通信模块160可以提供应用在终端设备100上的包括无线局域网(wirelesslocal area networks,WLAN)(如无线保真(wireless fidelity,Wi-Fi)网络),蓝牙(bluetooth,BT),全球导航卫星***(global navigation satellite system,GNSS),调频(frequency modulation,FM),近距离无线通信技术(near field communication,NFC),红外技术(infrared,IR)等无线通信的解决方案。无线通信模块160可以是集成至少一个通信处理模块的一个或多个器件。无线通信模块160经由天线2接收电磁波,将电磁波信号调频以及滤波处理,将处理后的信号发送到处理器110。无线通信模块160还可以从处理器110接收待发送的信号,对其进行调频,放大,经天线2转为电磁波辐射出去。The wireless communication module 160 can provide applications on the terminal device 100 including wireless local area networks (WLAN) (such as wireless fidelity (Wi-Fi) networks), bluetooth (BT), global navigation satellite system (global navigation satellite system, GNSS), frequency modulation (frequency modulation, FM), near field communication technology (near field communication, NFC), infrared technology (infrared, IR) and other wireless communication solutions. The wireless communication module 160 may be one or more devices integrating at least one communication processing module. The wireless communication module 160 receives electromagnetic waves via the antenna 2 , frequency modulates and filters the electromagnetic wave signals, and sends the processed signals to the processor 110 . The wireless communication module 160 can also receive the signal to be sent from the processor 110 , perform frequency modulation on it, amplify it, and convert it into electromagnetic waves for radiation through the antenna 2 .
在一种实施例中,终端设备100的天线1和移动通信模块150耦合,天线2和无线通信模块160耦合,使得终端设备100可以通过无线通信技术与网络以及其他设备通信。所述无线通信技术可以包括全球移动通讯***(global system for mobile communications,GSM),通用分组无线服务(general packet radio service,GPRS),码分多址接入(codedivision multiple access,CDMA),宽带码分多址(wideband code division multipleaccess,WCDMA),时分码分多址(time-division code division multiple access,TD-SCDMA),长期演进(long term evolution,LTE),BT,GNSS,WLAN,NFC,FM,和/或IR技术等。所述GNSS可以包括全球卫星定位***(global positioning system,GPS),全球导航卫星***(global navigation satellite system,GLONASS),北斗卫星导航***(beidounavigation satellite system,BDS),准天顶卫星***(quasi-zenith satellitesystem,QZSS)和/或星基增强***(satellite based augmentation systems,SBAS)。In an embodiment, the antenna 1 of the terminal device 100 is coupled with the mobile communication module 150, and the antenna 2 is coupled with the wireless communication module 160, so that the terminal device 100 can communicate with the network and other devices through wireless communication technology. The wireless communication technologies may include global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code Division Multiple Access (WCDMA), Time Division Code Division Multiple Access (TD-SCDMA), Long Term Evolution (LTE), BT, GNSS, WLAN, NFC, FM , and/or IR technology, etc. The GNSS may include a global positioning system (global positioning system, GPS), a global navigation satellite system (GLONASS), a Beidou satellite navigation system (beidounavigation satellite system, BDS), a quasi-zenith satellite system (quasi- zenith satellite system, QZSS) and/or satellite based augmentation systems (SBAS).
终端设备100通过GPU,显示屏194,以及应用处理器等实现显示功能。GPU为 图像处理的微处理器,连接显示屏194和应用处理器。GPU用于执行数学和几何计算,用于图形渲染。处理器110可包括一个或多个GPU,其执行程序指令以生成或改变显示信息。The terminal device 100 implements a display function through a GPU, a display screen 194, an application processor, and the like. The GPU is a microprocessor for image processing, and connects the display screen 194 and the application processor. The GPU is used to perform mathematical and geometric calculations for graphics rendering. Processor 110 may include one or more GPUs that execute program instructions to generate or alter display information.
显示屏194用于显示图像,视频等,其中,显示屏194包括显示面板,显示屏具体可以包括折叠屏、异形屏等,显示面板可以采用液晶显示屏(liquid crystal display,LCD),有机发光二极管(organic light-emitting diode,OLED),有源矩阵有机发光二极体或主动矩阵有机发光二极体(active-matrix organic light emitting diode的,AMOLED),柔性发光二极管(flex light-emitting diode,FLED),Miniled,MicroLed,Micro-oLed,量子点发光二极管(quantum dot light emitting diodes,QLED)等。在一种实施例中,终端设备100可以包括1个或N个显示屏194,N为大于1的正整数。The display screen 194 is used to display images, videos, etc., wherein the display screen 194 includes a display panel, and the display screen may specifically include a folding screen, a special-shaped screen, etc. The display panel may use a liquid crystal display (LCD), an organic light-emitting diode (organic light-emitting diode, OLED), active matrix organic light emitting diode or active matrix organic light emitting diode (active-matrix organic light emitting diode, AMOLED), flexible light emitting diode (flex light-emitting diode, FLED) ), Miniled, MicroLed, Micro-oLed, quantum dot light emitting diode (quantum dot light emitting diodes, QLED), etc. In one embodiment, the terminal device 100 may include one or N display screens 194 , where N is a positive integer greater than one.
终端设备100可以通过ISP,摄像头193,视频编解码器,GPU,显示屏194以及应用处理器等实现拍摄功能。The terminal device 100 can realize the shooting function through the ISP, the camera 193, the video codec, the GPU, the display screen 194 and the application processor.
ISP用于处理摄像头193反馈的数据。例如,拍照时,打开快门,光线通过镜头被传递到摄像头感光元件上,光信号转换为电信号,摄像头感光元件将所述电信号传递给ISP处理,转化为肉眼可见的图像。ISP还可以对图像的噪点,亮度,肤色进行算法优化。ISP还可以对拍摄场景的曝光,色温等参数优化。在一种实施例中,ISP可以设置在摄像头193中。The ISP is used to process the data fed back by the camera 193 . For example, when taking a photo, the shutter is opened, the light is transmitted to the camera photosensitive element through the lens, the light signal is converted into an electrical signal, and the camera photosensitive element transmits the electrical signal to the ISP for processing, and converts it into an image visible to the naked eye. ISP can also perform algorithm optimization on image noise, brightness, and skin tone. ISP can also optimize the exposure, color temperature and other parameters of the shooting scene. In one embodiment, the ISP may be provided in the camera 193 .
摄像头193用于捕获静态图像或视频。物体通过镜头生成光学图像投射到感光元件。感光元件可以是电荷耦合器件(charge coupled device,CCD)或互补金属氧化物半导体(complementary metal-oxide-semiconductor,CMOS)光电晶体管。感光元件把光信号转换成电信号,之后将电信号传递给ISP转换成数字图像信号。ISP将数字图像信号输出到DSP加工处理。DSP将数字图像信号转换成标准的RGB,YUV等格式的图像信号。在一种实施例中,终端设备100可以包括1个或N个摄像头193,N为大于1的正整数。Camera 193 is used to capture still images or video. The object is projected through the lens to generate an optical image onto the photosensitive element. The photosensitive element may 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 transmits the electrical signal to the ISP to convert it into a digital image signal. The ISP outputs the digital image signal to the DSP for processing. DSP converts digital image signals into standard RGB, YUV and other formats of image signals. In one embodiment, the terminal device 100 may include 1 or N cameras 193 , where N is a positive integer greater than 1.
数字信号处理器用于处理数字信号,除了可以处理数字图像信号,还可以处理其他数字信号。例如,当终端设备100在频点选择时,数字信号处理器用于对频点能量进行傅里叶变换等。A digital signal processor is used to process digital signals, in addition to processing digital image signals, it can also process other digital signals. For example, when the terminal device 100 selects a frequency point, the digital signal processor is used to perform Fourier transform on the frequency point energy, and the like.
视频编解码器用于对数字视频压缩或解压缩。终端设备100可以支持一种或多种视频编解码器。这样,终端设备100可以播放或录制多种编码格式的视频,例如:动态图像专家组(moving picture experts group,MPEG)1,MPEG2,MPEG3,MPEG4等。Video codecs are used to compress or decompress digital video. The terminal device 100 may support one or more video codecs. In this way, the terminal device 100 can play or record videos in various encoding formats, for example, moving picture experts group (moving picture experts group, MPEG) 1, MPEG2, MPEG3, MPEG4 and so on.
NPU为神经网络(neural-network,NN)计算处理器,通过借鉴生物神经网络结构,例如借鉴人脑神经元之间传递模式,对输入信息快速处理,还可以不断的自学习。通过NPU可以实现终端设备100的智能认知等应用,例如:图像识别,人脸识别,语音识别,文本理解等。The NPU is a neural-network (NN) computing processor. By drawing on the structure of biological neural networks, such as the transfer mode between neurons in the human brain, it can quickly process the input information, and can continuously learn by itself. Applications such as intelligent cognition of the terminal device 100 can be implemented through the NPU, such as image recognition, face recognition, speech recognition, text understanding, and the like.
外部存储器接口120可以用于连接外部存储卡,例如Micro SD卡,实现扩展终端设备100的存储能力。外部存储卡通过外部存储器接口120与处理器110通信,实现数据存储功能。例如将音乐,视频等文件保存在外部存储卡中。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 terminal device 100 . The external memory card communicates with the processor 110 through the external memory interface 120 to realize the data storage function. For example to save files like music, video etc in external memory card.
内部存储器121可以用于存储计算机可执行程序代码,所述可执行程序代码包括指令。内部存储器121可以包括存储程序区和存储数据区。其中,存储程序区可存储 操作***,至少一个功能所需的应用程序(比如声音播放功能,图像播放功能等)等。存储数据区可存储终端设备100使用过程中所创建的数据(比如音频数据,电话本等)等。此外,内部存储器121可以包括高速随机存取存储器,还可以包括非易失性存储器,例如至少一个磁盘存储器件,闪存器件,通用闪存存储器(universal flash storage,UFS)等。处理器110通过运行存储在内部存储器121的指令,和/或存储在设置于处理器中的存储器的指令,执行终端设备100的各种功能应用以及数据处理。Internal memory 121 may be used to store computer executable program code, which includes instructions. The internal memory 121 may include a storage program area and a storage data area. The storage program area can store the operating system, an application program required for at least one function (such as a sound playback function, an image playback function, etc.), and the like. The storage data area may store data (such as audio data, phone book, etc.) created during the use of the terminal device 100 and the like. In addition, the internal memory 121 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, universal flash storage (UFS), and the like. The processor 110 executes various functional applications and data processing of the terminal device 100 by executing instructions stored in the internal memory 121 and/or instructions stored in a memory provided in the processor.
终端设备100可以通过音频模块170,扬声器170A,受话器170B,麦克风170C,耳机接口170D,以及应用处理器等实现音频功能。例如音乐播放,录音等。The terminal device 100 may implement audio functions through an audio module 170, a speaker 170A, a receiver 170B, a microphone 170C, an earphone interface 170D, an application processor, and the like. Such as music playback, recording, etc.
音频模块170用于将数字音频信息转换成模拟音频信号输出,也用于将模拟音频输入转换为数字音频信号。音频模块170还可以用于对音频信号编码和解码。在一种实施例中,音频模块170可以设置于处理器110中,或将音频模块170的部分功能模块设置于处理器110中。The audio module 170 is used for converting digital audio information into analog audio signal output, and also for converting analog audio input into digital audio signal. Audio module 170 may also be used to encode and decode audio signals. In one embodiment, the audio module 170 may be provided in the processor 110 , or some functional modules of the audio module 170 may be provided in the processor 110 .
扬声器170A,也称“喇叭”,用于将音频电信号转换为声音信号。终端设备100可以通过扬声器170A收听音乐,或收听免提通话。Speaker 170A, also referred to as a "speaker", is used to convert audio electrical signals into sound signals. The terminal device 100 can listen to music through the speaker 170A, or listen to a hands-free call.
受话器170B,也称“听筒”,用于将音频电信号转换成声音信号。当终端设备100接听电话或语音信息时,可以通过将受话器170B靠近人耳接听语音。The receiver 170B, also referred to as "earpiece", is used to convert audio electrical signals into sound signals. When the terminal device 100 answers a call or a voice message, the voice can be answered by placing the receiver 170B close to the human ear.
麦克风170C,也称“话筒”,“传声器”,用于将声音信号转换为电信号。当拨打电话或发送语音信息时,用户可以通过人嘴靠近麦克风170C发声,将声音信号输入到麦克风170C。终端设备100可以设置至少一个麦克风170C。在另一些实施例中,终端设备100可以设置两个麦克风170C,除了采集声音信号,还可以实现降噪功能。在另一些实施例中,终端设备100还可以设置三个,四个或更多麦克风170C,实现采集声音信号,降噪,还可以识别声音来源,实现定向录音功能等。The microphone 170C, also called "microphone" or "microphone", is used to convert sound signals into electrical signals. When making a call or sending a voice message, the user can make a sound by approaching the microphone 170C through a human mouth, and input the sound signal into the microphone 170C. The terminal device 100 may be provided with at least one microphone 170C. In other embodiments, the terminal device 100 may be provided with two microphones 170C, which may implement a noise reduction function in addition to collecting sound signals. In other embodiments, the terminal device 100 may further be provided with three, four or more microphones 170C to collect sound signals, reduce noise, identify sound sources, and implement directional recording functions.
耳机接口170D用于连接有线耳机。耳机接口170D可以是USB接口130,也可以是3.5mm的开放移动终端设备平台(open mobile terminal platform,OMTP)标准接口,美国蜂窝电信工业协会(cellular telecommunications industry association of the USA,CTIA)标准接口。The earphone jack 170D is used to connect wired earphones. The earphone interface 170D can be the USB interface 130, or can be a 3.5mm open mobile terminal platform (open mobile terminal platform, OMTP) standard interface, a cellular telecommunications industry association of the USA (CTIA) standard interface.
压力传感器180A用于感受压力信号,可以将压力信号转换成电信号。在一种实施例中,压力传感器180A可以设置于显示屏194。压力传感器180A的种类很多,如电阻式压力传感器,电感式压力传感器,电容式压力传感器等。电容式压力传感器可以是包括至少两个具有导电材料的平行板。当有力作用于压力传感器180A,电极之间的电容改变。终端设备100根据电容的变化确定压力的强度。当有触摸操作作用于显示屏194,终端设备100根据压力传感器180A检测所述触摸操作强度。终端设备100也可以根据压力传感器180A的检测信号计算触摸的位置。在一种实施例中,作用于相同触摸位置,但不同触摸操作强度的触摸操作,可以对应不同的操作指令。例如:当有触摸操作强度小于第一压力阈值的触摸操作作用于短消息应用图标时,执行查看短消息的指令。当有触摸操作强度大于或等于第一压力阈值的触摸操作作用于短消息应用图标时,执行新建短消息的指令。The pressure sensor 180A is used to sense pressure signals, and can convert the pressure signals into electrical signals. In one embodiment, the pressure sensor 180A may be provided on the display screen 194 . There are many types of pressure sensors 180A, such as resistive pressure sensors, inductive pressure sensors, capacitive pressure sensors, and the like. The capacitive pressure sensor may be comprised of at least two parallel plates of conductive material. When a force is applied to the pressure sensor 180A, the capacitance between the electrodes changes. The terminal device 100 determines the intensity of the pressure according to the change in capacitance. When a touch operation acts on the display screen 194, the terminal device 100 detects the intensity of the touch operation according to the pressure sensor 180A. The terminal device 100 may also calculate the touched position according to the detection signal of the pressure sensor 180A. In one embodiment, touch operations that act on the same touch position but with different touch operation intensities may correspond to different operation instructions. For example, when a touch operation whose intensity is less than the first pressure threshold acts on the short message application icon, the instruction for viewing the short message is executed. When a touch operation with a touch operation intensity greater than or equal to the first pressure threshold acts on the short message application icon, the instruction to create a new short message is executed.
陀螺仪传感器180B可以用于确定终端设备100的运动姿态。在一种实施例中,可以通过陀螺仪传感器180B确定终端设备100围绕三个轴(即,x,y和z轴)的角速度。 陀螺仪传感器180B可以用于拍摄防抖。示例性的,当按下快门,陀螺仪传感器180B检测终端设备100抖动的角度,根据角度计算出镜头模组需要补偿的距离,让镜头通过反向运动抵消终端设备100的抖动,实现防抖。陀螺仪传感器180B还可以用于导航,体感游戏场景。The gyro sensor 180B may be used to determine the motion attitude of the terminal device 100 . In one embodiment, the angular velocity of the terminal device 100 about three axes (ie, the x, y and z axes) may be determined by the gyro sensor 180B. The gyro sensor 180B can be used for image stabilization. Exemplarily, when the shutter is pressed, the gyro sensor 180B detects the shaking angle of the terminal device 100, calculates the distance to be compensated by the lens module according to the angle, and allows the lens to offset the shaking of the terminal device 100 through reverse motion to achieve anti-shake. The gyro sensor 180B can also be used for navigation and somatosensory game scenarios.
气压传感器180C用于测量气压。在一种实施例中,终端设备100通过气压传感器180C测得的气压值计算海拔高度,辅助定位和导航。The air pressure sensor 180C is used to measure air pressure. In one embodiment, the terminal device 100 calculates the altitude by using the air pressure value measured by the air pressure sensor 180C to assist in positioning and navigation.
磁传感器180D包括霍尔传感器。终端设备100可以利用磁传感器180D检测翻盖皮套的开合。在一种实施例中,当终端设备100是翻盖机时,终端设备100可以根据磁传感器180D检测翻盖的开合。进而根据检测到的皮套的开合状态或翻盖的开合状态,设置翻盖自动解锁等特性。The magnetic sensor 180D includes a Hall sensor. The terminal device 100 can detect the opening and closing of the flip holster using the magnetic sensor 180D. In one embodiment, when the terminal device 100 is a flip machine, the terminal device 100 can detect the opening and closing of the flip according to the magnetic sensor 180D. Further, according to the detected opening and closing state of the leather case or the opening and closing state of the flip cover, characteristics such as automatic unlocking of the flip cover are set.
加速度传感器180E可检测终端设备100在各个方向上(一般为三轴)加速度的大小。当终端设备100静止时可检测出重力的大小及方向。还可以用于识别终端设备姿态,应用于横竖屏切换,计步器等应用。The acceleration sensor 180E can detect the magnitude of the acceleration of the terminal device 100 in various directions (generally three axes). The magnitude and direction of gravity can be detected when the terminal device 100 is stationary. It can also be used to identify the posture of terminal devices, and can be used in applications such as horizontal and vertical screen switching, pedometers, etc.
距离传感器180F,用于测量距离。终端设备100可以通过红外或激光测量距离。在一种实施例中,拍摄场景,终端设备100可以利用距离传感器180F测距以实现快速对焦。Distance sensor 180F for measuring distance. The terminal device 100 can measure the distance through infrared or laser. In one embodiment, when shooting a scene, the terminal device 100 can use the distance sensor 180F to measure the distance to achieve fast focusing.
接近光传感器180G可以包括例如发光二极管(LED)和光检测器,例如光电二极管。发光二极管可以是红外发光二极管。终端设备100通过发光二极管向外发射红外光。终端设备100使用光电二极管检测来自附近物体的红外反射光。当检测到充分的反射光时,可以确定终端设备100附近有物体。当检测到不充分的反射光时,终端设备100可以确定终端设备100附近没有物体。终端设备100可以利用接近光传感器180G检测用户手持终端设备100贴近耳朵通话,以便自动熄灭屏幕达到省电的目的。接近光传感器180G也可用于皮套模式,口袋模式自动解锁与锁屏。Proximity light sensor 180G may include, for example, light emitting diodes (LEDs) and light detectors, such as photodiodes. The light emitting diodes may be infrared light emitting diodes. The terminal device 100 emits infrared light to the outside through the light emitting diode. The terminal device 100 detects infrared reflected light from nearby objects using a photodiode. When sufficient reflected light is detected, it can be determined that there is an object near the terminal device 100 . When insufficient reflected light is detected, the terminal device 100 may determine that there is no object near the terminal device 100 . The terminal device 100 can use the proximity light sensor 180G to detect that the user holds the terminal device 100 close to the ear to talk, so as to automatically turn off the screen to save power. Proximity light sensor 180G can also be used in holster mode, pocket mode automatically unlocks and locks the screen.
环境光传感器180L用于感知环境光亮度。终端设备100可以根据感知的环境光亮度自适应调节显示屏194亮度。环境光传感器180L也可用于拍照时自动调节白平衡。环境光传感器180L还可以与接近光传感器180G配合,检测终端设备100是否在口袋里,以防误触。The ambient light sensor 180L is used to sense ambient light brightness. The terminal device 100 can adaptively adjust the brightness of the display screen 194 according to the perceived ambient light brightness. The ambient light sensor 180L can also be used to automatically adjust the white balance when taking pictures. The ambient light sensor 180L can also cooperate with the proximity light sensor 180G to detect whether the terminal device 100 is in a pocket, so as to prevent accidental touch.
指纹传感器180H用于采集指纹。终端设备100可以利用采集的指纹特性实现指纹解锁,访问应用锁,指纹拍照,指纹接听来电等。The fingerprint sensor 180H is used to collect fingerprints. The terminal device 100 can use the collected fingerprint characteristics to realize fingerprint unlocking, accessing application locks, taking photos with fingerprints, answering incoming calls with fingerprints, and the like.
温度传感器180J用于检测温度。在一种实施例中,终端设备100利用温度传感器180J检测的温度,执行温度处理策略。例如,当温度传感器180J上报的温度超过阈值,终端设备100执行降低位于温度传感器180J附近的处理器的性能,以便降低功耗实施热保护。在另一些实施例中,当温度低于另一阈值时,终端设备100对电池142加热,以避免低温导致终端设备100异常关机。在其他一些实施例中,当温度低于又一阈值时,终端设备100对电池142的输出电压执行升压,以避免低温导致的异常关机。The temperature sensor 180J is used to detect the temperature. In one embodiment, the terminal device 100 uses the temperature detected by the temperature sensor 180J to execute the temperature processing strategy. For example, when the temperature reported by the temperature sensor 180J exceeds a threshold value, the terminal device 100 reduces the performance of the processor located near the temperature sensor 180J, so as to reduce power consumption and implement thermal protection. In other embodiments, when the temperature is lower than another threshold, the terminal device 100 heats the battery 142 to avoid abnormal shutdown of the terminal device 100 caused by the low temperature. In some other embodiments, when the temperature is lower than another threshold, the terminal device 100 boosts the output voltage of the battery 142 to avoid abnormal shutdown caused by low temperature.
触摸传感器180K,也称“触控器件”。触摸传感器180K可以设置于显示屏194,由触摸传感器180K与显示屏194组成触摸屏,也称“触控屏”。触摸传感器180K用于检测作用于其上或附近的触摸操作。触摸传感器可以将检测到的触摸操作传递给应用处理器,以确定触摸事件类型。可以通过显示屏194提供与触摸操作相关的视觉输 出。在另一些实施例中,触摸传感器180K也可以设置于终端设备100的表面,与显示屏194所处的位置不同。Touch sensor 180K, also called "touch device". 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”. The touch sensor 180K is used to detect a touch operation on or near it. The touch sensor can pass the detected touch operation to the application processor to determine the type of touch event. Visual output associated with touch operations may be provided via display screen 194. In other embodiments, the touch sensor 180K may also be disposed on the surface of the terminal device 100 , which is different from the position where the display screen 194 is located.
在一种实施例中,由触摸传感器180K与显示屏194组成的触控屏可以位于终端设备100的侧边区域或折叠区域,用于当用户手接触触控屏时,确定用户触碰的位置以及触碰的手势;例如,用户手持终端设备时,可以通过大拇指点击触控屏上的任一位置,则触摸传感器180K可以检测到用户的点击操作,并将该点击操作传递给处理器,处理器根据该点击操作确定该点击操作用于唤醒屏幕。In one embodiment, the touch screen composed of the touch sensor 180K and the display screen 194 may be located in the side area or the folded area of the terminal device 100 to determine the position touched by the user when the user's hand touches the touch screen and touch gestures; for example, when the user holds the terminal device, he can click any position on the touch screen with his thumb, then the touch sensor 180K can detect the user's click operation, and transmit the click operation to the processor, The processor determines, according to the click operation, that the click operation is used to wake up the screen.
骨传导传感器180M可以获取振动信号。在一种实施例中,骨传导传感器180M可以获取人体声部振动骨块的振动信号。骨传导传感器180M也可以接触人体脉搏,接收血压跳动信号。在一种实施例中,骨传导传感器180M也可以设置于耳机中,结合成骨传导耳机。音频模块170可以基于所述骨传导传感器180M获取的声部振动骨块的振动信号,解析出语音信号,实现语音功能。应用处理器可以基于所述骨传导传感器180M获取的血压跳动信号解析心率信息,实现心率检测功能。The bone conduction sensor 180M can acquire vibration signals. In one embodiment, the bone conduction sensor 180M can acquire the vibration signal of the vibrating bone mass of the human voice. The bone conduction sensor 180M can also contact the pulse of the human body and receive the blood pressure beating signal. In one embodiment, the bone conduction sensor 180M can also be disposed in the earphone, and combined with the bone conduction earphone. The audio module 170 can analyze the voice signal based on the vibration signal of the vocal vibration bone block obtained by the bone conduction sensor 180M, so as to realize the voice function. The application processor can analyze the heart rate information based on the blood pressure beat signal obtained by the bone conduction sensor 180M, and realize the function of heart rate detection.
按键190包括开机键,音量键等。按键190可以是机械按键。也可以是触摸式按键。终端设备100可以接收按键输入,产生与终端设备100的用户设置以及功能控制有关的键信号输入。The keys 190 include a power-on key, a volume key, and the like. Keys 190 may be mechanical keys. It can also be a touch key. The terminal device 100 may receive key input and generate key signal input related to user settings and function control of the terminal device 100 .
马达191可以产生振动提示。马达191可以用于来电振动提示,也可以用于触摸振动反馈。例如,作用于不同应用(例如拍照,音频播放等)的触摸操作,可以对应不同的振动反馈效果。作用于显示屏194不同区域的触摸操作,马达191也可对应不同的振动反馈效果。不同的应用场景(例如:时间提醒,接收信息,闹钟,游戏等)也可以对应不同的振动反馈效果。触摸振动反馈效果还可以支持自定义。Motor 191 can generate vibrating cues. The motor 191 can be used for vibrating alerts for incoming calls, and can also be used for touch vibration feedback. For example, touch operations acting on different applications (such as taking pictures, playing audio, etc.) can correspond to different vibration feedback effects. The motor 191 can also correspond to different vibration feedback effects for touch operations on different areas of the display screen 194 . Different application scenarios (for example: time reminder, receiving information, alarm clock, games, etc.) can also correspond to different vibration feedback effects. The touch vibration feedback effect can also support customization.
指示器192可以是指示灯,可以用于指示充电状态,电量变化,也可以用于指示消息,未接来电,通知等。The indicator 192 can be an indicator light, which can be used to indicate the charging state, the change of the power, and can also be used to indicate a message, a missed call, a notification, and the like.
SIM卡接口195用于连接SIM卡。SIM卡可以通过***SIM卡接口195,或从SIM卡接口195拔出,实现和终端设备100的接触和分离。终端设备100可以支持1个或N个SIM卡接口,N为大于1的正整数。SIM卡接口195可以支持Nano SIM卡,Micro SIM卡,SIM卡等。同一个SIM卡接口195可以同时***多张卡。所述多张卡的类型可以相同,也可以不同。SIM卡接口195也可以兼容不同类型的SIM卡。SIM卡接口195也可以兼容外部存储卡。终端设备100通过SIM卡和网络交互,实现通话以及数据通信等功能。在一种实施例中,终端设备100采用eSIM,即:嵌入式SIM卡。eSIM卡可以嵌在终端设备100中,不能和终端设备100分离。The SIM card interface 195 is used to connect a SIM card. The SIM card can be contacted and separated from the terminal device 100 by inserting into the SIM card interface 195 or pulling out from the SIM card interface 195 . The terminal device 100 may support 1 or N SIM card interfaces, where N is a positive integer greater than 1. The SIM card interface 195 can support Nano SIM card, Micro SIM card, SIM card and so on. Multiple cards can be inserted into the same SIM card interface 195 at the same time. The types of the plurality of cards may be the same or different. The SIM card interface 195 can also be compatible with different types of SIM cards. The SIM card interface 195 is also compatible with external memory cards. The terminal device 100 interacts with the network through the SIM card to realize functions such as calls and data communication. In an embodiment, the terminal device 100 adopts an eSIM, that is, an embedded SIM card. The eSIM card can be embedded in the terminal device 100 and cannot be separated from the terminal device 100 .
当终端设备采用异形屏或折叠屏时,终端设备的触控显示屏可以包括多个触控显示区域,例如,终端设备的折叠屏在折叠状态下包括折叠区域,该折叠区域也可以实现触控响应。但是,现有技术中终端设备对特定的触控显示区域的操作局限较大,没有专门针对特定的触控显示区域的相关操作,基于此,本申请实施例提供一种手势交互方法,该手势交互方法中的终端设备的侧边区域或折叠区域存在触控响应区域,终端设备可以获取该触控响应区域的输入事件,并响应于所述输入事件,触发所述终端设备执行所述输入事件对应的操作指令,以实现对终端设备的侧边区域或折叠区域的手势操作,提升终端设备的操控体验。When the terminal device adopts a special-shaped screen or a folding screen, the touch display screen of the terminal device may include multiple touch display areas. For example, the folding screen of the terminal device includes a folding area in a folded state, and the folding area can also realize touch control. response. However, in the prior art, the operation of a terminal device on a specific touch display area is relatively limited, and there is no relevant operation specifically for a specific touch display area. Based on this, an embodiment of the present application provides a gesture interaction method. In the interactive method, there is a touch response area in the side area or folding area of the terminal device, and the terminal device can obtain the input event of the touch response area, and in response to the input event, trigger the terminal device to execute the input event The corresponding operation instructions are used to implement gesture operations on the side area or the folded area of the terminal device to improve the control experience of the terminal device.
本申请实施例1所公开的终端设备中,存储器用于存储计算机程序,处理器用于执行存储器中存储的计算机程序,以使终端设备执行本申请实施例2所述的方法。In the terminal device disclosed in Embodiment 1 of the present application, the memory is used to store a computer program, and the processor is used to execute the computer program stored in the memory, so that the terminal device executes the method described in Embodiment 2 of the present application.
实施例2Example 2
如图2所示的是本申请实施例2公开了一种视频特效添加方法,可应用于来电状态,方法包括以下步骤:As shown in FIG. 2, Embodiment 2 of the present application discloses a method for adding special effects to a video, which can be applied to an incoming call state, and the method includes the following steps:
Step100:捕捉用户的手势动作,获取手势动作的滑动信息;Step100: Capture the user's gesture action, and obtain the sliding information of the gesture action;
Step200:根据手势动作的滑动信息,将特效素材应用于屏幕上。Step 200: Apply the special effect material to the screen according to the sliding information of the gesture action.
本实施例的视频特效添加方法,有别于现有技术中用户在视频通话过程中开启特效需要至少两次点击的操作而导致的交互过程繁琐的问题,本实施例提供的方案通过对用户的手势动作的滑动信息进行捕捉和处理,能够达到用户的手指滑动到哪里特效就加到哪里的效果。The method for adding video special effects in this embodiment is different from the problem in the prior art that the user needs at least two clicks to activate special effects during a video call, and the interaction process is cumbersome. The sliding information of the gesture action is captured and processed, which can achieve the effect of adding special effects wherever the user's finger slides.
如图3所示,在本实施例的视频特效添加方法中,在步骤Step100:捕捉用户的手势动作,获取手势动作的滑动信息中,包括:As shown in FIG. 3 , in the video special effect adding method of the present embodiment, in Step 100 : capturing a user's gesture action, and acquiring the sliding information of the gesture action, including:
Step110:实时捕捉和记录用户的手指在屏幕的二维xy坐标系中滑动起点的起点坐标信息和滑动终点的终点坐标信息;Step110: Capture and record in real time the coordinate information of the starting point of the sliding start point and the coordinate information of the end point of the sliding end point in the two-dimensional xy coordinate system of the screen by the user's finger;
Step120:根据手指的起点坐标信息和终点坐标信息,判断手指的滑动方向以及滑动速度;Step120: According to the starting point coordinate information and the ending point coordinate information of the finger, determine the sliding direction and sliding speed of the finger;
Step130:根据手指的滑动方向,判断用户所采用的滑动手势。Step 130: Determine the sliding gesture adopted by the user according to the sliding direction of the finger.
其中,滑动信息包括滑动起点的起点坐标信息、滑动终点的终点坐标信息、滑动手势、滑动方向和滑动速度。The sliding information includes the starting point coordinate information of the sliding start point, the end point coordinate information of the sliding end point, the sliding gesture, the sliding direction and the sliding speed.
本实施例的视频特效添加方法,用户滑动时手指滑过屏幕会留下滑动信息,滑动起点的起点坐标信息和滑动终点的终点坐标信息提供了判断滑动手势、滑动方向和滑动速度的依据,滑动手势提供用户的手指在屏幕上滑动的方式,滑动方向提供用户的手指在屏幕上滑动的路径,滑动速度提供用户的手指在屏幕上滑动的快慢,综合这些滑动信息就能够准确得知屏幕上需要替换特效素材的区域。In the method for adding video special effects in this embodiment, when a user slides a finger across the screen, sliding information will be left, and the coordinate information of the starting point of the sliding start and the coordinate information of the end point of the sliding end provide the basis for judging the sliding gesture, the sliding direction and the sliding speed. Gestures provide the way that the user's finger slides on the screen, the sliding direction provides the path that the user's finger slides on the screen, and the sliding speed provides the speed of the user's finger sliding on the screen. Combining these sliding information can accurately know the needs of the screen. The area to replace the special effect material.
在本实施例的视频特效添加方法中,用户的滑动手势分为边滑动手势和角滑动手势,边滑动手势为从手机的四条边任意开始向屏幕中心横向或纵向滑动;角滑动手势以角向屏幕中心滑动为主。In the method for adding video special effects in this embodiment, the user's sliding gestures are divided into side sliding gestures and corner sliding gestures. The side sliding gesture is to slide horizontally or vertically from the four sides of the mobile phone to the center of the screen; the corner sliding gesture is a corner sliding gesture. The center of the screen slides.
当滑动手势为边滑动手势时,执行以下步骤:When the swipe gesture is an edge swipe gesture, perform the following steps:
Step140:根据手指的起点坐标信息和终点坐标信息,判断手指在屏幕上的坐标位移D与预设的最小距离D min的大小关系,以及滑动速度V与预设的最小速度V min的大小关系; Step140: According to the coordinate information of the starting point and the coordinate information of the end point of the finger, determine the size relationship between the coordinate displacement D of the finger on the screen and the preset minimum distance D min , and the size relationship between the sliding speed V and the preset minimum speed V min ;
当D>D min且V>V min时,执行步骤Step180。 When D>D min and V>V min , step Step180 is executed.
以从屏幕侧边向中心右滑为例。判断手指在屏幕上的坐标位移|Xs-Xe|与预设的最小距离D min的大小关系,以及滑动速度Vx与预设的最小速度Vmin的大小关系; Take the example of swiping right from the side of the screen to the center. Determine the relationship between the coordinate displacement |Xs-Xe| of the finger on the screen and the preset minimum distance Dmin , and the relationship between the sliding speed Vx and the preset minimum speed Vmin;
当|Xs-Xe|>D min且V x>V min时,则判断为有效滑动。 When |Xs-Xe|> Dmin and Vx > Vmin , it is determined that the sliding is valid.
其核心思路为:实时捕捉和记录用户手指在屏幕中二维坐标轴的坐标位置(x,y)的运动轨迹和速度(如图4a至图4b所示)。The core idea is to capture and record the movement trajectory and speed of the user's finger on the screen at the coordinate position (x, y) of the two-dimensional coordinate axis in real time (as shown in Figure 4a to Figure 4b).
其判断条件为:如果滑动起点横坐标X s为0(优选地可以预留10个像素的容错空间,容错空间的具体数值根据实际需求而定),且纵坐标Y s为屏幕中间点范围(纵轴长度最大Y max+200个像素);滑动终点的横坐标X e为大于X s,坐标位移|Xs-Xe|大于D min(优选地可根据应用场景、用户习惯、屏幕灵敏度等具体裁定,参考取值为100个像素),且移动速度V x大于V min(参考取值200像素/秒)。 Its judgment condition is: if the abscissa X s of the sliding starting point is 0 (preferably, a fault-tolerant space of 10 pixels can be reserved, and the specific value of the fault-tolerant space is determined according to actual needs), and the ordinate Y s is the range of the middle point of the screen ( The maximum length of the vertical axis is Y max +200 pixels); the abscissa X e of the sliding end point is greater than X s , and the coordinate displacement |Xs-Xe| is greater than D min (preferably according to the application scenario, user habits, screen sensitivity, etc. , the reference value is 100 pixels), and the moving speed V x is greater than V min (the reference value is 200 pixels/second).
上述判定过程为判断图4a至图4b中所示的手指横向拉动动作;基于上述思路可拓展实现获知用户横向拉动的区域面积,从而便于执行后续应用特效素材步骤。The above determination process is to determine the lateral pulling action of the finger shown in FIG. 4a to FIG. 4b; based on the above idea, the area of the area where the user is known to pull laterally can be expanded, so as to facilitate the subsequent steps of applying special effects materials.
需要注意的是,在安卓手机上该滑动手势动作可能是***默认的Home键(起始键)功能,因此在该场景下要注意***级手势监听捕捉。It should be noted that on Android phones, the swipe gesture action may be the default Home button (start button) function of the system, so in this scenario, attention should be paid to system-level gesture monitoring and capture.
同理可得,若手指从屏幕顶端向下滑,则坐标位移为|Ys-Ye|,滑动速度为V y,余下步骤代入上文所述的条件和步骤即可。 Similarly, if the finger slides down from the top of the screen, the coordinate displacement is |Ys-Ye|, the sliding speed is V y , and the remaining steps can be substituted into the conditions and steps described above.
本实施例的视频特效添加方法,预先设定最小距离D min和最小速度V min作为判断用户的手指是否有效滑动的标准,通过计算手指在屏幕上的坐标位移D和滑动速度V,来判断用户的手指是否真的在进行手势操作,避免发生错误相应用户在屏幕上的误触碰而错误添加特效素材的问题。 In the video special effect adding method of this embodiment, the minimum distance D min and the minimum speed V min are preset as the criteria for judging whether the user's finger slides effectively, and the user is judged by calculating the coordinate displacement D and sliding speed V of the finger on the screen. Whether the finger of the user is really performing the gesture operation, to avoid the problem of adding special effects material by mistake due to the user's mistaken touch on the screen.
以屏幕右上角向屏幕中心区域移动为例。当滑动手势为边滑动手势时,执行以下步骤:Take the upper right corner of the screen moving toward the center of the screen as an example. When the swipe gesture is an edge swipe gesture, perform the following steps:
Step150:预设起点区域;其中,所述起点区域的横坐标的最大值为X max,横坐标的最大值为Y maxStep150: preset a starting point area; wherein, the maximum value of the abscissa of the starting point area is X max , and the maximum value of the abscissa is Y max ;
Step160:根据手指的起点坐标信息,判断手指的滑动起点是否落在起点区域内;Step160: According to the coordinate information of the starting point of the finger, determine whether the sliding starting point of the finger falls within the starting point area;
若手指的滑动起点的横坐标X s<X max且纵坐标Y s<Y max,则判断为手指的滑动起点位于预设的起点区域内;从而执行步骤Step170。 If the abscissa X s <X max and the ordinate Y s <Y max of the sliding starting point of the finger, it is determined that the sliding starting point of the finger is located within the preset starting point area; thus step Step170 is executed.
Step170:根据手指的起点坐标信息和所述终点坐标信息,判断手指在屏幕上的坐标位移D与预设的最小距离D min的大小关系,以及滑动速度V与预设的最小速度V min的大小关系; Step170: According to the coordinate information of the starting point of the finger and the coordinate information of the end point, determine the relationship between the coordinate displacement D of the finger on the screen and the preset minimum distance D min , and the size of the sliding speed V and the preset minimum speed V min relation;
当D>D min、V>V min且所述滑动起点与所述滑动终点的连线的斜率k的范围满足0.268<|k|<3.73或0.268<|k-1|<3.73时,执行步骤Step180。 When D> Dmin , V> Vmin , and the range of the slope k of the connecting line between the sliding start point and the sliding end point satisfies 0.268<|k|<3.73 or 0.268<|k-1|<3.73, execute the step Step180.
此时,坐标位移
Figure PCTCN2021118451-appb-000001
At this point, the coordinate shift
Figure PCTCN2021118451-appb-000001
Step180:启动所述特效素材。Step 180: Start the special effect material.
如图5a至图5c所示,用户的手指在执行角滑动手势时,其角向心移动动作识别触发条件为起点O必须在图5b的方框形状的起点区域内,50为参考值,可根据实际需要或者屏幕灵敏度适当调整起点区域大小。As shown in Fig. 5a to Fig. 5c, when the user's finger performs the corner sliding gesture, the trigger condition for the recognition of its angular centripetal movement action is that the starting point O must be within the starting point area of the box shape in Fig. 5b, and 50 is a reference value, which can be determined according to Adjust the size of the starting point area according to actual needs or screen sensitivity.
角向心滑动动作识别是基于图4a至图4c所示的边滑动手势的判断条件做适当优化后得到的判断规则,以图5c中点A为终点为例,A坐标设为(X(A),Y(A)),起点是(X(O),Y(O))。判断规则如下:Angular centripetal sliding action recognition is a judgment rule obtained after appropriate optimization based on the judgment conditions of the side sliding gesture shown in Figure 4a to Figure 4c. Taking the point A in Figure 5c as the end point as an example, the A coordinate is set as (X (A ), Y(A)), and the starting point is (X(O), Y(O)). The judgment rules are as follows:
Figure PCTCN2021118451-appb-000002
Figure PCTCN2021118451-appb-000002
②坐标移动速度超过V min(参考取值200像素/秒); ②The coordinate movement speed exceeds V min (the reference value is 200 pixels/second);
③直线AO的斜率k范围在(0.268,3.73),即对应移动偏移的角度在15°到75°之间,如图4c中OAB三角形区域所示。(三角区范围可根据实际需求适当调整)。③ The slope k of the straight line AO is in the range of (0.268, 3.73), that is, the angle corresponding to the movement offset is between 15° and 75°, as shown in the OAB triangle area in Figure 4c. (The scope of the triangle area can be appropriately adjusted according to actual needs).
滑动区域识别(即等腰直角三角形区域识别):基于手指滑动的滑动终点进行如下处理:以图5c中点A为例,设A为用户滑动的滑动终点,过点A做一条斜率为-1的直线,则该直线与坐标轴的所围成的三角形区域即为滑动区域,因为该直线斜率为-1,因此与坐标轴的内角均为45°,如图5c所示,等腰直角三角形,为实现图中三角形区域的背景替换做好准备。Sliding area recognition (ie, isosceles right-angled triangle area recognition): Based on the sliding end point of finger sliding, the following processing is performed: Take point A in Figure 5c as an example, set A as the sliding end point of the user's sliding, and make a line through point A with a slope of -1 , then the triangle area enclosed by the line and the coordinate axis is the sliding area, because the slope of the line is -1, so the interior angle with the coordinate axis is 45°, as shown in Figure 5c, the isosceles right triangle , in preparation for the background replacement of the triangle area in the figure.
图5c仅例举了终端设备的一个角的情形,其他三个角处的判断规则可以根据图5c所例举的情形推断而得,最终得出判断规则为0.268<|k|<3.73或0.268<|k -1|<3.73。 Figure 5c only exemplifies the situation of one corner of the terminal device, the judgment rules at the other three corners can be inferred from the situation exemplified in Figure 5c, and the final judgment rule is 0.268<|k|<3.73 or 0.268 <|k -1 |<3.73.
本实施例的视频特效添加方法,预先设定起点区域和滑动区域,起点区域作为判定用户的手指是否能够触发滑动手势识别的判断条件,滑动区域作为判定用户的手指是否能够触发应用特效素材的判断条件,设定两个判断条件从而准确地判断用户的手指在屏幕的角落处是否存在滑动手势以及手指所滑动的区域大小,在屏幕的四个角落处设置的滑动区域,其边缘的倾角在15°到75°的范围内,用户的手指在执行角滑动手势时,就会覆盖滑动区域的部分或者全部,能够满足角滑动手势的判断要求,进而能够适应性地应用特效素材。In the video special effect adding method of this embodiment, the starting point area and the sliding area are preset, the starting point area is used as the judgment condition for judging whether the user's finger can trigger the recognition of the sliding gesture, and the sliding area is used as the judgment for judging whether the user's finger can trigger the application of the special effect material. Condition, set two judgment conditions to accurately judge whether the user's finger has a sliding gesture at the corner of the screen and the size of the area where the finger slides. The sliding area set at the four corners of the screen has an edge inclination of 15 In the range from ° to 75°, when the user's finger performs the corner sliding gesture, it will cover part or all of the sliding area, which can meet the judgment requirements of the corner sliding gesture, and then can adaptively apply special effects materials.
如图6所示,在本实施例的视频特效添加方法中,在步骤Step200:根据手势动作的滑动信息,将特效素材应用于屏幕上中,包括:As shown in FIG. 6 , in the video special effect adding method of the present embodiment, in step Step 200 : applying the special effect material to the screen according to the sliding information of the gesture action, including:
Step210:根据手势动作的滑动信息,将屏幕分割成第一区域和第二区域;Step210: According to the sliding information of the gesture action, the screen is divided into a first area and a second area;
Step220:对屏幕中显示的人像进行人像分割,对屏幕中背景位于第一区域中的部分进行特效素材替换。Step 220: Segment the portrait displayed on the screen, and replace the part of the background in the first area on the screen with special effects material.
其中,第一区域为与手势动作的滑动起点与滑动终点的连线相垂直且穿过滑动终点的分割线所扫过的屏幕的区域,第二区域为屏幕上除第一区域外的区域;滑动信息包括滑动起点的起点坐标信息、滑动终点的终点坐标信息、滑动手势、滑动方向和滑动速度。Wherein, the first area is the area of the screen that is perpendicular to the connecting line between the sliding start point and the sliding end point of the gesture action and passes through the dividing line of the sliding end point, and the second area is the area on the screen except the first area; The sliding information includes the starting point coordinate information of the sliding start point, the end point coordinate information of the sliding end point, the sliding gesture, the sliding direction and the sliding speed.
本实施例的视频特效添加方法,先进行人像分割和屏幕分割,将人像提取出,将屏幕分割为手指滑过的第一区域和未滑过的第二区域,并仅对第一区域的背景进行特效素材的替换。该方法能够实时捕捉手指在滑动中的位置,从而确定所需要替换背景的第一区域。在替换背景时,人像所占区域依旧显示人像,不会被替换成背景,形成前方人像不变,后方背景变化的效果,从而实现了实时捕捉用户的滑动手势、实时计算用户的手指滑过的区域、实时替换用户的手指滑过的区域的背景的功能。In the method for adding video special effects in this embodiment, portrait segmentation and screen segmentation are performed first, the portrait is extracted, and the screen is divided into a first area that the finger slides over and a second area that is not slid over, and only the background of the first area is Replace the effect material. The method can capture the position of the finger in the sliding process in real time, so as to determine the first area that needs to replace the background. When replacing the background, the area occupied by the portrait still displays the portrait, and will not be replaced with the background, resulting in the effect that the portrait in the front remains unchanged, and the background changes in the rear, so as to realize the real-time capture of the user's sliding gesture and real-time calculation of the user's finger sliding. Area, the ability to replace the background of the area where the user's finger slides in real time.
如图7所示,在本实施例的视频特效添加方法中,步骤Step210:根据手势动作的滑动信息,将屏幕分割成第一区域和第二区域,包括:As shown in FIG. 7 , in the video special effect adding method of this embodiment, Step 210 : according to the sliding information of the gesture action, divide the screen into a first area and a second area, including:
Step211:根据手势动作的滑动起点的起点坐标信息和滑动终点的终点坐标信息, 创建分割线;Step211: Create a dividing line according to the coordinate information of the starting point of the sliding start point of the gesture action and the coordinate information of the end point of the sliding end point;
Step212:根据分割线和滑动方向,将分割线沿滑动方向扫过的屏幕的区域分割为第一区域。Step 212: According to the dividing line and the sliding direction, divide the area of the screen swept by the dividing line along the sliding direction into a first area.
本实施例的视频特效添加方法,先计算用户的手指滑过的区域大小,再进行屏幕分割,将屏幕分割为手指滑过的第一区域和未滑过的第二区域,并仅对第一区域的背景进行特效素材的替换,实现了实时捕捉用户的滑动手势、实时计算用户的手指滑过的区域、实时替换用户的手指滑过的区域的背景的功能。In the method for adding video special effects in this embodiment, the size of the area that the user's finger slides over is calculated first, and then the screen is divided, and the screen is divided into a first area that the finger slides over and a second area that does not slide over. The background of the area is replaced with special effects material, which realizes the functions of capturing the user's sliding gesture in real time, calculating the area where the user's finger slides in real time, and replacing the background of the area where the user's finger slides in real time.
如图8所示,在本实施例的视频特效添加方法中,步骤Step220:对屏幕中显示的人像进行人像分割,对屏幕中背景位于第一区域中的部分进行特效素材替换,包括:As shown in FIG. 8 , in the video special effect adding method of the present embodiment, Step 220 : perform portrait segmentation on the portrait displayed on the screen, and replace the part of the screen where the background is located in the first area with special effects material, including:
Step221:对人像的原始图像使用双线性插值算法进行下采样,得到下采样图像;Step 221: down-sampling the original image of the portrait using a bilinear interpolation algorithm to obtain a down-sampled image;
Step222:计算下采样图像中的人物的轮廓(人像Mask),并对人物的轮廓使用双线性插值算法进行上采样,得到原始图像的轮廓;Step222: Calculate the outline of the person in the down-sampled image (Portrait Mask), and use the bilinear interpolation algorithm to upsample the outline of the person to obtain the outline of the original image;
Step223:基于原始图像的轮廓从原始图像中将人像分割出来,得到第一图层;Step223: Segment the portrait from the original image based on the contour of the original image to obtain the first layer;
Step224:将背景位于第一区域中的部分进行特效素材替换,得到第二图层;Step224: Replace the part of the background in the first area with special effects material to obtain the second layer;
Step225:将第一图层与第二图层进行叠加。Step225: Overlay the first layer with the second layer.
具体来说,在本实施例所公开的方法中,以*** android(谷歌安卓)标准camera(摄像头)API2.0引擎为例,可使用其他camera引擎输出连续的图像帧数据,帧数据格式可为YUV-NV21或者RGB等通用格式。先对原始图像使用双线性插值算法进行下采样,例如将原始1920 x 1080分辨率图像下采样为320 x 180分辨率的图像,从而得到下采样图像;在对下采样后的下采样图像进行人像分割处理,此处人像分割使用的深度学习模型在本发明实施例中不做限制,可采用CNN、FCN/FCN+/UNet等等常见的模型。人像分割处理后会输出具有人物的轮廓(Mask)的数据,其本质是一帧图像,如图9所示,但需注意该轮廓的分辨率暂为320x180,在此处通过处理低分辨率的轮廓,大幅度降低人像分割的计算复杂度和功耗开销。将输出的轮廓使用双线性插值算法进行上采样至原始图像的分辨率(本实施例中为1920x1080),由于是对黑白图像进行上采样,因此其上采样插值的图像损失率能够降低到最低。基于上述的轮廓的数据,将人像从原始图像中“抠出来”,得到第一图层,再与经过背景的特效素材替换的第二图层在GPU上进行图层叠加渲染,最终得到背景替换后的效果图。Specifically, in the method disclosed in this embodiment, taking the *** android (Google Android) standard camera API 2.0 engine as an example, other camera engines can be used to output continuous image frame data, and the frame data format can be Common formats such as YUV-NV21 or RGB. First, downsample the original image using a bilinear interpolation algorithm, for example, downsample the original 1920 x 1080 resolution image to a 320 x 180 resolution image to obtain a downsampled image; For portrait segmentation processing, the deep learning model used for portrait segmentation here is not limited in the embodiments of the present invention, and common models such as CNN, FCN/FCN+/UNet, etc. may be used. After the portrait segmentation processing, the data with the outline (Mask) of the person will be output, which is essentially a frame of image, as shown in Figure 9, but it should be noted that the resolution of the outline is temporarily 320x180. contour, which greatly reduces the computational complexity and power consumption of portrait segmentation. Use the bilinear interpolation algorithm to upsample the output contour to the resolution of the original image (1920x1080 in this embodiment). Since the black-and-white image is upsampled, the image loss rate of the upsampling interpolation can be reduced to a minimum. . Based on the above-mentioned outline data, the portrait is "keyed out" from the original image to obtain the first layer, which is then layered and rendered on the GPU with the second layer replaced by the special effect material of the background, and finally the background replacement is obtained. After effects.
本实施例的视频特效添加方法,采用双线性插值法逐帧对原始图像下采样,使分辨率等比例减少,且降低算力损耗,然后做人像分割,输出人像的轮廓,后再使用双线性插值法将轮廓上采样为原始图像的分辨率。从而大幅度降低人像分割在移动终端设备上的功耗和处理时延,满足30FPS的视频通话的帧率要求。该方法在做人像分割之前,对原始图像进行下采样处理,从而大幅度降低人像分割的计算和功耗开销,从而允许需要大计算量的深度学习人像分割模型算法能够运行在算力和功耗受限的移动终端上,满足视频播放的帧率要求。In the video special effect adding method of this embodiment, the bilinear interpolation method is used to downsample the original image frame by frame, so that the resolution is proportionally reduced, and the computing power consumption is reduced, and then the portrait is segmented, the outline of the portrait is output, and then the double Linear interpolation upsamples the contour to the resolution of the original image. Thereby, the power consumption and processing delay of portrait segmentation on mobile terminal devices are greatly reduced, and the frame rate requirements of 30FPS video calls are met. This method down-samples the original image before doing portrait segmentation, thereby greatly reducing the computational and power consumption overhead of portrait segmentation, thus allowing the deep learning portrait segmentation model algorithm that requires a large amount of computation to run in computing power and power consumption. On limited mobile terminals, it meets the frame rate requirements for video playback.
在本实施例的视频特效添加方法中,根据第一区域的区域面积或第一区域占屏幕的屏幕占比,选择特效素材的添加等级。In the video special effect adding method of this embodiment, the adding level of the special effect material is selected according to the area of the first area or the screen ratio of the first area on the screen.
本实施例的视频特效添加方法,在添加特效素材的过程中,用户可以自行选择添加特效素材的量,体现在操作应用中就是可以根据用户的手指滑过屏幕的区域大小来 选择特效素材的添加等级,这样的操作方法能够满足用户更多、更复杂的特效添加需求。In the video special effect adding method of this embodiment, in the process of adding special effect materials, the user can choose the amount of special effect materials to be added. In the operation application, the user can select the addition of special effect materials according to the size of the area where the user's finger slides across the screen. This method of operation can meet the needs of users for more and more complex special effects additions.
在本实施例的视频特效添加方法中,手势动作每划过10%,特效素材的添加等级对应提升一级。In the video special effect adding method of the present embodiment, the addition level of the special effect material is correspondingly increased by one level for every 10% of the gesture action.
本实施例的视频特效添加方法,能够给用户提供更加平滑的视频特效添加体验。The method for adding video special effects in this embodiment can provide users with a smoother experience of adding video special effects.
在实际应用中,可以上文图4a至图4c所描述的边滑动手势沿屏幕的横向/纵向的捕捉方法触发美颜类算法,以其滑动区域占整个屏幕的比例作为美颜级别。以十级美颜为例:比如从左侧或者顶部开始滑,滑动区域占比为10%时,开启一级美颜,全部滑到右侧时开启十级美颜,以此类推。In practical applications, the beautification algorithm can be triggered by the capture method of the side sliding gesture described in Figures 4a to 4c along the horizontal/vertical direction of the screen, and the ratio of the sliding area to the entire screen is used as the beauty level. Take the ten-level beauty as an example: for example, start sliding from the left or the top, when the sliding area accounts for 10%, the first-level beauty is turned on, when all the slides to the right, the ten-level beauty is turned on, and so on.
由于美颜为级别实现类的特效,因此建议使用边滑动手势捕捉触发方法,但如有业务需求或产品设计等因素,亦可使用角滑动手势捕捉方法触发,两者实现思路类似。Since beauty is a level-implemented special effect, it is recommended to use the edge swipe gesture capture trigger method, but if there are factors such as business requirements or product design, the corner swipe gesture capture method can also be used to trigger the trigger. The two implementation ideas are similar.
在本实施例的视频特效添加方法中,当第一区域的屏幕占比大于50%且所述手势动作的滑动终点的终点坐标信息不再变化时,将屏幕的整个背景进行特效素材替换。In the video special effect adding method of this embodiment, when the screen ratio of the first area is greater than 50% and the coordinate information of the end point of the sliding end point of the gesture action no longer changes, the entire background of the screen is replaced with special effect material.
本实施例的视频特效添加方法,由于用户在手指滑动大半的情况下往往就代表着有全部替换背景的需求,故采用本优选实施方案的方法能够便于用户操作,增强用户体验。In the method for adding video special effects in this embodiment, since the user often needs to replace all backgrounds when the user slides most of their fingers, the method of this preferred embodiment can facilitate user operations and enhance user experience.
如图10所示,在本实施例的视频特效添加方法中,在步骤Step210:根据手势动作的滑动信息,将屏幕分割成第一区域和第二区域的步骤之前,包括:As shown in Figure 10, in the video special effect adding method of the present embodiment, in step Step210: before the step of dividing the screen into a first area and a second area according to the sliding information of the gesture action, it includes:
Step201:根据滑动速度判断手势动作的滑动是否有效;Step201: Determine whether the sliding of the gesture action is valid according to the sliding speed;
若滑动速度大于第一速度,则执行步骤Step202:将屏幕的背景进行整体特效素材替换;If the sliding speed is greater than the first speed, step 202 is performed: replace the background of the screen with the overall special effect material;
若滑动速度小于第二速度,则不执行步骤Step200;其中,第一速度大于第二速度。If the sliding speed is less than the second speed, step Step 200 is not executed; wherein, the first speed is greater than the second speed.
本实施例的视频特效添加方法,预设两个用于判断滑动速度的判断条件,结合用户滑动速度判断本次滑动是否生效,如果滑动速度很快,滑动速度大于第一速度时,可以认为用户需要对整个背景进行替换,则开启背景的完整替换或虚化,滑动速度小于第二速度时,可以认为用户并没有执行滑动手势,也就不用启动应用特效素材的步骤。In the method for adding video special effects in this embodiment, two judgment conditions for judging the sliding speed are preset, and whether the current sliding is effective is judged in combination with the sliding speed of the user. If the sliding speed is fast and the sliding speed is greater than the first speed, it can be considered that the user If the entire background needs to be replaced, the complete replacement or blurring of the background is enabled. When the sliding speed is less than the second speed, it can be considered that the user has not performed the sliding gesture, and the step of applying the special effect material does not need to be started.
参见图6,在本实施例的视频特效添加方法中,在步骤Step220:对屏幕中显示的人像进行人像分割,对屏幕中背景位于第一区域中的部分进行特效素材替换之后,包括:Referring to FIG. 6 , in the method for adding special effects to a video in this embodiment, in Step 220 : segmenting the portrait displayed on the screen, and replacing the part of the screen with the background in the first area after the special effect material is replaced, including:
Step230:判断手势动作的滑动方向;Step230: Determine the sliding direction of the gesture action;
若滑动方向为远离手指在屏幕上的滑动起点的正向时,执行步骤Step240:添加新的特效素材;If the sliding direction is the forward direction away from the sliding starting point of the finger on the screen, step 240 is performed: adding a new special effect material;
若滑动方向为朝向手指在屏幕上的滑动起点的反向时,执行步骤Step250:恢复上一个特效素材。If the sliding direction is the opposite direction toward the starting point of sliding the finger on the screen, step 250 is performed: the last special effect material is restored.
如图11所示,用户的手指在执行手势动作的时候,可以通过多次滑动对特效素材进行切换,即在前文所述的规则基础上,再次滑动手指,就能更换为下一个特效素材。As shown in Figure 11, when the user's finger performs a gesture action, the special effect material can be switched by sliding multiple times.
本实施例的视频特效添加方法,通过对滑动方向的识别,给用户提供回溯的操作,可以将屏幕的背景替换/虚化进行取消,比如手指向左滑,开启背景替换/虚化;手指再 向左滑,换另一个背景素材;手指向右滑(即反向操作),恢复上一个背景素材/真实背景。这样用户可以在多个特效素材中自由地选择更喜欢的特效素材,而不会为滑过喜欢的特效素材而担心,增强用户体验。The method for adding video special effects in this embodiment provides the user with a retrospective operation by recognizing the sliding direction, and can cancel the background replacement/blur of the screen, for example, slide your finger to the left to enable background replacement/blur; Swipe left to change to another background material; swipe right (that is, reverse operation) to restore the previous background material/real background. In this way, the user can freely select the preferred special effect material from among multiple special effect materials, without worrying about sliding over the favorite special effect material, which enhances the user experience.
如图12、图13a和图13b所示,在本实施例的视频特效添加方法中,步骤Step200根据手势动作的滑动信息,将特效素材应用于屏幕上,包括:As shown in Figure 12, Figure 13a and Figure 13b, in the video special effect adding method of this embodiment, Step 200 applies the special effect material to the screen according to the sliding information of the gesture action, including:
Step210’:根据手势动作的滑动信息,在手势动作在屏幕上的滑动起点处随着用户的滑动方向拉出控制面板,控制面板上防止多个特效素材;Step210': According to the sliding information of the gesture action, pull out the control panel along with the sliding direction of the user at the sliding starting point of the gesture action on the screen, and prevent multiple special effects materials on the control panel;
Step220’:将特效素材应用于屏幕上。Step220’: Apply the special effect material to the screen.
本实施例的视频特效添加方法,目的是为分区域背景替换/虚化的实现,其不局限上述边滑动手势和角滑动手势的捕捉方法来触发,本方法的核心在于使用滑动手势快速开启特效,可根据边滑动/角滑动的滑动区域面积作为背景替换/虚化的范围,给用户提供了具有选择性的控制面板,在进行特效素材替换的时候,用户的视觉体验更佳,能够选择出更符合用户需求的特效素材。The purpose of the method for adding video special effects in this embodiment is to realize subregional background replacement/blurring. It is not limited to triggering by the above-mentioned capture methods of edge sliding gestures and corner sliding gestures. The core of this method is to use sliding gestures to quickly activate special effects. , the area of the sliding area of edge sliding/corner sliding can be used as the range of background replacement/blurring, providing users with a selective control panel. When replacing special effects materials, users have a better visual experience and can choose Special effects materials that are more in line with user needs.
如图14所示,在本实施例的视频特效添加方法中,在步骤Step200:根据手势动作的滑动信息,将特效素材应用于屏幕上之前,还包括:As shown in FIG. 14 , in the video special effect adding method of this embodiment, in Step 200 : before applying the special effect material on the screen according to the sliding information of the gesture action, the method further includes:
Step200’:检测每个特效素材的使用频率,根据使用频率由多到少对特效素材的呈现顺序进行排序。Step200': Detect the frequency of use of each special effect material, and sort the presentation order of the special effect material according to the frequency of use.
本实施例的视频特效添加方法,能够根据用户习惯,定制用户常用特效素材的列表顺序,例如优先显示上次使用的特效素材,或根据使用频率从多到少排序,从而在用户每次使用时能够更加快速地添加特效素材至屏幕的背景中,使用户的使用更方便,体验更好。The method for adding video special effects in this embodiment can customize the list order of the user's commonly used special effect materials according to the user's habits, for example, the last used special effect materials are displayed first, or they are sorted according to the frequency of use, so that when the user uses each time It can add special effects materials to the background of the screen more quickly, making the user's use more convenient and the experience better.
在本实施例的视频特效添加方法中,特效素材的素材数量小于10。In the video special effect adding method of this embodiment, the number of special effect materials is less than 10.
本实施例的视频特效添加方法,为特效素材的备用库设定素材数量的上限,这些特效素材在划动时循环出现,避免由于特效素材太多而导致用户滑动后很难恢复到原始状态。The video special effect adding method of this embodiment sets the upper limit of the number of materials for the backup library of special effect materials, and these special effect materials appear cyclically when swiping, so as to avoid that it is difficult for the user to restore the original state after sliding due to too many special effect materials.
本实施例所公开的视频特效添加方法,用滑动手势替代原有通过按键点击的方式开启特效的交互设计。根据用户的手指在屏幕上滑过的区域的区域面积或屏幕占比,做区域性的人像分割和背景替换/虚化,实现区域性背景替换/虚化。使得在视频通话中,用户滑动进行区域性背景替换时,可根据用户手指在屏幕上的位置和滑动手势的角度划分区域,不传输已被替换掉的区域的部分视频流,从而节省视频流的数据传输。可以以用户手指滑过的区域面积/屏幕占比作为美颜级别的调整。也可以以完整的用户手指滑动动作为背景替换的素材、美妆类素材、3D-Animoji或贴纸素材的一键切换。此外本方法还使用了角向心滑动手势的捕捉和分析方法。In the method for adding video special effects disclosed in this embodiment, a sliding gesture is used to replace the original interaction design of opening special effects by clicking a button. According to the area or screen ratio of the area where the user's finger slides on the screen, perform regional portrait segmentation and background replacement/blur to realize regional background replacement/blur. In a video call, when the user swipes to replace the regional background, the area can be divided according to the position of the user's finger on the screen and the angle of the swipe gesture, and part of the video stream of the replaced area is not transmitted, thus saving the time of the video stream. data transmission. The beauty level can be adjusted based on the area of the area where the user's finger slides/screen ratio. It is also possible to switch the material, beauty material, 3D-Animoji or sticker material with the complete user's finger sliding motion as the background replacement. In addition, this method also uses the capture and analysis method of angular centripetal swipe gesture.
实施例3Example 3
如图15所示的是本申请实施例3所提供的一种视频特效添加装置,装置包括:As shown in FIG. 15 is a video special effect adding device provided by Embodiment 3 of the present application, and the device includes:
信息获取模块10,用于捕捉用户的手势动作,获取手势动作的滑动信息;The information acquisition module 10 is used to capture the gesture action of the user and acquire the sliding information of the gesture action;
特效应用模块20,用于根据手势动作的滑动信息,将特效素材应用于手势动作在屏幕上滑过的区域中。The special effect application module 20 is configured to apply the special effect material to the area where the gesture action slides on the screen according to the sliding information of the gesture action.
本实施例的视频特效添加装置,有别于现有技术中用户在视频通话过程中开启特效需要至少两次点击的操作而导致的交互过程繁琐的问题,本实施例提供的方案通过使用信息获取模块10和特效应用模块20对用户的手势动作的滑动信息进行捕捉和处理,能够达到用户的手指滑动到哪里特效就加到哪里的效果。The device for adding video special effects in this embodiment is different from the problem in the prior art that the user needs at least two clicks to activate special effects during a video call, and the interaction process is cumbersome. The solution provided in this embodiment is obtained by using information The module 10 and the special effect application module 20 capture and process the sliding information of the user's gesture, so as to achieve the effect of adding the special effect wherever the user's finger slides.
如图16所示,在本实施例的视频特效添加装置中,信息获取模块10包括:As shown in FIG. 16 , in the video special effect adding device of this embodiment, the information acquisition module 10 includes:
记录单元11,用于实时捕捉和记录用户的手指在屏幕的二维xy坐标系中滑动起点的起点坐标信息和滑动终点的终点坐标信息;The recording unit 11 is used to capture and record the starting point coordinate information of the user's finger and the end point coordinate information of the sliding end point in the two-dimensional xy coordinate system of the screen in real time;
计算单元12,用于根据手指的起点坐标信息和终点坐标信息,判断手指的滑动方向以及滑动速度;The calculation unit 12 is used to judge the sliding direction and sliding speed of the finger according to the starting point coordinate information and the ending point coordinate information of the finger;
判断单元13,用于根据手指的滑动方向,判断用户所采用的滑动手势。The determining unit 13 is configured to determine the sliding gesture adopted by the user according to the sliding direction of the finger.
本实施例的视频特效添加装置,记录单元11用于记录用户的手指在屏幕上滑动时产生的滑动信息,计算单元12通过用户滑动时手指的滑动起点和滑动终点的坐标,来确定在屏幕上添加特效素材的区域,判断单元13在用户使用不同的滑动手势时分别对用户的手指的滑动轨迹进行判断,以便满足实时添加特效素材的需求。In the video special effect adding device of the present embodiment, the recording unit 11 is used to record the sliding information generated when the user's finger slides on the screen, and the calculation unit 12 determines the coordinates of the sliding starting point and the sliding end point of the user's finger when the user slides on the screen. In the area where special effect materials are added, the judgment unit 13 respectively judges the sliding trajectories of the user's fingers when the user uses different sliding gestures, so as to meet the requirement of adding special effect materials in real time.
如图17所示,在本实施例的视频特效添加装置中,特效应用模块2包括:As shown in FIG. 17 , in the video special effect adding device of this embodiment, the special effect application module 2 includes:
分割单元21,用于根据手势动作的滑动信息,将屏幕分割成第一区域和第二区域;The dividing unit 21 is used for dividing the screen into a first area and a second area according to the sliding information of the gesture action;
应用单元22,用于对所述屏幕中显示的人像进行人像分割,对所述屏幕中背景位于所述第一区域中的部分进行特效素材替换。The application unit 22 is configured to perform portrait segmentation on the portrait displayed on the screen, and perform special effect material replacement on the part of the background located in the first area on the screen.
本实施例的视频特效添加装置,分割单元21先计算用户的手指滑过的区域大小,进行屏幕分割,将屏幕分割为手指滑过的第一区域和未滑过的第二区域,应用单元22先进行人像分割,再对第一区域的背景进行特效素材的替换,实现了实时捕捉用户的滑动手势、实时计算用户的手指滑过的区域、实时替换用户的手指滑过的区域的背景的功能。In the video special effect adding device of this embodiment, the segmentation unit 21 first calculates the size of the area that the user's finger slides over, performs screen segmentation, and divides the screen into a first area that the finger slides over and a second area that is not slid over, and the application unit 22 First perform portrait segmentation, and then replace the background of the first area with special effects materials, realizing the functions of capturing the user's sliding gesture in real time, calculating the area where the user's finger slides in real time, and replacing the background of the area where the user's finger slides in real time. .
实施例4Example 4
本申请实施例4提供了一种终端设备,包括如本申请实施例2所述的视频特效添加装置。Embodiment 4 of the present application provides a terminal device, including the apparatus for adding video special effects as described in Embodiment 2 of the present application.
实施例5Example 5
本申请实施例5提供了一种计算机可读存储介质,包括程序或指令,当所述程序或指令在计算机上运行时,如本申请实施例1所述的方法被执行。Embodiment 5 of the present application provides a computer-readable storage medium, including a program or an instruction, and when the program or instruction is run on a computer, the method described in Embodiment 1 of the present application is executed.
在上述实施例中,可以全部或部分地通过软件、硬件、固件或者其任意组合来实现。当使用软件实现时,可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载和执行所述计算机指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以是通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过 有线(例如同轴电缆、光纤、数字用户线(Digital Subscriber Line,DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集成的服务器、数据中心等数据存储设备。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如,高密度数字视频光盘(Digital Video Disc,DVD))、或者半导体介质(例如,固态硬盘(Solid State Disk,SSD))等。In the above-mentioned embodiments, it may be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented in 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 instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer may be a general purpose computer, special purpose computer, computer network, or other programmable device. The computer instructions may be stored in or transmitted from one computer readable storage medium to another computer readable storage medium, for example, the computer instructions may be downloaded from a website site, computer, server or data center Transmission to another website site, computer, server or data center via wired (eg coaxial cable, optical fiber, Digital Subscriber Line, DSL) or wireless (eg infrared, wireless, microwave, etc.) means. The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. that includes an integration of one or more available media. The available media may be magnetic media (eg, floppy disks, hard disks, magnetic tapes), optical media (eg, high-density digital video discs (DVDs)), or semiconductor media (eg, solid state disks, SSD)) etc.
本申请实施例所公开的视频特效添加方法、装置及终端设备,用手势动作替代原有通过按键点击的方式开启特效,能够减少用户操作的复杂度,在视频通话来电时快速开启特效。能够根据用户手指滑过的区域面积或屏幕占比,做区域性的人像分割以及背景替换或虚化,提升产品的趣味性、可玩性和交互性。还能够在做人像分割之前,对原始图像进行下采样处理,从而大幅度降低人像分割的计算和功耗开销,从而允许需要大计算量的深度学习人像分割模型算法能够运行在算力和功耗受限的移动终端上,满足视频播放的帧率要求。The method, device, and terminal device for adding video special effects disclosed in the embodiments of the present application use gesture actions to replace the original method of opening special effects by clicking buttons, which can reduce the complexity of user operations and enable special effects quickly when a video call is incoming. It can perform regional portrait segmentation and background replacement or blurring according to the area or screen ratio that the user's finger slides over to improve the fun, playability and interactivity of the product. It can also downsample the original image before doing portrait segmentation, thereby greatly reducing the computational and power consumption overhead of portrait segmentation, thus allowing the deep learning portrait segmentation model algorithm that requires a large amount of computation to run in computing power and power consumption. On limited mobile terminals, it meets the frame rate requirements for video playback.
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、计算机软件或者二者的结合来实现,为了清楚地说明硬件和软件的可互换性,在上述说明中已经按照功能一般性地描述了各示例的组成及步骤。这些功能究竟以硬件还是软件方式来执行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. Interchangeability, the above description has generally described the components and steps of each example in terms of function. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Skilled artisans may implement the described functionality using different methods for each particular application, but such implementations should not be considered beyond the scope of this application.
以上仅为本申请的较佳实施例而已,并不用以限制本申请,凡在本申请的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本申请保护的范围之内。The above are only preferred embodiments of the present application, and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the protection of the present application. within the range.

Claims (20)

  1. 一种视频特效添加方法,其特征在于,所述方法包括以下步骤:A method for adding special effects to a video, characterized in that the method comprises the following steps:
    捕捉用户的手势动作,获取所述手势动作的滑动信息;Capture the gesture action of the user, and obtain the sliding information of the gesture action;
    根据所述手势动作的滑动信息,将特效素材应用于屏幕上。According to the sliding information of the gesture action, the special effect material is applied to the screen.
  2. 根据权利要求1所述的视频特效添加方法,其特征在于,The method for adding special effects to a video according to claim 1, wherein,
    所述捕捉用户的手势动作,获取所述手势动作的滑动信息的步骤,包括:The step of capturing the gesture action of the user and acquiring the sliding information of the gesture action includes:
    实时捕捉和记录用户的手指在所述屏幕的二维xy坐标系中滑动起点的起点坐标信息和滑动终点的终点坐标信息;Capture and record in real time the coordinate information of the starting point and the coordinate information of the end point of the sliding end point of the user's finger in the two-dimensional xy coordinate system of the screen;
    根据手指的所述起点坐标信息和所述终点坐标信息,判断手指的滑动方向以及滑动速度;According to the coordinate information of the starting point and the coordinate information of the end point of the finger, determine the sliding direction and sliding speed of the finger;
    根据手指的滑动方向,判断用户所采用的滑动手势;According to the sliding direction of the finger, determine the sliding gesture adopted by the user;
    其中,所述滑动信息包括滑动起点的起点坐标信息、滑动终点的终点坐标信息、滑动手势、滑动方向和滑动速度。Wherein, the sliding information includes the starting point coordinate information of the sliding start point, the end point coordinate information of the sliding end point, the sliding gesture, the sliding direction and the sliding speed.
  3. 根据权利要求2所述的视频特效添加方法,其特征在于,The method for adding special effects to a video according to claim 2, wherein,
    当所述滑动手势为边滑动手势时,执行以下步骤:When the sliding gesture is an edge sliding gesture, perform the following steps:
    根据手指的所述起点坐标信息和所述终点坐标信息,判断手指在所述屏幕上的坐标位移D与预设的最小距离D min的大小关系,以及所述滑动速度V与预设的最小速度V min的大小关系; According to the coordinate information of the starting point and the coordinate information of the end point of the finger, determine the relationship between the coordinate displacement D of the finger on the screen and the preset minimum distance D min , and the sliding speed V and the preset minimum speed The size relationship of V min ;
    当D>D min且V>V min时,启动所述特效素材。 When D> Dmin and V> Vmin , the special effect material is activated.
  4. 根据权利要求2所述的视频特效添加方法,其特征在于,The method for adding special effects to a video according to claim 2, wherein,
    当所述滑动手势为角滑动手势时,执行以下步骤:When the sliding gesture is a corner sliding gesture, perform the following steps:
    预设起点区域;其中,所述起点区域的横坐标的最大值为X max,横坐标的最大值为Y maxA preset starting point area; wherein, the maximum value of the abscissa of the starting point area is X max , and the maximum value of the abscissa is Y max ;
    根据手指的所述起点坐标信息,判断手指的滑动起点是否落在起点区域内;According to the coordinate information of the starting point of the finger, determine whether the sliding starting point of the finger falls within the starting point area;
    若手指的滑动起点的横坐标X s<X max且纵坐标Y s<Y max,则判断为手指的滑动起点位于预设的起点区域内; If the abscissa X s <X max and the ordinate Y s <Y max of the sliding starting point of the finger, it is determined that the sliding starting point of the finger is located within the preset starting point area;
    根据手指的所述起点坐标信息和所述终点坐标信息,判断手指在所述屏幕上的坐标位移D与预设的最小距离D min的大小关系,以及所述滑动速度V与预设的最小速度V min的大小关系; According to the coordinate information of the starting point and the coordinate information of the end point of the finger, determine the relationship between the coordinate displacement D of the finger on the screen and the preset minimum distance D min , and the sliding speed V and the preset minimum speed The size relationship of V min ;
    当D>D min、V>V min且所述滑动起点与所述滑动终点的连线的斜率k的范围满足0.268<|k|<3.73或0.268<|k -1|<3.73时,启动所述特效素材。 When D> Dmin , V> Vmin and the range of the slope k of the connecting line between the sliding start point and the sliding end point satisfies 0.268<|k|<3.73 or 0.268<|k −1 |<3.73, start all The special effect material.
  5. 根据权利要求1所述的视频特效添加方法,其特征在于,The method for adding special effects to a video according to claim 1, wherein,
    所述根据所述手势动作的滑动信息,将特效素材应用于屏幕上的步骤,包括:The step of applying the special effect material on the screen according to the sliding information of the gesture action includes:
    根据所述手势动作的滑动信息,将所述屏幕分割成第一区域和第二区域;dividing the screen into a first area and a second area according to the sliding information of the gesture action;
    对所述屏幕中显示的人像进行人像分割,对所述屏幕中背景位于所述第一区域中的部分进行特效素材替换;Performing portrait segmentation on the portrait displayed on the screen, and replacing the part of the background in the screen in the first area with special effects material;
    其中,in,
    所述第一区域为与所述手势动作的滑动起点与滑动终点的连线相垂直且穿过所述滑动终点的分割线所扫过的屏幕的区域,所述第二区域为所述屏幕上除所述第一区域 外的区域;The first area is an area of the screen that is perpendicular to the connecting line between the sliding start point and the sliding end point of the gesture action and which is swept by the dividing line passing through the sliding end point, and the second area is an area on the screen. an area other than the first area;
    所述滑动信息包括滑动起点的起点坐标信息、滑动终点的终点坐标信息、滑动手势、滑动方向和滑动速度。The sliding information includes the starting point coordinate information of the sliding start point, the end point coordinate information of the sliding end point, the sliding gesture, the sliding direction and the sliding speed.
  6. 根据权利要求5所述的视频特效添加方法,其特征在于,所述根据所述手势动作的滑动信息,将所述屏幕分割成第一区域和第二区域的步骤,包括:The method for adding video special effects according to claim 5, wherein the step of dividing the screen into a first area and a second area according to the sliding information of the gesture action comprises:
    根据所述手势动作的滑动起点的起点坐标信息和滑动终点的终点坐标信息,创建所述分割线;Create the dividing line according to the starting point coordinate information of the sliding start point of the gesture action and the end point coordinate information of the sliding end point;
    根据所述分割线和所述滑动方向,将所述分割线沿所述滑动方向扫过的所述屏幕的区域分割为所述第一区域。According to the dividing line and the sliding direction, the area of the screen swept by the dividing line along the sliding direction is divided into the first area.
  7. 根据权利要求5所述的视频特效添加方法,其特征在于,所述对所述屏幕中显示的人像进行人像分割,对所述屏幕中背景位于所述第一区域中的部分进行特效素材替换的步骤,包括:The method for adding special effects to a video according to claim 5, wherein the portrait segmentation is performed on the portrait displayed on the screen, and the part of the background on the screen located in the first area is replaced by the special effect material. steps, including:
    对所述人像的原始图像使用双线性插值算法进行下采样,得到下采样图像;down-sampling the original image of the portrait using a bilinear interpolation algorithm to obtain a down-sampled image;
    计算所述下采样图像中的人物的轮廓,并对所述人物的轮廓使用双线性插值算法进行上采样,得到所述原始图像的轮廓;Calculate the outline of the person in the down-sampled image, and use the bilinear interpolation algorithm to upsample the outline of the person to obtain the outline of the original image;
    基于所述原始图像的轮廓从所述原始图像中将所述人像分割出来,得到第一图层;Segmenting the portrait from the original image based on the contour of the original image to obtain a first layer;
    将背景位于所述第一区域中的部分进行特效素材替换,得到第二图像;The part of the background located in the first area is replaced with special effects material to obtain a second image;
    将所述第一图像与所述第二图像进行叠加。The first image and the second image are superimposed.
  8. 根据权利要求5所述的视频特效添加方法,其特征在于,根据所述第一区域的区域面积或所述第一区域占所述屏幕的屏幕占比,选择所述特效素材的添加等级。The video special effect adding method according to claim 5, wherein the adding level of the special effect material is selected according to the area of the first area or the screen ratio of the first area to the screen.
  9. 根据权利要求8所述的视频特效添加方法,其特征在于,所述第一区域的屏幕占比每增加10%,所述特效素材的添加等级对应提升一级。The method for adding special effects to a video according to claim 8, wherein, for every 10% increase in the screen ratio of the first area, the adding level of the special effect material is correspondingly increased by one level.
  10. 根据权利要求5所述的视频特效添加方法,其特征在于,当所述第一区域的屏幕占比大于50%且所述手势动作的滑动终点的终点坐标信息不再变化时,将所述屏幕的整个背景进行特效素材替换。The method for adding video special effects according to claim 5, wherein when the screen ratio of the first area is greater than 50% and the coordinate information of the end point of the sliding end point of the gesture action no longer changes, the screen The entire background is replaced with special effects material.
  11. 根据权利要求5所述的视频特效添加方法,其特征在于,The method for adding special effects to a video according to claim 5, wherein,
    在所述根据所述手势动作的滑动信息,将所述屏幕分割成第一区域和第二区域的步骤之前,包括:Before the step of dividing the screen into a first area and a second area according to the sliding information of the gesture action, the method includes:
    根据所述滑动速度判断所述手势动作的滑动是否有效;Determine whether the sliding of the gesture action is valid according to the sliding speed;
    若所述滑动速度大于第一速度,则将所述屏幕的背景进行整体特效素材替换;If the sliding speed is greater than the first speed, replace the background of the screen with the overall special effect material;
    若所述滑动速度小于第二速度,则不执行根据所述手势动作的滑动信息,将特效素材应用于屏幕上的步骤;If the sliding speed is less than the second speed, the step of applying the special effect material on the screen according to the sliding information of the gesture action is not performed;
    其中,所述第一速度大于所述第二速度。Wherein, the first speed is greater than the second speed.
  12. 根据权利要求5所述的视频特效添加方法,其特征在于,The method for adding special effects to a video according to claim 5, wherein,
    在所述对所述屏幕中显示的人像进行人像分割,对所述屏幕中背景位于所述第一区域中的部分进行特效素材替换的步骤之后,包括:After the steps of performing portrait segmentation on the portrait displayed on the screen and replacing the special effect material on the part of the background in the first area on the screen, the steps include:
    判断所述手势动作的滑动方向;Determine the sliding direction of the gesture action;
    若所述滑动方向为远离手指在所述屏幕上的滑动起点的正向时,添加新的特效素材;If the sliding direction is a forward direction away from the sliding starting point of the finger on the screen, add a new special effect material;
    若所述滑动方向为朝向手指在所述屏幕上的滑动起点的反向时,恢复上一个特效素材。If the sliding direction is the reverse direction toward the starting point of sliding of the finger on the screen, the last special effect material is restored.
  13. 根据权利要求1所述的视频特效添加方法,其特征在于,所述根据所述手势动作的滑动信息,将特效素材应用于屏幕上的步骤,包括:The method for adding special effects to a video according to claim 1, wherein the step of applying the special effect material on the screen according to the sliding information of the gesture action comprises:
    根据所述手势动作的滑动信息,在所述手势动作在所述屏幕上的滑动起点处随着用户的滑动方向拉出控制面板,所述控制面板上防止多个特效素材;According to the sliding information of the gesture action, at the sliding starting point of the gesture action on the screen, the control panel is pulled out along the sliding direction of the user, and multiple special effect materials are prevented on the control panel;
    将所述特效素材应用于所述屏幕上。The special effect material is applied to the screen.
  14. 根据权利要求1所述的视频特效添加方法,其特征在于,在所述根据所述手势动作的滑动信息,将特效素材应用于屏幕上的步骤之前,包括:The method for adding video special effects according to claim 1, wherein before the step of applying the special effect material on the screen according to the sliding information of the gesture action, the method comprises:
    检测每个所述特效素材的使用频率,根据使用频率由多到少对所述特效素材的呈现顺序进行排序。The use frequency of each special effect material is detected, and the presentation order of the special effect material is sorted according to the frequency of use.
  15. 根据权利要求1所述的视频特效添加方法,其特征在于,所述特效素材的素材数量小于10。The method for adding special effects to a video according to claim 1, wherein the number of special effect materials is less than 10.
  16. 一种视频特效添加装置,其特征在于,所述装置包括:A device for adding special effects to a video, characterized in that the device comprises:
    信息获取模块,用于捕捉用户的手势动作,获取所述手势动作的滑动信息;an information acquisition module, used for capturing the gesture action of the user, and acquiring the sliding information of the gesture action;
    特效应用模块,用于根据所述手势动作的滑动信息,将特效素材应用于屏幕上。The special effect application module is used for applying special effect material on the screen according to the sliding information of the gesture action.
  17. 根据权利要求16所述的视频特效添加装置,其特征在于,所述信息获取模块包括:The video special effect adding device according to claim 16, wherein the information acquisition module comprises:
    记录单元,用于实时捕捉和记录用户的手指在所述屏幕的二维xy坐标系中滑动起点的起点坐标信息和滑动终点的终点坐标信息;a recording unit for capturing and recording in real time the starting point coordinate information of the sliding start point and the end point coordinate information of the sliding end point of the user's finger in the two-dimensional xy coordinate system of the screen;
    计算单元,用于根据手指的所述起点坐标信息和所述终点坐标信息,判断手指的滑动方向以及滑动速度;a calculation unit, configured to judge the sliding direction and sliding speed of the finger according to the coordinate information of the starting point and the coordinate information of the end point of the finger;
    判断单元,用于根据手指的滑动方向,判断用户所采用的滑动手势。The judgment unit is used for judging the sliding gesture adopted by the user according to the sliding direction of the finger.
  18. 根据权利要求16所述的视频特效添加装置,其特征在于,所述特效应用模块包括:The video special effect adding device according to claim 16, wherein the special effect application module comprises:
    分割单元,用于根据所述手势动作的滑动信息,将所述屏幕分割成第一区域和第二区域;a dividing unit, configured to divide the screen into a first area and a second area according to the sliding information of the gesture action;
    应用单元,用于对所述屏幕中显示的人像进行人像分割,对所述屏幕中背景位于所述第一区域中的部分进行特效素材替换。The application unit is configured to perform portrait segmentation on the portrait displayed on the screen, and perform special effect material replacement on the part of the background in the first area on the screen.
  19. 一种终端设备,其特征在于,包括如权利要求16至18任一项所述的视频特效添加装置。A terminal device, characterized by comprising the video special effect adding apparatus according to any one of claims 16 to 18.
  20. 一种计算机可读存储介质,其特征在于,包括程序或指令,当所述程序或指令在计算机上运行时,如权利要求1至15中任一项所述的方法被执行。A computer-readable storage medium, characterized by comprising a program or an instruction, when the program or the instruction is run on a computer, the method according to any one of claims 1 to 15 is performed.
PCT/CN2021/118451 2020-09-25 2021-09-15 Method and apparatus for adding special effect in video, and terminal device WO2022062985A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011021330.0A CN114257775B (en) 2020-09-25 2020-09-25 Video special effect adding method and device and terminal equipment
CN202011021330.0 2020-09-25

Publications (1)

Publication Number Publication Date
WO2022062985A1 true WO2022062985A1 (en) 2022-03-31

Family

ID=80790250

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/118451 WO2022062985A1 (en) 2020-09-25 2021-09-15 Method and apparatus for adding special effect in video, and terminal device

Country Status (2)

Country Link
CN (2) CN114257775B (en)
WO (1) WO2022062985A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115480651A (en) * 2022-11-04 2022-12-16 深圳润方创新技术有限公司 Control method of electronic drawing board with copy content analysis function and electronic drawing board

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130141327A1 (en) * 2011-12-05 2013-06-06 Wistron Corp. Gesture input method and system
CN105808145A (en) * 2016-03-28 2016-07-27 努比亚技术有限公司 Method and terminal for achieving image processing
CN106385591A (en) * 2016-10-17 2017-02-08 腾讯科技(上海)有限公司 Video processing method and video processing device
CN106951090A (en) * 2017-03-29 2017-07-14 北京小米移动软件有限公司 Image processing method and device
CN107340964A (en) * 2017-06-02 2017-11-10 武汉斗鱼网络科技有限公司 The animation effect implementation method and device of a kind of view
CN108984094A (en) * 2018-06-29 2018-12-11 北京微播视界科技有限公司 Switch method, apparatus, terminal device and the storage medium of global special efficacy

Family Cites Families (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104780093B (en) * 2014-01-15 2018-05-01 阿里巴巴集团控股有限公司 Expression information processing method and processing device during instant messaging
CN104866755B (en) * 2015-06-11 2018-03-30 北京金山安全软件有限公司 Setting method and device for background picture of application program unlocking interface and electronic equipment
CN105892898A (en) * 2015-11-20 2016-08-24 乐视移动智能信息技术(北京)有限公司 Notification center callout method and apparatus as well as system
CN106020664B (en) * 2016-05-11 2019-07-09 广东合晟网络科技有限公司 Image processing method
CN109391792B (en) * 2017-08-03 2021-10-29 腾讯科技(深圳)有限公司 Video communication method, device, terminal and computer readable storage medium
CN108022279B (en) * 2017-11-30 2021-07-06 广州市百果园信息技术有限公司 Video special effect adding method and device and intelligent mobile terminal
CN107948667B (en) * 2017-12-05 2020-06-30 广州酷狗计算机科技有限公司 Method and device for adding display special effect in live video
CN109089059A (en) * 2018-10-19 2018-12-25 北京微播视界科技有限公司 Method, apparatus, electronic equipment and the computer storage medium that video generates
US10388322B1 (en) * 2018-10-29 2019-08-20 Henry M. Pena Real time video special effects system and method
US11218646B2 (en) * 2018-10-29 2022-01-04 Henry M. Pena Real time video special effects system and method
CN110944230B (en) * 2019-11-21 2021-09-10 北京达佳互联信息技术有限公司 Video special effect adding method and device, electronic equipment and storage medium
CN111050203B (en) * 2019-12-06 2022-06-14 腾讯科技(深圳)有限公司 Video processing method and device, video processing equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130141327A1 (en) * 2011-12-05 2013-06-06 Wistron Corp. Gesture input method and system
CN105808145A (en) * 2016-03-28 2016-07-27 努比亚技术有限公司 Method and terminal for achieving image processing
CN106385591A (en) * 2016-10-17 2017-02-08 腾讯科技(上海)有限公司 Video processing method and video processing device
CN106951090A (en) * 2017-03-29 2017-07-14 北京小米移动软件有限公司 Image processing method and device
CN107340964A (en) * 2017-06-02 2017-11-10 武汉斗鱼网络科技有限公司 The animation effect implementation method and device of a kind of view
CN108984094A (en) * 2018-06-29 2018-12-11 北京微播视界科技有限公司 Switch method, apparatus, terminal device and the storage medium of global special efficacy

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115480651A (en) * 2022-11-04 2022-12-16 深圳润方创新技术有限公司 Control method of electronic drawing board with copy content analysis function and electronic drawing board

Also Published As

Publication number Publication date
CN114257775B (en) 2023-04-07
CN116437034A (en) 2023-07-14
CN114257775A (en) 2022-03-29

Similar Documents

Publication Publication Date Title
US11785329B2 (en) Camera switching method for terminal, and terminal
CN114816210B (en) Full screen display method and device of mobile terminal
WO2021017889A1 (en) Display method of video call appliced to electronic device and related apparatus
WO2021000881A1 (en) Screen splitting method and electronic device
US20230046708A1 (en) Application Interface Interaction Method, Electronic Device, and Computer-Readable Storage Medium
EP4325879A1 (en) Method for displaying image in photographic scene and electronic device
WO2021052214A1 (en) Hand gesture interaction method and apparatus, and terminal device
CN111010506A (en) Shooting method and electronic equipment
EP4050883A1 (en) Photographing method and electronic device
WO2021036770A1 (en) Split-screen processing method and terminal device
WO2021180089A1 (en) Interface switching method and apparatus and electronic device
CN110559645B (en) Application operation method and electronic equipment
WO2022001619A1 (en) Screenshot method and electronic device
WO2021052407A1 (en) Electronic device control method and electronic device
WO2022001258A1 (en) Multi-screen display method and apparatus, terminal device, and storage medium
CN113935898A (en) Image processing method, system, electronic device and computer readable storage medium
WO2021042878A1 (en) Photography method and electronic device
WO2022062985A1 (en) Method and apparatus for adding special effect in video, and terminal device
WO2022078116A1 (en) Brush effect picture generation method, image editing method and device, and storage medium
WO2022033344A1 (en) Video stabilization method, and terminal device and computer-readable storage medium
CN114089902A (en) Gesture interaction method and device and terminal equipment
WO2022252786A1 (en) Window split-screen display method and electronic device
CN114579900A (en) Cross-device page switching method, electronic device and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 21871356

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21871356

Country of ref document: EP

Kind code of ref document: A1