CN110599437A - Method and apparatus for processing video - Google Patents

Method and apparatus for processing video Download PDF

Info

Publication number
CN110599437A
CN110599437A CN201910918295.3A CN201910918295A CN110599437A CN 110599437 A CN110599437 A CN 110599437A CN 201910918295 A CN201910918295 A CN 201910918295A CN 110599437 A CN110599437 A CN 110599437A
Authority
CN
China
Prior art keywords
image
video
fusion
map
processing
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN201910918295.3A
Other languages
Chinese (zh)
Inventor
丁予康
张赫男
刘霄
孙昊
文石磊
丁二锐
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
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 Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201910918295.3A priority Critical patent/CN110599437A/en
Publication of CN110599437A publication Critical patent/CN110599437A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T5/00Image enhancement or restoration
    • G06T5/50Image enhancement or restoration using two or more images, e.g. averaging or subtraction
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/10Segmentation; Edge detection
    • G06T7/13Edge detection
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T7/00Image analysis
    • G06T7/90Determination of colour characteristics
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/10Image acquisition modality
    • G06T2207/10016Video; Image sequence
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20024Filtering details
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T2207/00Indexing scheme for image analysis or image enhancement
    • G06T2207/20Special algorithmic details
    • G06T2207/20212Image combination
    • G06T2207/20221Image fusion; Image merging

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Image Processing (AREA)

Abstract

The embodiment of the disclosure discloses a method and a device for processing video. One embodiment of the method comprises: for the video frames in the acquired original video, the following processing operations are performed: converting the video frame into a gray image; carrying out reverse color processing on the gray level image to obtain a reverse color image; performing edge extraction on the color reflection image to obtain an edge image; fusing the edge image and the gray level image to obtain a fused image; obtaining a result image based on the fusion graph and a preset sketch stroke graph; and generating a video based on the obtained result image, and outputting the generated video. The implementation realizes the conversion from the original video to the pencil drawing style video.

Description

