WO2020228406A1 - 图像风格化生成方法、装置及电子设备 - Google Patents

图像风格化生成方法、装置及电子设备 Download PDF

Info

Publication number
WO2020228406A1
WO2020228406A1 PCT/CN2020/079205 CN2020079205W WO2020228406A1 WO 2020228406 A1 WO2020228406 A1 WO 2020228406A1 CN 2020079205 W CN2020079205 W CN 2020079205W WO 2020228406 A1 WO2020228406 A1 WO 2020228406A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
target object
displayed
stylized
interactive interface
Prior art date
Application number
PCT/CN2020/079205
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 WO2020228406A1 publication Critical patent/WO2020228406A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T3/00Geometric image transformations in the plane of the image
    • G06T3/04Context-preserving transformations, e.g. by using an importance map
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/20Analysis of motion

Definitions

  • the present disclosure relates to the field of data processing technology, and in particular to a method, device and electronic device for generating image stylization.
  • the system can usually display more different types of stylization in a more friendly way, further improving the user experience.
  • the embodiments of the present disclosure provide an image stylized generation method, device and electronic device, which at least partially solve the problems existing in the prior art.
  • embodiments of the present disclosure provide a method for generating image stylization, including:
  • the image to be displayed in the current interactive interface is converted into a first stylized image corresponding to the target object in real time within a first time period.
  • the method After the image to be displayed in the current interactive interface is converted into a first stylized image corresponding to the target object in real time within the first time period, the method also includes:
  • the transition image of the target object is displayed in the interactive interface in real time.
  • the method further includes:
  • the native image of the target object is displayed in real time on the interactive interface.
  • the real-time display of the transition image of the target object in the interactive interface includes:
  • the stylized image with the first transparency and the native image with the second transparency are superimposed and displayed.
  • the method further includes:
  • the image to be displayed in the current interactive interface is converted into a second stylized image corresponding to the target object in real time in the fourth time period.
  • the acquiring multiple images containing the target object displayed on the interactive interface includes:
  • One or more video frames are selected from the video file to form multiple images containing the target object.
  • the selecting one or more video frames from the video file to form multiple images containing the target object includes:
  • the method further includes:
  • Weight the number of pixels in each gray level and use the weighted gray average value as the threshold
  • the image after the binarization process is used as the edge image of the target object.
  • the image processing parameter and the lightweight model are used to convert the image to be displayed in the current interactive interface into a stylized image corresponding to the target object in real time ,include:
  • a stylized image corresponding to the target object is generated.
  • an image stylization generation device including:
  • An acquiring module configured to acquire a plurality of images containing a target object displayed on the interactive interface, and the target object forms a first graphic area in the plurality of images
  • a determining module configured to determine whether the target object is in a static state based on the change trend of the first graphic area in the time series;
  • the selection module is configured to randomly select a group of image processing parameters from a plurality of groups of image processing parameters stored in a preset lightweight model when the target object is in a static state, to form a first image processing parameter;
  • the conversion module is configured to use the first image processing parameters and the lightweight model to convert the image to be displayed in the current interactive interface into a first stylized corresponding to the target object in a first time period image.
  • an embodiment of the present disclosure also provides an electronic device, which includes:
  • At least one processor and,
  • a memory communicatively connected with the at least one processor; wherein,
  • the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute any of the foregoing first aspect or any implementation of the first aspect Image stylization generation method.
  • embodiments of the present disclosure also provide a non-transitory computer-readable storage medium that stores computer instructions that are used to make the computer execute the first aspect or the first aspect described above.
  • An image stylized generation method in any implementation manner of one aspect.
  • the embodiments of the present disclosure also provide a computer program product.
  • the computer program product includes a computing program stored on a non-transitory computer-readable storage medium.
  • the computer program includes program instructions. When executed, the computer is caused to execute the image stylization generation method in the foregoing first aspect or any implementation manner of the first aspect.
  • the image stylization generation scheme in the embodiment of the present disclosure includes acquiring a plurality of images containing a target object displayed on an interactive interface, and the target object forms a first graphic area in the plurality of images; based on the first graphic
  • the change trend of the area in the time series determines whether the target object is in a static state; when the target object is in a static state, randomly select one from the multiple sets of image processing parameters stored in the preset lightweight model Set of image processing parameters to form a first image processing parameter; using the first image processing parameter and the lightweight model, in the first time period, the image to be displayed in the current interactive interface is converted in real time to the target
  • the first stylized image corresponding to the object is converted in real time to the target
  • the stylization effect of the image can be randomly set, which improves the user experience.
  • FIG. 1 is a schematic diagram of an image stylized generation process provided by an embodiment of the disclosure
  • FIG. 2 is a schematic diagram of a neural network model provided by an embodiment of the disclosure.
  • FIG. 3 is a schematic diagram of another image stylized generation process provided by an embodiment of the disclosure.
  • FIG. 4 is a schematic diagram of another image stylized generation process provided by an embodiment of the disclosure.
  • FIG. 5 is a schematic structural diagram of an image stylization generating apparatus provided by an embodiment of the disclosure.
  • FIG. 6 is a schematic diagram of an electronic device provided by an embodiment of the disclosure.
  • the embodiment of the present disclosure provides a method for image stylization generation.
  • the image stylization generation method provided in this embodiment can be executed by a computing device, which can be implemented as software, or as a combination of software and hardware, and the computing device can be integrated in a server, terminal device, etc.
  • an image stylized generation method provided by an embodiment of the present disclosure includes the following steps:
  • S101 Acquire a plurality of images containing a target object displayed on an interactive interface, and the target object forms a first graphic area in the plurality of images.
  • the solutions of the embodiments of the present disclosure can be applied to an electronic device with data processing functions.
  • the electronic device includes hardware and software installed in the electronic device.
  • the electronic device can also install various applications, such as image processing applications. Programs, video playback applications, social applications, etc.
  • the interactive interface is a window running in an application program, and an image or video containing the target object is displayed on the interactive interface.
  • the target object is a specific object defined in the present disclosure.
  • the target object has a certain shape. By changing the shape of the target object, commands based on different shapes can be formed.
  • the target object may be the body shape of the human body, and the human body forms different postures through limbs, which can constitute different posture commands.
  • the target object can also be various gestures, and gestures such as "thumbs up" are formed through gestures to express different gesture instructions.
  • the target object occupies a certain position and area in the interactive interface.
  • the projection of the target object on the interactive interface constitutes the first graphic area, which can be displayed in multiple images formed by the interactive area .
  • the electronic device can acquire multiple images (target image sequence) obtained by shooting the target object and played on the interactive interface remotely or locally through a wired connection or a wireless connection.
  • the interactive interface may be an interface for displaying an image obtained by shooting a target object.
  • the interactive interface may be an interface of an application installed on the above-mentioned execution subject for capturing images.
  • the target object may be a person for whom the image is taken.
  • the target object may be a user who uses the above-mentioned execution subject to take a selfie.
  • the multiple images can also be image sequences for moving target detection.
  • the images included in the multiple images may be all or part of the images in the image sequence obtained by shooting the target object, and the multiple images include the images currently displayed on the interactive interface.
  • the multiple images may include a preset number of images, including the image currently displayed on the interactive interface.
  • S102 Determine whether the target object is in a static state based on the change trend of the first graphic area in the time series.
  • Moving target detection can be performed on multiple images, and the action information corresponding to each of the multiple images can be determined. Since multiple images usually contain certain time information (for example, image capture time or image formation time) when they are formed, the time on the multiple images can be extracted to form a time sequence. Based on the time sequence, multiple images can be arranged in order of time, so that the action information (for example, action instructions) contained in the multiple images can be determined based on the time dimension.
  • time information for example, image capture time or image formation time
  • the action information is used to characterize the action state of the target object sequentially generated in the time sequence, and the action state can be a moving state or a static state.
  • the action state corresponding to the image can be based on the image, relative to the image before the image (it can be an image adjacent to the image, or a preset number of intervals between the image and the image.
  • the image of each image) the moving distance of the area composed of pixels that move on the target interface (for example, the moving distance may be the maximum moving distance of the moving distance of each pixel in the area composed of the moving pixels; or It can be the average value of the moving distance of each pixel).
  • the moving speed is determined according to the moving distance and the play time difference between the image and the target image, and if the moving speed is greater than or equal to a preset speed threshold, it is determined that the action state corresponding to the image is a moving state.
  • the shape command represented by the first graphic area formed by the target object in the static state is the action command that the user really wants to express.
  • the shape formed by the target object in the motion state is usually the intermediate transient shape before the action command is formed. Therefore, it is necessary to determine which images of the first graphic area are related to user instructions based on multiple images.
  • the judgment may be made based on the state changes of the multiple images in a time series.
  • the graphics command represented by the first graphics area in the static state is parsed into the operation command of the target object.
  • the operation instruction can be expressed in a variety of ways, and the form of the operation instruction can include but is not limited to at least one of the following: numbers, characters, symbols, level signals, etc.
  • the electronic device is provided with a lightweight model, and the lightweight model is used to stylize the image received in the electronic device.
  • the electronic device In order to reduce the resource consumption of the electronic device (for example, a mobile phone), the electronic device can still effectively stylize the input image with a small resource occupation.
  • the solution of the present disclosure designs a targeted lightweight model.
  • the lightweight model is designed in a neural network model, which includes a convolutional layer, a pooling layer, and a sampling layer. In order to improve the computational efficiency of the neural network and reduce the computational complexity of the system electronic equipment, the solution of the present disclosure does not provide a fully connected layer.
  • the main parameters of the convolutional layer include the size of the convolution kernel and the number of input feature maps.
  • Each convolutional layer can contain several feature maps of the same size.
  • the feature values of the same layer adopt the method of sharing weights.
  • the convolution in each layer The core size is the same.
  • the convolution layer performs convolution calculation on the input image and extracts the layout features of the input image.
  • the feature extraction layer of the convolutional layer can be connected to the sampling layer.
  • the sampling layer is used to find the local average value of the input expression image and perform secondary feature extraction. By connecting the sampling layer and the convolutional layer, it can ensure that the neural network model is The input expression image has better robustness.
  • a pooling layer is also provided behind the convolutional layer.
  • the pooling layer uses average pooling to process the output results of the convolutional layer, which can improve the gradient flow of the neural network and obtain More contagious results.
  • the lightweight model contains different parameters. By setting the parameters, the lightweight model can produce different artistic styles. Specifically, when it is determined that the target object is in a static state, a set of image processing parameters can be randomly selected from a plurality of sets of image processing parameters stored in a preset lightweight model to form the first image processing parameter.
  • the stylization type can be set in the lightweight model, so that the image to be displayed can be converted into the target in real time in the current interactive interface.
  • the image to be displayed may be one or more images selected by the user in the current interactive interface, and the image to be displayed may also be one or more video frame images in the video to be displayed. Since the first image processing parameter is generated by random generation, the stylization type of the first stylized image is also random, so that a stylized effect can be displayed randomly from multiple stylized effects, which improves users Experience.
  • the second image processing parameter can be randomly generated after a preset period of time in a preset manner, and the second stylized image is generated through the second image processing parameter.
  • the first stylized image is different.
  • the transition image of the target object is displayed in real time on the interactive interface.
  • the transition image is an image with a smooth transition between the stylized image and the native image.
  • the native image of the target object is displayed in real time on the interactive interface.
  • the user's experience of using stylized can be further improved.
  • displaying the transition image of the target object in the interactive interface in real time may include the following steps:
  • S301 Acquire n stylized images displayed in the second time period and n native images corresponding to the n stylized images, where the native images are images that have not undergone stylization processing.
  • S302 Set a first transparency (n-i)/n for the i-th stylized image among the n stylized images, and set a second transparency i/n for the i-th native image among the n native images.
  • i and n are natural numbers, and i is less than or equal to n.
  • S303 Superimpose and display the stylized image with the first transparency and the native image with the second transparency.
  • the image displayed on the interactive interface can be smoothly transitioned between the stylized image and the native image.
  • the video content in the interactive interface can be collected to obtain A video file containing multiple video frames. Based on actual needs, one or more video frames are selected from the video file to form multiple images containing the target object.
  • the target object detection may be performed on the video frame in the video file to obtain the target object.
  • the image frame that does not contain the target object is not processed, thereby saving the resources of the electronic device.
  • the first graphics area in the current video frame is the same as the first video area in the previous video frame. If so, in the Delete the current video frame from the image sequence. In this way, the resources of the electronic device can be further optimized.
  • the method further include:
  • the target object can be detected by the edge detection operator. If the edge detection operator uses only one structural element, the output image contains only one geometric information, which is not conducive to the preservation of image details. In order to ensure the accuracy of image detection, an edge detection operator containing multiple structural elements is selected.
  • S402 Perform detail matching on the multiple images using each of the multiple structural elements to obtain a filtered image.
  • each structural element is used as a scale to match the image details, which can fully maintain various details of the image while filtering out different types and sizes of noise.
  • S403 Determine the gray level edge calculation of the filtered image to obtain the number of pixels existing in each gray level of the multiple gray levels in the filtered image.
  • the filtered image can be converted into a grayscale image.
  • the number of pixels in each grayscale image can be calculated .
  • S404 Weight the number of pixels in each gray level, and use the weighted gray average value as a threshold.
  • a gray level value with a larger number of pixels is given greater weight, and a gray level with a smaller number of pixels is given greater weight.
  • the value is set with a smaller weight, and the weighted average gray value is calculated as an average value by calculating the weighted gray value as a threshold, so that the gray image can be binarized based on the average gray value.
  • S405 Perform binarization processing on the filtered image based on the threshold.
  • the filtered image can be binarized, for example, the pixels larger than the threshold are binarized to data 1, and the pixels smaller than the threshold are binarized to 0.
  • S406 Use the binarized image as an edge image of the target object.
  • the edge image of the target object is obtained. For example, the pixel that is binarized to 1 is assigned to black, and the image that is binarized to 0 is assigned to white.
  • steps S401 to S406 the accuracy of target object detection is improved on the premise of reducing the resource consumption of the electronic device system.
  • the mapping table can be defined in advance. Based on the pre-defined mapping table, the zoom factor and translation factor corresponding to the operation instruction can be searched for. By setting the zoom factor and translation factor, different Stylized effect of style.
  • an input layer can be set in the lightweight model.
  • the input layer contains scaling factors and translation factors. After obtaining specific image processing parameters, the scaling factors and translation factors corresponding to the operation instructions are used as input factors.
  • the configuration of all conditional input layers in the lightweight model can simply and effectively configure the lightweight model.
  • the conditional input layer can be set in one or more convolutional layers, pooling layers or sampling layers according to actual needs. The parameters of all the condition input layers after the configuration is completed are used as the image processing parameters of the lightweight model, so that different types of stylized models can be obtained.
  • the generating a stylized image corresponding to the target object based on the multiple convolutional layers and pooling layers may include steps S501-S503:
  • S501 Set the feature representation of the image to be displayed and the stylized image in the convolutional layer and the pooling layer.
  • the image to be displayed and the stylized image in the training sample are sampled in the convolutional layer and the pooling layer of the lightweight network. After sampling, the data in each layer constitutes the image to be displayed and the stylized image in the convolution Feature representation of layers and pooling layers.
  • the feature representation of the image to be displayed and the stylized image in the i-th layer can be Pi and Fi.
  • the square error loss function can be defined based on these two characteristic representations, and the square error loss function is set to minimize the loss function L, then the minimized loss function L can be expressed in the i-th layer as:
  • k and j are natural numbers less than or equal to i.
  • S503 Generate a stylized image corresponding to the target object based on the minimized loss function.
  • an image stylization generating device 50 including:
  • the obtaining module 501 is configured to obtain a plurality of images containing a target object displayed on the interactive interface, and the target object forms a first graphic area in the plurality of images.
  • the determining module 502 is configured to determine whether the target object is in a static state based on the change trend of the first graphic area in the time series.
  • the selection module 503 is configured to randomly select a group of image processing parameters from a plurality of groups of image processing parameters stored in the preset lightweight model when the target object is in a static state, to form a first image processing parameter.
  • the conversion module 504 is configured to use the first image processing parameters and the lightweight model to convert the image to be displayed in the current interactive interface into a first style corresponding to the target object in a first time period. ⁇ image.
  • the device shown in FIG. 5 can correspondingly execute the content in the foregoing method embodiment.
  • an electronic device 60 which includes:
  • At least one processor and,
  • a memory communicatively connected with the at least one processor; wherein,
  • the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor, so that the at least one processor can execute the image stylization generation method in the foregoing method embodiment.
  • the embodiments of the present disclosure also provide a non-transitory computer-readable storage medium that stores computer instructions, and the computer instructions are used to make the computer execute the foregoing method embodiments.
  • the embodiments of the present disclosure also provide a computer program product, the computer program product includes a calculation program stored on a non-transitory computer-readable storage medium, the computer program includes program instructions, when the program instructions are executed by a computer, The computer executes the image stylization generation method in the foregoing method embodiment.
  • FIG. 6 shows a schematic structural diagram of an electronic device 60 suitable for implementing embodiments of the present disclosure.
  • the electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablets), PMPs (portable multimedia players), vehicle terminals (for example, Mobile terminals such as car navigation terminals) and fixed terminals such as digital TVs, desktop computers, etc.
  • the electronic device shown in FIG. 6 is only an example, and should not bring any limitation to the function and scope of use of the embodiments of the present disclosure.
  • the electronic device 60 may include a processing device (such as a central processing unit, a graphics processor, etc.) 601, which may be loaded into a random access device according to a program stored in a read-only memory (ROM) 602 or from a storage device 608
  • the program in the memory (RAM) 603 executes various appropriate actions and processing.
  • the RAM 603 also stores various programs and data required for the operation of the electronic device 60.
  • the processing device 601, the ROM 602, and the RAM 603 are connected to each other through a bus 604.
  • An input/output (I/O) interface 605 is also connected to the bus 604.
  • the following devices can be connected to the I/O interface 605: including input devices 606 such as touch screen, touch panel, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; including, for example, liquid crystal display (LCD), speakers, An output device 607 such as a vibrator; a storage device 608 such as a magnetic tape, a hard disk, etc.; and a communication device 609.
  • the communication device 609 may allow the electronic device 60 to perform wireless or wired communication with other devices to exchange data.
  • the figure shows the electronic device 60 with various devices, it should be understood that it is not required to implement or have all the devices shown. It may be implemented alternatively or provided with more or fewer devices.
  • the process described above with reference to the flowchart can be implemented as a computer software program.
  • the embodiments of the present disclosure include a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart.
  • the computer program may be downloaded and installed from the network through the communication device 609, or installed from the storage device 608, or installed from the ROM 602.
  • the processing device 601 the above-mentioned functions defined in the method of the embodiment of the present disclosure are executed.
  • the above-mentioned computer-readable medium in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the two.
  • the computer-readable storage medium may be, for example, but not limited to, an electric, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections with one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable Programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk 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, and the program may be used by or in combination with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in a baseband or as a part of a carrier wave, and a computer-readable program code is carried therein. This propagated data signal can take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the foregoing.
  • the computer-readable signal medium may also be any computer-readable medium other than the computer-readable storage medium.
  • the computer-readable signal medium may send, propagate, or transmit the program for use by or in combination with the instruction execution system, apparatus, or device .
  • the program code contained on the computer-readable medium can be transmitted by any suitable medium, including but not limited to: wire, optical cable, RF (Radio Frequency), etc., or any suitable combination of the above.
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; or it may exist alone without being assembled 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 at least two Internet protocol addresses; and sends to the node evaluation device including the at least two A node evaluation request for an Internet Protocol address, wherein the node evaluation device selects an Internet Protocol address from the at least two Internet Protocol addresses and returns it; receives the Internet Protocol address returned by the node evaluation device; wherein, the obtained The Internet Protocol address indicates the edge node in the content distribution network.
  • the aforementioned computer-readable medium carries one or more programs, and when the aforementioned one or more programs are executed by the electronic device, the electronic device: receives a node evaluation request including at least two Internet Protocol addresses; Among the at least two Internet Protocol addresses, select an Internet Protocol address; return the selected Internet Protocol address; wherein, the received Internet Protocol address indicates an edge node in the content distribution network.
  • the computer program code for performing the operations of the present disclosure may be written in one or more programming languages or a combination thereof.
  • the above-mentioned programming languages include object-oriented programming languages-such as Java, Smalltalk, C++, and also conventional Procedural programming language-such as "C" language or similar programming language.
  • the program code can be executed entirely on the user's computer, partly on the user's computer, executed as an independent software package, partly on the user's computer and partly executed on a remote computer, or entirely executed on the remote computer or server.
  • the remote computer can be connected to the user's 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 (for example, using an Internet service provider to pass Internet connection).
  • LAN local area network
  • WAN wide area network
  • each block in the flowchart or block diagram can represent a module, program segment, or part of code, and the module, program segment, or part of code contains one or more for realizing the specified logical function Executable instructions.
  • the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two blocks shown in succession can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved.
  • each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or operations Or it can be realized by a combination of dedicated hardware and computer instructions.
  • the units involved in the embodiments described in the present disclosure can be implemented in software or hardware. Wherein, the name of the unit does not constitute a limitation on the unit itself under certain circumstances.
  • the first obtaining unit can also be described as "a unit for obtaining at least two Internet Protocol addresses.”

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Multimedia (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Processing Or Creating Images (AREA)

Abstract

本公开实施例中提供了一种图像风格化生成方法、装置及电子设备,属于数据处理技术领域,该方法包括:获取交互界面上显示的包含目标对象的多个图像,所述目标对象在所述多个图像中形成第一图形区域;基于所述第一图形区域在时间序列上的变化趋势,确定所述目标对象是否处于静止状态;当所述目标对象处于静止状态时,从预先设置的轻量化模型中存储的多组图像处理参数中,随机选择一组图像处理参数,形成第一图像处理参数;利用所述第一图像处理参数及所述轻量化模型,在第一时间段内将当前交互界面中待展示的图像实时转化为与所述目标对象相对应的第一风格化图像。通过本公开的处理方案,能够随机的设置图像的风格化效果。

Description

图像风格化生成方法、装置及电子设备
相关申请的交叉引用
本申请要求于2019年05月15日提交的,申请号为201910403860.2、发明名称为“图像风格化生成方法、装置及电子设备”的中国专利申请的优先权,该申请的全文通过引用结合在本申请中。
技术领域
本公开涉及数据处理技术领域,尤其涉及一种图像风格化生成方法、装置及电子设备。
背景技术
随着社会的不断发展和进步,电子产品开始广泛的进入了人们的生活中。尤其是近些年这些电子产品不但普及速度快,其更新的速度也是非常的惊人。基于电子设备而发展的软件也得到的迅猛的发展,越来越多的用户开始使用智能手机等电子设备来进行社交等网络操作。在进行网络操作的过程中,越来越多的人希望自己拍摄或录制的视频具有独特的风格化特点。
在对图像进行风格化的过程中,通常需要对用户拍摄的照片或录制的视频进行大量的数据计算,这就对用户使用的进行拍照的电子设备提出了较高的要求,即电子设备具有较高的运算速度。而目前市面上的电子设备存在较多的性能差异,这对风格化的实现造成了一定的障碍。
除此之外,用户在进行拍照之前或录制视频之前,通常***能够以更加友好的方式显示更多的不同类型的风格化,进一步的提高用户的使用体验。
发明内容
有鉴于此,本公开实施例提供一种图像风格化生成方法、装置及电子设备,至少部分解决现有技术中存在的问题。
第一方面,本公开实施例提供了一种图像风格化生成方法,包括:
获取交互界面上显示的包含目标对象的多个图像,所述目标对象在所述多 个图像中形成第一图形区域;
基于所述第一图形区域在时间序列上的变化趋势,确定所述目标对象是否处于静止状态;
当所述目标对象处于静止状态时,从预先设置的轻量化模型中存储的多组图像处理参数中,随机选择一组图像处理参数,形成第一图像处理参数;
利用所述第一图像处理参数及所述轻量化模型,在第一时间段内将当前交互界面中待展示的图像实时转化为与所述目标对象相对应的第一风格化图像。
根据本公开实施例的一种具体实现方式,所述在第一时间段内将当前交互界面中待展示的图像实时转化为与所述目标对象相对应的第一风格化图像之后,所述方法还包括:
在所述第一时间段之后的第二时间段内,在所述交互界面中实时显示所述目标对象的过渡图像。
根据本公开实施例的一种具体实现方式,所述在所述交互界面中实时显示所述目标对象的过渡图像之后,所述方法还包括:
在所述第二时间段之后的第三时间段内,在所述交互界面中实时显示所述目标对象的原生图像。
根据本公开实施例的一种具体实现方式,所述在所述交互界面中实时显示所述目标对象的过渡图像,包括:
获取在所述第二时间段内显示的n个风格化图像及所述n个风格化图像对应的n原生图像,所述原生图像为没有经过风格化处理的图像;
对n个风格化图像中的第i个风格化图像设置第一透明度(n-i)/n,对n个原生图像中的第i个原生图像设置第二透明度i/n;
将具有第一透明度的风格化图像和第二透明度的原生图像叠加显示。
根据本公开实施例的一种具体实现方式,所述在所述交互界面中实时显示所述目标对象的原生图像之后,所述方法还包括:
在所述第三时间段之后的第四时间段内,从预先设置的轻量化模型中存储的多组图像处理参数中,随机选择一组图像处理参数,形成第二图像处理参数;
基于所述第二图像处理参数,在第四时间段内将当前交互界面中待展示的 图像实时转化为与所述目标对象相对应的第二风格化图像。
根据本公开实施例的一种具体实现方式,所述获取交互界面上显示的包含目标对象的多个图像,包括:
对所述交互界面中的视频内容进行采集,以获得包含多个视频帧的视频文件;
从所述视频文件中选取一个或多个的视频帧,以形成包含所述目标对象的多个图像。
根据本公开实施例的一种具体实现方式,所述从所述视频文件中选取一个或多个的视频帧,形成包含所述目标对象的多个图像,包括:
对所述视频文件中的视频帧进行目标对象检测,以得到包含目标对象的图像序列;
在所述图像序列中,判断当前视频帧中的第一图形区域与上一视频帧中的第一视频区域是否相同;
响应于当前视频帧中的第一图形区域与上一视频帧中的第一视频区域相同,在所述图像序列中删除当前视频帧。
根据本公开实施例的一种具体实现方式,所述获取交互界面上显示的包含目标对象的多个图像之后,所述方法还包括:
选取不同取向的多个结构元素;
利用多个结构元素中的每一结构元素对所述多个图像进行细节匹配,以得到滤波图像;
确定滤波图像的灰度边缘,以得到滤波图像中多个灰度级别中每一灰度级别中存在的像素数;
对每一灰度级别中的像素数进行加权,并将加权后的灰度平均值作为阈值;
基于所述阈值对所述滤波图像进行二值化处理;
将二值化处理后的图像作为所述目标对象的边缘图像。
根据本公开实施例的一种具体实现方式,所述利用所述图像处理参数及所述轻量化模型,将当前交互界面中待展示的图像实时转化为与所述目标对象相对应的风格化图像,包括:
在所述轻量化模型中选取多个卷积层和池化层,其中,所述池化层采用平均池化处理方式;
设置待展示的图像与风格化图像在所述卷积层和池化层的特征表示;
基于所述特征表示,构建最小化损失函数;
基于所述最小化损失函数,生成与所述目标对象相对应的风格化图像。
第二方面,本公开实施例提供了一种图像风格化生成装置,包括:
获取模块,用于获取交互界面上显示的包含目标对象的多个图像,所述目标对象在所述多个图像中形成第一图形区域;
确定模块,用于基于所述第一图形区域在时间序列上的变化趋势,确定所述目标对象是否处于静止状态;
选择模块,用于当所述目标对象处于静止状态时,从预先设置的轻量化模型中存储的多组图像处理参数中,随机选择一组图像处理参数,形成第一图像处理参数;
转化模块,用于利用所述第一图像处理参数及所述轻量化模型,在第一时间段内将当前交互界面中待展示的图像实时转化为与所述目标对象相对应的第一风格化图像。
第三方面,本公开实施例还提供了一种电子设备,该电子设备包括:
至少一个处理器;以及,
与该至少一个处理器通信连接的存储器;其中,
该存储器存储有可被该至少一个处理器执行的指令,该指令被该至少一个处理器执行,以使该至少一个处理器能够执行前述任第一方面或第一方面的任一实现方式中的图像风格化生成方法。
第四方面,本公开实施例还提供了一种非暂态计算机可读存储介质,该非暂态计算机可读存储介质存储计算机指令,该计算机指令用于使该计算机执行前述第一方面或第一方面的任一实现方式中的图像风格化生成方法。
第五方面,本公开实施例还提供了一种计算机程序产品,该计算机程序产品包括存储在非暂态计算机可读存储介质上的计算程序,该计算机程序包括程序指令,当该程序指令被计算机执行时,使该计算机执行前述第一方面或第一 方面的任一实现方式中的图像风格化生成方法。
本公开实施例中的图像风格化生成方案,包括获取交互界面上显示的包含目标对象的多个图像,所述目标对象在所述多个图像中形成第一图形区域;基于所述第一图形区域在时间序列上的变化趋势,确定所述目标对象是否处于静止状态;当所述目标对象处于静止状态时,从预先设置的轻量化模型中存储的多组图像处理参数中,随机选择一组图像处理参数,形成第一图像处理参数;利用所述第一图像处理参数及所述轻量化模型,在第一时间段内将当前交互界面中待展示的图像实时转化为与所述目标对象相对应的第一风格化图像。通过本公开的方案,在降低电子设备计算负荷的同时,能够随机的设置图像的风格化效果,提高了用户的使用体验。
附图说明
为了更清楚地说明本公开实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本公开的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。
图1为本公开实施例提供的一种图像风格化生成流程示意图;
图2为本公开实施例提供的一种神经网络模型示意图;
图3为本公开实施例提供的另一种图像风格化生成流程示意图;
图4为本公开实施例提供的另一种图像风格化生成流程示意图;
图5为本公开实施例提供的图像风格化生成装置结构示意图;
图6为本公开实施例提供的电子设备示意图。
具体实施方式
下面结合附图对本公开实施例进行详细描述。
以下通过特定的具体实例说明本公开的实施方式,本领域技术人员可由本说明书所揭露的内容轻易地了解本公开的其他优点与功效。显然,所描述的实施例仅仅是本公开一部分实施例,而不是全部的实施例。本公开还可以通过另外不同的具体实施方式加以实施或应用,本说明书中的各项细节也可以基于不 同观点与应用,在没有背离本公开的精神下进行各种修饰或改变。需说明的是,在不冲突的情况下,以下实施例及实施例中的特征可以相互组合。基于本公开中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本公开保护的范围。
需要说明的是,下文描述在所附权利要求书的范围内的实施例的各种方面。应显而易见,本文中所描述的方面可体现于广泛多种形式中,且本文中所描述的任何特定结构及/或功能仅为说明性的。基于本公开,所属领域的技术人员应了解,本文中所描述的一个方面可与任何其它方面独立地实施,且可以各种方式组合这些方面中的两者或两者以上。举例来说,可使用本文中所阐述的任何数目个方面来实施设备及/或实践方法。另外,可使用除了本文中所阐述的方面中的一或多者之外的其它结构及/或功能性实施此设备及/或实践此方法。
还需要说明的是,以下实施例中所提供的图示仅以示意方式说明本公开的基本构想,图式中仅显示与本公开中有关的组件而非按照实际实施时的组件数目、形状及尺寸绘制,其实际实施时各组件的型态、数量及比例可为一种随意的改变,且其组件布局型态也可能更为复杂。
另外,在以下描述中,提供具体细节是为了便于透彻理解实例。然而,所属领域的技术人员将理解,可在没有这些特定细节的情况下实践所述方面。
本公开实施例提供一种图像风格化生成方法。本实施例提供的图像风格化生成方法可以由一计算装置来执行,该计算装置可以实现为软件,或者实现为软件和硬件的组合,该计算装置可以集成设置在服务器、终端设备等中。
参见图1,本公开实施例提供的一种图像风格化生成方法,包括如下步骤:
S101,获取交互界面上显示的包含目标对象的多个图像,所述目标对象在所述多个图像中形成第一图形区域。
本公开实施例的方案可应用于具有数据处理功能的电子设备中,该电子设备包含硬件和安装于电子设备内的软件,同时该电子设备还可以安装各种应用程序,例如,图像处理类应用程序、视频播放类应用程序、社交类应用程序等。
交互界面是运行于应用程序中的窗口,交互界面上显示有包含目标对象的图像或者视频。目标对象是本公开中定义的特定的对象,目标对象具有一定的 形状,通过改变目标对象的形状,可以形成基于不同形状的命令。例如,目标对象可以是人体的体型,人体通过四肢形成不同的姿势,可以构成不同的姿势命令。或者,目标对象还可以是各种手势,通过手势形成比如“竖起大拇指”之类的姿态,来表达不同的手势指令。
目标对象在交互界面中占据一定的位置和面积,与之对应的,目标对象在交互界面上的投影便构成了第一图形区域,该第一图形区域能够在交互区域形成的多个图像中显示。
电子设备可以通过有线连接方式或者无线连接方式从远程,或从本地获取在交互界面上播放的、对目标对象进行拍摄得到的多个图像(目标图像序列)。其中,交互界面可以是用于显示对目标对象进行拍摄得到的图像的界面。例如,交互界面可以是上述执行主体上安装的、用于拍摄图像的应用的界面。目标对象可以是对其进行拍摄图像的人物,例如,目标对象可以是使用上述执行主体进行自拍的用户。多个图像还可以是进行运动目标检测的图像序列。通常,多个图像包括的图像可以是对目标对象进行拍摄得到的图像序列中的图像的全部或一部分,多个图像包括当前在交互界面上显示的图像。作为一种情况,多个图像可以包括预设数量个图像,其中包括当前在交互界面上显示的图像。
S102,基于所述第一图形区域在时间序列上的变化趋势,确定所述目标对象是否处于静止状态。
可以对多个图像进行运动目标检测,确定多个图像中每一图像分别对应的动作信息。由于多个图像是在形成时通常会包含一定的时间信息(例如,图像拍摄时间或图像形成时间),为此可以对多个图像上的时间进行提取,形成时间序列。基于时间序列,可以按照时间的先后顺序对多个图像进行先后顺序排列,从而基于时间的维度来判断多个图像上包含的动作信息(例如,动作指令)。
动作信息用于表征目标对象在时间序列内依次产生的动作状态,动作状态可以是运动状态或静止状态。对于多个图像中的图像,该图像对应的动作状态可以根据该图像中,相对于该图像之前的图像(可以是与该图像相邻的图像,也可以是与该图像之间间隔预设数量个图像的图像),在目标界面发生移动的像素组成的区域的移动距离(例如,该移动距离可以是上述发生移动的像素组 成的区域中的每个像素的移动距离中的最大移动距离;或者可以是各个像素的移动距离的平均值)来确定。例如,如果上述移动距离大于等于预设的距离阈值,确定该图像对应的动作状态为运动状态。或者,根据上述移动距离以及该图像与上述目标图像之间的播放时间差,确定出移动速度,如果移动速度大于等于预设的速度阈值,确定该图像对应的动作状态为运动状态。
通常来讲,目标对象在静止状态形成第一图形区域所表示的形状指令才是用户真实想表达的动作指令,目标对象在运动状态形成的形状通常是形成动作指令之前的中间暂态形状,为此,需要基于多个图像来判断哪些图像上的第一图形区域与用户指令相关。
具体的,可以基于所述多个图像在时间序列上的状态变化来进行判断。当检测到目标对象在多个图像上的状态由运动状态转换为静止状态时,将静止状态上第一图形区域所表示的图形指令解析为目标对象的操作指令。该操作指令可以用多种方式进行表达,操作指令的形式可以包括但不限于以下至少一种:数字、文字、符号、电平信号等。
S103,当所述目标对象处于静止状态时,从预先设置的轻量化模型中存储的多组图像处理参数中,随机选择一组图像处理参数,形成第一图像处理参数。
电子设备内部设置有轻量化模型,该轻量化模型用于对电子设备中接收到的图像进行风格化处理。为了降低电子设备(例如,手机)的资源消耗,使电子设备能够在较小的资源占用的情况下,仍然能够有效的对输入的图像进行风格化处理。本公开的方案设计了一种针对性的轻量化模型。参见图2,轻量化模型采用神经网络模型的方式设计,神经网络模型包括卷积层、池化层、采样层。为了提高神经网络的计算效率,同时降低***电子设备的计算复杂,本公开的方案中不设置全连接层。
卷积层主要参数包括卷积核的大小和输入特征图的数量,每个卷积层可以包含若干个相同大小的特征图,同一层特征值采用共享权值的方式,每层内的卷积核大小一致。卷积层对输入图像进行卷积计算,并提取输入图像的布局特征。
卷积层的特征提取层后面都可以与采样层连接,采样层用来求输入表情图 像的局部平均值并进行二次特征提取,通过将采样层与卷积层连接,能够保证神经网络模型对于输入表情图像具有较好的鲁棒性。
为了加快神经网络模型的训练速度,在卷积层后面还设置有池化层,池化层采用平均池化的方式对卷积层的输出结果进行处理,能够改进神经网络的梯度流并且可以获得更有感染力的结果。
轻量化模型内部含有不同的参数,通过设置参数可以使轻量化模型产生不同的艺术化风格。具体的,当确定目标对象处于静止状态时,可以从预先设置的轻量化模型中存储的多组图像处理参数中,随机选择一组图像处理参数,形成第一图像处理参数。
S104,利用所述第一图像处理参数及所述轻量化模型,在第一时间段内将当前交互界面中待展示的图像实时转化为与所述目标对象相对应的第一风格化图像。
在获取到第一图像处理参数之后,基于该第一图像处理参数,可以在轻量化模型中设置风格化的类型,从而能够在当前的交互界面中将待展示的图像实时转化为与所述目标对象相对应的第一风格化图像。待展示的图像可以是用户在当前交互界面中选择的一个或多个图像,待展示的图像也可以是待展示视频中的一个或多个视频帧图像。由于第一图像处理参数是通过随机生成的方式产生,第一风格化图像的风格化类型也具有随机性,从而能够从多个风格化效果中随机的显示出一种风格化效果,提高了用户的使用体验。
除了产生第一风格化图像之外,还可以通过预先设置的方式,在预设时间段之后随机第二图像处理参数,通过第二图像处理参数产生第二风格化图像,第二风格化图像与第一风格化图像不同。
作为一种情况,为了增加用户体验,在第一时间段之后的第二时间段内,在所述交互界面中实时显示所述目标对象的过渡图像。过渡图像为风格化图像和原生图像之间进行平滑过渡的图像。
在第二时间段内显示完过渡图像之后,在所述第二时间段之后的第三时间段内,在所述交互界面中实时显示所述目标对象的原生图像。这样,通过风格化图像、过渡图像和原生图像之间的切换,能够进一步的提高用户使用风格化 的体验。
参见图3,根据本公开实施例的一种具体实现方式,在所述交互界面中实时显示所述目标对象的过渡图像,可以包括如下步骤:
S301,获取在所述第二时间段内显示的n个风格化图像及所述n个风格化图像对应的n原生图像,所述原生图像为没有经过风格化处理的图像。
S302,对n个风格化图像中的第i个风格化图像设置第一透明度(n-i)/n,对n个原生图像中的第i个原生图像设置第二透明度i/n。其中,i,n均为自然数,i小于或等于n。
S303,将具有第一透明度的风格化图像和第二透明度的原生图像叠加显示。
通过步骤S301~S303中的方式,能够让交互界面显示的图像在风格化图像和原生图像之间进行平滑的过渡。
作为一种可选的实施方式,在获取交互界面上显示的包含目标对象的多个图像的过程中,当交互界面上的内容为视频内容时,可以对交互界面中的视频内容进行采集,获得包含多个视频帧的视频文件。基于实际的需要,从所述视频文件中选取一个或多个的视频帧,形成包含所述目标对象的多个图像。
为了能够减少选取多个图像的过程中对于电子设备资源的消耗,根据本公开实施例的一种可选实现方式,可以先对所述视频文件中的视频帧进行目标对象检测,得到包含目标对象的图像序列,对于不包含目标对象的图像帧,则不进行处理,从而节省了电子设备的资源。
对于包含目标对象的图像序列中,为了进一步的减少电子设备的资源消耗,可以判断当前视频帧中的第一图形区域与上一视频帧中的第一视频区域是否相同,若是,则在所述图像序列中删除当前视频帧。通过这种方式,能够进一步优化电子设备的资源。
为了便于对获取的多个图像进行目标对象识别,参见图4,根据本公开实施例的一种具体实现方式,所述获取交互界面上显示的包含目标对象的多个图像之后,所述方法还包括:
S401,选取不同取向的多个结构元素。
可以通过边缘检测算子对目标对象进行检测,如果边缘检测算子只采用一 种结构元素,其输出图像中只包含了一种几何信息,不利于图像细节的保持。为了能够保证图像检测的准确度,选择包含多种结构元的边缘检测算子。
S402,利用多个结构元素中的每一结构元素对所述多个图像进行细节匹配,得到滤波图像。
通过采用不同取向的多个结构元素,将每一结构元素作为一种尺度对图像细节进行匹配,可以在过滤到不同类型和大小的噪声的同时,充分保持图像的各种细节。
S403,确定滤波图像的灰度边缘计算,以得到滤波图像中多个灰度级别中每一灰度级别中存在的像素数。
对图像滤波之后,为了进一步的减少计算量,可以将滤波之后的图像转变为灰度图像,通过对灰度图像设置多个灰度级别,可以计算得到每一个灰度级别图像中存在的像素数。
S404,对每一灰度级别中的像素数进行加权,并将加权后的灰度平均值作为阈值。
基于不同灰度级中像素的数目,可以考虑基于像素数对灰度级别进行加权处理,例如,对于像素数较多的灰度级别值给予较大的权重,对于像素数较少的灰度级别值设置较小的权重,通过对加权后的灰度值进行平均值计算,得到加权后的平均灰度值作为阈值,从而能够基于该平均灰度值对灰度图像进行二值化处理。
S405,基于所述阈值对所述滤波图像进行二值化处理。
基于该阈值,可以对滤波图像进行二值化处理,例如,对于大于该阈值的像素二值化为数据1,对于小于该阈值的像素二值化为0。
S406,将二值化处理后的图像作为所述目标对象的边缘图像。
通过将二值化之后的数据进行相应的颜色赋值,便得到了目标对象的边缘图像,例如将二值化为1的像素赋值为黑色,将二值化为0的图像赋值为白色。
通过步骤S401~S406中的步骤,在减少电子设备***资源消耗的前提下,提高了目标对象检测的准确度。
在确定第一图像处理参数之前,可以在预先定义映射表,基于预先定义的 映射表,能够查找与所述操作指令相对应的缩放因子和平移因子,通过设置缩放因子和平移因子,能够形成不同风格的风格化效果。为此,可以在轻量化模型中设置输入层,输入层包含缩放因子和平移因子,在获得具体的图像处理参数之后,将与所述操作指令相对应的缩放因子和平移因子作为输入因子,在所述轻量化模型中所有的条件输入层进行配置,能够简单有效的对轻量化模型进行配置。条件输入层可以根据实际的需要设置在一个或多个卷积层、池化层或采样层中。将所有条件输入层完成配置后的参数,作为所述轻量化模型的图像处理参数,从而能够得到不同类型的风格化模型。
根据本公开实施例的一种可选实现方式,所述基于所述多个卷积层和池化层,生成与所述目标对象相对应的风格化图像,可以包括步骤S501-S503:
S501,设置待展示的图像与风格化图像在所述卷积层和池化层的特征表示。
待展示图像和训练样本中的风格化图像在轻量化网络的卷积层和池化层中均进行采样,采样之后在各层的数据构成了待展示的图像与风格化图像在所述卷积层和池化层的特征表示。例如,对于轻量化模型中第i层而言,待展示图像和风格化图像在第i层的特征表示可以用Pi和Fi。
S502,基于所述特征表示,构建最小化损失函数。
基于Pi和Fi,可以基于这两个特征表示定义平方误差损耗函数,并将该平方误差损耗函数设置为最小化损失函数L,则最小化损失函数L在第i层可以表示为:
Figure PCTCN2020079205-appb-000001
其中,k,j为小于等于i的自然数。
S503,基于所述最小化损失函数,生成与所述目标对象相对应的风格化图像。
通过对最小化函数进行计算,使最小化函数L的数值最小,可以得到与目标对象相对应的风格化图像。
通过特征表示和最小化函数的方式,提高了生成的风格化图像的准确度。
与上面的方法实施例相对应,参见图5,本公开还一种图像风格化生成装置 50,包括:
获取模块501,用于获取交互界面上显示的包含目标对象的多个图像,所述目标对象在所述多个图像中形成第一图形区域。
确定模块502,用于基于所述第一图形区域在时间序列上的变化趋势,确定所述目标对象是否处于静止状态。
选择模块503,用于当所述目标对象处于静止状态时,从预先设置的轻量化模型中存储的多组图像处理参数中,随机选择一组图像处理参数,形成第一图像处理参数。
转化模块504,用于利用所述第一图像处理参数及所述轻量化模型,在第一时间段内将当前交互界面中待展示的图像实时转化为与所述目标对象相对应的第一风格化图像。
图5所示装置可以对应的执行上述方法实施例中的内容,本实施例未详细描述的部分,参照上述方法实施例中记载的内容,在此不再赘述。
参见图6,本公开实施例还提供了一种电子设备60,该电子设备包括:
至少一个处理器;以及,
与该至少一个处理器通信连接的存储器;其中,
该存储器存储有可被该至少一个处理器执行的指令,该指令被该至少一个处理器执行,以使该至少一个处理器能够执行前述方法实施例中图像风格化生成方法。
本公开实施例还提供了一种非暂态计算机可读存储介质,该非暂态计算机可读存储介质存储计算机指令,该计算机指令用于使该计算机执行前述方法实施例中。
本公开实施例还提供了一种计算机程序产品,该计算机程序产品包括存储在非暂态计算机可读存储介质上的计算程序,该计算机程序包括程序指令,当该程序指令被计算机执行时,使该计算机执行前述方法实施例中的图像风格化生成方法。
下面参考图6,其示出了适于用来实现本公开实施例的电子设备60的结构示意图。本公开实施例中的电子设备可以包括但不限于诸如移动电话、笔记本 电脑、数字广播接收器、PDA(个人数字助理)、PAD(平板电脑)、PMP(便携式多媒体播放器)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字TV、台式计算机等等的固定终端。图6示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图6所示,电子设备60可以包括处理装置(例如中央处理器、图形处理器等)601,其可以根据存储在只读存储器(ROM)602中的程序或者从存储装置608加载到随机访问存储器(RAM)603中的程序而执行各种适当的动作和处理。在RAM 603中,还存储有电子设备60操作所需的各种程序和数据。处理装置601、ROM 602以及RAM 603通过总线604彼此相连。输入/输出(I/O)接口605也连接至总线604。
通常,以下装置可以连接至I/O接口605:包括例如触摸屏、触摸板、键盘、鼠标、图像传感器、麦克风、加速度计、陀螺仪等的输入装置606;包括例如液晶显示器(LCD)、扬声器、振动器等的输出装置607;包括例如磁带、硬盘等的存储装置608;以及通信装置609。通信装置609可以允许电子设备60与其他设备进行无线或有线通信以交换数据。虽然图中示出了具有各种装置的电子设备60,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承载在计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置609从网络上被下载和安装,或者从存储装置608被安装,或者从ROM 602被安装。在该计算机程序被处理装置601执行时,执行本公开实施例的方法中限定的上述功能。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的***、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包 括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM或闪存)、光纤、便携式紧凑磁盘只读存储器(CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行***、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输用于由指令执行***、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、RF(射频)等等,或者上述的任意合适的组合。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:获取至少两个网际协议地址;向节点评价设备发送包括所述至少两个网际协议地址的节点评价请求,其中,所述节点评价设备从所述至少两个网际协议地址中,选取网际协议地址并返回;接收所述节点评价设备返回的网际协议地址;其中,所获取的网际协议地址指示内容分发网络中的边缘节点。
或者,上述计算机可读介质承载有一个或者多个程序,当上述一个或者多个程序被该电子设备执行时,使得该电子设备:接收包括至少两个网际协议地址的节点评价请求;从所述至少两个网际协议地址中,选取网际协议地址;返回选取出的网际协议地址;其中,接收到的网际协议地址指示内容分发网络中的边缘节点。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括面向对象的程序设计语言-诸如Java、 Smalltalk、C++,还包括常规的过程式程序设计语言-诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)-连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的***、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的***来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定,例如,第一获取单元还可以被描述为“获取至少两个网际协议地址的单元”。
应当理解,本公开的各部分可以用硬件、软件、固件或它们的组合来实现。
以上所述,仅为本公开的具体实施方式,但本公开的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本公开揭露的技术范围内,可轻易想到的变化或替换,都应涵盖在本公开的保护范围之内。因此,本公开的保护范围应以权利要求的保护范围为准。

