WO2023165390A1 - 变焦特效的生成方法、装置、设备及存储介质 - Google Patents

变焦特效的生成方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2023165390A1
WO2023165390A1 PCT/CN2023/077636 CN2023077636W WO2023165390A1 WO 2023165390 A1 WO2023165390 A1 WO 2023165390A1 CN 2023077636 W CN2023077636 W CN 2023077636W WO 2023165390 A1 WO2023165390 A1 WO 2023165390A1
Authority
WO
WIPO (PCT)
Prior art keywords
zoom
video frame
target
current video
cycle
Prior art date
Application number
PCT/CN2023/077636
Other languages
English (en)
French (fr)
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 WO2023165390A1 publication Critical patent/WO2023165390A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N23/00Cameras or camera modules comprising electronic image sensors; Control thereof
    • H04N23/60Control of cameras or camera modules
    • H04N23/67Focus control based on electronic image sensor signals
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N5/00Details of television systems
    • H04N5/222Studio circuitry; Studio devices; Studio equipment
    • H04N5/262Studio circuits, e.g. for mixing, switching-over, change of character of image, other special effects ; Cameras specially adapted for the electronic generation of special effects
    • H04N5/2621Cameras specially adapted for the electronic generation of special effects during image pickup, e.g. digital cameras, camcorders, video cameras having integrated special effects capability