Method and apparatus for processing video
Technical Field
The disclosed embodiments relate to the field of computer technologies, and in particular, to a method and an apparatus for processing a video.
Background
In daily life, after people shoot videos, in order to enable the videos to have a certain artistic style, the videos are subjected to post-processing to generate videos with artistic effects, for example, videos with a pencil drawing style. Currently, the means for generating video with a pencil-drawing style is mostly based on neural networks. For example, a neural network is trained by using a large amount of sample data, and then the trained neural network is used for processing a video, so that a video with a pencil drawing style is obtained. Generally, neural networks are computationally expensive and require higher-configured hardware devices for support. In addition, the video frames in the video can be processed by using a more traditional image processing mode, so that the video with the pencil drawing style is obtained. The traditional image processing mode is poor in processing effect on shadow, brightness and the like, so that the obtained pencil-drawing-style video effect is poor.
Disclosure of Invention
The embodiment of the disclosure provides a method and a device for processing video.
In a first aspect, an embodiment of the present disclosure provides a method for processing video, where the method includes: for the video frames in the acquired original video, the following processing operations are performed: converting the video frame into a gray image; carrying out reverse color processing on the gray level image to obtain a reverse color image; performing edge extraction on the color reflection image to obtain an edge image; fusing the edge image and the gray level image to obtain a fused image; obtaining a result image based on the fusion graph and a preset sketch stroke graph; and generating a video based on the obtained result image, and outputting the generated video.
In some embodiments, the obtaining a result image based on the fusion map and a preset sketch stroke map includes: and for the pixel points in the fusion graph, in response to the fact that the pixel value of the pixel point is smaller than the preset threshold value, the pixel value of the pixel point is fused with the pixel value of the pixel point at the corresponding position in the sketch stroke graph, and the fusion result is used as the pixel value of the pixel point to obtain a result image.
In some embodiments, the performing edge extraction on the color map to obtain an edge image includes: carrying out fuzzy processing on the color reflection image to obtain a fuzzy image; and fusing the fuzzy image and the gray image to obtain an edge image.
In some embodiments, the blurring the color inversion map to obtain a blur map includes: carrying out minimum value filtering on the color reflection map to obtain a filtering image; and carrying out mean value filtering on the filtered image to obtain a fuzzy image.
In some embodiments, the fusing the blur map and the gray scale map to obtain an edge image includes: and calculating the values of the corresponding pixel points in the gray-scale image and the fuzzy image based on a preset calculation mode, and taking the calculation result as the value of the corresponding pixel point in the edge image.
In a second aspect, an embodiment of the present disclosure provides an apparatus for processing video, the apparatus including: an execution unit configured to execute a preset processing operation on a video frame in the acquired original video, wherein the execution unit includes: a conversion unit configured to convert the video frame into a grayscale image; a color inversion unit configured to perform color inversion processing on the grayscale image to obtain an inversion image; an extraction unit configured to perform edge extraction on the color map to obtain an edge image; a fusion unit configured to fuse the edge image and the grayscale image to obtain a fusion image; a generating unit configured to obtain a result image based on the fusion graph and a preset sketch stroke graph; an output unit configured to generate a video based on the obtained result image, and output the generated video.
In some embodiments, the generating unit is further configured to: and for the pixel points in the fusion graph, in response to the fact that the pixel value of the pixel point is smaller than the preset threshold value, the pixel value of the pixel point is fused with the pixel value of the pixel point at the corresponding position in the sketch stroke graph, and the fusion result is used as the pixel value of the pixel point to obtain a result image.
In some embodiments, the extraction unit includes: the fuzzy module is configured to carry out fuzzy processing on the inverse color image to obtain a fuzzy image; and the fusion module is configured to fuse the fuzzy image and the gray image to obtain an edge image.
In some embodiments, the obfuscation module is further configured to: carrying out minimum value filtering on the color reflection map to obtain a filtering image; and carrying out mean value filtering on the filtered image to obtain a fuzzy image.
In some embodiments, the fusion module is further configured to: and calculating the values of the corresponding pixel points in the gray-scale image and the fuzzy image based on a preset calculation mode, and taking the calculation result as the value of the corresponding pixel point in the edge image.
In a third aspect, an embodiment of the present disclosure provides an apparatus, including: one or more processors; a storage device, on which one or more programs are stored, which, when executed by the one or more processors, cause the one or more processors to implement the method as described in any implementation manner of the first aspect.
In a fourth aspect, the disclosed embodiments provide a computer-readable medium on which a computer program is stored, wherein the computer program, when executed by a processor, implements the method as described in any implementation manner of the first aspect.
According to the method and the device for processing the video, the following processing operations are firstly executed for each video frame in the acquired original video: 1) converting the video frame into a gray image; 2) carrying out reverse color processing on the gray level image to obtain a reverse color image; 3) performing edge extraction on the reverse color image to obtain an edge image; 4) fusing the edge image and the gray level image to obtain a fused image; 5) and obtaining a result image based on the fusion graph and the sketch stroke graph. Thereafter, a video is generated based on the resultant image, and the generated video is output. The gray level image of each video frame in the original video is processed, and the video with the pencil drawing style can be obtained by combining the sketch pen-touch image, so that the conversion from the original video to the pencil drawing style video is realized.
Drawings
Other features, objects and advantages of the disclosure will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which one embodiment of the present disclosure may be applied;
FIG. 2 is a flow diagram for one embodiment of a method for processing video, according to the present disclosure;
FIG. 3 is a schematic diagram of a sketch pen-touch diagram of the present disclosure;
FIG. 4 is a schematic diagram of one application scenario of a method for processing video according to the present disclosure;
FIG. 5 is a flow diagram of yet another embodiment of a method for processing video according to the present disclosure;
FIG. 6 is a schematic block diagram illustrating one embodiment of an apparatus for processing video according to the present disclosure;
FIG. 7 is a schematic block diagram of a computer system suitable for use in implementing an electronic device of an embodiment of the present disclosure.
Detailed Description
The present disclosure is described in further detail below with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that, in the present disclosure, the embodiments and features of the embodiments may be combined with each other without conflict. The present disclosure will be described in detail below with reference to the accompanying drawings in conjunction with embodiments.
Fig. 1 illustrates an exemplary system architecture 100 of a method for processing video or an apparatus for processing video to which embodiments of the present disclosure may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as video processing software, image processing software, a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices having a display screen and supporting video processing, including but not limited to smart cameras, smart phones, tablet computers, laptop portable computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as multiple pieces of software or software modules (e.g., to provide distributed services) or as a single piece of software or software module. And is not particularly limited herein.
The server 105 may be a server providing various services, such as a background server providing support for video playing on the terminal devices 101, 102, 103. The backend server may process the received data such as video and feed back the processing result (e.g., the video in the pencil-drawing style) to the terminal devices 101, 102, 103.
The server 105 may be hardware or software. When the server 105 is hardware, it may be implemented as a distributed server cluster composed of a plurality of servers, or may be implemented as a single server. When the server 105 is software, it may be implemented as multiple pieces of software or software modules (e.g., to provide distributed services), or as a single piece of software or software module. And is not particularly limited herein.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
It should be noted that the method for processing video provided by the embodiment of the present disclosure may be executed by the terminal devices 101, 102, and 103, or may be executed by the server 105. Accordingly, the apparatus for processing video may be provided in the terminal devices 101, 102, 103, or in the server 105. This is not limited in this application.
With continued reference to fig. 2, a flow 200 of one embodiment of a method for processing video in accordance with the present disclosure is shown. The method for processing video comprises the following steps:
in step 201, the following processing operation steps 2011-2015 are executed for the video frames in the acquired original video.
In the present embodiment, an executing subject of the method for processing video (e.g., the terminal apparatus 101, 102, 103 or the server 105 shown in fig. 1) may execute the following preset processing operation steps 2011-2015 for each video frame in the acquired original video.
Here, when the execution subject is a terminal device, the original video may refer to a video that is locally and previously stored in the terminal device, or may refer to a video that is captured by the terminal device in real time. When the execution subject is a server, the original video may refer to a video that is locally stored in advance by the server, or may refer to a video that is received in real time from the terminal device.
In step 2011, the video frame is converted into a grayscale image.
In this embodiment, the execution subject may convert the video frame into a grayscale image. The gray scale image is also called a gray scale image. The relationship between white and black is logarithmically divided into several levels, called gray scale. The general gray scale is divided into 256 steps of 0 to 255. The white color was 255, and the black color was 0. An image represented in grayscale is referred to as a grayscale image. When a video frame of an original video is a color image (e.g., an RGB image), the execution body may convert the color image into a grayscale image in various existing ways.
Step 2012, inverse color processing is performed on the gray image to obtain an inverse color map.
In this embodiment, the executing entity may perform a reverse color processing on the grayscale image obtained in step 2011, thereby obtaining a reverse color map. The inverse color processing means that the gray value of the pixel point in the gray image is inverted, that is, the gray value of the pixel point is subtracted from 255 to obtain the gray value of the pixel point after the inverse color processing.
And 2013, performing edge extraction on the reverse color image to obtain an edge image.
In this embodiment, the execution subject may perform edge extraction on the inverse color map obtained in step 2012 by using various edge extraction methods, so as to obtain an edge image.
In some optional implementations of this embodiment, the step 2013 may be specifically performed as follows:
in step S1, the inverse color map is blurred to obtain a blurred image.
In this implementation, the execution subject may perform a blurring process on the inverse color map obtained in step 2012 to obtain a blurred image.
And step S2, fusing the fuzzy image and the gray image to obtain an edge image.
In this implementation, the executive body may fuse the blur map obtained in step S1 and the grayscale map obtained in step 2011, so as to obtain an edge image.
In some alternative implementations, the step S1 may be specifically performed as follows:
firstly, minimum value filtering is carried out on the inverse color map to obtain a filtering image.
In this implementation, the execution subject may perform minimum value filtering on the inverse color map obtained in step 2012 to obtain a filtered image.
And then, carrying out mean value filtering on the filtered image to obtain a fuzzy image.
In this implementation, the execution subject may perform mean filtering on the obtained filtered image, thereby obtaining a blur map.
In some alternative implementations, the step S2 may be specifically performed as follows: and calculating the values of the corresponding pixel points in the gray-scale image and the fuzzy image based on a preset calculation mode, and taking the calculation result as the value of the corresponding pixel point in the edge image.
In this implementation manner, the execution subject may calculate values of corresponding pixel points in the grayscale image obtained in step 2011 and the blur image obtained in step S1 based on a preset calculation manner, and use the calculation result as the value of the corresponding pixel point in the edge image. Here, the preset calculation manner may include a preset calculation formula. As an example, the preset calculation manner may calculate the value of the corresponding pixel point in the gray-scale map by a formula Gi × 255/(255-Fi), where Gi represents the value of the ith pixel point in the gray-scale map, and F is the value of the ith pixel point in the gray-scale mapiRepresenting the value of the ith pixel in the blur map.
And step 2014, fusing the edge image and the gray image to obtain a fused image.
In this embodiment, the executing entity may fuse the edge image obtained in step 2013 and the grayscale image obtained in step 2011 by using various image fusion methods, so as to obtain a fusion map. By fusing the edge image and the gray level image, a fusion image comprising edges and gray level distribution can be obtained, and image shadows and edges are enhanced, so that the generated result image is more in line with the pencil drawing style.
Step 2015, obtaining a result image based on the fusion map and a preset sketch stroke map.
In this embodiment, a sketch stroke map may be stored in the execution body in advance. Here, the brush stroke may refer to a trace left when the brush touches the drawing during drawing. As an example, the sketch pen drawing may be a sketch image drawn manually using a pencil. Lines with different colors are distributed in the sketch pen-touch diagram, and the effect can be shown as figure 3. It should be noted that the lines of the sketch pen-touch diagram in fig. 3 are only schematic, and are not limited to the density, the color shade, the trend, and the like of the lines of the sketch pen-touch diagram. In practice, the density, the color depth, the trend and the like of the lines of the sketch pen-touch diagram can be set according to actual needs.
In this way, the execution subject may adopt various image fusion methods to fuse the fusion map obtained in step 2014 and the sketch pen-touch map, so as to obtain a result image.
And 202, generating a video based on the obtained result image, and outputting the generated video.
In this embodiment, the executing subject may obtain one result image for each video frame in the original video. Executing the subject based on the resulting plurality of resultant images may generate a video. Here, the generated video is a pencil-drawing style video. Thereafter, the execution body may output the generated video. As an example, when the execution subject is a terminal device, the execution subject may directly output and play the generated video. When the execution main body is a server, the execution main body can output the video to the terminal equipment so as to play the video by the terminal equipment.
With continued reference to fig. 4, fig. 4 is a schematic diagram of an application scenario of the method for processing video according to the present embodiment. In the application scenario of fig. 4, the terminal device 401 first performs the following processing operations for each video frame in the original video captured in real time: 1) converting the video frame into a gray image; 2) carrying out reverse color processing on the gray level image to obtain a reverse color image; 3) performing edge extraction on the reverse color image to obtain an edge image; 4) fusing the edge image and the gray level image to obtain a fused image; 5) and obtaining a result image based on the fused image and the sketch stroke graph. After that, the terminal apparatus 401 generates a video based on the obtained result image, and plays the generated video.
According to the method provided by the embodiment of the disclosure, the gray level image of each video frame in the original video is processed, and the video with the pencil drawing style can be obtained by combining the sketch pen drawing, so that the conversion from the original video to the video with the pencil drawing style is realized.
With further reference to fig. 5, a flow 500 of yet another embodiment of a method for processing video is shown. The flow 500 of the method for processing video comprises the following steps:
in step 501, the following processing operations 5011 to 5015 are performed on the video frames in the acquired original video.
In the present embodiment, an executing subject of the method for processing video (e.g., the terminal apparatus 101, 102, 103 or the server 105 shown in FIG. 1) can execute the following preset processing operation steps 5011 to 5015 for each video frame in the acquired original video.
In step 5011, the video frame is converted into a grayscale image.
In this embodiment, step 5011 is similar to step 2011 of the embodiment shown in fig. 2, and is not described herein again.
In step 5012, the grayscale image is subjected to a color reversal process to obtain a color reversal image.
In this embodiment, step 5012 is similar to step 2012 of the embodiment shown in fig. 2, and is not described herein again.
In step 5013, the reverse color image is subjected to edge extraction to obtain an edge image.
In this embodiment, step 5013 is similar to step 2013 of the embodiment shown in fig. 2, and is not described here again.
And step 5014, fusing the edge image and the gray level image to obtain a fused image.
In this embodiment, step 5014 is similar to step 2014 of the embodiment shown in fig. 2, and is not described herein again.
Step 5015, for the pixel point in the fusion map, in response to determining that the pixel value of the pixel point is smaller than the preset threshold, fusing the pixel value of the pixel point with the pixel value of the pixel point at the corresponding position in the sketch stroke map, and taking the fusion result as the pixel value of the pixel point to obtain a result image.
In this embodiment, for each pixel point in the fusion map obtained in step 5014, the execution subject may determine whether the pixel value of the pixel point is smaller than the preset threshold. If the pixel value of the pixel point is smaller than the preset threshold value, the execution main body can fuse the pixel value of the pixel point with the pixel value of the pixel point at the corresponding position in the sketch stroke diagram. For example, the pixel values are multiplied by preset weighting coefficients respectively and then added to obtain a fusion result, and the fusion result is used as the pixel value of the pixel point.
Here, the range of the pixel value of the pixel point in the fusion map may be 0 to 255, where 255 denotes white and 0 denotes black. Smaller pixel values indicate darker color for the pixel. Therefore, if the pixel value of a certain pixel point in the fusion image is smaller than the preset threshold, it indicates that the pixel point may be a pixel point of a shadow part in the fusion image. In the actual drawing process of the pencil drawing, the shaded part is often represented by dense lines, and the effect is similar to that displayed in a sketch pen-touch diagram. Therefore, by fusing the pixel points with the pixel values smaller than the preset threshold value in the fused image with the pixel points at the corresponding positions in the sketch pen-touch image, the shadow parts in the obtained result image can be closer to the real pencil sketch effect. In practice, the preset threshold may be set according to actual needs.
Step 502, generating a video based on the obtained result image, and outputting the generated video.
In this embodiment, step 502 is similar to step 202 of the embodiment shown in fig. 2, and is not described herein again.
As can be seen from fig. 5, compared with the embodiment corresponding to fig. 2, the process 500 of the method for processing a video in this embodiment highlights a step of fusing the pixel value of the pixel point with the pixel value smaller than the preset threshold in the fused image with the pixel value of the pixel point at the corresponding position in the sketch stroke image. Therefore, the scheme described in the embodiment can enable the shadow part in the result image to have the pen-touch effect of pencil sketch, and further enable the obtained video effect of the pencil drawing style to be better.
With further reference to fig. 6, as an implementation of the methods shown in the above figures, the present disclosure provides an embodiment of an apparatus for processing video, which corresponds to the method embodiment shown in fig. 2, and which is particularly applicable in various electronic devices.
As shown in fig. 6, the apparatus 600 for processing video of the present embodiment includes: an execution unit 601 and an output unit 602. Wherein, the execution unit 601 is configured to execute a preset processing operation on a video frame in the acquired original video, wherein the execution unit 601 comprises: a conversion unit 6011 configured to convert the video frame into a grayscale image; an inverse color unit 6012 configured to perform inverse color processing on the grayscale image to obtain an inverse color map; an extraction unit 6013 configured to perform edge extraction on the inverse color map to obtain an edge image; a fusion unit 6014 configured to fuse the edge image and the grayscale image to obtain a fusion image; a generating unit 6015 configured to obtain a result image based on the fusion map and a preset sketch stroke map; the output unit 602 is configured to generate a video based on the resultant image, and output the generated video.
In this embodiment, specific processing of the execution unit 601 and the output unit 602 of the apparatus 600 for processing a video and technical effects brought by the specific processing can refer to related descriptions of step 201 and step 202 in the corresponding embodiment of fig. 2, which are not described herein again.
In some optional implementations of this embodiment, the generating unit 6015 is further configured to: and for the pixel points in the fusion graph, in response to the fact that the pixel value of the pixel point is smaller than the preset threshold value, the pixel value of the pixel point is fused with the pixel value of the pixel point at the corresponding position in the sketch stroke graph, and the fusion result is used as the pixel value of the pixel point to obtain a result image.
In some optional implementations of this embodiment, the extraction unit 6013 includes: a blurring module (not shown in the figure) configured to perform blurring processing on the inverse color image to obtain a blurred image; and a fusion module (not shown in the figure) configured to fuse the blur map and the gray map to obtain an edge image.
In some optional implementations of this embodiment, the obfuscation module is further configured to: carrying out minimum value filtering on the color reflection map to obtain a filtering image; and carrying out mean value filtering on the filtered image to obtain a fuzzy image.
In some optional implementations of this embodiment, the fusion module is further configured to: and calculating the values of the corresponding pixel points in the gray-scale image and the fuzzy image based on a preset calculation mode, and taking the calculation result as the value of the corresponding pixel point in the edge image.
Referring now to fig. 7, a schematic diagram of an electronic device (e.g., the server or terminal device of fig. 1) 700 suitable for use in implementing embodiments of the present disclosure is shown. The electronic device shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
As shown in fig. 7, electronic device 700 may include a processing means (e.g., central processing unit, graphics processor, etc.) 701 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from storage 708 into a Random Access Memory (RAM) 703. In the RAM703, various programs and data necessary for the operation of the electronic apparatus 700 are also stored. The processing device 701, the ROM 702, and the RAM703 are connected to each other by a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
Generally, the following devices may be connected to the I/O interface 705: input devices 706 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 707 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage 708 including, for example, magnetic tape, hard disk, etc.; and a communication device 709. The communication means 709 may allow the electronic device 700 to communicate wirelessly or by wire with other devices to exchange data. While fig. 7 illustrates an electronic device 700 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided. Each block shown in fig. 7 may represent one device or may represent multiple devices as desired.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such embodiments, the computer program may be downloaded and installed from a network via the communication means 709, or may be installed from the storage means 708, or may be installed from the ROM 702. The computer program, when executed by the processing device 701, performs the above-described functions defined in the methods of embodiments of the present disclosure. It should be noted that the computer readable medium described in the embodiments of 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 electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In embodiments of the disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In embodiments of the present disclosure, however, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: for the video frames in the acquired original video, the following processing operations are performed: converting the video frame into a gray image; carrying out reverse color processing on the gray level image to obtain a reverse color image; performing edge extraction on the color reflection image to obtain an edge image; fusing the edge image and the gray level image to obtain a fused image; obtaining a result image based on the fusion graph and a preset sketch stroke graph; and generating a video based on the obtained result image, and outputting the generated video.
Computer program code for carrying out operations for embodiments of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming 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. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, 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 the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes an execution unit and an output unit. Here, the names of these units do not constitute a limitation to the unit itself in some cases, and for example, the output unit may also be described as "a unit that generates a video based on the resulting image and outputs the generated video".
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention in the embodiments of the present disclosure is not limited to the specific combination of the above-mentioned features, but also encompasses other embodiments in which any combination of the above-mentioned features or their equivalents is made without departing from the inventive concept as defined above. For example, the above features and (but not limited to) technical features with similar functions disclosed in the embodiments of the present disclosure are mutually replaced to form the technical solution.