Claims (12)

  1. 一种图像风格化生成方法,其特征在于,包括:
    获取交互界面上显示的包含目标对象的多个图像,所述目标对象在所述多个图像中形成第一图形区域;
    基于所述第一图形区域在时间序列上的变化趋势,确定所述目标对象是否处于静止状态;
    当所述目标对象处于静止状态时,从预先设置的轻量化模型中存储的多组图像处理参数中,随机选择一组图像处理参数,形成第一图像处理参数;
    利用所述第一图像处理参数及所述轻量化模型,在第一时间段内将当前交互界面中待展示的图像实时转化为与所述目标对象相对应的第一风格化图像。
  2. 根据权利要求1所述的方法,其特征在于,所述在第一时间段内将当前交互界面中待展示的图像实时转化为与所述目标对象相对应的第一风格化图像之后,所述方法还包括:
    在所述第一时间段之后的第二时间段内,在所述交互界面中实时显示所述目标对象的过渡图像。
  3. 根据权利要求2所述的方法,其特征在于,所述在所述交互界面中实时显示所述目标对象的过渡图像之后,所述方法还包括:
    在所述第二时间段之后的第三时间段内,在所述交互界面中实时显示所述目标对象的原生图像。
  4. 根据权利要求2所述的方法,其特征在于,所述在所述交互界面中实时显示所述目标对象的过渡图像,包括:
    获取在所述第二时间段内显示的n个风格化图像及所述n个风格化图像对应的n原生图像,所述原生图像为没有经过风格化处理的图像;
    对n个风格化图像中的第i个风格化图像设置第一透明度(n-i)/n,对n个原生图像中的第i个原生图像设置第二透明度i/n;
    将具有第一透明度的风格化图像和第二透明度的原生图像叠加显示。
  5. 根据权利要求3所述的方法,其特征在于,所述在所述交互界面中实时显示所述目标对象的原生图像之后,所述方法还包括:
    在所述第三时间段之后的第四时间段内,从预先设置的轻量化模型中存储 的多组图像处理参数中,随机选择一组图像处理参数,形成第二图像处理参数;
    基于所述第二图像处理参数,在第四时间段内将当前交互界面中待展示的图像实时转化为与所述目标对象相对应的第二风格化图像。
  6. 根据权利要求1所述的方法,其特征在于,所述获取交互界面上显示的包含目标对象的多个图像,包括:
    对所述交互界面中的视频内容进行采集,以获得包含多个视频帧的视频文件;
    从所述视频文件中选取一个或多个的视频帧,以形成包含所述目标对象的多个图像。
  7. 根据权利要求6所述的方法,其特征在于,所述从所述视频文件中选取一个或多个的视频帧,形成包含所述目标对象的多个图像,包括:
    对所述视频文件中的视频帧进行目标对象检测,以得到包含目标对象的图像序列;
    在所述图像序列中,判断当前视频帧中的第一图形区域与上一视频帧中的第一视频区域是否相同;
    响应于当前视频帧中的第一图形区域与上一视频帧中的第一视频区域相同,在所述图像序列中删除当前视频帧。
  8. 根据权利要求1所述的方法,其特征在于,所述获取交互界面上显示的包含目标对象的多个图像之后,所述方法还包括:
    选取不同取向的多个结构元素;
    利用多个结构元素中的每一结构元素对所述多个图像进行细节匹配,以得到滤波图像;
    确定滤波图像的灰度边缘,以得到滤波图像中多个灰度级别中每一灰度级别中存在的像素数;
    对每一灰度级别中的像素数进行加权,并将加权后的灰度平均值作为阈值;
    基于所述阈值对所述滤波图像进行二值化处理;
    将二值化处理后的图像作为所述目标对象的边缘图像。
  9. 根据权利要求1所述的方法,其特征在于,在第一时间段内将当前交互 界面中待展示的图像实时转化为与所述目标对象相对应的第一风格化图像,包括:
    在所述轻量化模型中选取多个卷积层和池化层,其中,所述池化层采用平均池化处理方式;
    设置待展示的图像与风格化图像在所述卷积层和池化层的特征表示;
    基于所述特征表示,构建最小化损失函数;
    基于所述最小化损失函数,生成与所述目标对象相对应的风格化图像。
  10. 一种图像风格化生成装置,其特征在于,包括:
    获取模块,用于获取交互界面上显示的包含目标对象的多个图像,所述目标对象在所述多个图像中形成第一图形区域;
    确定模块,用于基于所述第一图形区域在时间序列上的变化趋势,确定所述目标对象是否处于静止状态;
    选择模块,用于当所述目标对象处于静止状态时,从预先设置的轻量化模型中存储的多组图像处理参数中,随机选择一组图像处理参数,形成第一图像处理参数;
    转化模块,用于利用所述第一图像处理参数及所述轻量化模型,在第一时间段内将当前交互界面中待展示的图像实时转化为与所述目标对象相对应的第一风格化图像。
  11. 一种电子设备,其特征在于,所述电子设备包括:
    至少一个处理器;以及,
    与所述至少一个处理器通信连接的存储器;其中,
    所述存储器存储有可被所述至少一个处理器执行的指令,所述指令被所述至少一个处理器执行,以使所述至少一个处理器能够执行前述任一权利要求1-9所述的图像风格化生成方法。
  12. 一种非暂态计算机可读存储介质,该非暂态计算机可读存储介质存储计算机指令,该计算机指令用于使该计算机执行前述任一权利要求1-9所述的图像风格化生成方法。