Definitions

  • Embodiments of the present disclosure relate to the technical field of image processing, for example, to a method, device, device, and storage medium for generating a zoom special effect.
  • Embodiments of the present disclosure provide a method, device, device, and storage medium for generating a zoom special effect.
  • an embodiment of the present disclosure provides a method for generating a zoom special effect, including:
  • the zoom parameters include: zoom ratio range, zoom duration and zoom mode;
  • the embodiment of the present disclosure also provides a device for generating a zoom special effect, including:
  • the zoom parameter acquisition module is configured to obtain the zoom target and zoom parameters set by the user on the special effect tool interface; wherein, the zoom parameters include: zoom ratio range, zoom duration and zoom mode;
  • the target detection module is configured to perform target detection on the video to be processed
  • the zoom processing module is configured to, in response to detecting the zoom target, perform zoom processing on the video to be processed according to the zoom parameter, and obtain a zoom special effect video.
  • an embodiment of the present disclosure further provides an electronic device, and the electronic device includes:
  • a storage device configured to store one or more programs
  • the one or more processing devices When the one or more programs are executed by the one or more processing devices, the one or more processing devices implement the method for generating a zoom special effect as described in the embodiments of the present disclosure.
  • the embodiments of the present disclosure further provide a computer-readable medium on which a computer program is stored, and when the program is executed by the processing device, the method for generating the zoom special effect as described in the embodiments of the present disclosure is implemented.
  • FIG. 1 is a flow chart of a method for generating a zoom special effect in an embodiment of the present disclosure
  • Fig. 2 is an example diagram of a special effect tool interface in an embodiment of the present disclosure
  • Fig. 3 is an example diagram of splicing the current video frame after translation and the set material map in the embodiment of the present disclosure
  • FIG. 4 is a schematic structural diagram of an apparatus for generating a zoom special effect in an embodiment of the present disclosure
  • Fig. 5 is a schematic structural diagram of an electronic device in an embodiment of the present disclosure.
  • the term “comprise” and its variations are open-ended, ie “including but not limited to”.
  • the term “based on” is “based at least in part on”.
  • the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one further embodiment”; the term “some embodiments” means “at least some embodiments.” Relevant definitions of other terms will be given in the description below.
  • Figure 1 is a flow chart of a method for generating a zoom effect provided by an embodiment of the present disclosure.
  • This embodiment can perform zoom processing on a video, and the method can be executed by a device for generating a zoom effect, which can be implemented by hardware and/or software Composed, and generally can be integrated in a device with the function of generating zoom effects, the device can be an electronic device such as a server, a mobile terminal, or a server cluster.
  • the method includes the following steps:
  • the zoom parameters include: zoom ratio range, zoom duration and zoom mode.
  • the zoom mode includes the number of cycles and the zoom trend in each cycle
  • the zoom ratio range includes the initial zoom ratio and the target zoom ratio in one cycle
  • the zoom duration is the duration of one cycle.
  • the zoom trend can include two aspects: the change trend of the zoom ratio and the change of the zoom speed, for example: the zoom ratio first increases and then decreases, and the speed is faster during the increase process, and the speed is slower during the decrease process; The zoom ratio first increases and then directly returns to the initial zoom ratio; the zoom ratio directly changes to the target zoom ratio and then gradually decreases, etc.
  • the user can generate different zoom effects by selecting different zoom parameters, thereby increasing the diversity of zoom effects.
  • the special effect tool may be an application program (Application, APP) for producing a special effect image or a special effect video, or a small tool embedded in the APP.
  • the special effect tool interface is provided with zoom parameter selection controls, and the user can set desired zoom parameters through these controls.
  • FIG. 2 is an example diagram of the special effect tool interface in this embodiment. As shown in FIG. 2, the interface includes a zoom target selection control, a zoom ratio range selection control, a zoom duration selection control and a zoom mode selection control , used to click the drop-down box of the zoom parameter selection control, and select the corresponding parameter from the drop-down box.
  • the zoom ratio range is 1.0-2.0
  • the zoom duration can be selected as 1.5 seconds
  • the number of cycles is selected to be 3 times.
  • the zoom trend is that the zoom ratio first increases and then decreases, and the speed is faster in the process of increasing, and the speed is faster in the process of decreasing. Slower etc.
  • the zoom target may be a target object arbitrarily selected by the user, such as: animals (such as: cat faces, dog faces), human bodies (such as: human limbs), human faces, and the like.
  • the video to be processed may be a video collected in real time or a recorded video or a video downloaded from a local database or a server database.
  • any target detection algorithm in the related art may be used to detect the zoom target in the video to be processed.
  • the zoom target in each video frame in the video to be processed is detected.
  • the process of performing target detection on the video to be processed may be: During the playback process, the zoom target is detected on the current video frame being played; if the zoom target is detected in the current video frame and the zoom target is not detected in the previous video frame, start timing from the current video frame to obtain the current video frame The timing moment corresponding to the frame; if the zoom target is detected in the current video frame and the zoom target is detected in the previous video frame, the time is accumulated on the timing moment corresponding to the previous video frame to obtain the timing moment corresponding to the current video frame .
  • the process of playing the video to be processed can be understood as the process of recording the video of the current scene, or the process of playing the recorded video, or the process of playing the downloaded video. It may be understood that the zoom target is detected in the current video frame and the zoom target is not detected in the previous video frame: the zoom target appears for the first time in the current frame or the zoom target appears again after disappearing for a period of time. At this time, timing starts from the current video frame, and the timing moment corresponding to the current video frame is obtained. If the zoom target is detected in the current video frame and the zoom target is detected in the previous video frame, it may be understood that the zoom target appears in consecutive video frames.
  • the set duration is accumulated on the timing moment corresponding to the last video frame to obtain the timing moment corresponding to the current video frame.
  • the set duration may be determined by the frame rate of the video. Assuming that the frame rate of the video to be processed is f, the duration is set to 1/f. In this embodiment, acquiring the timing moment corresponding to the current video frame can improve the accuracy of determining the zoom ratio.
  • the zoom ratio of the video frame containing the zoom target is determined according to the zoom parameter, and zoom processing is performed on the video frame containing the zoom target according to the zoom ratio.
  • the manner of zooming the video to be processed according to the zoom parameter may be: determining the zoom ratio according to the timing moment and the zoom parameter; and performing zoom processing on the current video frame based on the zoom ratio.
  • the zoom ratio may be a ratio for zooming the video frame, for example, assuming that the zoom ratio is 1.5, the video frame is enlarged by 1.5 times.
  • the timing moment can be understood as the elapsed time from the timing start to the current video frame. For example, if a zoom target is detected in the current frame, then the timing moment corresponding to the current frame is obtained, then the zoom ratio is determined according to the timing moment and the zoom parameter, and zoom processing is performed on the current video frame according to the zoom ratio.
  • the zoom ratio is determined according to the timing moment and the zoom parameter, so as to perform zoom processing on the current video frame based on the zoom ratio, which can improve the accuracy of the zoom processing.
  • the way to determine the zoom ratio according to the timing moment and zoom parameters can be: determine the corresponding relationship between the cycle progress and the zoom ratio in a cycle based on the zoom ratio range, zoom duration and zoom trend; The cycle progress; determine the zoom ratio corresponding to the cycle progress based on the corresponding relationship.
  • the loop progress can be understood as the ratio of the duration between the timing moment corresponding to the current video frame and the start time of one loop to the total duration of one loop. For example: suppose the start time of a cycle is t0, the end time is t1, and the timing time t2 corresponding to the current video frame is in this cycle, then the cycle progress is (t2-t0)/(t1-t0).
  • the way to determine the corresponding relationship between the cycle progress and the zoom ratio in a cycle based on the zoom ratio range, zoom duration, and zoom trend may be: first determine the number of video frames contained in a cycle according to the zoom duration and frame rate, and then according to the zoom The trend determines the variation of the zoom ratio between adjacent video frames in a cycle, and finally determines the zoom ratio of each video frame according to the initial zoom ratio in the zoom ratio range and the variation of the zoom ratio, and determines the cycle progress of each video frame, so that Get the corresponding relationship between cycle progress and zoom ratio.
  • the zoom ratio range is k1-k2
  • the zoom duration is T
  • the zoom trend is to gradually increase the zoom ratio with a step size of k
  • the zoom ratio with a step size of k/2 and the frame rate is f
  • the number of video frames contained in one cycle is Tf
  • the zoom ratios of each video frame are: k1+k, k1+2k, ... k1+nk, k1+nk+k/2, ..., k2, and finally
  • the loop progress corresponding to each video frame is obtained, so as to obtain the corresponding relationship between the loop progress and the zoom ratio.
  • the method of determining the cycle progress corresponding to the timing moment according to the zoom duration and the number of cycles may be: judging whether the timing moment is in the zoom cycle according to the zoom duration and the number of cycles; if so, obtaining the period corresponding to the cycle where the timing moment is located;
  • the time period includes a start time and an end time; the cycle progress corresponding to the timing moment is determined based on the time period.
  • the zoom duration is multiplied by the number of cycles to obtain the total duration, and the timing is compared with the total duration. If the timing is greater than the total duration, the current video frame is not in the zoom cycle, that is, the current video frame is not Perform zoom processing, if the timing time is less than the total duration, the current video frame is in the zoom cycle, that is, zoom processing is performed on the current video frame.
  • the way of obtaining the time period corresponding to the cycle where the timing moment is located may be: firstly determine the time period corresponding to each cycle according to the zoom duration, and then determine which time period the timing moment corresponding to the current video frame is in, so as to obtain the cycle where the timing moment is located. For example, assuming that the zoom duration is T and the number of cycles is 3, the period of the first cycle is 0-T, the period of the second cycle is T-2T, and the period of the third cycle is 2T-3T; the current video The timing moment of the frame is t1, and t1 is between T-2T, then the timing moment of the current video frame is in the second cycle.
  • the manner of determining the cycle progress corresponding to the timing moment based on the period may be: calculating the ratio of the duration between the timing moment corresponding to the current video frame and the start time of the corresponding period to the zoom duration. For example: assuming that the timing moment corresponding to the current video frame is within the period T-2T, and the timing moment t2 corresponding to the current video frame is in this cycle, the cycle progress is (t2-T)/T. In this embodiment, it is possible to improve Determines the accuracy of the zoom scale.
  • the zooming process can be understood as: performing a zoom-in or zoom-out operation (zoom operation) on the zoom object.
  • the manner of performing zoom processing on the current video frame based on the zoom ratio may be: perform zoom processing only on the zoom target, or perform zoom processing on the entire video frame.
  • the way to zoom the current video frame based on the zoom ratio may be: extract the zoom target from the current video frame to obtain the background image and the zoom target image; zoom the zoom target image to the zoom ratio; The zoom target image is translated to move the zoom point to the set position; the zoom target image after translation is superimposed on the background image to obtain the target video frame.
  • the zoom point is a set point on the zoom target, such as the center point of the zoom target.
  • the zoom point may be a pixel on the tip of the nose.
  • the set position may be the center point of the picture where the current video frame is located, for example: the zoom target after zooming is translated so that the tip of the nose moves to the midpoint of the picture where the video frame is located.
  • the process of extracting the zoom target for the current video frame may be: detecting the zoom target in the current video frame to obtain a target detection frame, and cutting the zoom target from the current video frame according to the target detection frame, Get the zoom target image and background image.
  • the background image is the image with the zoom target cut out.
  • the zoom target image is zoomed and translated, if it is directly superimposed with the background image, a blank area may appear. Therefore, the background image needs to be repaired first.
  • the process of superimposing the translated zoom target image and the background image to obtain the target video frame may be: performing image restoration on the background image; superimposing the translated zoom target image and the repaired background image to obtain the target video frame .
  • the method of performing image repair on the background image may be: input the background image into the preset restoration model, and output the repaired background image.
  • the preset restoration model may be obtained after training a preset neural network with a large number of samples.
  • a manner of superimposing the translated zoom target image and the repaired background image may be: superimposing the translated zoom target image on the repaired background image to obtain the target video frame.
  • the manner of zooming the current video frame based on the zoom ratio may be: scaling the zoom ratio of the current video frame; and translating the zoomed current video frame so that the zoom point moves to a set position.
  • the zoom point is a set point on the zoom target, such as a center point of the zoom target.
  • the zoom point may be a pixel on the tip of the nose.
  • the set position may be the center point of the screen where the current video frame is located.
  • the current video frame is reduced or enlarged by a determined zoom ratio, and then the zoomed current video frame is translated so that the zoom point moves to the center of the picture where the video frame is located.
  • the following step is further included: if the zoom ratio of the current video frame is enlarged, then cropping the shifted current video frame to obtain the target video frame. Make the size of the target video frame the same as that of the current video frame before zooming in; if the zoom ratio is reduced for the current video frame, then the current video frame after translation is spliced with the set material map to obtain the target video frame, so that the target video frame is the same as The size of the current video frame before downscaling is the same.
  • the set material map may be a material map generated based on the current video frame, or a material map randomly selected from a material library.
  • FIG. 3 is an example diagram of splicing the shifted current video frame and the set material map in this embodiment. As shown in FIG. 3 , the shifted current video frame is located in the central area, and the peripheral black area is set Material map.
  • the zoomed video frame or the zoom target is translated, so that the zoom point moves to a set position, so that the zoom target moves to the center of the screen as the zoom target zooms.
  • the zoom target and zoom parameters set by the user on the special effect tool interface are obtained;
  • the zoom parameters include: zoom ratio range, zoom duration and zoom mode; target detection is performed on the video to be processed; if the zoom target is detected, the The zoom parameter performs zoom processing on the video to be processed to obtain a zoom special effect video.
  • the zoom special effect generation method provided by the embodiments of the present disclosure performs zoom special effect processing on a video based on the zoom parameters selected by the user, which can not only reduce the generation efficiency of zoom special effects, but also increase the diversity of zoom effects.
  • FIG. 4 is a schematic structural diagram of a zoom special effect generating device disclosed in an embodiment of the present disclosure. As shown in FIG. 4 , the device includes:
  • the zoom parameter acquisition module 210 is configured to acquire the zoom target and zoom parameters set by the user on the special effect tool interface; wherein, the zoom parameters include: zoom ratio range, zoom duration and zoom mode;
  • the target detection module 220 is configured to perform target detection on the video to be processed
  • the zoom processing module 230 is configured to perform zoom processing on the video to be processed according to zoom parameters when a zoom target is detected, and obtain a zoom special effect video.
  • the target detection module 220 is further configured to:
  • the zoom target detection is performed on the current video frame being played
  • the set duration is accumulated on the timing moment corresponding to the previous video frame to obtain the timing moment corresponding to the current video frame.
  • the zoom processing module 230 is further configured to:
  • the zoom mode includes the number of cycles and the zoom trend in each cycle, the zoom ratio range includes the initial zoom ratio and the target zoom ratio in one cycle; the zoom duration is the duration of one cycle.
  • the zoom processing module 230 is further configured to:
  • the zoom ratio corresponding to the cycle progress is determined based on the corresponding relationship.
  • the zoom processing module 230 is further configured to:
  • the cycle progress corresponding to the timing moment is determined based on the time period.
  • the zoom processing module 230 is further configured to:
  • the zoom processing module 230 is further configured to:
  • the zoom processing module 230 is further configured to:
  • the zoom point is a set point on the zoom target.
  • the zoom processing module 230 is further configured to:
  • the zoom ratio is enlarged for the current video frame, then the current video frame after translation is cut to obtain the target video frame, so that the size of the target video frame is the same as that of the current video frame before zooming in;
  • the zoom ratio is reduced for the current video frame, the shifted current video frame and the set material map are spliced to obtain the target video frame, so that the size of the target video frame is the same as that of the current video frame before reduction .
  • the above-mentioned device can execute the methods provided by all the foregoing embodiments of the present disclosure, and has corresponding functional modules and advantageous effects for executing the above-mentioned methods.
  • the above-mentioned device can execute the methods provided by all the foregoing embodiments of the present disclosure, and has corresponding functional modules and advantageous effects for executing the above-mentioned methods.
  • FIG. 5 it shows a schematic structural diagram of an electronic device 300 suitable for implementing the embodiments of the present disclosure.
  • Electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (Personal Digital Assistant, PDA), tablet computers (PAD), portable multimedia players (Portable Media Player , PMP), mobile terminals such as vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital television (Television, TV), desktop computers, etc., or various forms of servers, such as independent servers or server clusters.
  • PDA Personal Digital Assistant
  • PMP portable multimedia players
  • mobile terminals such as vehicle-mounted terminals (such as vehicle-mounted navigation terminals)
  • fixed terminals such as digital television (Television, TV), desktop computers, etc.
  • servers such as independent servers or server clusters.
  • the electronic device shown in FIG. 5 is only an example, and should not limit the functions and scope of use of the embodiments of the present disclosure.
  • an electronic device 300 may include a processing device (such as a central processing unit, a graphics processing unit, etc.)
  • the device 308 loads programs in the random access storage device (Random Access Memory, RAM) 303 to execute various appropriate actions and processes.
  • RAM Random Access Memory
  • various programs and data necessary for the operation of the electronic device 300 are also stored.
  • the processing device 301, ROM 302, and RAM 303 are connected to each other through a bus 304.
  • An input/output (Input/Output, I/O) interface 305 is also connected to the bus 304 .
  • an input device 306 including, for example, a touch screen, a touchpad, a keyboard, a mouse, a camera, a microphone, an accelerometer, a gyroscope, etc.; including, for example, a liquid crystal display (Liquid Crystal Display, LCD) , an output device 307 such as a speaker, a vibrator, etc.; a storage device 308 including, for example, a magnetic tape, a hard disk, etc.; and a communication device 309.
  • the communication means 309 may allow the electronic device 300 to perform wireless or wired communication with other devices to exchange data. While FIG. 5 shows electronic device 300 having various means, it should be understood that implementing or having all of the means shown is not a requirement. More or fewer means may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product comprising a computer program carried on a computer readable medium, the computer program comprising program code for performing a word recommendation method.
  • the computer program may be downloaded and installed from a network via communication means 309, or from storage means 308, or from ROM 302.
  • the processing device 301 When the computer program is executed by the processing device 301, the above-mentioned functions defined in the methods of the embodiments of the present disclosure are performed.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two.
  • a computer readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination thereof.
  • Examples of computer readable storage media may include, but are not limited to, electrical connections with one or more conductors, portable computer diskettes, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read-only Memory (Erasable Programmable Read-Only Memory, EPROM) or flash memory, optical fiber, portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above .
  • a computer-readable storage medium may be any tangible medium that contains or stores a program that can be used by or in conjunction with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • a computer-readable signal medium may also be any computer-readable medium other than a computer-readable storage medium, which can transmit, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device .
  • the program code contained on the computer readable medium can be transmitted by any appropriate medium, including but not limited to: electric wire, optical cable, radio frequency (Radio Frequency, RF), etc., or any suitable combination of the above.
  • the client and the server can communicate using any currently known or future network protocols such as HTTP (HyperText Transfer Protocol, Hypertext Transfer Protocol), and can communicate with digital data in any form or medium Communications (eg, communication networks) are interconnected.
  • Examples of communication networks include local area networks (Local Area Network, LAN), wide area networks (Wide Area Network, WAN), internetworks (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently existing networks that are known or developed in the future.
  • the above-mentioned computer-readable medium may be contained in the above-mentioned electronic device; it may also exist independently, not incorporated into the electronic device.
  • the above-mentioned computer-readable medium carries one or more programs, and when the above-mentioned one or more programs are executed by the electronic device, the electronic device: obtains the zoom target and zoom parameters set by the user on the special effect tool interface; wherein, the The zoom parameters include: zoom ratio range, zoom duration and zoom mode; target detection is performed on the video to be processed; if the zoom target is detected, zoom processing is performed on the video to be processed according to the zoom parameters to obtain a zoom special effect video.
  • the storage medium may be a non-transitory storage medium.
  • Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, or combinations thereof, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages - such as the "C" language or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server.
  • the remote computer can be connected to the user computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as through an Internet service provider). Internet connection).
  • LAN local area network
  • WAN wide area network
  • Internet service provider such as AT&T, MCI, Sprint, EarthLink, MSN, GTE, etc.
  • each block in a flowchart or block diagram may represent a module, program segment, or portion of code that contains one or more logical functions for implementing specified executable instructions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or they may sometimes be executed in the reverse order, depending upon the functionality involved.
  • each block of the block diagrams and/or flowchart illustrations, and combinations of blocks in the block diagrams and/or flowchart illustrations can be implemented by a dedicated hardware-based system that performs the specified functions or operations , or may be implemented by a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments described in the present disclosure may be implemented by software or by hardware. Wherein, the name of a unit does not constitute a limitation of the unit itself under certain circumstances.
  • exemplary types of hardware logic components include: Field Programmable Gate Array (FPGA), Application Specific Integrated Circuit (Application Specific Integrated Circuit, ASIC), application specific standard product (Application Specific Standard Product, ASSP), system on chip (System on Chip, SOC), complex programmable logic device (Complex Programmable Logic Device, CPLD) and so on.
  • FPGA Field Programmable Gate Array
  • ASIC Application Specific Integrated Circuit
  • ASSP application specific standard product
  • SOC System on Chip
  • complex programmable logic device Complex Programmable Logic Device, CPLD
  • a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, apparatus, or device.
  • a machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • a machine-readable medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing.
  • machine-readable storage media examples include one or more wire-based electrical connections, portable computer disks, hard disks, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM), or flash memory), optical fiber, compact disc read only memory (CD-ROM), optical storage, magnetic storage, or any suitable combination of the foregoing.
  • RAM random access memory
  • ROM read only memory
  • EPROM erasable programmable read only memory
  • flash memory flash memory
  • optical fiber compact disc read only memory
  • CD-ROM compact disc read only memory
  • magnetic storage or any suitable combination of the foregoing.
  • the embodiments of the present disclosure disclose a method for generating a zoom special effect, including:
  • the zoom parameters include: zoom ratio range, zoom duration and zoom mode;
  • zoom processing is performed on the video to be processed according to the zoom parameter to obtain a zoom special effect video.
  • target detection is performed on the video to be processed, including:
  • the detection of the zoom target is performed on the current video frame being played
  • the zoom target is detected in the current video frame and the zoom target is detected in the previous video frame, then add the set duration to the timing moment corresponding to the previous video frame to obtain the timing moment corresponding to the current video frame .
  • performing zoom processing on the video to be processed according to the zoom parameter includes:
  • the zooming method includes the number of cycles and the zoom trend in each cycle, and the zoom ratio range includes an initial zoom ratio and a target zoom ratio in one cycle; the zooming time The length is the duration of one cycle.
  • determining the zoom ratio according to the timing moment and the zoom parameter includes:
  • a zoom ratio corresponding to the cycle progress is determined based on the corresponding relationship.
  • determining the cycle progress corresponding to the timing moment according to the zoom duration and the cycle number includes:
  • the period includes a start time and an end time
  • the cycle progress corresponding to the timing moment is determined based on the time period.
  • performing zoom processing on the current video frame based on the zoom ratio includes:
  • the zoom target image after translation is superimposed on the background image to obtain the target video frame, including:
  • performing zoom processing on the current video frame based on the zoom ratio includes:
  • after translating the zoomed current video frame further include:
  • the zoom ratio is enlarged for the current video frame, then the current video frame after translation is cut to obtain the target video frame, so that the size of the target video frame is the same as that of the current video frame before zooming in;
  • the current video frame after translation is spliced with the set material map to obtain the target video frame, so that the target video frame is the same as the current video before zooming out.
  • the frames are the same size.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • Studio Devices (AREA)