Claims (12)

1. A method for processing video, comprising:
for the video frames in the acquired original video, the following processing operations are performed: converting the video frame into a gray image; carrying out reverse color processing on the gray level image to obtain a reverse color image; performing edge extraction on the color reflection image to obtain an edge image; fusing the edge image and the gray level image to obtain a fused image; obtaining a result image based on the fusion graph and a preset sketch stroke graph;
and generating a video based on the obtained result image, and outputting the generated video.
2. The method according to claim 1, wherein the obtaining a result image based on the fusion map and a preset sketch stroke map comprises:
and for the pixel points in the fusion graph, in response to the fact that the pixel value of the pixel point is smaller than the preset threshold value, the pixel value of the pixel point is fused with the pixel value of the pixel point at the corresponding position in the sketch stroke graph, and the fusion result is used as the pixel value of the pixel point to obtain a result image.
3. The method of claim 1, wherein the performing edge extraction on the inverse color map to obtain an edge image comprises:
carrying out fuzzy processing on the reverse color image to obtain a fuzzy image;
and fusing the blurred image and the gray image to obtain an edge image.
4. The method of claim 3, wherein the blurring the inverse color map to obtain a blurred map comprises:
carrying out minimum value filtering on the color reflection map to obtain a filtering image;
and carrying out mean value filtering on the filtered image to obtain a fuzzy image.
5. The method of claim 3, wherein the fusing the blur map and the gray map to obtain an edge image comprises:
and calculating the values of the corresponding pixel points in the gray-scale image and the fuzzy image based on a preset calculation mode, and taking the calculation result as the value of the corresponding pixel point in the edge image.
6. An apparatus for processing video, comprising:
an execution unit configured to execute a preset processing operation on a video frame in the acquired original video, wherein the execution unit includes: a conversion unit configured to convert the video frame into a grayscale image; the reverse color unit is configured to perform reverse color processing on the gray level image to obtain a reverse color image; the extraction unit is configured to perform edge extraction on the color reflection map to obtain an edge image; the fusion unit is configured to fuse the edge image and the gray level image to obtain a fusion image; a generating unit configured to obtain a result image based on the fusion graph and a preset sketch stroke graph;
an output unit configured to generate a video based on the obtained result image, and output the generated video.
7. The apparatus of claim 6, wherein the generating unit is further configured to:
and for the pixel points in the fusion graph, in response to the fact that the pixel value of the pixel point is smaller than the preset threshold value, the pixel value of the pixel point is fused with the pixel value of the pixel point at the corresponding position in the sketch stroke graph, and the fusion result is used as the pixel value of the pixel point to obtain a result image.
8. The apparatus of claim 6, wherein the extraction unit comprises:
the fuzzy module is configured to perform fuzzy processing on the reverse color image to obtain a fuzzy image;
and the fusion module is configured to fuse the blurred image and the gray image to obtain an edge image.
9. The apparatus of claim 8, wherein the obfuscation module is further configured to:
carrying out minimum value filtering on the color reflection map to obtain a filtering image;
and carrying out mean value filtering on the filtered image to obtain a fuzzy image.
10. The apparatus of claim 8, wherein the fusion module is further configured to:
and calculating the values of the corresponding pixel points in the gray-scale image and the fuzzy image based on a preset calculation mode, and taking the calculation result as the value of the corresponding pixel point in the edge image.
11. An apparatus, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-5.
12. A computer-readable medium, on which a computer program is stored, wherein the program, when executed by a processor, implements the method of any one of claims 1-5.
CN201910918295.3A 2019-09-26 2019-09-26 Method and apparatus for processing video Pending CN110599437A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910918295.3A CN110599437A (en) 2019-09-26 2019-09-26 Method and apparatus for processing video

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910918295.3A CN110599437A (en) 2019-09-26 2019-09-26 Method and apparatus for processing video