PCT/CN2020/079205 2019-05-15 2020-03-13 图像风格化生成方法、装置及电子设备 WO2020228406A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910403860.2A CN110189246B (zh) 2019-05-15 2019-05-15 图像风格化生成方法、装置及电子设备
CN201910403860.2 2019-05-15

Publications (1)

Publication Number Publication Date
WO2020228406A1 true WO2020228406A1 (zh) 2020-11-19

Family

ID=67716352

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/079205 WO2020228406A1 (zh) 2019-05-15 2020-03-13 图像风格化生成方法、装置及电子设备

Country Status (2)

Country Link
CN (1) CN110189246B (zh)
WO (1) WO2020228406A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113469923A (zh) * 2021-05-28 2021-10-01 北京达佳互联信息技术有限公司 一种图像处理方法、装置、电子设备及存储介质
CN113742630A (zh) * 2021-09-16 2021-12-03 阿里巴巴新加坡控股有限公司 图像处理方法、电子设备及计算机存储介质
CN113891141A (zh) * 2021-10-25 2022-01-04 北京字节跳动网络技术有限公司 一种视频处理方法、装置及设备
CN114040129A (zh) * 2021-11-30 2022-02-11 北京字节跳动网络技术有限公司 视频生成方法、装置、设备及存储介质

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110189246B (zh) * 2019-05-15 2023-02-28 北京字节跳动网络技术有限公司 图像风格化生成方法、装置及电子设备
CN110598781A (zh) * 2019-09-05 2019-12-20 Oppo广东移动通信有限公司 图像处理方法、装置、电子设备及存储介质
CN111986076A (zh) * 2020-08-21 2020-11-24 深圳市慧鲤科技有限公司 图像处理方法及装置、互动式展示装置和电子设备
CN112053286B (zh) * 2020-09-04 2023-09-05 抖音视界有限公司 图像处理方法、装置、电子设备和可读介质
CN112148410A (zh) * 2020-09-29 2020-12-29 维沃移动通信有限公司 图像显示方法及电子设备
CN112906553B (zh) * 2021-02-09 2022-05-17 北京字跳网络技术有限公司 图像处理方法、装置、设备及介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108171652A (zh) * 2017-12-28 2018-06-15 努比亚技术有限公司 一种改进图像风格效果的方法、移动终端及存储介质
CN108537776A (zh) * 2018-03-12 2018-09-14 维沃移动通信有限公司 一种图像风格迁移模型生成方法及移动终端
US20180300850A1 (en) * 2017-04-14 2018-10-18 Facebook, Inc. Artifact reduction for image style transfer
CN110189246A (zh) * 2019-05-15 2019-08-30 北京字节跳动网络技术有限公司 图像风格化生成方法、装置及电子设备

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103501445B (zh) * 2013-10-12 2017-02-22 青岛旲天下智能科技有限公司 一种手势交互的双向互动数字电视盒***及实现方法
CN104869346A (zh) * 2014-02-26 2015-08-26 ***通信集团公司 一种视频通话中的图像处理方法及电子设备
CN106341695B (zh) * 2016-08-31 2020-08-11 腾讯数码(天津)有限公司 直播间互动方法、装置及***
CN107171932B (zh) * 2017-04-27 2021-06-08 腾讯科技(深圳)有限公司 一种图片风格转换方法、装置及***
CN107277615B (zh) * 2017-06-30 2020-06-23 北京奇虎科技有限公司 直播风格化处理方法、装置、计算设备及存储介质
CN108205803B (zh) * 2017-07-19 2020-12-25 北京市商汤科技开发有限公司 图像处理方法、神经网络模型的训练方法及装置
CN107633228A (zh) * 2017-09-20 2018-01-26 北京奇虎科技有限公司 视频数据处理方法及装置、计算设备
CN108875751B (zh) * 2017-11-02 2021-03-02 北京旷视科技有限公司 图像处理方法和装置、神经网络的训练方法、存储介质
CN108961349A (zh) * 2018-06-29 2018-12-07 广东工业大学 一种风格化图像的生成方法、装置、设备及存储介质
CN108986110A (zh) * 2018-07-02 2018-12-11 Oppo(重庆)智能科技有限公司 图像处理方法、装置、移动终端及存储介质
CN109308679B (zh) * 2018-08-13 2022-08-30 深圳市商汤科技有限公司 一种图像风格转换方法及装置、设备、存储介质
CN109151489B (zh) * 2018-08-14 2019-05-31 广州虎牙信息科技有限公司 直播视频图像处理方法、装置、存储介质和计算机设备
CN109697690A (zh) * 2018-11-01 2019-04-30 北京达佳互联信息技术有限公司 图像风格迁移方法和***
CN109636712B (zh) * 2018-12-07 2022-03-01 北京达佳互联信息技术有限公司 图像风格迁移及数据存储方法、装置和电子设备

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180300850A1 (en) * 2017-04-14 2018-10-18 Facebook, Inc. Artifact reduction for image style transfer
CN108171652A (zh) * 2017-12-28 2018-06-15 努比亚技术有限公司 一种改进图像风格效果的方法、移动终端及存储介质
CN108537776A (zh) * 2018-03-12 2018-09-14 维沃移动通信有限公司 一种图像风格迁移模型生成方法及移动终端
CN110189246A (zh) * 2019-05-15 2019-08-30 北京字节跳动网络技术有限公司 图像风格化生成方法、装置及电子设备

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113469923A (zh) * 2021-05-28 2021-10-01 北京达佳互联信息技术有限公司 一种图像处理方法、装置、电子设备及存储介质
CN113469923B (zh) * 2021-05-28 2024-05-24 北京达佳互联信息技术有限公司 一种图像处理方法、装置、电子设备及存储介质
CN113742630A (zh) * 2021-09-16 2021-12-03 阿里巴巴新加坡控股有限公司 图像处理方法、电子设备及计算机存储介质
CN113742630B (zh) * 2021-09-16 2023-12-15 阿里巴巴新加坡控股有限公司 图像处理方法、电子设备及计算机存储介质
CN113891141A (zh) * 2021-10-25 2022-01-04 北京字节跳动网络技术有限公司 一种视频处理方法、装置及设备
CN113891141B (zh) * 2021-10-25 2024-01-26 抖音视界有限公司 一种视频处理方法、装置及设备
CN114040129A (zh) * 2021-11-30 2022-02-11 北京字节跳动网络技术有限公司 视频生成方法、装置、设备及存储介质
CN114040129B (zh) * 2021-11-30 2023-12-05 北京字节跳动网络技术有限公司 视频生成方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN110189246B (zh) 2023-02-28
CN110189246A (zh) 2019-08-30