Abstract

本公开实施例公开了一种变焦特效的生成方法、装置、设备及存储介质。方法包括:获取用户在特效工具界面设置的变焦目标及变焦参数;其中,所述变焦参数包括:变焦比例范围、变焦时长及变焦方式;对待处理视频进行目标检测;响应于检测到所述变焦目标,根据所述变焦参数对所述待处理视频进行变焦处理,获得变焦特效视频。

Description

变焦特效的生成方法、装置、设备及存储介质
本申请要求在2022年03月03日提交中国专利局、申请号为202210204603.8的中国专利申请的优先权,以上申请的全部内容通过引用结合在本申请中。
技术领域
本公开实施例涉及图像处理技术领域,例如涉及一种变焦特效的生成方法、装置、设备及存储介质。
背景技术
目前传统的特效工具中,想要实现特效需要开发人员进行着色器代码的编写,但是着色器编写门槛高,对工具用户极度不友好。且目前的特效工具,由于变焦功能单一,使得生产的特效也比较单一,用户体验差。
发明内容
本公开实施例提供一种变焦特效的生成方法、装置、设备及存储介质。
第一方面,本公开实施例提供了一种变焦特效的生成方法,包括:
获取用户在特效工具界面设置的变焦目标及变焦参数;其中,所述变焦参数包括:变焦比例范围、变焦时长及变焦方式;
对待处理视频进行目标检测;
响应于检测到所述变焦目标,根据所述变焦参数对所述待处理视频进行变焦处理,获得变焦特效视频。
第二方面,本公开实施例还提供了一种变焦特效的生成装置,包括:
变焦参数获取模块,设置为获取用户在特效工具界面设置的变焦目标及变焦参数;其中,所述变焦参数包括:变焦比例范围、变焦时长及变焦方式;
目标检测模块,设置为对待处理视频进行目标检测;
变焦处理模块,设置为响应于检测到所述变焦目标,根据所述变焦参数对所述待处理视频进行变焦处理,获得变焦特效视频。
第三方面,本公开实施例还提供了一种电子设备,所述电子设备包括:
一个或多个处理装置;
存储装置,设置为存储一个或多个程序;
当所述一个或多个程序被所述一个或多个处理装置执行,使得所述一个或多个处理装置实现如本公开实施例所述的变焦特效的生成方法。
第四方面,本公开实施例还提供了一种计算机可读介质,其上存储有计算机程序,该程序被处理装置执行时实现如本公开实施例所述的变焦特效的生成方法。
附图说明
图1是本公开实施例中的一种变焦特效的生成方法的流程图;
图2是本公开实施例中的特效工具界面的示例图;
图3是本公开实施例中平移后的当前视频帧与设定素材图拼接的示例图;
图4是本公开实施例中的一种变焦特效的生成装置的结构示意图;
图5是本公开实施例中的一种电子设备的结构示意图。
具体实施方式
下面将参照附图描述本公开的实施例。虽然附图中显示了本公开的某些实施例,然而应当理解的是,本公开可以通过各种形式来实现,而且不应该被解释为限于这里阐述的实施例,相反提供这些实施例是为了更加透彻和完整地理解本公开。应当理解的是,本公开的附图及实施例仅用于示例性作用,并非用于限制本公开的保护范围。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“一个或多个”。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
图1为本公开实施例提供的一种变焦特效的生成方法的流程图,本实施例可对视频进行变焦处理,该方法可以由变焦特效的生成装置来执行,该装置可由硬件和/或软件组成,并一般可集成在具有变焦特效的生成功能的设备中,该设备可以是服务器、移动终端或服务器集群等电子设备。如图1所示,该方法包括如下步骤:
S110,获取用户在特效工具界面设置的变焦目标及变焦参数。
其中,变焦参数包括:变焦比例范围、变焦时长及变焦方式。变焦方式包括循环次数以及各循环中的变焦趋势,变焦比例范围包括一次循环中的初始变焦比例和目标变焦比例,变焦时长为一次循环所占的时长。变焦趋势可以包括为变焦比例的变化趋势以及变焦速度的变化情况两个方面,例如:变焦比例先增大后减小及在增大的过程中速度较快,减小的过程中速度较慢;变焦比例先增大后直接恢复至初始变焦比例;变焦比例直接变为目标变焦比例后逐渐减小等。本实施例中,用户通过选择不同的变焦参数,可以生成不同的变焦特效,从而提高变焦特效的多样性。
本实施例中,特效工具可以是用于生产特效图像或者特效视频的应用程序(Application,APP)或者内嵌于APP中的小工具。特效工具界面中设置有变焦参数选择控件,用户可以通过这些控件设置想要的变焦参数。示例性的,图2是本实施例中特效工具界面的示例图,如图2所示,在该界面中包含变焦目标选择控件、有变焦比例范围选择控件、变焦时长选择控件及变焦方式选择控件,用于点击变焦参数选择控件的下拉框,从下拉框中选择对应的参数。例如:变焦比例范围选择1.0-2.0,变焦时长可以选择1.5秒,循环次数选择3次,变焦趋势为变焦比例先增大后减小及在增大的过程中速度较快,减小的过程中速度较慢等。
其中,变焦目标可以是用户任意选择的目标对象,例如:动物(如:猫脸、狗脸)、人体(例如:人的肢体)、人物面部等。
S120,对待处理视频进行目标检测。
其中,待处理视频可以是实时采集的视频或者已经录制好的视频或者从本地数据库或者服务器数据库下载的视频。本实施例中,可以采用相关技术中任意的目标检测算法对待处理视频中的变焦目标进行检测。
例如,用户在特效工具界面设置了变焦目标之后,对待处理视频中每个视频帧中的变焦目标进行检测。
本实施例中,对待处理视频进行目标检测的过程可以是:在待处理视频播 放过程中,对播放的当前视频帧进行变焦目标的检测;若在当前视频帧中检测到变焦目标且未在上一视频帧中检测到变焦目标,则从当前视频帧开始计时,获得当前视频帧对应的计时时刻;若在当前视频帧中检测到变焦目标且在上一视频帧中检测到变焦目标,则在上一视频帧对应的计时时刻上累加时间,获得当前视频帧对应的计时时刻。
其中,待处理视频播放过程可以理解为对当前场景进行视频录制的过程,或者已经录制好的视频的播放过程,或者下载的视频的播放过程。在当前视频帧中检测到变焦目标且未在上一视频帧中检测到变焦目标可以理解为:变焦目标在当前帧中首次出现或者变焦目标消失一段时间后再次出现。此时从当前视频帧开始计时,获得当前视频帧对应的计时时刻。若在当前视频帧中检测到所述变焦目标且在上一视频帧中检测到所述变焦目标可以理解为:变焦目标在连续的视频帧中出现。此时,在上一视频帧对应的计时时刻上累加设定时长,获得当前视频帧对应的计时时刻。其中,设定时长可以有视频的帧率来确定。假设待处理视频的帧率为f,则设定时长为1/f。本实施例中,获取当前视频帧对应的计时时刻,可以提高确定变焦比例的准确性。
S130,响应于检测到变焦目标,根据变焦参数对待处理视频进行变焦处理,获得变焦特效视频。
本实施例中,若在待处理视频中检测到变焦目标,则根据变焦参数确定包含变焦目标的视频帧的变焦比例,并根据变焦比例对包含变焦目标的视频帧进行变焦处理。
例如,根据变焦参数对待处理视频进行变焦处理的方式可以是:根据计时时刻和变焦参数确定变焦比例;基于变焦比例对当前视频帧进行变焦处理。
其中,变焦比例可以是将视频帧缩放的比例,例如:假设变焦比例为1.5,则将视频帧放大1.5倍。计时时刻可以理解为从计时开始到当前视频帧经过的时长。例如,若在当前帧中检测到变焦目标,则获取当前帧对应的计时时刻,则根据计时时刻和变焦参数确定变焦比例,并根据变焦比例对当前视频帧进行变焦处理。本实施例中,根据计时时刻和变焦参数确定变焦比例,以基于变焦比例对当前视频帧进行变焦处理,可以提高变焦处理的准确性。
例如,根据计时时刻和变焦参数确定变焦比例的方式可以是:基于变焦比例范围、变焦时长和变焦趋势确定一次循环中的循环进度与变焦比例的对应关系;根据变焦时长和循环次数确定计时时刻对应的循环进度;基于对应关系确定循环进度对应的变焦比例。
其中,循环进度可以理解为当前视频帧对应的计时时刻与一次循环的起始时间间的时长占一次循环总时长的比例。例如:假设一次循环的起始时间为t0,终止时间为t1,且当前视频帧对应的计时时刻t2处于该次循环中,则循环进度为(t2-t0)/(t1-t0)。
例如,基于变焦比例范围、变焦时长和变焦趋势确定一次循环中的循环进度与变焦比例的对应关系的方式可以是:首先根据变焦时长和帧率确定一次循环中包含的视频帧数量,然后根据变焦趋势确定一次循环中相邻视频帧间变焦比例的变化量,最后根据变焦比例范围中的初始变焦比例以及变焦比例的变化量确定各视频帧的变焦比例,并确定各视频帧的循环进度,从而获得循环进度与变焦比例的对应关系。示例性的,假设变焦比例范围k1-k2,变焦时长为T,变焦趋势为先以k的步长逐渐增加变焦比例,后以k/2的步长逐渐增加变焦比例,且帧率为f,则一次循环中包含的视频帧数量为Tf,则各视频帧的变焦比例依次为:k1+k,k1+2k,……k1+nk,k1+nk+k/2,……,k2,最后获取各视频帧对应的循环进度,从而获得循环进度与变焦比例的对应关系。
例如,根据变焦时长和循环次数确定计时时刻对应的循环进度的方式可以是:根据变焦时长和循环次数判断计时时刻是否处于变焦循环中;若处于,则获取计时时刻所在循环对应的时段;其中,时段包括起始时间和终止时间;基于时段确定计时时刻对应的循环进度。
本实施例中,将变焦时长与循环次数相乘,获得总时长,将计时时刻与总时长相比较,若计时时刻大于总时长,则当前视频帧未处于变焦循环中,即对当前视频帧不进行变焦处理,若计时时刻小于总时长,则当前视频帧处于变焦循环中,即对当前视频帧进行变焦处理。
其中,获取计时时刻所在循环对应的时段的方式可以是:首先根据变焦时长确定各循环对应的时段,然后再确定当前视频帧对应的计时时刻处于哪个时段之间,从而获得计时时刻所在的循环。例如,假设变焦时长为T,循环次数为3次,则第一次循环的时段为0-T,第二次循环的时段为T-2T,第三次循环的时段为2T-3T;当前视频帧的计时时刻为t1,且t1位于T-2T之间,则当前视频帧的计时时刻处于第二次循环中。
其中,基于时段确定计时时刻对应的循环进度的方式可以是:计算当前视频帧对应的计时时刻与其对应时段的起始时间间的时长与变焦时长间的比例。例如:假设当前视频帧对应的计时时刻处于T-2T时段间,且当前视频帧对应的计时时刻t2处于该次循环中,则循环进度为(t2-T)/T。本实施例中,可以提高 确定变焦比例的准确性。
其中,变焦处理可以理解理解为:对变焦对象执行放大或缩小的操作(缩放操作)。本实施例中,基于变焦比例对当前视频帧进行变焦处理的方式可以是:只对变焦目标进行变焦处理,或者对整个视频帧进行变焦处理。
在一实施例中,基于变焦比例对当前视频帧进行变焦处理的方式可以是:对当前视频帧进行变焦目标的提取,获得背景图及变焦目标图;将变焦目标图缩放变焦比例;将缩放后的变焦目标图进行平移,使得变焦点移动至设定位置;将平移后的变焦目标图与背景图进行叠加,获得目标视频帧。
其中,变焦点为变焦目标上的设定点,例如变焦目标的中心点。例如:假设:变焦目标为人脸,则变焦点可以是鼻尖上的像素点。设定位置可以是当前视频帧所在画面的中心点,例如:将缩放后的变焦目标进行平移,使得鼻尖点移动至视频帧所在画面的中点。
本实施例中,对当前视频帧进行变焦目标的提取的过程可以是:对当前视频帧中的变焦目标进行检测,获得目标检测框,根据目标检测框将变焦目标从当前视频帧中裁剪出来,获得变焦目标图和背景图。
其中,背景图为抠掉变焦目标的图,当对变焦目标图缩放及平移后,若直接和背景图直接叠加,可能会出现空白区域,因此,需要先对背景图进行修复。
例如,将平移后的变焦目标图与背景图进行叠加,获得目标视频帧的过程可以是:对背景图进行图像修复;将平移后的变焦目标图与修复的背景图进行叠加,获得目标视频帧。
其中,对背景图进行图像修复的方式可以是:将背景图输入设定修复模型中,输出修复的背景图。其中设定修复模型可以是采用大量样本对设定神经网络训练后的获得的。将平移后的变焦目标图与修复的背景图进行叠加的方式可以是:将平移后的变焦目标图叠加在修复的背景图之上,获得目标视频帧。
在一实施例中,基于变焦比例对当前视频帧进行变焦处理的方式可以是:将当前视频帧缩放变焦比例;将缩放后的当前视频帧进行平移,使得变焦点移动至设定位置。
其中,变焦点为所述变焦目标上的设定点,例如变焦目标的中心点。例如:假设:变焦目标为人脸,则变焦点可以是鼻尖上的像素点。设定位置可以是当前视频帧所在画面的中心点。
例如,将当前视频帧缩小或者放大确定的变焦比例,然后将缩放后的当前视频帧进行平移,使得变焦点移动至视频帧所在画面的中心。
在一实施例中,在将缩放后的当前视频帧进行平移之后,还包括如下步骤:若对当前视频帧放大变焦比例,则对平移后的当前视频帧进行裁剪,获得目标视频帧。使得目标视频帧与放大前的当前视频帧的尺寸相同;若对当前视频帧缩小变焦比例,则对平移后的当前视频帧与设定素材图进行拼接,获得目标视频帧,使得目标视频帧与缩小前的当前视频帧的尺寸相同。
其中,设定素材图可以是基于当前视频帧生成的素材图,或者从素材库中随机选择的素材图。
本实施例中,当前视频帧所在画面的尺寸固定,若当前视频帧放大变焦比例并平移后,则有一部分图像会溢出当前画面,因此需要将溢出画面的图像裁剪掉。若当前视频帧缩小变焦比例并平移后,则当前画面会出现空白区域,则需要获取空白区域对应的设定素材图,并将设定素材图与平移后的当前视频帧进行拼接,获得目标视频帧。示例性的,图3是本实施例中平移后的当前视频帧与设定素材图拼接的示例图,如图3所示,平移后的当前视频帧位于中心区域,***的黑色区域为设定素材图。
本实施例中,对缩放后的视频帧或者变焦目标进行平移,使得变焦点移动至设定位置,使得呈现随着变焦目标缩放变焦目标平移至画面中心的效果。
本公开实施例,获取用户在特效工具界面设置的变焦目标及变焦参数;其中,变焦参数包括:变焦比例范围、变焦时长及变焦方式;对待处理视频进行目标检测;若检测到变焦目标,则根据变焦参数对待处理视频进行变焦处理,获得变焦特效视频。本公开实施例提供的变焦特效的生成方法,基于用户选择的变焦参数对视频进行变焦特效处理,不仅可以降低变焦特效的生成效率,还可以提高变焦效果的多样性。
图4是本公开实施例公开的一种变焦特效的生成装置的结构示意图,如图4所示,该装置包括:
变焦参数获取模块210,设置为获取用户在特效工具界面设置的变焦目标及变焦参数;其中,变焦参数包括:变焦比例范围、变焦时长及变焦方式;
目标检测模块220,设置为对待处理视频进行目标检测;
变焦处理模块230,设置为当检测到变焦目标时,根据变焦参数对待处理视频进行变焦处理,获得变焦特效视频。
在一实施例中,目标检测模块220,还设置为:
在待处理视频播放过程中,对播放的当前视频帧进行变焦目标的检测;
若在当前视频帧中检测到变焦目标且未在上一视频帧中检测到变焦目标, 则从当前视频帧开始计时,获得当前视频帧对应的计时时刻;
若在当前视频帧中检测到变焦目标且在上一视频帧中检测到变焦目标,则在上一视频帧对应的计时时刻上累加设定时长,获得当前视频帧对应的计时时刻。
在一实施例中,变焦处理模块230,还设置为:
根据计时时刻和变焦参数确定变焦比例;
基于变焦比例对当前视频帧进行变焦处理。
在一实施例中,变焦方式包括循环次数以及各循环中的变焦趋势,变焦比例范围包括一次循环中的初始变焦比例和目标变焦比例;变焦时长为一次循环所占的时长。
在一实施例中,变焦处理模块230,还设置为:
基于变焦比例范围、变焦时长和变焦趋势确定一次循环中的循环进度与变焦比例的对应关系;
根据变焦时长和循环次数确定计时时刻对应的循环进度;
基于对应关系确定循环进度对应的变焦比例。
在一实施例中,变焦处理模块230,还设置为:
根据变焦时长和循环次数判断计时时刻是否处于变焦循环中;
若处于,则获取计时时刻所在循环对应的时段;其中,时段包括起始时间和终止时间;
基于时段确定计时时刻对应的循环进度。
在一实施例中,变焦处理模块230,还设置为:
对所述当前视频帧进行所述变焦目标的提取,获得背景图及变焦目标图;
将所述变焦目标图缩放所述变焦比例;
将缩放后的变焦目标图进行平移,使得变焦点移动至设定位置;其中,所述变焦点为所述变焦目标上的设定点;
将平移后的变焦目标图与所述背景图进行叠加,获得目标视频帧。
在一实施例中,变焦处理模块230,还设置为:
对所述背景图进行图像修复;
将平移后的变焦目标图与修复的背景图进行叠加,获得目标视频帧。
在一实施例中,变焦处理模块230,还设置为:
将所述当前视频帧缩放所述变焦比例;
将缩放后的当前视频帧进行平移,使得变焦点移动至设定位置;其中,所 述变焦点为所述变焦目标上的设定点。
在一实施例中,变焦处理模块230,还设置为:
若对所述当前视频帧放大所述变焦比例,则对平移后的当前视频帧进行裁剪,获得目标视频帧,使得所述目标视频帧与放大前的当前视频帧的尺寸相同;
若对所述当前视频帧缩小所述变焦比例,则对平移后的当前视频帧与设定素材图进行拼接,获得目标视频帧,使得所述目标视频帧与缩小前的当前视频帧的尺寸相同。
上述装置可执行本公开前述所有实施例所提供的方法,具备执行上述方法相应的功能模块和有益效果。未在本实施例中详尽描述的技术细节,可参见本公开前述所有实施例所提供的方法。
下面参考图5,其示出了适于用来实现本公开实施例的电子设备300的结构示意图。本公开实施例中的电子设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、个人数字助理(Personal Digital Assistant,PDA)、平板电脑(PAD)、便携式多媒体播放器(Portable Media Player,PMP)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字电视(Television,TV)、台式计算机等等的固定终端,或者各种形式的服务器,如独立服务器或者服务器集群。图5示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图5所示,电子设备300可以包括处理装置(例如中央处理器、图形处理器等)301,其可以根据存储在只读存储装置(Read-Only Memory,ROM)302中的程序或者从存储装置308加载到随机访问存储装置(Random Access Memory,RAM)303中的程序而执行各种适当的动作和处理。在RAM 303中,还存储有电子设备300操作所需的各种程序和数据。处理装置301、ROM 302以及RAM 303通过总线304彼此相连。输入/输出(Input/Output,I/O)接口305也连接至总线304。
通常,以下装置可以连接至I/O接口305:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置306;包括例如液晶显示器(Liquid Crystal Display,LCD)、扬声器、振动器等的输出装置307;包括例如磁带、硬盘等的存储装置308;以及通信装置309。通信装置309可以允许电子设备300与其他设备进行无线或有线通信以交换数据。虽然图5示出了具有各种装置的电子设备300,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行词语的推荐方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置309从网络上被下载和安装,或者从存储装置308被安装,或者从ROM 302被安装。在该计算机程序被处理装置301执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的***、装置或器件,或者任意以上的组合。计算机可读存储介质的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(Erasable Programmable Read-Only Memory,EPROM)或闪存、光纤、便携式紧凑磁盘只读存储器(Compact Disc Read-Only Memory,CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行***、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行***、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、射频(Radio Frequency,RF)等等,或者上述的任意合适的组合。
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(Local Area Network,LAN),广域网(Wide Area Network,WAN),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在, 而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:获取用户在特效工具界面设置的变焦目标及变焦参数;其中,所述变焦参数包括:变焦比例范围、变焦时长及变焦方式;对待处理视频进行目标检测;若检测到所述变焦目标,则根据所述变焦参数对所述待处理视频进行变焦处理,获得变焦特效视频。
存储介质可以是非暂态(non-transitory)存储介质。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的***、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的***来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(Field Programmable Gate Array,FPGA)、专用集成电路(Application  Specific Integrated Circuit,ASIC)、专用标准产品(Application Specific Standard Product,ASSP)、片上***(System on Chip,SOC)、复杂可编程逻辑设备(Complex Programmable Logic Device,CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行***、装置或设备使用或与指令执行***、装置或设备结合地使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体***、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开实施例的一个或多个实施例,本公开实施例公开了一种变焦特效的生成方法,包括:
获取用户在特效工具界面设置的变焦目标及变焦参数;其中,所述变焦参数包括:变焦比例范围、变焦时长及变焦方式;
对待处理视频进行目标检测;
若检测到所述变焦目标,则根据所述变焦参数对所述待处理视频进行变焦处理,获得变焦特效视频。
在一实施例中,对待处理视频进行目标检测,包括:
在所述待处理视频播放过程中,对播放的当前视频帧进行所述变焦目标的检测;
若在当前视频帧中检测到所述变焦目标且未在上一视频帧中检测到所述变焦目标,则从所述当前视频帧开始计时,获得当前视频帧对应的计时时刻;
若在当前视频帧中检测到所述变焦目标且在上一视频帧中检测到所述变焦目标,则在上一视频帧对应的计时时刻上累加设定时长,获得当前视频帧对应的计时时刻。
在一实施例中,根据所述变焦参数对所述待处理视频进行变焦处理,包括:
根据所述计时时刻和所述变焦参数确定变焦比例;
基于所述变焦比例对所述当前视频帧进行变焦处理。
在一实施例中,所述变焦方式包括循环次数以及各循环中的变焦趋势,所述变焦比例范围包括一次循环中的初始变焦比例和目标变焦比例;所述变焦时 长为一次循环所占的时长。
在一实施例中,根据所述计时时刻和所述变焦参数确定变焦比例,包括:
基于所述变焦比例范围、所述变焦时长和所述变焦趋势确定一次循环中的循环进度与变焦比例的对应关系;
根据所述变焦时长和所述循环次数确定所述计时时刻对应的循环进度;
基于所述对应关系确定所述循环进度对应的变焦比例。
在一实施例中,根据所述变焦时长和所述循环次数确定所述计时时刻对应的循环进度,包括:
根据所述变焦时长和所述循环次数判断所述计时时刻是否处于变焦循环中;
若处于,则获取所述计时时刻所在循环对应的时段;其中,所述时段包括起始时间和终止时间;
基于所述时段确定所述计时时刻对应的循环进度。
在一实施例中,基于所述变焦比例对所述当前视频帧进行变焦处理,包括:
对所述当前视频帧进行所述变焦目标的提取,获得背景图及变焦目标图;
将所述变焦目标图缩放所述变焦比例;
将缩放后的变焦目标图进行平移,使得变焦点移动至设定位置;其中,所述变焦点为所述变焦目标上的设定点;
将平移后的变焦目标图与所述背景图进行叠加,获得目标视频帧。
在一实施例中,将平移后的变焦目标图与所述背景图进行叠加,获得目标视频帧,包括:
对所述背景图进行图像修复;
将平移后的变焦目标图与修复的背景图进行叠加,获得目标视频帧。
在一实施例中,基于所述变焦比例对所述当前视频帧进行变焦处理,包括:
将所述当前视频帧缩放所述变焦比例;
将缩放后的当前视频帧进行平移,使得变焦点移动至设定位置;其中,所述变焦点为所述变焦目标上的设定点。
在一实施例中,在将缩放后的当前视频帧进行平移之后,还包括:
若对所述当前视频帧放大所述变焦比例,则对平移后的当前视频帧进行裁剪,获得目标视频帧,使得所述目标视频帧与放大前的当前视频帧的尺寸相同;
若对所述当前视频帧缩小所述变焦比例,则对平移后的当前视频帧与设定素材图进行拼接,获得目标视频帧,使得所述目标视频帧与缩小前的当前视频 帧的尺寸相同。
本公开不限于这里所述的特定实施例,能够进行各种变化、重新调整和替代而不会脱离本公开的保护范围。因此,虽然通过以上实施例对本公开进行了说明,但是本公开不仅仅限于以上实施例,在不脱离本公开构思的情况下,还可以包括更多其他等效实施例,而本公开的范围由所附的权利要求范围决定。

Claims (13)

  1. 一种变焦特效的生成方法,包括:
    获取用户在特效工具界面设置的变焦目标及变焦参数;其中,所述变焦参数包括:变焦比例范围、变焦时长及变焦方式;
    对待处理视频进行目标检测;
    响应于检测到所述变焦目标,根据所述变焦参数对所述待处理视频进行变焦处理,获得变焦特效视频。
  2. 根据权利要求1所述的方法,其中,对待处理视频进行目标检测,包括:
    在所述待处理视频播放过程中,对播放的当前视频帧进行所述变焦目标的检测;
    响应于在当前视频帧中检测到所述变焦目标且未在上一视频帧中检测到所述变焦目标,从所述当前视频帧开始计时,获得当前视频帧对应的计时时刻;
    响应于在当前视频帧中检测到所述变焦目标且在上一视频帧中检测到所述变焦目标,在上一视频帧对应的计时时刻上累加设定时长,获得当前视频帧对应的计时时刻。
  3. 根据权利要求2所述的方法,其中,根据所述变焦参数对所述待处理视频进行变焦处理,包括:
    根据所述计时时刻和所述变焦参数确定变焦比例;
    基于所述变焦比例对所述当前视频帧进行变焦处理。
  4. 根据权利要求1或3所述的方法,其中,所述变焦方式包括循环次数以及每个循环中的变焦趋势,所述变焦比例范围包括一次循环中的初始变焦比例和目标变焦比例;所述变焦时长为一次循环所占的时长。
  5. 根据权利要求4所述的方法,其中,根据所述计时时刻和所述变焦参数确定变焦比例,包括:
    基于所述变焦比例范围、所述变焦时长和所述变焦趋势确定一次循环中的循环进度与变焦比例的对应关系;
    根据所述变焦时长和所述循环次数确定所述计时时刻对应的循环进度;
    基于所述对应关系确定所述循环进度对应的变焦比例。
  6. 根据权利要求5所述的方法,其中,根据所述变焦时长和所述循环次数确定所述计时时刻对应的循环进度,包括:
    根据所述变焦时长和所述循环次数判断所述计时时刻是否处于变焦循环中;
    响应于所述计时时刻处于变焦循环中,获取所述计时时刻所在循环对应的 时段;其中,所述时段包括起始时间和终止时间;
    基于所述时段确定所述计时时刻对应的循环进度。
  7. 根据权利要求3所述的方法,其中,基于所述变焦比例对所述当前视频帧进行变焦处理,包括:
    对所述当前视频帧进行所述变焦目标的提取,获得背景图及变焦目标图;
    将所述变焦目标图缩放所述变焦比例;
    将缩放后的变焦目标图进行平移,使得变焦点移动至设定位置;其中,所述变焦点为所述变焦目标上的设定点;
    将平移后的变焦目标图与所述背景图进行叠加,获得目标视频帧。
  8. 根据权利要求7所述的方法,其中,将平移后的变焦目标图与所述背景图进行叠加,获得目标视频帧,包括:
    对所述背景图进行图像修复;
    将平移后的变焦目标图与修复的背景图进行叠加,获得目标视频帧。
  9. 根据权利要求3所述的方法,其中,基于所述变焦比例对所述当前视频帧进行变焦处理,包括:
    将所述当前视频帧缩放所述变焦比例;
    将缩放后的当前视频帧进行平移,使得变焦点移动至设定位置;其中,所述变焦点为所述变焦目标上的设定点。
  10. 根据权利要求9所述的方法,在将缩放后的当前视频帧进行平移之后,还包括:
    响应于对所述当前视频帧放大所述变焦比例,对平移后的当前视频帧进行裁剪,获得目标视频帧,使得所述目标视频帧与放大前的当前视频帧的尺寸相同;
    响应于对所述当前视频帧缩小所述变焦比例,对平移后的当前视频帧与设定素材图进行拼接,获得目标视频帧,使得所述目标视频帧与缩小前的当前视频帧的尺寸相同。
  11. 一种变焦特效的生成装置,包括:
    变焦参数获取模块,设置为获取用户在特效工具界面设置的变焦目标及变焦参数;其中,所述变焦参数包括:变焦比例范围、变焦时长及变焦方式;
    目标检测模块,设置为对待处理视频进行目标检测;
    变焦处理模块,设置为响应于检测到所述变焦目标,根据所述变焦参数对所述待处理视频进行变焦处理,获得变焦特效视频。
  12. 一种电子设备,包括:
    一个或多个处理装置;
    存储装置,设置为存储一个或多个程序;
    当所述一个或多个程序被所述一个或多个处理装置执行,使得所述一个或多个处理装置实现如权利要求1-10中任一所述的变焦特效的生成方法。
  13. 一种计算机可读介质,所述计算机可读介质上存储有计算机程序,所述计算机程序被处理装置执行时实现如权利要求1-10中任一所述的变焦特效的生成方法。
PCT/CN2023/077636 2022-03-03 2023-02-22 变焦特效的生成方法、装置、设备及存储介质 WO2023165390A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210204603.8A CN114584709B (zh) 2022-03-03 2022-03-03 变焦特效的生成方法、装置、设备及存储介质
CN202210204603.8 2022-03-03

Publications (1)

Publication Number Publication Date
WO2023165390A1 true WO2023165390A1 (zh) 2023-09-07

Family

ID=81777737

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/077636 WO2023165390A1 (zh) 2022-03-03 2023-02-22 变焦特效的生成方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN114584709B (zh)
WO (1) WO2023165390A1 (zh)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114584709B (zh) * 2022-03-03 2024-02-09 北京字跳网络技术有限公司 变焦特效的生成方法、装置、设备及存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02247628A (ja) * 1989-03-20 1990-10-03 Nikon Corp トリミング撮影可能なカメラ
CN111756996A (zh) * 2020-06-18 2020-10-09 影石创新科技股份有限公司 视频处理方法、视频处理装置、电子设备及计算机可读存储介质
CN112532808A (zh) * 2020-11-24 2021-03-19 维沃移动通信有限公司 图像处理方法、装置和电子设备
CN113949808A (zh) * 2020-07-17 2022-01-18 北京字节跳动网络技术有限公司 视频生成方法、装置、可读介质及电子设备
CN114584709A (zh) * 2022-03-03 2022-06-03 北京字跳网络技术有限公司 变焦特效的生成方法、装置、设备及存储介质

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4694345A (en) * 1985-04-11 1987-09-15 Rank Cintel Limited Video signals special effects generator with variable pixel size
WO2020147028A1 (zh) * 2019-01-16 2020-07-23 深圳市大疆创新科技有限公司 一种拍摄方法及相关设备
CN111083380B (zh) * 2019-12-31 2021-06-11 维沃移动通信有限公司 一种视频处理方法、电子设备及存储介质
CN112087579B (zh) * 2020-09-17 2022-08-12 维沃移动通信有限公司 视频拍摄方法、装置和电子设备
CN112954199B (zh) * 2021-01-28 2023-02-03 维沃移动通信有限公司 视频录制方法及装置
CN112954212B (zh) * 2021-02-08 2022-08-30 维沃移动通信有限公司 视频生成方法、装置及设备
CN113923350A (zh) * 2021-09-03 2022-01-11 维沃移动通信(杭州)有限公司 视频拍摄方法、装置、电子设备和可读存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02247628A (ja) * 1989-03-20 1990-10-03 Nikon Corp トリミング撮影可能なカメラ
CN111756996A (zh) * 2020-06-18 2020-10-09 影石创新科技股份有限公司 视频处理方法、视频处理装置、电子设备及计算机可读存储介质
CN113949808A (zh) * 2020-07-17 2022-01-18 北京字节跳动网络技术有限公司 视频生成方法、装置、可读介质及电子设备
CN112532808A (zh) * 2020-11-24 2021-03-19 维沃移动通信有限公司 图像处理方法、装置和电子设备
CN114584709A (zh) * 2022-03-03 2022-06-03 北京字跳网络技术有限公司 变焦特效的生成方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN114584709A (zh) 2022-06-03
CN114584709B (zh) 2024-02-09

Similar Documents

Publication Publication Date Title
CN109640188B (zh) 视频预览方法、装置、电子设备及计算机可读存储介质
WO2021196903A1 (zh) 视频处理方法、装置、可读介质及电子设备
WO2021093737A1 (zh) 生成视频的方法、装置、电子设备和计算机可读介质
CN109168026B (zh) 即时视频显示方法、装置、终端设备及存储介质
US11482257B2 (en) Image display method and apparatus
CN112259062B (zh) 特效展示方法、装置、电子设备及计算机可读介质
CN112051961A (zh) 虚拟交互方法、装置、电子设备及计算机可读存储介质
CN110519645B (zh) 视频内容的播放方法、装置、电子设备及计算机可读介质
WO2021057740A1 (zh) 视频生成方法、装置、电子设备和计算机可读介质
WO2023284437A1 (zh) 媒体文件处理方法、装置、设备、可读存储介质及产品
WO2023165390A1 (zh) 变焦特效的生成方法、装置、设备及存储介质
US20240143649A1 (en) Multimedia information processing method, apparatus, electronic device, and medium
WO2023216936A1 (zh) 视频播放方法、装置、电子设备、存储介质和程序产品
CN113992926B (zh) 界面显示方法、装置、电子设备和存储介质
CN116934577A (zh) 一种风格图像生成方法、装置、设备及介质
JP7417733B2 (ja) ビデオ再生ページ表示方法、装置、電子機器及び媒体
WO2024001802A1 (zh) 图像处理方法、装置、电子设备及存储介质
WO2024022179A1 (zh) 媒体内容的显示方法、装置、电子设备和存储介质
WO2023155708A1 (zh) 视角的切换方法、装置、电子设备、存储介质和程序产品
CN113905177B (zh) 视频生成方法、装置、设备及存储介质
WO2022218109A1 (zh) 交互方法, 装置, 电子设备及计算机可读存储介质
WO2021073204A1 (zh) 对象的显示方法、装置、电子设备及计算机可读存储介质
CN111385638B (zh) 视频处理方法和装置
CN110991312A (zh) 生成检测信息的方法、装置、电子设备和介质
US12041379B2 (en) Image special effect processing method, apparatus, and electronic device, and computer-readable 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: 23762790

Country of ref document: EP

Kind code of ref document: A1