Publications (1)

Publication Number Publication Date
CN110599437A true CN110599437A (en) 2019-12-20

Family

ID=68863931

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910918295.3A Pending CN110599437A (en) 2019-09-26 2019-09-26 Method and apparatus for processing video

Country Status (1)

Country Link
CN (1) CN110599437A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112995534A (en) * 2021-02-05 2021-06-18 北京字跳网络技术有限公司 Video generation method, device, equipment and readable storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070154112A1 (en) * 2006-01-05 2007-07-05 Canon Kabushiki Kaisha Image processing apparatus, image processing method, and computer program
CN103021002A (en) * 2011-09-27 2013-04-03 康佳集团股份有限公司 Colorful sketch image generating method
CN105528765A (en) * 2015-12-02 2016-04-27 小米科技有限责任公司 Method and device for processing image
CN107336727A (en) * 2017-07-26 2017-11-10 湖南中车时代通信信号有限公司 A kind of interlock access handles method
CN108682040A (en) * 2018-05-21 2018-10-19 努比亚技术有限公司 A kind of sketch image generation method, terminal and computer readable storage medium
CN109035377A (en) * 2018-07-20 2018-12-18 广州市普汉科技有限公司 For obtaining the embossment sketch effect image processing method for being suitable for laser engraving
CN109300099A (en) * 2018-08-29 2019-02-01 努比亚技术有限公司 A kind of image processing method, mobile terminal and computer readable storage medium
CN110070495A (en) * 2019-02-20 2019-07-30 北京字节跳动网络技术有限公司 Processing method, device and the electronic equipment of image

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070154112A1 (en) * 2006-01-05 2007-07-05 Canon Kabushiki Kaisha Image processing apparatus, image processing method, and computer program
CN103021002A (en) * 2011-09-27 2013-04-03 康佳集团股份有限公司 Colorful sketch image generating method
CN105528765A (en) * 2015-12-02 2016-04-27 小米科技有限责任公司 Method and device for processing image
CN107336727A (en) * 2017-07-26 2017-11-10 湖南中车时代通信信号有限公司 A kind of interlock access handles method
CN108682040A (en) * 2018-05-21 2018-10-19 努比亚技术有限公司 A kind of sketch image generation method, terminal and computer readable storage medium
CN109035377A (en) * 2018-07-20 2018-12-18 广州市普汉科技有限公司 For obtaining the embossment sketch effect image processing method for being suitable for laser engraving
CN109300099A (en) * 2018-08-29 2019-02-01 努比亚技术有限公司 A kind of image processing method, mobile terminal and computer readable storage medium
CN110070495A (en) * 2019-02-20 2019-07-30 北京字节跳动网络技术有限公司 Processing method, device and the electronic equipment of image

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
张江红等: "基于FPGA的铅笔画绘制算法结构设计及优化" *
张江红等: "基于FPGA的铅笔画绘制算法结构设计及优化", 《工程图学学报》 *
王琦等: "中国书画的计算机虚拟绘制概述", 《计算机辅助设计与图形学学报》 *
黄双萍等: "基于特征融合的人脸素描自动生成系统研究", 《计算机应用与软件》 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112995534A (en) * 2021-02-05 2021-06-18 北京字跳网络技术有限公司 Video generation method, device, equipment and readable storage medium
CN112995534B (en) * 2021-02-05 2023-01-24 北京字跳网络技术有限公司 Video generation method, device, equipment and readable storage medium