Similar Documents

Publication Publication Date Title
WO2020228406A1 (zh) 图像风格化生成方法、装置及电子设备
US20220261960A1 (en) Super-resolution reconstruction method and related apparatus
WO2020186935A1 (zh) 虚拟对象的显示方法、装置、电子设备和计算机可读存储介质
WO2018177379A1 (zh) 手势识别、控制及神经网络训练方法、装置及电子设备
WO2021254502A1 (zh) 目标对象显示方法、装置及电子设备
WO2022007627A1 (zh) 一种图像特效的实现方法、装置、电子设备及存储介质
WO2020156058A1 (zh) 基于终端的图像拖拽变形实现方法和装置
CN110287891A (zh) 基于人体关键点的手势控制方法、装置及电子设备
WO2020220809A1 (zh) 目标对象的动作识别方法、装置和电子设备
WO2020192195A1 (zh) 图像处理方法、装置和电子设备
CN111638791B (zh) 虚拟角色的生成方法、装置、电子设备及存储介质
CN112184548A (zh) 图像超分辨率方法、装置、设备及存储介质
WO2023138549A1 (zh) 图像处理方法、装置、电子设备及存储介质
CN113050860B (zh) 一种控件识别方法和相关装置
CN112258653A (zh) 弹性对象的渲染方法、装置、设备及存储介质
WO2021057463A1 (zh) 图像风格化处理方法、装置、电子设备及可读介质
CN109121000A (zh) 一种视频处理方法及客户端
US20240187725A1 (en) Photographing method and electronic device
WO2022218042A1 (zh) 视频处理方法、装置、视频播放器、电子设备及可读介质
CN111199169A (zh) 图像处理方法和装置
CN110211017B (zh) 图像处理方法、装置及电子设备
CN110197459B (zh) 图像风格化生成方法、装置及电子设备
CN111652675A (zh) 展示方法、装置和电子设备
CN111191553A (zh) 人脸跟踪方法、装置及电子设备
WO2024120223A1 (zh) 图像处理方法、装置、设备、存储介质及计算机程序产品

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: 20805163

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: 20805163

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 22.03.2022)

122 Ep: pct application non-entry in european phase

Ref document number: 20805163

Country of ref document: EP

Kind code of ref document: A1