Similar Documents

Publication Publication Date Title
CN111476871B (en) Method and device for generating video
CN110349107B (en) Image enhancement method, device, electronic equipment and storage medium
US11514263B2 (en) Method and apparatus for processing image
CN107622504B (en) Method and device for processing pictures
CN110059623B (en) Method and apparatus for generating information
JP7261732B2 (en) Method and apparatus for determining character color
CN111459364B (en) Icon updating method and device and electronic equipment
CN109102484B (en) Method and apparatus for processing image
CN112308950A (en) Video generation method and device
CN114066722B (en) Method and device for acquiring image and electronic equipment
WO2019242409A1 (en) Qr code generation method and apparatus for terminal device
CN113038176B (en) Video frame extraction method and device and electronic equipment
CN110555799A (en) Method and apparatus for processing video
CN110636331B (en) Method and apparatus for processing video
CN111369475B (en) Method and apparatus for processing video
CN110070482B (en) Image processing method, apparatus and computer readable storage medium
CN113409199A (en) Image processing method, image processing device, electronic equipment and computer readable medium
CN110599437A (en) Method and apparatus for processing video
CN114339447A (en) Method, device and equipment for converting picture into video and storage medium
CN114866706B (en) Image processing method, device, electronic equipment and storage medium
CN110827254A (en) Method and device for determining image definition
CN108537786B (en) Method and apparatus for processing image
CN116363239A (en) Method, device, equipment and storage medium for generating special effect diagram
CN111314627B (en) Method and apparatus for processing video frames
CN110399802B (en) Method, apparatus, medium, and electronic device for processing eye brightness of face image

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication

Application publication date: 20191220

RJ01 Rejection of invention patent application after publication