WO2020125631A1 - Video compression method and apparatus, and computer-readable storage medium - Google Patents

Video compression method and apparatus, and computer-readable storage medium Download PDF

Info

Publication number
WO2020125631A1
WO2020125631A1 PCT/CN2019/126016 CN2019126016W WO2020125631A1 WO 2020125631 A1 WO2020125631 A1 WO 2020125631A1 CN 2019126016 W CN2019126016 W CN 2019126016W WO 2020125631 A1 WO2020125631 A1 WO 2020125631A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
frame
blur
video compression
pixel
Prior art date
Application number
PCT/CN2019/126016
Other languages
French (fr)
Chinese (zh)
Inventor
谢仁礼
何林俊
Original Assignee
深圳Tcl新技术有限公司
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 深圳Tcl新技术有限公司 filed Critical 深圳Tcl新技术有限公司
Publication of WO2020125631A1 publication Critical patent/WO2020125631A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/85Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using pre-processing or post-processing specially adapted for video compression
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/10Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding
    • H04N19/169Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding
    • H04N19/186Methods or arrangements for coding, decoding, compressing or decompressing digital video signals using adaptive coding characterised by the coding unit, i.e. the structural portion or semantic portion of the video signal being the object or the subject of the adaptive coding the unit being a colour or a chrominance component
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N19/00Methods or arrangements for coding, decoding, compressing or decompressing digital video signals
    • H04N19/42Methods or arrangements for coding, decoding, compressing or decompressing digital video signals characterised by implementation details or hardware specially adapted for video compression or decompression, e.g. dedicated software implementation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N21/00Selective content distribution, e.g. interactive television or video on demand [VOD]
    • H04N21/40Client devices specifically adapted for the reception of or interaction with content, e.g. set-top-box [STB]; Operations thereof
    • H04N21/47End-user applications
    • H04N21/478Supplemental services, e.g. displaying phone caller identification, shopping application
    • H04N21/4788Supplemental services, e.g. displaying phone caller identification, shopping application communicating with other users, e.g. chatting
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04NPICTORIAL COMMUNICATION, e.g. TELEVISION
    • H04N7/00Television systems
    • H04N7/14Systems for two-way working
    • H04N7/141Systems for two-way working between two video terminals, e.g. videophone

Definitions

  • This application relates to the field of video processing, and in particular, to a video compression method, device, and computer-readable storage medium.
  • Video chat has gradually replaced ordinary language and text, and has become an important way for people to communicate and communicate in work or daily life.
  • the video information in the video chat process is composed of one frame of image, but the current video image contains a lot of redundant information, which takes up a lot of bandwidth during the digital transmission of video, which affects the cost of operation and the video’s Fluency.
  • many compression methods have emerged, such as JPEG and MPEG methods.
  • the current compression method will compress all the content in each frame of the image, which leads to the reduction of the clarity of the face in the video, which cannot meet the requirements of people in the process of video chatting.
  • the main purpose of the present application is to provide a video compression method, device and computer-readable storage medium, aiming to realize the recognition of the area where the face is located in the video chat and blur the compression of the part outside the area where the face is located, Not only can reduce the bandwidth cost of the entire process, but also ensure the clarity and fluency of face information in the video.
  • the present application provides a video compression method, which includes the following steps:
  • Gaussian blur processing is performed on the background image to obtain a blurred background image
  • the step of dividing each frame of the video image into a face image and a background image includes:
  • the step of performing skin color analysis on each frame of the video image to obtain the face image and background image in each frame includes:
  • Morphological processing is performed on the skin color region of each frame image to obtain a face image and a background image in each frame image.
  • the first preset algorithm is used to perform brightness compensation on each frame image according to the brightness and chromaticity of the pixels in each frame image to obtain the compensated pixels in each frame image
  • the chroma steps include:
  • the chromaticity of the compensated pixels in each frame image is calculated according to the illumination compensation coefficient and the brightness of the pixels in each frame image.
  • the step of performing Gaussian blur processing on each frame image to obtain a blurred background image includes:
  • Gaussian blur processing is performed on each image to obtain a background image that is gradually blurred from a direction away from the center point of the blur processing.
  • the step of performing Gaussian blur processing on each image to obtain a progressively blurred background image includes:
  • Gaussian blur processing is performed on each pixel of the blur area according to the variable radius of the Gaussian blur processing to obtain a gradually blurred blur area.
  • the transition area is located between the face image and the blurred area.
  • the step of determining the blur processing center point of the blur area according to the second preset algorithm includes:
  • the blur processing center point of the blur area is calculated according to the coordinates of each pixel in the blur area.
  • the second preset algorithm is:
  • x is the horizontal coordinate of the pixel
  • y is the vertical coordinate of the pixel
  • target is the target function
  • background is the background function
  • x0 is the horizontal coordinate of the blur processing center point
  • y0 is the vertical coordinate of the blur processing center point.
  • the present application also provides a video compression device
  • the video compression device includes: a memory, a processor, and a video compression program stored on the memory and executable on the processor, so When the video compression program is executed by the processor, the following steps are realized:
  • Gaussian blur processing is performed on the background image to obtain a blurred background image
  • the present application also provides a computer-readable storage medium on which a video compression program is stored.
  • a video compression program is executed by a processor, the video compression method described above is implemented. step.
  • This application obtains a video image and performs face recognition on each frame image in the video image to obtain a face image and a background image in each frame image; Gaussian blur processing is performed on the background image to obtain a blurred background Image; Compress the blurred background image.
  • the application can determine the face area in the image according to skin color, and perform blur compression processing on the part outside the face area, so that during the video transmission process, the user can be guaranteed during the video process
  • the unprocessed face image can meet the requirements of people's face clarity in the video chat process; at the same time, relative The clear background image requires less bandwidth, which can reduce the bandwidth cost of the entire system.
  • FIG. 1 is a schematic structural diagram of a video compression terminal involved in an embodiment of the present application
  • FIG. 2 is a schematic flowchart of a first embodiment of a video compression method of this application
  • FIG. 3 is a schematic diagram of a detailed process of performing face recognition on each frame image in the video image in the embodiment of the present application to obtain the face image and the background image in each frame image;
  • FIG. 4 is a schematic diagram of a detailed process of performing Gaussian blur processing on each frame image to obtain a blurred background image in an embodiment of the present application;
  • FIG. 5 is a schematic diagram of a progressive blurring method in an embodiment of a video compression method of this application.
  • the commonly used video compression algorithm directly compresses the entire video picture, which not only reduces the video transmission cost, but also affects the clarity of the face in the video.
  • the present application provides a video compression method, by obtaining a video image, and performing face recognition on each frame image in the video image to obtain a face image and a background image in each frame image; Gaussian blur processing is performed on the background image to obtain a blurred background image; and compression processing is performed on the blurred background image.
  • This application can realize the recognition of the area of the face in the image in the process of video chat, and the area other than the face is blurred and compressed, thereby ensuring the clarity of the face information in the process of video chat and reducing the cost of video bandwidth .
  • FIG. 1 is a schematic structural diagram of a video compression terminal according to an embodiment of the present application.
  • the terminal may be a PC, or may be a terminal device that can have a video compression function, such as a smart phone, tablet computer, video recorder, or portable computer.
  • a video compression function such as a smart phone, tablet computer, video recorder, or portable computer.
  • the terminal may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, a memory 1005, a camera 1006, stored on the memory, and may be on the processor Video compression program running.
  • the communication bus 1002 is used to implement connection communication between these components.
  • the user interface 1003 may include a display (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface.
  • the network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
  • the memory 1005 may be a high-speed RAM memory, or may be a non-volatile memory (non-volatile memory), such as a disk memory.
  • the memory 1005 may optionally be a storage device independent of the foregoing processor 1001.
  • the terminal may further include a microphone, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and so on.
  • sensors such as light sensors, motion sensors and other sensors.
  • the terminal can also be configured with other sensors such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, which will not be repeated here.
  • FIG. 1 does not constitute a limitation on the terminal, and may include more or less components than those illustrated, or combine certain components, or have different component arrangements.
  • the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a video compression program.
  • the network interface 1004 is mainly used to connect to the background server and perform data communication with the background server;
  • the user interface 1003 is mainly used to connect to the client (user) and perform data communication with the client;
  • the processor 1001 is mainly used to execute the video compression program stored in the memory 1005 to achieve the following steps:
  • Gaussian blur processing is performed on the background image to obtain a blurred background image
  • processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
  • processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
  • Morphological processing is performed on the skin color region of each frame image to obtain a face image and a background image in each frame image.
  • processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
  • the chromaticity of the compensated pixels in each frame image is calculated according to the illumination compensation coefficient and the brightness of the pixels in each frame image.
  • processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
  • Gaussian blur processing is performed on each frame image to get gradually away from the direction of the center point of the blur processing
  • processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
  • Gaussian blur processing is performed on each pixel of the blur area according to the variable radius of the Gaussian blur processing to obtain a gradually blurred blur area.
  • processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
  • the transition area is located between the face image and the blur area.
  • processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
  • processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
  • the blur processing center point of the blur area is calculated according to the coordinates of each pixel in the blur area.
  • processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
  • the second preset algorithm is:
  • x is the horizontal coordinate of the pixel
  • y is the vertical coordinate of the pixel
  • target is the target function
  • background is the background function
  • x0 is the horizontal coordinate of the blur processing center point
  • y0 is the vertical coordinate of the blur processing center point.
  • FIG. 2 is a schematic flowchart of a first embodiment of a video compression method according to this application.
  • the video compression method includes:
  • Step S100 obtaining a video image
  • the video compression method mainly recognizes the area of the face in the image during the video chat process, and blurs the area other than the face to ensure the face information during the video chat process Sharpness also reduces the cost of video bandwidth.
  • the video compression method can be completed by a device with an image processing function such as a terminal or a server.
  • the device with image processing function may be a PC, a server connected to the terminal, or a mobile terminal device such as a smart phone, tablet computer, video recorder, portable computer, or the like.
  • This embodiment uses a mobile terminal as an example for description.
  • This application can be applied to video recording scenarios, as well as video chat sessions through chat software, such as video calls in WeChat or QQ.
  • the embodiment of the present application collects video images through a camera, where the camera may be a camera of the mobile terminal, such as a mobile phone camera or a computer camera.
  • Step S200 Perform face recognition on each frame image in the video image to obtain a face image and a background image in each frame image;
  • This application divides each frame of images into face images and background images through face recognition, mainly by extracting the face features in each frame image to achieve face recognition.
  • face recognition mainly by extracting the face features in each frame image to achieve face recognition.
  • the step of dividing each frame of the video image into a face image and a background image includes:
  • face recognition is mainly performed by skin color recognition.
  • Skin color is important information in face information. Skin color recognition can speed up the recognition process of face recognition, and is a relatively quick and concise method for face recognition. Specific embodiments may also recognize the human face through other techniques, so that each frame of image is divided into a human face image and a background image.
  • skin color analysis is performed on each frame of the video image, which mainly utilizes the clustering characteristics of skin color in a specific color space, that is, skin color in a certain color space, people of different ages, races and genders
  • the chromaticity of the skin tone is stably distributed within a certain range, which can be described by a correlation distribution model.
  • Commonly used distribution models are regional models, Gaussian models, histogram models, etc.
  • the skin color analysis for each frame of image is to first project each frame of image obtained in the instant messaging software video chat to the color space to obtain the brightness and chromaticity of the pixels in each frame of image, and then for each frame Image pixels are compensated for brightness to eliminate differences in brightness of people's skin tones of different ages, races, and genders, and then the chromaticity of each frame of image pixels after compensation is compared with the skin color chromaticity model constructed by a large number of skin color samples. Determine the skin color area of each frame image, and then segment the skin color area to obtain the face image and background image of each frame image. Through this method of skin color recognition, the face image and the background image of each image can be separated.
  • the method for segmenting the skin color region may be a threshold method, a boundary detection method, a matching method, and the like.
  • Step S300 performing Gaussian blur processing on the background image to obtain a blurred background image
  • Gaussian blur is a widely practical technology in image processing, and is a data smoothing technology that is suitable for multiple occasions.
  • the Gaussian fuzzy calculation process is the same as that in the prior art, and no redundant description is given here. To put it simply, the average value of the pixels of a certain pixel of the background image in step S200 is taken, so that the pixel loses details, and the effect of smoothing the pixel is achieved, so that the image becomes blurry. During the blurring process, the larger the range of surrounding pixels, the stronger the blurring effect.
  • the progressive blurring effect may be from the blurred area close to the face image to away from the face image
  • the blur area gradually blurs, that is, the area close to the face image is clearer, and the area farther away from the face image is more blurry; it can also start from the blur area away from the face image to the blur area close to the face image, that is, The area near the face image is blurry, and the area away from the face image is clearer; it can also start from the area in the middle of the blur area and gradually blur toward the two sides, that is, near the face area and away from the face area, that is, in the middle of the background image The area is clearer, and the area near and far away from the face is blurry.
  • Step S400 Compress the blurred background image.
  • each frame image is divided into two images: a face image and a background image, and the background image is Gaussian blurred, and then compressed, so that each frame image is divided into two images: human face
  • the image and the background image are transmitted, and the background image occupies less bandwidth after blurring and compression.
  • the receiving client decompresses the compressed background image to obtain a blurred background image, and merges it with the face image to form an image. In this way, this process realizes the functions to be implemented in this application, effectively reduces the cost of bandwidth, and at the same time ensures the clarity of face information in video chat.
  • the application by acquiring a video image, according to skin color analysis of each frame of the video image, the face image and background image in each frame of image are obtained; Gaussian blur processing is performed on the background image to obtain a blurred background image ; Compress the blurred background image.
  • the application can determine the face area in the image according to skin color, and perform blur compression processing on the part outside the face area, so that during the video transmission process, the user can be guaranteed during the video process
  • the most concerned part the clearness of the face area, but it will not be very important part: the background image is blurred.
  • the unprocessed face image can meet the requirements of people's face clarity in the video chat process; at the same time, relative The clear background image requires less bandwidth, which can reduce the bandwidth cost of the entire system.
  • FIG. 3 is a schematic diagram of a detailed process of performing a skin color analysis on each frame of the video image in the embodiment of the present application to obtain a face image and a background image in each frame of the image.
  • step S200 includes:
  • Step S201 Project the image of each frame into a preset color space to obtain the brightness and chromaticity of pixels in the image of each frame;
  • the preset color spaces are: YCrCb color space, RGB color space, HSI color space, YIQ color space, etc.
  • the projection onto the YCrCb color space is used as an example for description.
  • the YCbCr color space represents color as three sub-views, namely brightness Y, blue chroma Cb and red chroma Cr. In this way, by projecting each frame of image into the YCbCr color space, you can get the two kinds of information of the brightness Y and chroma CrCb of each frame of image pixels.
  • step S202 the first preset algorithm is used to perform brightness compensation on each frame image according to the brightness and chroma of the pixels in each frame image to obtain the chroma of the compensated pixels in each frame image;
  • the difference in skin color between people of different ages, races, and genders is mainly in brightness, but the difference in chroma is small. That is, different skin tones differ greatly in brightness, but are relatively close in chroma.
  • the reference white algorithm is used as an example for description. Specifically, the brightness compensation for each frame image is performed by referring to the white algorithm, that is, in step S201 The luminance Y and chromaticity CrCb of each pixel of the image are calculated and compensated by the reference white algorithm, and the influence of the luminance Y of the pixel in the YCbCr color space is eliminated to obtain the CbCr chromaticity of the pixel of the video image.
  • Step Reference White algorithm is a commonly used brightness compensation algorithm.
  • the brightness compensation process includes:
  • the chromaticity of the compensated pixel in each frame of image is calculated according to the illumination compensation coefficient.
  • Step S203 comparing the chromaticity of the compensated pixels in each frame image with a preset skin color chromaticity Gaussian model to obtain a skin color probability map of pixels in each frame image;
  • the distribution range of skin color on chromaticity can be described by establishing a skin color model.
  • Common skin color models include regional models, Gaussian models, and histogram models.
  • a Gaussian model is used to describe the distribution range of different skin tones in chroma. Specifically, in the CbCr space, a large number of skin color samples are selected for statistics to obtain the distribution range of each skin color in chroma, and then a Gaussian model is used for calculation and description.
  • the Gaussian model is preset in the embodiments of the present application Skin color chroma Gaussian model. Specifically, the chromaticity of the compensated pixels in each frame of image is compared with the preset skin color chromaticity Gaussian model to obtain a skin color probability map of the pixels in each frame of image.
  • the CbCr chromaticity value is compared with the preset skin tone chromaticity Gaussian model, that is, the chromaticity of each pixel in the YCrCb chromaticity space and the distance between the distribution center of the preset skin tone chromaticity Gaussian model and The similarity of skin color, and then the probability that the point is skin color.
  • the chromaticity of the pixel in the YCrCb chromaticity space is The farther the distribution center of the preset skin tone chroma Gaussian model, the smaller the probability that the pixel is skin color, and the chroma of the pixel in the YCrCb chromaticity space is not in the preset skin tone chroma Gaussian model Within the distribution range, the probability that the pixel is skin color is 0. In this way, by comparing the chromaticity of all compensated pixels with a preset skin color chromaticity Gaussian model, a skin color probability map of the entire image can be obtained.
  • Step S204 determine the skin color region of each frame image using an adaptive threshold according to the skin color probability map of pixels in each frame image
  • each frame image After obtaining the skin color probability map of each frame image, the entire image needs to be segmented, and then it is determined that each frame image is divided into a skin color area and a background area.
  • segmentation methods include threshold method, boundary detection method, matching method and so on.
  • an adaptive threshold method is used for segmentation. Specifically, the skin color probability map of each pixel in each frame of image is compared with the preset adaptive threshold. If the skin color probability of the pixel is greater than the set adaptive threshold, the pixel is the skin color area, and the skin color of the pixel If the probability is less than the set adaptive threshold, the pixel is a non-skin area. In this way, the adaptive threshold can be used to determine the skin area and non-skin area of each image.
  • the adaptive threshold segmentation method is a more common segmentation method for image segmentation.
  • the adaptive threshold segmentation method is simpler to calculate and less affected by other factors.
  • step S205 morphological processing is performed on the skin color region of each frame image to obtain a face image and a background image in each frame image.
  • the skin color area of each frame of the image segmented is not a coherent whole, more scattered, or even composed of multiple unconnected image areas.
  • morphological processing needs to be used to improve the segmentation effect .
  • the segmented skin color region is processed with a morphological processing-related algorithm to make the skin color region boundary smoother, and the dispersed skin color regions are completely connected as a whole.
  • the overall skin color area is the face image, and the other area is the background image. In this way, the whole frame image is divided into two parts: a face image and a background image.
  • the morphological processing method is a commonly used image processing method, and the image processing process is the same as in the prior art, and no redundant description is provided here.
  • FIG. 4 is a schematic diagram of a detailed process of performing Gaussian blur processing on each frame image to obtain a blurred background image in an embodiment of the present application.
  • step S300 further includes:
  • Step S301 Perform Gaussian filtering on the background image to obtain the transition area and the blur area;
  • the blur processing adopts a progressive blur processing method, which divides each frame of the image into three areas, namely a clear area, a transition area, and a blur area.
  • the transition area is located between the clear area and the blur area.
  • the clear area The resolution of is greater than the resolution of the transition area, and the resolution of the transition area is greater than the resolution of the blurred area.
  • FIG. 5 is a schematic diagram of the progressive blurring method in the embodiment of the video compression method of the present application.
  • the face image and the background image of each frame image in the chat video are cut and separated, and the background image is subjected to Gaussian filter processing.
  • the separated face image is our clear area a, and the background image after Gaussian filtering is divided into transition area b and blur area c.
  • Gaussian filter processing is a common method for image processing, which is the same as in the prior art, and will not be redundantly described here.
  • Step S302 Determine a blur processing center point of the blur area according to a second preset algorithm
  • the second preset algorithm is:
  • x is the horizontal coordinate of the pixel
  • y is the vertical coordinate of the pixel
  • target is the target function
  • background is the background function
  • x0 is the horizontal coordinate of the blur processing center point
  • y0 is the vertical coordinate of the blur processing center point.
  • the blur processing center point of the blur area is determined according to the second preset algorithm, and the blur processing center point is located in the clear area.
  • the position coordinates of the blur processing center point of the blur area c are calculated by the above formula, and then the position of the blur processing center point is obtained, and the blur processing center point is located in the clear area a.
  • Step S303 Calculate the distance between each pixel in the blur area and the blur processing center point according to the blur processing center point;
  • the distance between each pixel in the blur area c and the blur processing center point can be obtained.
  • Step S304 Calculate the variable radius of each pixel in the blur area for Gaussian blur processing according to the distance between each pixel in the blur area and the center point of the blur processing;
  • the size of the distance between each pixel point in the blur area c and the center point of the blur processing is related calculated to obtain the variable Gaussian blur processing radius.
  • Step S305 Perform Gaussian blur processing on each pixel of the blur area according to the variable radius of the Gaussian blur processing to obtain a gradually blurred blur area.
  • the larger the variable radius of the Gaussian blur processing the more blurred the image blur processing effect after the Gaussian blur processing; on the contrary, the smaller the variable radius of the Gaussian blur processing, the Gaussian blur processing The later the image blurring effect is clearer, that is, the pixels near the blurring center point are clearer, and the pixels farther from the blurring center point are blurry.
  • each pixel in the blur area c is Gaussian blurred according to the size of the variable radius of the Gaussian blur processing.
  • the larger the variable radius of the Gaussian blur processing of each pixel in the blur area c the more blurred the Gaussian blur.
  • the smaller the variable radius of the Gaussian blur processing of each pixel in the blur area c the clearer the Gaussian blur. That is, in the blur area c, the closer to the clear area a, the clearer the image blur effect, and the farther away from the clear area a, the more blurred the image blur effect, thus forming a gradual blur from the clear area to the blur area Effect.
  • compressing the blur area c with the progressive blur effect together with the transition area b can reduce the bandwidth of the video chat during transmission, and at the same time ensure the clarity of face information that has not been processed by blur compression.
  • the blurring process from the clear area to the blurry area can have a more natural transition, so that the processed image in the video chat process does not appear too abrupt, and the background blur is improved. effect.
  • the face image and the background image in each frame image are separated to obtain the face image and the background image, and the background image is subjected to Gaussian filter processing to obtain the transition area and the blur area;
  • Two preset algorithms determine the blur processing center point of the blur area; according to the blur processing center point, calculate the distance between each pixel point in the blur area and the blur processing center point; according to the blur area
  • the distance between the pixel point and the center point of the blur processing calculates the variable radius of each pixel point of the blur area for Gaussian blur processing; the Gaussian blur processing of each pixel point of the blur area according to the variable radius of the Gaussian blur processing, Obtain progressively blurred areas of blur.
  • the image is divided into two face image parts and a background image part.
  • the background image is blurred and compressed, which can reduce the bandwidth of the entire frame image during transmission, and can also ensure that the image is not blurred and compressed.
  • the clarity of the face image The method of progressive blur processing from the clear area to the blur area can make the blur effect more natural and the transition more coherent.
  • embodiments of the present application also provide a computer-readable storage medium that stores a video compression program on the computer-readable storage medium, and when the video compression program is executed by a processor, implements the steps of the video compression method described above .
  • the methods in the above embodiments can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware, but in many cases the former is better Implementation.
  • the technical solution of the present application can be embodied in the form of a software product in essence or part that contributes to the existing technology, and the computer software product is stored in a storage medium (such as ROM/RAM) as described above , Disk, CD), including several instructions to make a terminal device (which can be a mobile phone, computer, server, air conditioner, or network equipment, etc.) to perform the method described in each embodiment of the present application.

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Signal Processing (AREA)
  • General Engineering & Computer Science (AREA)
  • Image Processing (AREA)
  • Image Analysis (AREA)

Abstract

Disclosed is a video compression method. The method comprises: acquiring a video image; carrying out face recognition on each frame of an image in the video image to obtain a face image and a background image in each frame of the image; carrying out Gaussian blurring processing on the background image to obtain a blurred background image; and carrying out compression processing on the blurred background image. Also disclosed are a video compression apparatus and a computer-readable storage medium. The present application can achieve the effects that in a video chat process, the clarity of face information in a video process can be ensured, and the bandwidth of a video can also be reduced.

Description

视频压缩方法、装置和计算机可读存储介质Video compression method, device and computer readable storage medium
本申请要求于2018年12月17日提交中国专利局、申请号为201811546877.5、发明名称为“视频压缩方法、装置和计算机可读存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。This application requires the priority of the Chinese patent application filed on December 17, 2018 in the Chinese Patent Office with the application number 201811546877.5 and the invention titled "Video compression method, device and computer-readable storage medium" In the application.
技术领域Technical field
本申请涉及视频处理领域,尤其涉及一种视频压缩方法、装置和计算机可读存储介质。This application relates to the field of video processing, and in particular, to a video compression method, device, and computer-readable storage medium.
背景技术Background technique
随着经济和互联网的发展,人们之间的交流方式已在渐渐发生变化,视频聊天逐渐取代普通语言文字,成为人们工作或日常生活中交流和交流的重要方式。With the development of the economy and the Internet, the way of communication between people has gradually changed. Video chat has gradually replaced ordinary language and text, and has become an important way for people to communicate and communicate in work or daily life.
视频聊天过程中的视频信息是由一帧帧图像组成的,但现在的视频图像中包含了大量的冗余信息,在视频数字化传送过程中占用了大量的带宽,影响了运行的成本和视频的流畅度。但为了减少运行成本和提高视频流畅度,出现了很多压缩方法,如JPEG和MPEG方法等。The video information in the video chat process is composed of one frame of image, but the current video image contains a lot of redundant information, which takes up a lot of bandwidth during the digital transmission of video, which affects the cost of operation and the video’s Fluency. However, in order to reduce operating costs and improve video fluency, many compression methods have emerged, such as JPEG and MPEG methods.
然而目前的压缩方法会将每帧图像中所有内容进行压缩,从而导致视频中人脸的清晰度降低,无法满足人们视频聊天过程中对人脸清晰度的要求。However, the current compression method will compress all the content in each frame of the image, which leads to the reduction of the clarity of the face in the video, which cannot meet the requirements of people in the process of video chatting.
发明内容Summary of the invention
本申请的主要目的在于提供一种视频压缩方法、装置和计算机可读存储介质,旨在实现在视频聊天中将人脸所在区域识别出来,并将人脸所在区域以外的部分做模糊压缩处理,即能降低整个过程的带宽成本,又能保证视频中人脸信息的清晰度和流畅度。The main purpose of the present application is to provide a video compression method, device and computer-readable storage medium, aiming to realize the recognition of the area where the face is located in the video chat and blur the compression of the part outside the area where the face is located, Not only can reduce the bandwidth cost of the entire process, but also ensure the clarity and fluency of face information in the video.
为实现上述目的,本申请提供一种视频压缩方法,所述视频压缩方法包括以下步骤:To achieve the above objective, the present application provides a video compression method, which includes the following steps:
获取视频图像;Get video images;
对所述视频图像中每帧图像进行人脸识别,得到所述每帧图像中的人脸图像和背景图像;Performing face recognition on each frame of the video image to obtain the face image and background image in each frame of the image;
对所述背景图像进行高斯模糊处理得到模糊的背景图像;Gaussian blur processing is performed on the background image to obtain a blurred background image;
对所述模糊的背景图像进行压缩处理。Compress the blurred background image.
在一种实现方式中,所述将所述所述视频图像中每帧图像划分为人脸图像和背景图像的步骤包括:In an implementation manner, the step of dividing each frame of the video image into a face image and a background image includes:
对所述视频图像中每帧图像进行肤色分析,得到所述每帧图像中的人脸图像和背景图像。Perform skin color analysis on each frame of the video image to obtain the face image and background image in each frame of image.
在一种实现方式中,所述对所述视频图像中每帧图像进行肤色分析,得到所述每帧图像中的人脸图像和背景图像的步骤包括:In an implementation manner, the step of performing skin color analysis on each frame of the video image to obtain the face image and background image in each frame includes:
将所述每帧图像投射到预设的色彩空间,得到所述每帧图像中像素点的亮度与色度;Project the image of each frame into a preset color space to obtain the brightness and chromaticity of pixels in the image of each frame;
根据所述每帧图像中像素点的亮度与色度利用第一预设算法对所述每帧图像进行亮度补偿,得到每帧图像中补偿后的像素点的色度;Using a first preset algorithm to perform brightness compensation on each frame image according to the brightness and chromaticity of pixels in each frame image to obtain the chromaticity of the compensated pixel points in each frame image;
将所述每帧图像中补偿后的像素点的色度与预设的肤色色度高斯模型进行对比,得到每帧图像中像素点的肤色概率图;Comparing the chromaticity of the compensated pixels in each frame image with a preset skin tone chromaticity Gaussian model to obtain a skin color probability map of pixels in each frame image;
根据所述每帧图像中像素点的肤色概率图利用自适应阈值确定每帧图像的肤色区域;Determine the skin color area of each frame image by using an adaptive threshold according to the skin color probability map of pixels in each frame image;
对所述每帧图像的肤色区域进行形态学处理得到每帧图像中的人脸图像和背景图像。Morphological processing is performed on the skin color region of each frame image to obtain a face image and a background image in each frame image.
在一种实现方式中,所述根据所述每帧图像中像素点的亮度与色度利用第一预设算法对所述每帧图像进行亮度补偿,得到每帧图像中补偿后的像素点的色度的步骤包括:In an implementation manner, the first preset algorithm is used to perform brightness compensation on each frame image according to the brightness and chromaticity of the pixels in each frame image to obtain the compensated pixels in each frame image The chroma steps include:
根据所述每帧图像中像素点的亮度计算每帧图像中像素点的平均像素灰度值;Calculating the average pixel gray value of the pixels in each frame image according to the brightness of the pixels in each frame image;
根据所述平均像素灰度值计算光照补偿系数;Calculate the illumination compensation coefficient according to the average pixel gray value;
根据所述光照补偿系数,以及每帧图像中像素点的亮度计算获得每帧图像中补偿后的像素点的色度。The chromaticity of the compensated pixels in each frame image is calculated according to the illumination compensation coefficient and the brightness of the pixels in each frame image.
在一种实现方式中,所述对所述每帧图像进行高斯模糊处理得到模糊的背景图像的步骤包括:In an implementation manner, the step of performing Gaussian blur processing on each frame image to obtain a blurred background image includes:
对所述每帧图像进行高斯模糊处理得到从远离模糊处理中心点的方向渐进模糊的背景图像。Gaussian blur processing is performed on each image to obtain a background image that is gradually blurred from a direction away from the center point of the blur processing.
在一种实现方式中,所述对所述每帧图像进行高斯模糊处理得到渐进模 糊的背景图像的步骤包括:In an implementation manner, the step of performing Gaussian blur processing on each image to obtain a progressively blurred background image includes:
对背景图像进行高斯滤波处理,得到过渡区域和模糊区域;Perform Gaussian filtering on the background image to obtain transition areas and blurred areas;
根据第二预设算法确定所述模糊区域的模糊处理中心点;Determine the center point of the blur processing of the blur area according to a second preset algorithm;
根据所述模糊处理中心点,计算出所述模糊区域中各像素点与所述模糊处理中心点的距离;Calculating the distance between each pixel in the blur area and the blur processing center point according to the blur processing center point;
根据所述模糊区域中各像素点与所述模糊处理中心点的距离计算出模糊区域各像素点进行高斯模糊处理的可变半径;Calculating the variable radius of each pixel in the blur area for Gaussian blur processing according to the distance between each pixel in the blur area and the center point of the blur processing;
根据所述高斯模糊处理的可变半径对所述模糊区域各像素点进行高斯模糊处理,得到渐进模糊的模糊区域。Gaussian blur processing is performed on each pixel of the blur area according to the variable radius of the Gaussian blur processing to obtain a gradually blurred blur area.
在一种实现方式中,所述过渡区域位于所述人脸图像和所述模糊区域之间。In one implementation, the transition area is located between the face image and the blurred area.
在一种实现方式中,所述模糊区域中各像素点与所述模糊处理中心点的距离越大,计算的高斯模糊处理的可变半径越大,进行高斯处理后的图像越模糊;所述模糊区域中各像素点与所述模糊处理中心点的距离越小,计算的高斯模糊处理的可变半径越小,进行高斯处理后的图像越清晰。In an implementation manner, the larger the distance between each pixel in the blur area and the center point of the blur processing, the larger the calculated variable radius of the Gaussian blur processing, and the more blurred the image after the Gaussian processing; The smaller the distance between each pixel in the blur area and the center point of the blur processing, the smaller the calculated variable radius of the Gaussian blur processing, and the sharper the image after the Gaussian processing.
在一种实现方式中,根据第二预设算法确定所述模糊区域的模糊处理中心点的步骤包括:In an implementation manner, the step of determining the blur processing center point of the blur area according to the second preset algorithm includes:
根据所述模糊区域中的各像素点的坐标计算所述模糊区域的模糊处理中心点。The blur processing center point of the blur area is calculated according to the coordinates of each pixel in the blur area.
在一种实现方式中,所述第二预设算法为:In one implementation, the second preset algorithm is:
Figure PCTCN2019126016-appb-000001
Figure PCTCN2019126016-appb-000001
Figure PCTCN2019126016-appb-000002
Figure PCTCN2019126016-appb-000002
Figure PCTCN2019126016-appb-000003
Figure PCTCN2019126016-appb-000003
其中,x为像素点的横坐标,y为像素点的纵坐标,target为目标函数,background为背景函数,x0为模糊处理中心点的横坐标,y0为模糊处理中心点的纵坐标。Where x is the horizontal coordinate of the pixel, y is the vertical coordinate of the pixel, target is the target function, background is the background function, x0 is the horizontal coordinate of the blur processing center point, and y0 is the vertical coordinate of the blur processing center point.
此外,为实现上述目的,本申请还提供一种视频压缩装置,所述视频压缩装置包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的视频压缩程序,所述视频压缩程序被所述处理器执行时实现以下步骤:In addition, in order to achieve the above object, the present application also provides a video compression device, the video compression device includes: a memory, a processor, and a video compression program stored on the memory and executable on the processor, so When the video compression program is executed by the processor, the following steps are realized:
获取视频图像;Get video images;
对所述视频图像中每帧图像进行人脸识别,得到所述每帧图像中的人脸图像和背景图像;Performing face recognition on each frame of the video image to obtain the face image and background image in each frame of the image;
对所述背景图像进行高斯模糊处理得到模糊的背景图像;Gaussian blur processing is performed on the background image to obtain a blurred background image;
对所述模糊的背景图像进行压缩处理。Compress the blurred background image.
此外,为实现上述目的,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有视频压缩程序,所述视频压缩程序被处理器执行时实现上述的视频压缩方法的步骤。In addition, in order to achieve the above object, the present application also provides a computer-readable storage medium on which a video compression program is stored. When the video compression program is executed by a processor, the video compression method described above is implemented. step.
本申请通过获取视频图像,根据对所述视频图像中每帧图像进行人脸识别,得到所述每帧图像中的人脸图像和背景图像;对所述背景图像进行高斯模糊处理得到模糊的背景图像;对所述模糊的背景图像进行压缩处理。通过上述方式,本申请在获取视频图像时,能够根据肤色确定出图像中人脸区域,并对人脸区域以外的部分进行模糊压缩处理,这样在视频传输的过程中既能保证视频过程中用户最关注的部分:人脸区域的清晰,又将不是很重要的部分:背景图像进行模糊处理。相对于现有技术中将每帧图像中所有内容进行压缩的方式,本申请中,分割出来的未进行处理的人脸图像能够满足人们视频聊天过程中对人脸清晰度的要求;同时,相对清晰的背景图像,所需带宽较小,能够降低整个系统的带宽成本。This application obtains a video image and performs face recognition on each frame image in the video image to obtain a face image and a background image in each frame image; Gaussian blur processing is performed on the background image to obtain a blurred background Image; Compress the blurred background image. In the above manner, when acquiring a video image, the application can determine the face area in the image according to skin color, and perform blur compression processing on the part outside the face area, so that during the video transmission process, the user can be guaranteed during the video process The most concerned part: the clearness of the face area, but it will not be very important part: the background image is blurred. Compared with the method of compressing all the content in each frame of the image in the prior art, in this application, the unprocessed face image can meet the requirements of people's face clarity in the video chat process; at the same time, relative The clear background image requires less bandwidth, which can reduce the bandwidth cost of the entire system.
附图说明BRIEF DESCRIPTION
图1为本申请实施例方案涉及的视频压缩终端结构示意图;FIG. 1 is a schematic structural diagram of a video compression terminal involved in an embodiment of the present application;
图2为本申请视频压缩方法第一实施例的流程示意图;2 is a schematic flowchart of a first embodiment of a video compression method of this application;
图3为本申请实施例中对所述视频图像中每帧图像进行人脸识别,得到所述每帧图像中的人脸图像和背景图像的一细化流程示意图;3 is a schematic diagram of a detailed process of performing face recognition on each frame image in the video image in the embodiment of the present application to obtain the face image and the background image in each frame image;
图4为本申请实施例中对所述每帧图像进行高斯模糊处理得到模糊的背 景图像的一细化流程示意图;4 is a schematic diagram of a detailed process of performing Gaussian blur processing on each frame image to obtain a blurred background image in an embodiment of the present application;
图5为本申请视频压缩方法实施例中渐进模糊方式示意图。5 is a schematic diagram of a progressive blurring method in an embodiment of a video compression method of this application.
具体实施方式detailed description
应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。It should be understood that the specific embodiments described herein are only used to explain the present application, and are not used to limit the present application.
由于在现有技术中,常用的视频压缩算法是直接对视频画面整体进行压缩,在降低视频传输成本的同时,却也影响了视频中人脸的清晰度。In the prior art, the commonly used video compression algorithm directly compresses the entire video picture, which not only reduces the video transmission cost, but also affects the clarity of the face in the video.
为了解决上述技术问题,本申请提供一种视频压缩方法,通过获取视频图像,根据对所述视频图像中每帧图像进行人脸识别,得到所述每帧图像中的人脸图像和背景图像;对所述背景图像进行高斯模糊处理得到模糊的背景图像;对所述模糊的背景图像进行压缩处理。本申请能够实现在视频聊天过程中识别出图像中人脸所在区域,并且将人脸以外的区域作模糊压缩处理,从而保证在视频聊天过程中人脸信息清晰度的同时也降低了视频带宽成本。In order to solve the above technical problems, the present application provides a video compression method, by obtaining a video image, and performing face recognition on each frame image in the video image to obtain a face image and a background image in each frame image; Gaussian blur processing is performed on the background image to obtain a blurred background image; and compression processing is performed on the blurred background image. This application can realize the recognition of the area of the face in the image in the process of video chat, and the area other than the face is blurred and compressed, thereby ensuring the clarity of the face information in the process of video chat and reducing the cost of video bandwidth .
请参阅图1,图1为本申请实施例方案涉及的视频压缩终端结构示意图。Please refer to FIG. 1, which is a schematic structural diagram of a video compression terminal according to an embodiment of the present application.
本申请实施例终端可以是PC,也可以是智能手机、平板电脑、录像机、便携计算机等可具有视频压缩功能的终端设备。In this embodiment of the present application, the terminal may be a PC, or may be a terminal device that can have a video compression function, such as a smart phone, tablet computer, video recorder, or portable computer.
如图1所示,该终端可以包括:处理器1001,例如CPU,通信总线1002,用户接口1003,网络接口1004,存储器1005,摄像头1006,存储在所述存储器上并可在所述处理器上运行的视频压缩程序。其中,通信总线1002用于实现这些组件之间的连接通信。用户接口1003可以包括显示屏(Display)、输入单元比如键盘(Keyboard),可选用户接口1003还可以包括标准的有线接口、无线接口。网络接口1004可选的可以包括标准的有线接口、无线接口(如WI-FI接口)。存储器1005可以是高速RAM存储器,也可以是稳定的存储器(non-volatile memory),例如磁盘存储器。存储器1005可选的还可以是独立于前述处理器1001的存储装置。As shown in FIG. 1, the terminal may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, a memory 1005, a camera 1006, stored on the memory, and may be on the processor Video compression program running. Among them, the communication bus 1002 is used to implement connection communication between these components. The user interface 1003 may include a display (Display), an input unit such as a keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory, or may be a non-volatile memory (non-volatile memory), such as a disk memory. The memory 1005 may optionally be a storage device independent of the foregoing processor 1001.
在一种实现方式中,终端还可以包括麦克风、RF(Radio Frequency,射频)电路,传感器、音频电路、WiFi模块等等。其中,传感器比如光传感器、运动传感器以及其他传感器。当然,终端还可配置陀螺仪、气压计、湿度计、 温度计、红外线传感器等其他传感器,在此不再赘述。In an implementation manner, the terminal may further include a microphone, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, and so on. Among them, sensors such as light sensors, motion sensors and other sensors. Of course, the terminal can also be configured with other sensors such as gyroscopes, barometers, hygrometers, thermometers, and infrared sensors, which will not be repeated here.
本领域技术人员可以理解,图1中示出的终端结构并不构成对终端的限定,可以包括比图示更多或更少的部件,或者组合某些部件,或者不同的部件布置。A person skilled in the art may understand that the terminal structure shown in FIG. 1 does not constitute a limitation on the terminal, and may include more or less components than those illustrated, or combine certain components, or have different component arrangements.
如图1所示,作为一种计算机存储介质的存储器1005中可以包括操作系统、网络通信模块、用户接口模块以及视频压缩程序。As shown in FIG. 1, the memory 1005 as a computer storage medium may include an operating system, a network communication module, a user interface module, and a video compression program.
在图1所示的终端中,网络接口1004主要用于连接后台服务器,与后台服务器进行数据通信;用户接口1003主要用于连接客户端(用户端),与客户端进行数据通信;而处理器1001主要用于执行存储器1005中存储的视频压缩程序,以实现以下步骤:In the terminal shown in FIG. 1, the network interface 1004 is mainly used to connect to the background server and perform data communication with the background server; the user interface 1003 is mainly used to connect to the client (user) and perform data communication with the client; and the processor 1001 is mainly used to execute the video compression program stored in the memory 1005 to achieve the following steps:
获取视频图像;Get video images;
对所述视频图像中每帧图像进行人脸识别,得到所述每帧图像中的人脸图像和背景图像;Performing face recognition on each frame of the video image to obtain the face image and background image in each frame of the image;
对所述背景图像进行高斯模糊处理得到模糊的背景图像;Gaussian blur processing is performed on the background image to obtain a blurred background image;
对所述模糊的背景图像进行压缩处理。Compress the blurred background image.
进一步地,所述处理器1002主要用于执行存储器1001中存储的视频压缩程序,以实现以下步骤:Further, the processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
对所述视频图像中每帧图像进行肤色分析,得到所述每帧图像中的人脸图像和背景图像。Perform skin color analysis on each frame of the video image to obtain the face image and background image in each frame of image.
进一步地,所述处理器1002主要用于执行存储器1001中存储的视频压缩程序,以实现以下步骤:Further, the processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
将所述每帧图像投射到预设的色彩空间,得到所述每帧图像中像素点的亮度与色度;Project the image of each frame into a preset color space to obtain the brightness and chromaticity of pixels in the image of each frame;
根据所述每帧图像中像素点的亮度与色度利用第一预设算法对所述每帧图像进行亮度补偿,得到每帧图像中补偿后的像素点的色度;Using a first preset algorithm to perform brightness compensation on each frame image according to the brightness and chroma of pixels in each frame image to obtain the chroma of the compensated pixels in each frame image;
将所述每帧图像中补偿后的像素点的色度与预设的肤色色度高斯模型进行对比,得到每帧图像中像素点的肤色概率图;Comparing the chromaticity of the compensated pixels in each frame image with a preset skin tone chromaticity Gaussian model to obtain a skin color probability map of pixels in each frame image;
根据所述每帧图像中像素点的肤色概率图利用自适应阈值确定每帧图像的肤色区域;Determine the skin color area of each frame image by using an adaptive threshold according to the skin color probability map of pixels in each frame image;
对所述每帧图像的肤色区域进行形态学处理得到每帧图像中的人脸图像 和背景图像。Morphological processing is performed on the skin color region of each frame image to obtain a face image and a background image in each frame image.
进一步地,所述处理器1002主要用于执行存储器1001中存储的视频压缩程序,以实现以下步骤:Further, the processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
根据所述每帧图像中像素点的亮度与色度计算每帧图像中像素点的平均像素灰度值;Calculating the average pixel gray value of the pixels in each frame image according to the brightness and chroma of the pixels in each frame image;
根据所述平均像素灰度值计算光照补偿系数;Calculate the illumination compensation coefficient according to the average pixel gray value;
根据所述光照补偿系数,以及每帧图像中像素点的亮度计算获得每帧图像中补偿后的像素点的色度。The chromaticity of the compensated pixels in each frame image is calculated according to the illumination compensation coefficient and the brightness of the pixels in each frame image.
进一步地,所述处理器1002主要用于执行存储器1001中存储的视频压缩程序,以实现以下步骤:Further, the processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
对所述每帧图像进行高斯模糊处理得到从远离模糊处理中心点的方向渐Gaussian blur processing is performed on each frame image to get gradually away from the direction of the center point of the blur processing
进模糊的背景图像。Into the blurred background image.
进一步地,所述处理器1002主要用于执行存储器1001中存储的视频压缩程序,以实现以下步骤:Further, the processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
对背景图像进行高斯滤波处理,得到过渡区域和模糊区域;Perform Gaussian filtering on the background image to obtain transition areas and blurred areas;
根据第二预设算法确定所述模糊区域的模糊处理中心点;Determine the center point of the blur processing of the blur area according to a second preset algorithm;
根据所述模糊处理中心点,计算出所述模糊区域中各像素点与所述模糊处理中心点的距离;Calculating the distance between each pixel in the blur area and the blur processing center point according to the blur processing center point;
根据所述模糊区域中各像素点与所述模糊处理中心点的距离计算出模糊区域各像素点进行高斯模糊处理的可变半径;Calculating the variable radius of each pixel in the blur area for Gaussian blur processing according to the distance between each pixel in the blur area and the center point of the blur processing;
根据所述高斯模糊处理的可变半径对所述模糊区域各像素点进行高斯模糊处理,得到渐进模糊的模糊区域。Gaussian blur processing is performed on each pixel of the blur area according to the variable radius of the Gaussian blur processing to obtain a gradually blurred blur area.
进一步地,所述处理器1002主要用于执行存储器1001中存储的视频压缩程序,以实现以下步骤:Further, the processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
所述过渡区域位于所述人脸图像和所述模糊区域之间。The transition area is located between the face image and the blur area.
进一步地,所述处理器1002主要用于执行存储器1001中存储的视频压缩程序,以实现以下步骤:Further, the processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
所述模糊区域中各像素点与所述模糊处理中心点的距离越大,计算的高斯模糊处理的可变半径越大,进行高斯处理后的图像越模糊;所述模糊区域中各像素点与所述模糊处理中心点的距离越小,计算的高斯模糊处理的可变 半径越小,进行高斯处理后的图像越清晰。The larger the distance between each pixel in the blur area and the center point of the blur processing, the larger the calculated variable radius of the Gaussian blur processing, and the more blurred the image after the Gaussian processing is; The smaller the distance of the center point of the blur processing, the smaller the calculated variable radius of the Gaussian blur processing, and the sharper the image after the Gaussian processing.
进一步地,所述处理器1002主要用于执行存储器1001中存储的视频压缩程序,以实现以下步骤:Further, the processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
根据所述模糊区域中的各像素点的坐标计算所述模糊区域的模糊处理中心点。The blur processing center point of the blur area is calculated according to the coordinates of each pixel in the blur area.
进一步地,所述处理器1002主要用于执行存储器1001中存储的视频压缩程序,以实现以下步骤:Further, the processor 1002 is mainly used to execute the video compression program stored in the memory 1001 to implement the following steps:
所述第二预设算法为:The second preset algorithm is:
Figure PCTCN2019126016-appb-000004
Figure PCTCN2019126016-appb-000004
Figure PCTCN2019126016-appb-000005
Figure PCTCN2019126016-appb-000005
Figure PCTCN2019126016-appb-000006
Figure PCTCN2019126016-appb-000006
其中,x为像素点的横坐标,y为像素点的纵坐标,target为目标函数,background为背景函数,x0为模糊处理中心点的横坐标,y0为模糊处理中心点的纵坐标。Where x is the horizontal coordinate of the pixel, y is the vertical coordinate of the pixel, target is the target function, background is the background function, x0 is the horizontal coordinate of the blur processing center point, and y0 is the vertical coordinate of the blur processing center point.
本申请视频压缩设备的具体实施例与下述视频压缩方法各实施例基本相同,在此不作赘述。The specific embodiments of the video compression device of the present application are basically the same as the following embodiments of the video compression method, and details are not described herein.
请参阅图2,图2为本申请视频压缩方法第一实施例的流程示意图。Please refer to FIG. 2, which is a schematic flowchart of a first embodiment of a video compression method according to this application.
在本申请实施例中,该视频压缩方法包括:In the embodiment of the present application, the video compression method includes:
步骤S100,获取视频图像;Step S100, obtaining a video image;
在本申请实施例中,该视频压缩方法主要是通过在视频聊天过程中识别出图像中人脸所在区域,并且将人脸以外的区域作模糊压缩处理,从而保证在视频聊天过程中人脸信息清晰度的同时也降低了视频带宽成本。该视频压缩方法可以通过终端或者服务器等具有图像处理功能的设备来完成。具体的,具有图像处理功能的设备可以是PC,与终端相连的服务器,也可以是智能手 机、平板电脑、录像机、便携计算机等可移动式终端设备。本实施例以移动终端为例进行说明。本申请可以应用于录像场景,也可以应用于通过聊天软件进行视频会话的场景,比如应用于微信或QQ中视频通话等。In the embodiment of the present application, the video compression method mainly recognizes the area of the face in the image during the video chat process, and blurs the area other than the face to ensure the face information during the video chat process Sharpness also reduces the cost of video bandwidth. The video compression method can be completed by a device with an image processing function such as a terminal or a server. Specifically, the device with image processing function may be a PC, a server connected to the terminal, or a mobile terminal device such as a smart phone, tablet computer, video recorder, portable computer, or the like. This embodiment uses a mobile terminal as an example for description. This application can be applied to video recording scenarios, as well as video chat sessions through chat software, such as video calls in WeChat or QQ.
本申请实施例通过摄像头采集视频图像,其中,摄像头可以为所述移动终端的摄像头,例如手机摄像头、电脑摄像头。The embodiment of the present application collects video images through a camera, where the camera may be a camera of the mobile terminal, such as a mobile phone camera or a computer camera.
步骤S200,对所述视频图像中每帧图像进行人脸识别,得到所述每帧图像中的人脸图像和背景图像;Step S200: Perform face recognition on each frame image in the video image to obtain a face image and a background image in each frame image;
本申请通过人脸识别将每帧图像划分为人脸图像和背景图像,主要通过对每帧图像中人脸特征进行提取,从而实现人脸识别,目前人脸识别技术存在较多现有技术,此处不做详细介绍。This application divides each frame of images into face images and background images through face recognition, mainly by extracting the face features in each frame image to achieve face recognition. At present, there are many existing technologies in face recognition technology. No detailed introduction will be given here.
作为另一中实施例,所述将所述所述视频图像中每帧图像划分为人脸图像和背景图像的步骤包括:As another embodiment, the step of dividing each frame of the video image into a face image and a background image includes:
对所述视频图像中每帧图像进行肤色分析,得到所述每帧图像中的人脸图像和背景图像。Perform skin color analysis on each frame of the video image to obtain the face image and background image in each frame of image.
本实施例主要通过肤色识别来进行人脸识别,肤色是人脸信息中的重要信息,通过肤色识别,能加快人脸识别的识别过程,是较为快速简洁的进行人脸识别的方法。具体实施例还可以通过其他方式技术识别人脸,从而将每帧图像划分为人脸图像和背景图像。In this embodiment, face recognition is mainly performed by skin color recognition. Skin color is important information in face information. Skin color recognition can speed up the recognition process of face recognition, and is a relatively quick and concise method for face recognition. Specific embodiments may also recognize the human face through other techniques, so that each frame of image is divided into a human face image and a background image.
具体地,对所述视频图像中每帧图像进行肤色分析,主要是利用了肤色在特定的色彩空间具有聚类性的特点,即肤色在一定的色彩空间内,不同年龄、种族和性别的人的肤色的色度稳定分布在一定的范围内,该范围能用相关分布模型来描述。常用的分布模型有区域模型,高斯模型,直方图模型等。在本实施例中,对每帧图像进行肤色分析是先将在即时通信软件视频聊天中获取的每帧图像投射到色彩空间,得到每帧图像中像素点的亮度与色度,然后对每帧图像像素点进行亮度补偿,以消除不同年龄、种族和性别的人肤色在亮度上的区别,再将补偿后的每帧图像像素点的色度与大量肤色样本构建的肤色色度模型进行对比,确定出每帧图像的肤色区域,在对肤色区域进行分割处理,得到每帧图像的人脸图像和背景图像。通过这样肤色识别的方法,就能将每幅图像的人脸图像和背景图像分别开来。在本申请实施例中,对肤色区域进行分割的方法可以是阈值法,边界探测法,匹配法等。Specifically, skin color analysis is performed on each frame of the video image, which mainly utilizes the clustering characteristics of skin color in a specific color space, that is, skin color in a certain color space, people of different ages, races and genders The chromaticity of the skin tone is stably distributed within a certain range, which can be described by a correlation distribution model. Commonly used distribution models are regional models, Gaussian models, histogram models, etc. In this embodiment, the skin color analysis for each frame of image is to first project each frame of image obtained in the instant messaging software video chat to the color space to obtain the brightness and chromaticity of the pixels in each frame of image, and then for each frame Image pixels are compensated for brightness to eliminate differences in brightness of people's skin tones of different ages, races, and genders, and then the chromaticity of each frame of image pixels after compensation is compared with the skin color chromaticity model constructed by a large number of skin color samples. Determine the skin color area of each frame image, and then segment the skin color area to obtain the face image and background image of each frame image. Through this method of skin color recognition, the face image and the background image of each image can be separated. In the embodiment of the present application, the method for segmenting the skin color region may be a threshold method, a boundary detection method, a matching method, and the like.
步骤S300,对所述背景图像进行高斯模糊处理得到模糊的背景图像;Step S300, performing Gaussian blur processing on the background image to obtain a blurred background image;
在本实施例中,采用的是高斯模糊处理方式,高斯模糊是图像处理中广泛实用的技术,是一种数据平滑技术,适用于多个场合。高斯模糊计算处理过程与现有技术中相同,此处不做多余赘述。简单来说就是对步骤S200中的背景图像的某个像素点的像素取周围像素点像素的平均值,这样就使该像素点失去细节,达到使该像素点平滑的效果,从而使图像变得模糊。在模糊过程中,选取的周围像素点的范围越大,模糊效果越强烈。In this embodiment, a Gaussian blur processing method is adopted. Gaussian blur is a widely practical technology in image processing, and is a data smoothing technology that is suitable for multiple occasions. The Gaussian fuzzy calculation process is the same as that in the prior art, and no redundant description is given here. To put it simply, the average value of the pixels of a certain pixel of the background image in step S200 is taken, so that the pixel loses details, and the effect of smoothing the pixel is achieved, so that the image becomes blurry. During the blurring process, the larger the range of surrounding pixels, the stronger the blurring effect.
需要说明的是,在对步骤S200中的背景图像进行高斯模糊处理,得到渐进模糊的背景图像的过程中,此渐进模糊效果可以是从靠近人脸图像的模糊区域开始,到远离人脸图像的模糊区域逐渐模糊,即靠近人脸图像的区域较清晰,远离人脸图像的区域较模糊;也可以是,从远离人脸图像的模糊区域开始,到靠近人脸图像的模糊区域逐渐模糊,即靠近人脸图像的区域较模糊,远离人脸图像的区域较清晰;也可以是从模糊区域的中间的区域开始,向两边即靠近人脸区域和远离人脸区域逐渐模糊,即背景图像的中间区域较清晰,靠近人脸区域和远离人脸区域较模糊。It should be noted that, in the process of performing Gaussian blur processing on the background image in step S200 to obtain a progressively blurred background image, the progressive blurring effect may be from the blurred area close to the face image to away from the face image The blur area gradually blurs, that is, the area close to the face image is clearer, and the area farther away from the face image is more blurry; it can also start from the blur area away from the face image to the blur area close to the face image, that is, The area near the face image is blurry, and the area away from the face image is clearer; it can also start from the area in the middle of the blur area and gradually blur toward the two sides, that is, near the face area and away from the face area, that is, in the middle of the background image The area is clearer, and the area near and far away from the face is blurry.
步骤S400,对所述模糊的背景图像进行压缩处理。Step S400: Compress the blurred background image.
具体地,本实施例中,是将每帧图像分为人脸图像和背景图像两幅图像,并对背景图像进行高斯模糊后,再进行压缩,这样就将每帧图像分为了两幅图像人脸图像和背景图像进行传输,并且背景图像在进行模糊压缩后占用的带宽较小。另一边,接收方客户端在接收到两幅图像后,对压缩的背景图像进行解压得到模糊的背景图像,在与人脸图像合并成一副图像。这样,这个过程就实现了本申请要实现的功能,有效地降低带宽成本,同时保证视频聊天中人脸信息的清晰。Specifically, in this embodiment, each frame image is divided into two images: a face image and a background image, and the background image is Gaussian blurred, and then compressed, so that each frame image is divided into two images: human face The image and the background image are transmitted, and the background image occupies less bandwidth after blurring and compression. On the other side, after receiving the two images, the receiving client decompresses the compressed background image to obtain a blurred background image, and merges it with the face image to form an image. In this way, this process realizes the functions to be implemented in this application, effectively reduces the cost of bandwidth, and at the same time ensures the clarity of face information in video chat.
本申请通过获取视频图像,根据对所述视频图像中每帧图像进行肤色分析,得到所述每帧图像中的人脸图像和背景图像;对所述背景图像进行高斯模糊处理得到模糊的背景图像;对所述模糊的背景图像进行压缩处理。通过上述方式,本申请在获取视频图像时,能够根据肤色确定出图像中人脸区域,并对人脸区域以外的部分进行模糊压缩处理,这样在视频传输的过程中既能保证视频过程中用户最关注的部分:人脸区域的清晰,又将不是很重要的部分:背景图像进行模糊处理。相对于现有技术中将每帧图像中所有内容进行 压缩的方式,本申请中,分割出来的未进行处理的人脸图像能够满足人们视频聊天过程中对人脸清晰度的要求;同时,相对清晰的背景图像,所需带宽较小,能够降低整个系统的带宽成本。In this application, by acquiring a video image, according to skin color analysis of each frame of the video image, the face image and background image in each frame of image are obtained; Gaussian blur processing is performed on the background image to obtain a blurred background image ; Compress the blurred background image. In the above manner, when acquiring a video image, the application can determine the face area in the image according to skin color, and perform blur compression processing on the part outside the face area, so that during the video transmission process, the user can be guaranteed during the video process The most concerned part: the clearness of the face area, but it will not be very important part: the background image is blurred. Compared with the method of compressing all the content in each frame of the image in the prior art, in this application, the unprocessed face image can meet the requirements of people's face clarity in the video chat process; at the same time, relative The clear background image requires less bandwidth, which can reduce the bandwidth cost of the entire system.
请参阅图3,图3为本申请实施例中对所述视频图像中每帧图像进行肤色分析,得到所述每帧图像中的人脸图像和背景图像的一细化流程示意图。Please refer to FIG. 3, which is a schematic diagram of a detailed process of performing a skin color analysis on each frame of the video image in the embodiment of the present application to obtain a face image and a background image in each frame of the image.
基于图2所示的实施例,本实施中,步骤S200包括:Based on the embodiment shown in FIG. 2, in this implementation, step S200 includes:
步骤S201,将所述每帧图像投射到预设的色彩空间,得到所述每帧图像中像素点的亮度与色度;Step S201: Project the image of each frame into a preset color space to obtain the brightness and chromaticity of pixels in the image of each frame;
将所述每帧图像投射到预设的色彩空间,预设的色彩空间有:YCrCb色彩空间,RGB色彩空间,HSI色彩空间,YIQ色彩空间等。具体的,本实施例以投射到YCrCb色彩空间为例进行说明。YCbCr色彩空间将色彩表示为三个分景,即亮度Y,蓝色色度Cb和红色色度Cr。这样,将每帧图像投射到YCbCr色彩空间中,就可以得到每帧图像像素点的亮度Y与色度CrCb两种信息。Projecting each frame of image into a preset color space, the preset color spaces are: YCrCb color space, RGB color space, HSI color space, YIQ color space, etc. Specifically, in this embodiment, the projection onto the YCrCb color space is used as an example for description. The YCbCr color space represents color as three sub-views, namely brightness Y, blue chroma Cb and red chroma Cr. In this way, by projecting each frame of image into the YCbCr color space, you can get the two kinds of information of the brightness Y and chroma CrCb of each frame of image pixels.
步骤S202,根据所述每帧图像中像素点的亮度与色度利用第一预设算法对所述每帧图像进行亮度补偿,得到每帧图像中补偿后的像素点的色度;In step S202, the first preset algorithm is used to perform brightness compensation on each frame image according to the brightness and chroma of the pixels in each frame image to obtain the chroma of the compensated pixels in each frame image;
在色彩空间中,不同年龄、种族和性别的人的肤色区别主要在亮度上,而在色度上的区别较小。即不同肤色在亮度上差异很大,而在色度上较为接近。通过对每帧图像像素点的亮度进行补偿,就能消除不同年龄、种族和性别的人肤色上的影响,从而提高图像肤色的检测率。In the color space, the difference in skin color between people of different ages, races, and genders is mainly in brightness, but the difference in chroma is small. That is, different skin tones differ greatly in brightness, but are relatively close in chroma. By compensating the brightness of pixel points of each frame of image, the influence of the skin color of people of different ages, races and genders can be eliminated, thereby improving the detection rate of image skin color.
实际处理过程中对每帧图像进行亮度补偿,进行亮度补偿方法有很多,本实施例以参考白算法为例进行说明,具体地,通过参考白算法对每帧图像进行亮度补偿,即将步骤S201中每帧图像像素点的亮度Y与色度CrCb用参考白算法进行计算补偿后,消除在YCbCr色彩空间中像素点亮度Y的影响,得到该视频图像像素点的CbCr色度。步骤参考白算法是常用的亮度补偿算法,亮度补偿过程包括:In the actual processing process, there are many brightness compensation methods for each frame image. There are many methods for performing brightness compensation. In this embodiment, the reference white algorithm is used as an example for description. Specifically, the brightness compensation for each frame image is performed by referring to the white algorithm, that is, in step S201 The luminance Y and chromaticity CrCb of each pixel of the image are calculated and compensated by the reference white algorithm, and the influence of the luminance Y of the pixel in the YCbCr color space is eliminated to obtain the CbCr chromaticity of the pixel of the video image. Step Reference White algorithm is a commonly used brightness compensation algorithm. The brightness compensation process includes:
根据所述每帧图像中像素点的亮度与色度计算每帧图像中像素点的平均像素灰度值;Calculating the average pixel gray value of the pixels in each frame image according to the brightness and chroma of the pixels in each frame image;
根据所述平均像素灰度值计算光照补偿系数;Calculate the illumination compensation coefficient according to the average pixel gray value;
根据所述光照补偿系数计算获得每帧图像中补偿后的像素点的色度。The chromaticity of the compensated pixel in each frame of image is calculated according to the illumination compensation coefficient.
具体地,对每帧图像中像素点的灰度值进行统计,并根据每帧图像中像素点的灰度值计算获得每帧图像的平均像素灰度值,然后根据平均像素灰度值计算对应的光照补偿系数,其中光照补偿系=255/平均像素灰度值,最后根据所述每帧图像中像素点的色度乘以光照补偿系数则获得每帧图像中补偿后的像素点的色度。Specifically, the gray value of the pixels in each frame of image is counted, and the average pixel gray value of each frame of image is calculated according to the gray value of the pixel in each frame of image, and then the corresponding value is calculated according to the average pixel gray value Illumination compensation coefficient, where the illumination compensation system=255/average pixel gray value, and finally the chromaticity of the compensated pixel in each frame image is obtained by multiplying the chromaticity of the pixel in each frame image by the illumination compensation coefficient .
步骤S203,将所述每帧图像中补偿后的像素点的色度与预设的肤色色度高斯模型进行对比,得到每帧图像中像素点的肤色概率图;Step S203, comparing the chromaticity of the compensated pixels in each frame image with a preset skin color chromaticity Gaussian model to obtain a skin color probability map of pixels in each frame image;
由于不同年龄、种族和性别的人的肤色在亮度上相差很大,而在色度上比较接近,并且在色度上的分布满足二维独立分布,分布区域比较集中,所以除去亮度影响后,肤色在色度上的分布范围能建立肤色模型来描述,常用的肤色模型有区域模型,高斯模型,直方图模型等。本实施例是采用高斯模型来描述不同肤色在色度上的分布范围的。具体地,在CbCr空间下,选取大量的肤色样本进行统计,得到各个肤色在色度上的分布范围,然后用高斯模型来进行计算描述,所述高斯模型就是本申请实施例中所预设的肤色色度高斯模型。具体地,将所述每帧图像中补偿后的像素点的色度与预设的肤色色度高斯模型进行对比,得到每帧图像中像素点的肤色概率图,是将步骤S202中像素点的CbCr色度值与所述的预设的肤色色度高斯模型进行比较,即将每个像素点在YCrCb色度空间的色度与所述的预设的肤色色度高斯模型分布中心的远近得到与肤色的相似度,进而得到该点是肤色的概率。像素点在YCrCb色度空间的色度与所述的预设的肤色色度高斯模型分布中心的越近,则该像素点是肤色的概率越大,像素点在YCrCb色度空间的色度与所述的预设的肤色色度高斯模型分布中心的越远,则该像素点是肤色的概率越小,像素点在YCrCb色度空间的色度不在所述的预设的肤色色度高斯模型分布范围内,则该像素点是肤色的概率为0。这样,通过将所有补偿后的像素点的色度与预设的肤色色度高斯模型进行对比,就能得到整幅图像的肤色概率图。Since the skin color of people of different ages, races and genders differs greatly in brightness, but is close in chromaticity, and the distribution in chromaticity satisfies the two-dimensional independent distribution, the distribution area is relatively concentrated, so after removing the influence of brightness, The distribution range of skin color on chromaticity can be described by establishing a skin color model. Common skin color models include regional models, Gaussian models, and histogram models. In this embodiment, a Gaussian model is used to describe the distribution range of different skin tones in chroma. Specifically, in the CbCr space, a large number of skin color samples are selected for statistics to obtain the distribution range of each skin color in chroma, and then a Gaussian model is used for calculation and description. The Gaussian model is preset in the embodiments of the present application Skin color chroma Gaussian model. Specifically, the chromaticity of the compensated pixels in each frame of image is compared with the preset skin color chromaticity Gaussian model to obtain a skin color probability map of the pixels in each frame of image. The CbCr chromaticity value is compared with the preset skin tone chromaticity Gaussian model, that is, the chromaticity of each pixel in the YCrCb chromaticity space and the distance between the distribution center of the preset skin tone chromaticity Gaussian model and The similarity of skin color, and then the probability that the point is skin color. The closer the chromaticity of a pixel in the YCrCb chromaticity space to the distribution center of the preset skin color chromaticity Gaussian model, the greater the probability that the pixel is skin color. The chromaticity of the pixel in the YCrCb chromaticity space is The farther the distribution center of the preset skin tone chroma Gaussian model, the smaller the probability that the pixel is skin color, and the chroma of the pixel in the YCrCb chromaticity space is not in the preset skin tone chroma Gaussian model Within the distribution range, the probability that the pixel is skin color is 0. In this way, by comparing the chromaticity of all compensated pixels with a preset skin color chromaticity Gaussian model, a skin color probability map of the entire image can be obtained.
步骤S204,根据所述每帧图像中像素点的肤色概率图利用自适应阈值确定每帧图像的肤色区域;Step S204, determine the skin color region of each frame image using an adaptive threshold according to the skin color probability map of pixels in each frame image;
得到每帧图像的肤色概率图后,需要对整幅图像进行分割,进而确定每帧图像分为肤色区域和背景区域。常用的分割方法有阈值法,边界探测法, 匹配法等。本实施例采用自适应阈值的方法来进行分割。具体就是将每帧图像中像素点的肤色概率图与预设的自适应阈值进行比较,该像素点的肤色概率大于所设的自适应阈值,则该像素点为肤色区域,该像素点的肤色概率小于所设的自适应阈值,则该像素点为非肤色区域。这样利用自适应阈值就能确定出每帧图像的肤色区域和非肤色区域。After obtaining the skin color probability map of each frame image, the entire image needs to be segmented, and then it is determined that each frame image is divided into a skin color area and a background area. Commonly used segmentation methods include threshold method, boundary detection method, matching method and so on. In this embodiment, an adaptive threshold method is used for segmentation. Specifically, the skin color probability map of each pixel in each frame of image is compared with the preset adaptive threshold. If the skin color probability of the pixel is greater than the set adaptive threshold, the pixel is the skin color area, and the skin color of the pixel If the probability is less than the set adaptive threshold, the pixel is a non-skin area. In this way, the adaptive threshold can be used to determine the skin area and non-skin area of each image.
自适应阈值分割方法为图像分割较为常见的分割方法,自适应阈值分割方法计算较为简单,受其他因素影响较小。The adaptive threshold segmentation method is a more common segmentation method for image segmentation. The adaptive threshold segmentation method is simpler to calculate and less affected by other factors.
步骤S205,对所述每帧图像的肤色区域进行形态学处理得到每帧图像中的人脸图像和背景图像。In step S205, morphological processing is performed on the skin color region of each frame image to obtain a face image and a background image in each frame image.
在实际处理过程中可能会出现进行分割的每帧图像的肤色区域不是一个连贯的整体,较为分散,甚至是多个不相连的图像区域构成的情况,此时需要利用形态学处理来改善分割效果。具体地,是通过步骤S204确定出每帧图像的肤色区域后,用形态学处理相关算法对分割的肤色区域进行处理,使肤色区域边界较为平滑,分散的肤色区域完整连接为一个整体,这样连为整体的肤色区域为人脸图像,另一区域为背景图像。这样整帧图像就分为了人脸图像和背景图像两部分。In the actual processing process, it may happen that the skin color area of each frame of the image segmented is not a coherent whole, more scattered, or even composed of multiple unconnected image areas. At this time, morphological processing needs to be used to improve the segmentation effect . Specifically, after determining the skin color region of each frame of image through step S204, the segmented skin color region is processed with a morphological processing-related algorithm to make the skin color region boundary smoother, and the dispersed skin color regions are completely connected as a whole. The overall skin color area is the face image, and the other area is the background image. In this way, the whole frame image is divided into two parts: a face image and a background image.
形态学处理方法是常用的图像处理方法,图像处理过程与现有技术中相同,此处不做多余赘述。The morphological processing method is a commonly used image processing method, and the image processing process is the same as in the prior art, and no redundant description is provided here.
请参阅图4,图4为本申请实施例中对所述每帧图像进行高斯模糊处理得到模糊的背景图像的一细化流程示意图。Please refer to FIG. 4, which is a schematic diagram of a detailed process of performing Gaussian blur processing on each frame image to obtain a blurred background image in an embodiment of the present application.
基于图2所示的实施例,本实施中,步骤S300还包括:Based on the embodiment shown in FIG. 2, in this implementation, step S300 further includes:
步骤S301,对背景图像进行高斯滤波处理,得到过渡区域和模糊区域;Step S301: Perform Gaussian filtering on the background image to obtain the transition area and the blur area;
在本申请实施例中,模糊处理采用渐进模糊处理方式,将每帧图像分为3个区域,即清晰区域,过渡区域,模糊区域,所述过渡区域位于清晰区域和模糊区域之间,清晰区域的分辨率大于过渡区域的分辨率,过渡区的分辨率大于模糊区域的分辨率。例如,参照图5,图5为本申请视频压缩方法实施例中渐进模糊方式示意图,将聊天视频中的每帧图像的人脸图像与背景图像进行切割分离,并将背景图像进行高斯滤波处理,分离后的人脸图像就是我们的清晰区域a,经高斯滤波处理后的背景图像分为过渡区域b和模糊区域c。In the embodiment of the present application, the blur processing adopts a progressive blur processing method, which divides each frame of the image into three areas, namely a clear area, a transition area, and a blur area. The transition area is located between the clear area and the blur area. The clear area The resolution of is greater than the resolution of the transition area, and the resolution of the transition area is greater than the resolution of the blurred area. For example, referring to FIG. 5, FIG. 5 is a schematic diagram of the progressive blurring method in the embodiment of the video compression method of the present application. The face image and the background image of each frame image in the chat video are cut and separated, and the background image is subjected to Gaussian filter processing. The separated face image is our clear area a, and the background image after Gaussian filtering is divided into transition area b and blur area c.
高斯滤波处理为图像处理常用方法,与现有技术中相同,此处不做多余赘述。Gaussian filter processing is a common method for image processing, which is the same as in the prior art, and will not be redundantly described here.
步骤S302,根据第二预设算法确定所述模糊区域的模糊处理中心点;Step S302: Determine a blur processing center point of the blur area according to a second preset algorithm;
在本申请实施例中,所述第二预设算法为:In the embodiment of the present application, the second preset algorithm is:
Figure PCTCN2019126016-appb-000007
Figure PCTCN2019126016-appb-000007
Figure PCTCN2019126016-appb-000008
Figure PCTCN2019126016-appb-000008
Figure PCTCN2019126016-appb-000009
Figure PCTCN2019126016-appb-000009
其中,x为像素点的横坐标,y为像素点的纵坐标,target为目标函数,background为背景函数,x0为模糊处理中心点的横坐标,y0为模糊处理中心点的纵坐标。Where x is the horizontal coordinate of the pixel, y is the vertical coordinate of the pixel, target is the target function, background is the background function, x0 is the horizontal coordinate of the blur processing center point, and y0 is the vertical coordinate of the blur processing center point.
需要说明的是,根据第二预设算法确定所述模糊区域的模糊处理中心点,模糊处理中心点位于清晰区域。It should be noted that the blur processing center point of the blur area is determined according to the second preset algorithm, and the blur processing center point is located in the clear area.
具体地,在本实施例中,通过上述公式计算出模糊区域c的模糊处理中心点的位置坐标,进而得到模糊处理中心点的位置,模糊处理中心点位于清晰区域a中。Specifically, in this embodiment, the position coordinates of the blur processing center point of the blur area c are calculated by the above formula, and then the position of the blur processing center point is obtained, and the blur processing center point is located in the clear area a.
步骤S303,根据所述模糊处理中心点,计算出所述模糊区域中各像素点与所述模糊处理中心点的距离;Step S303: Calculate the distance between each pixel in the blur area and the blur processing center point according to the blur processing center point;
通过对上述模糊处理中心点的位置坐标与模糊区域c中各个像素点的位置坐标进行计算,就能得到模糊区域c中各像素点与模糊处理中心点的距离大小。By calculating the position coordinates of the above-mentioned blur processing center point and the position coordinates of each pixel in the blur area c, the distance between each pixel in the blur area c and the blur processing center point can be obtained.
步骤S304,根据所述模糊区域中各像素点与所述模糊处理中心点的距离计算出模糊区域各像素点进行高斯模糊处理的可变半径;Step S304: Calculate the variable radius of each pixel in the blur area for Gaussian blur processing according to the distance between each pixel in the blur area and the center point of the blur processing;
具体地,得到模糊区域c中各像素点与模糊处理中心点的距离的大小后,将模糊区域c中各像素点与模糊处理中心点的距离的大小进行相关计算,得到高斯模糊处理的可变半径。模糊区域c中各像素点与模糊处理中心点的距离越大,高斯模糊处理的可变半径就越大,模糊区域c中各像素点与模糊处 理中心点的距离越小,高斯模糊处理的可变半径就越小。Specifically, after obtaining the size of the distance between each pixel in the blur area c and the center point of the blur processing, the size of the distance between each pixel point in the blur area c and the center point of the blur processing is related calculated to obtain the variable Gaussian blur processing radius. The larger the distance between each pixel in the blur area c and the blur processing center point, the larger the variable radius of the Gaussian blur processing, and the smaller the distance between each pixel in the blur area c and the blur processing center point, the Gaussian blur processing can The smaller the variable radius.
高斯模糊处理可变半径的计算方法与现有技术中相同,此处不做多余赘述。The calculation method of the variable radius of Gaussian blur processing is the same as that in the prior art, and no redundant description is given here.
步骤S305,根据所述高斯模糊处理的可变半径对所述模糊区域各像素点进行高斯模糊处理,得到渐进模糊的模糊区域。Step S305: Perform Gaussian blur processing on each pixel of the blur area according to the variable radius of the Gaussian blur processing to obtain a gradually blurred blur area.
需要说明的是,在本实施例中,高斯模糊处理的可变半径越大,进行高斯模糊处理后图像模糊处理效果就越模糊;相反,高斯模糊处理的可变半径越小,进行高斯模糊处理后图像模糊处理效果就越清晰,即离模糊处理中心点近的像素点较清晰,离模糊处理中心点远的像素点较模糊。It should be noted that, in this embodiment, the larger the variable radius of the Gaussian blur processing, the more blurred the image blur processing effect after the Gaussian blur processing; on the contrary, the smaller the variable radius of the Gaussian blur processing, the Gaussian blur processing The later the image blurring effect is clearer, that is, the pixels near the blurring center point are clearer, and the pixels farther from the blurring center point are blurry.
具体为,在得到模糊区域c中各像素点高斯模糊处理的可变半径后,根据高斯模糊处理的可变半径的大小,对模糊区域c中各像素点进行高斯模糊。模糊区域c中各像素点高斯模糊处理的可变半径越大,高斯模糊越模糊,模糊区域c中各像素点高斯模糊处理的可变半径越小,高斯模糊越清晰。即在模糊区域c中,离清晰区域a越近的地方,图像模糊效果越清晰,离清晰区域a越远的地方,图像模糊效果越模糊,这样就形成了从清晰区域到模糊区域逐渐渐进模糊的效果。然后,将有渐进模糊效果的模糊区域c与过渡区域b一起进行压缩,就能在传输过程中降低视频聊天的带宽,同时又能保证未被模糊压缩处理的人脸信息的清晰度。Specifically, after obtaining the variable radius of the Gaussian blur processing of each pixel in the blur area c, each pixel in the blur area c is Gaussian blurred according to the size of the variable radius of the Gaussian blur processing. The larger the variable radius of the Gaussian blur processing of each pixel in the blur area c, the more blurred the Gaussian blur. The smaller the variable radius of the Gaussian blur processing of each pixel in the blur area c, the clearer the Gaussian blur. That is, in the blur area c, the closer to the clear area a, the clearer the image blur effect, and the farther away from the clear area a, the more blurred the image blur effect, thus forming a gradual blur from the clear area to the blur area Effect. Then, compressing the blur area c with the progressive blur effect together with the transition area b can reduce the bandwidth of the video chat during transmission, and at the same time ensure the clarity of face information that has not been processed by blur compression.
在本实施例中,通过设置过渡区域b的方式,能使清晰区域到模糊区域的模糊过程有个比较自然的过渡,使视频聊天过程中处理后的图像不会显得太突兀,提高背景虚化效果。In this embodiment, by setting the transition area b, the blurring process from the clear area to the blurry area can have a more natural transition, so that the processed image in the video chat process does not appear too abrupt, and the background blur is improved. effect.
在本申请实施例中,将所述每帧图像中的人脸图像与背景图像进行分离,得到人脸图像和背景图像,并对背景图像进行高斯滤波处理,得到过渡区域和模糊区域;根据第二预设算法确定所述模糊区域的模糊处理中心点;根据所述模糊处理中心点,计算出所述模糊区域中各像素点与所述模糊处理中心点的距离;根据所述模糊区域中各像素点与所述模糊处理中心点的距离计算出模糊区域各像素点进行高斯模糊处理的可变半径;根据所述高斯模糊处理的可变半径对所述模糊区域各像素点进行高斯模糊处理,得到渐进模糊的模糊区域。通过这样的方式,将图像分为两个人脸图像部分和背景图像部分,其中,对背景图像进行模糊和压缩,能降低整帧图像在传输过程中的带宽, 又能保证未被模糊压缩处理的人脸图像的清晰度。从清晰区域到模糊区域渐进模糊处理的方式又能使模糊效果比较自然,过渡比较连贯。In the embodiment of the present application, the face image and the background image in each frame image are separated to obtain the face image and the background image, and the background image is subjected to Gaussian filter processing to obtain the transition area and the blur area; Two preset algorithms determine the blur processing center point of the blur area; according to the blur processing center point, calculate the distance between each pixel point in the blur area and the blur processing center point; according to the blur area The distance between the pixel point and the center point of the blur processing calculates the variable radius of each pixel point of the blur area for Gaussian blur processing; the Gaussian blur processing of each pixel point of the blur area according to the variable radius of the Gaussian blur processing, Obtain progressively blurred areas of blur. In this way, the image is divided into two face image parts and a background image part. Among them, the background image is blurred and compressed, which can reduce the bandwidth of the entire frame image during transmission, and can also ensure that the image is not blurred and compressed. The clarity of the face image. The method of progressive blur processing from the clear area to the blur area can make the blur effect more natural and the transition more coherent.
此外,本申请实施例还提出一种计算机可读存储介质,所述计算机可读存储介质上存储有视频压缩程序,所述视频压缩程序被处理器执行时实现如上所述的视频压缩方法的步骤。In addition, embodiments of the present application also provide a computer-readable storage medium that stores a video compression program on the computer-readable storage medium, and when the video compression program is executed by a processor, implements the steps of the video compression method described above .
本申请计算机可读存储介质的具体实施例与上述视频压缩方法各实施例基本相同,在此不作赘述。The specific embodiments of the computer-readable storage medium of the present application are basically the same as the embodiments of the above-mentioned video compression method, which will not be repeated here.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排他性的包含,从而使得包括一系列要素的过程、方法、物品或者系统不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、方法、物品或者系统所固有的要素。在没有更多限制的情况下,由语句“包括一个……”限定的要素,并不排除在包括该要素的过程、方法、物品或者系统中还存在另外的相同要素。It should be noted that in this article, the terms "include", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system that includes a series of elements includes not only those elements, It also includes other elements that are not explicitly listed, or include elements inherent to this process, method, article, or system. Without more restrictions, the element defined by the sentence "include a..." does not exclude that there are other identical elements in the process, method, article or system that includes the element.
上述本申请实施例序号仅仅为了描述,不代表实施例的优劣。The sequence numbers of the above embodiments of the present application are for description only, and do not represent the advantages and disadvantages of the embodiments.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the methods in the above embodiments can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware, but in many cases the former is better Implementation. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence or part that contributes to the existing technology, and the computer software product is stored in a storage medium (such as ROM/RAM) as described above , Disk, CD), including several instructions to make a terminal device (which can be a mobile phone, computer, server, air conditioner, or network equipment, etc.) to perform the method described in each embodiment of the present application.
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围。The above are only preferred embodiments of the present application, and do not limit the scope of the patent of the present application. Any equivalent structure or equivalent process transformation made by the description and drawings of this application, or directly or indirectly used in other related technical fields , The same reason is included in the scope of patent protection in this application.

Claims (20)

  1. 一种视频压缩方法,其中,所述视频压缩方法包括以下步骤:A video compression method, wherein the video compression method includes the following steps:
    获取视频图像;Get video images;
    对所述视频图像中每帧图像进行人脸识别,得到所述每帧图像中的人脸图像和背景图像;Performing face recognition on each frame of the video image to obtain the face image and background image in each frame of the image;
    对所述背景图像进行高斯模糊处理得到模糊的背景图像;Gaussian blur processing is performed on the background image to obtain a blurred background image;
    对所述模糊的背景图像进行压缩处理。Compress the blurred background image.
  2. 如权利要求1所述的视频压缩方法,其中,所述将所述所述视频图像中每帧图像划分为人脸图像和背景图像的步骤包括:The video compression method according to claim 1, wherein the step of dividing each frame image in the video image into a face image and a background image includes:
    对所述视频图像中每帧图像进行肤色分析,得到所述每帧图像中的人脸图像和背景图像。Perform skin color analysis on each frame of the video image to obtain the face image and background image in each frame of image.
  3. 如权利要求2所述的视频压缩方法,其中,所述对所述视频图像中每帧图像进行肤色分析,得到所述每帧图像中的人脸图像和背景图像的步骤包括:The video compression method according to claim 2, wherein the step of performing skin color analysis on each frame of the video image to obtain a face image and a background image in each frame of the image includes:
    将所述每帧图像投射到预设的色彩空间,得到所述每帧图像中像素点的亮度与色度;Project the image of each frame into a preset color space to obtain the brightness and chromaticity of pixels in the image of each frame;
    根据所述每帧图像中像素点的亮度与色度利用第一预设算法对所述每帧图像进行亮度补偿,得到每帧图像中补偿后的像素点的色度;Using a first preset algorithm to perform brightness compensation on each frame image according to the brightness and chromaticity of pixels in each frame image to obtain the chromaticity of the compensated pixel points in each frame image;
    将所述每帧图像中补偿后的像素点的色度与预设的肤色色度高斯模型进行对比,得到每帧图像中像素点的肤色概率图;Comparing the chromaticity of the compensated pixels in each frame image with a preset skin tone chromaticity Gaussian model to obtain a skin color probability map of pixels in each frame image;
    根据所述每帧图像中像素点的肤色概率图利用自适应阈值确定每帧图像的肤色区域;Determine the skin color area of each frame image by using an adaptive threshold according to the skin color probability map of pixels in each frame image;
    对所述每帧图像的肤色区域进行形态学处理得到每帧图像中的人脸图像和背景图像。Morphological processing is performed on the skin color region of each frame image to obtain a face image and a background image in each frame image.
  4. 如权利要求3所述的视频压缩方法,其中,所述根据所述每帧图像中像素点的亮度与色度利用第一预设算法对所述每帧图像进行亮度补偿,得到每帧图像中补偿后的像素点的色度的步骤包括:The video compression method according to claim 3, wherein the first preset algorithm is used to perform brightness compensation on each frame image according to the brightness and chroma of pixels in each frame image to obtain each frame image The steps of the compensated pixel chroma include:
    根据所述每帧图像中像素点的亮度计算每帧图像中像素点的平均像素灰度值;Calculating the average pixel gray value of the pixels in each frame image according to the brightness of the pixels in each frame image;
    根据所述平均像素灰度值计算光照补偿系数;Calculate the illumination compensation coefficient according to the average pixel gray value;
    根据所述光照补偿系数计算获得每帧图像中补偿后的像素点的色度。The chromaticity of the compensated pixel in each frame of image is calculated according to the illumination compensation coefficient.
  5. 如权利要求1所述的视频压缩方法,其中,所述对所述每帧图像进行高斯模糊处理得到模糊的背景图像的步骤包括:The video compression method according to claim 1, wherein the step of performing Gaussian blur processing on each frame image to obtain a blurred background image includes:
    对所述每帧图像进行高斯模糊处理得到从远离模糊处理中心点的方向渐进模糊的背景图像。Gaussian blur processing is performed on each image to obtain a background image that is gradually blurred from a direction away from the center point of the blur processing.
  6. 如权利要求5所述的视频压缩方法,其中,所述对所述每帧图像进行高斯模糊处理得到从远离模糊处理中心点的方向渐进模糊的背景图像的步骤包括:The video compression method according to claim 5, wherein the step of performing Gaussian blur processing on each frame image to obtain a background image that is gradually blurred from a direction away from the center point of the blur processing includes:
    对背景图像进行高斯滤波处理,得到过渡区域和模糊区域;Perform Gaussian filtering on the background image to obtain transition areas and blurred areas;
    根据第二预设算法确定所述模糊区域的模糊处理中心点;Determine the center point of the blur processing of the blur area according to a second preset algorithm;
    根据所述模糊处理中心点,计算出所述模糊区域中各像素点与所述模糊处理中心点的距离;Calculating the distance between each pixel in the blur area and the blur processing center point according to the blur processing center point;
    根据所述模糊区域中各像素点与所述模糊处理中心点的距离计算出模糊区域各像素点进行高斯模糊处理的可变半径;Calculating the variable radius of each pixel in the blur area for Gaussian blur processing according to the distance between each pixel in the blur area and the center point of the blur processing;
    根据所述高斯模糊处理的可变半径对所述模糊区域各像素点进行高斯模糊处理,得到渐进模糊的模糊区域。Gaussian blur processing is performed on each pixel of the blur area according to the variable radius of the Gaussian blur processing to obtain a gradually blurred blur area.
  7. 如权利要求6所述的视频压缩方法,其中,所述过渡区域位于所述人脸图像和所述模糊区域之间。The video compression method according to claim 6, wherein the transition area is located between the face image and the blur area.
  8. 如权利要求6所述的视频压缩方法,其中,所述模糊区域中各像素点与所述模糊处理中心点的距离越大,计算的高斯模糊处理的可变半径越大,进行高斯处理后的图像越模糊;所述模糊区域中各像素点与所述模糊处理中心点的距离越小,计算的高斯模糊处理的可变半径越小,进行高斯处理后的图像越清晰。The video compression method according to claim 6, wherein the larger the distance between each pixel in the blur area and the center point of the blur processing, the larger the calculated variable radius of the Gaussian blur processing, and the The more blurred the image; the smaller the distance between each pixel in the blurred area and the center point of the blur processing, the smaller the calculated variable radius of the Gaussian blur processing, and the sharper the image after the Gaussian processing.
  9. 如权利要求6所述的视频压缩方法,其中,根据第二预设算法确定所述模糊区域的模糊处理中心点的步骤包括:The video compression method according to claim 6, wherein the step of determining the blur processing center point of the blur area according to the second preset algorithm includes:
    根据所述模糊区域中的各像素点的坐标计算所述模糊区域的模糊处理中心点。The blur processing center point of the blur area is calculated according to the coordinates of each pixel in the blur area.
  10. 如权利要求6所述的视频压缩方法,其中,所述第二预设算法为:The video compression method according to claim 6, wherein the second preset algorithm is:
    Figure PCTCN2019126016-appb-100001
    Figure PCTCN2019126016-appb-100001
    Figure PCTCN2019126016-appb-100002
    Figure PCTCN2019126016-appb-100002
    Figure PCTCN2019126016-appb-100003
    Figure PCTCN2019126016-appb-100003
    其中,x为像素点的横坐标,y为像素点的纵坐标,target为目标函数,background为背景函数,x0为模糊处理中心点的横坐标,y0为模糊处理中心点的纵坐标。Where x is the horizontal coordinate of the pixel, y is the vertical coordinate of the pixel, target is the target function, background is the background function, x0 is the horizontal coordinate of the blur processing center point, and y0 is the vertical coordinate of the blur processing center point.
  11. 一种视频压缩装置,其中,所述视频压缩装置包括:存储器、处理器及存储在所述存储器上并可在所述处理器上运行的视频压缩程序,所述视频压缩程序被处理器执行时实现如下步骤:A video compression device, wherein the video compression device includes: a memory, a processor, and a video compression program stored on the memory and executable on the processor, when the video compression program is executed by the processor Implement the following steps:
    获取视频图像;Get video images;
    对所述视频图像中每帧图像进行人脸识别,得到所述每帧图像中的人脸图像和背景图像;Performing face recognition on each frame of the video image to obtain the face image and background image in each frame of the image;
    对所述每帧图像进行高斯模糊处理得到模糊的背景图像;Gaussian blur processing is performed on each image to obtain a blurred background image;
    对所述模糊的背景图像进行压缩处理。Compress the blurred background image.
  12. 如权利要求11所述的视频压缩装置,其中,所述视频压缩程序被处理器执行时还实现如下步骤:The video compression device according to claim 11, wherein when the video compression program is executed by the processor, the following steps are further implemented:
    对所述视频图像中每帧图像进行肤色分析,得到所述每帧图像中的人脸图像和背景图像。Perform skin color analysis on each frame of the video image to obtain the face image and background image in each frame of image.
  13. 如权利要求12所述的视频压缩装置,其中,所述视频压缩程序被处理器执行时还实现如下步骤:The video compression device according to claim 12, wherein when the video compression program is executed by the processor, the following steps are further implemented:
    将所述每帧图像投射到预设的色彩空间,得到所述每帧图像中像素点的亮度与色度;Project the image of each frame into a preset color space to obtain the brightness and chromaticity of pixels in the image of each frame;
    根据所述每帧图像中像素点的亮度与色度利用第一预设算法对所述每帧图像进行亮度补偿,得到每帧图像中补偿后的像素点的色度;Using a first preset algorithm to perform brightness compensation on each frame image according to the brightness and chromaticity of pixels in each frame image to obtain the chromaticity of the compensated pixel points in each frame image;
    将所述每帧图像中补偿后的像素点的色度与预设的肤色色度高斯模型进行对比,得到每帧图像中像素点的肤色概率图;Comparing the chromaticity of the compensated pixels in each frame image with a preset skin tone chromaticity Gaussian model to obtain a skin color probability map of pixels in each frame image;
    根据所述每帧图像中像素点的肤色概率图利用自适应阈值确定每帧图像的肤色区域;Determine the skin color area of each frame image by using an adaptive threshold according to the skin color probability map of pixels in each frame image;
    对所述每帧图像的肤色区域进行形态学处理得到每帧图像中的人脸图像和背景图像。Morphological processing is performed on the skin color region of each frame image to obtain a face image and a background image in each frame image.
  14. 如权利要求13所述的视频压缩装置,其中,所述视频压缩程序被处理器执行时还实现如下步骤:The video compression apparatus according to claim 13, wherein the video compression program further implements the following steps when executed by the processor:
    根据所述每帧图像中像素点的亮度计算每帧图像中像素点的平均像素灰度值;Calculating the average pixel gray value of the pixels in each frame image according to the brightness of the pixels in each frame image;
    根据所述平均像素灰度值计算光照补偿系数;Calculate the illumination compensation coefficient according to the average pixel gray value;
    根据所述光照补偿系数计算获得每帧图像中补偿后的像素点的色度。The chromaticity of the compensated pixel in each frame of image is calculated according to the illumination compensation coefficient.
  15. 如权利要求11所述的视频压缩装置,其中,所述视频压缩程序被处理器执行时还实现如下步骤:The video compression device according to claim 11, wherein when the video compression program is executed by the processor, the following steps are further implemented:
    对所述每帧图像进行高斯模糊处理得到从远离模糊处理中心点的方向渐进模糊的背景图像。Gaussian blur processing is performed on each image to obtain a background image that is gradually blurred from a direction away from the center point of the blur processing.
  16. 如权利要求15所述的视频压缩装置,其中,所述视频压缩程序被处理器执行时还实现如下步骤:The video compression device according to claim 15, wherein the video compression program further implements the following steps when executed by the processor:
    对背景图像进行高斯滤波处理,得到过渡区域和模糊区域;Perform Gaussian filtering on the background image to obtain transition areas and blurred areas;
    根据第二预设算法确定所述模糊区域的模糊处理中心点;Determine the center point of the blur processing of the blur area according to a second preset algorithm;
    根据所述模糊处理中心点,计算出所述模糊区域中各像素点与所述模糊处理中心点的距离;Calculating the distance between each pixel in the blur area and the blur processing center point according to the blur processing center point;
    根据所述模糊区域中各像素点与所述模糊处理中心点的距离计算出模糊区域各像素点进行高斯模糊处理的可变半径;Calculating the variable radius of each pixel in the blur area for Gaussian blur processing according to the distance between each pixel in the blur area and the center point of the blur processing;
    根据所述高斯模糊处理的可变半径对所述模糊区域各像素点进行高斯模糊处理,得到渐进模糊的模糊区域。Gaussian blur processing is performed on each pixel of the blur area according to the variable radius of the Gaussian blur processing to obtain a gradually blurred blur area.
  17. 如权利要求16所述的视频压缩装置,其中,所述模糊区域中各像素点与所述模糊处理中心点的距离越大,计算的高斯模糊处理的可变半径越大,进行高斯处理后的图像越模糊;所述模糊区域中各像素点与所述模糊处理中心点的距离越小,计算的高斯模糊处理的可变半径越小,进行高斯处理后的图像越清晰。The video compression device according to claim 16, wherein the larger the distance between each pixel in the blur area and the center point of the blur processing, the larger the calculated variable radius of the Gaussian blur processing. The more blurred the image; the smaller the distance between each pixel in the blurred area and the center point of the blur processing, the smaller the calculated variable radius of the Gaussian blur processing, and the sharper the image after the Gaussian processing.
  18. 如权利要求16所述的视频压缩装置,其中,所述视频压缩程序被处理器执行时还实现如下步骤:The video compression device according to claim 16, wherein the video compression program further implements the following steps when executed by the processor:
    根据所述模糊区域中的各像素点的坐标计算所述模糊区域的模糊处理中心点。The blur processing center point of the blur area is calculated according to the coordinates of each pixel in the blur area.
  19. 如权利要求16所述的视频压缩装置,其中,所述第二预设算法为:The video compression device according to claim 16, wherein the second preset algorithm is:
    Figure PCTCN2019126016-appb-100004
    Figure PCTCN2019126016-appb-100004
    Figure PCTCN2019126016-appb-100005
    Figure PCTCN2019126016-appb-100005
    Figure PCTCN2019126016-appb-100006
    Figure PCTCN2019126016-appb-100006
    其中,x为像素点的横坐标,y为像素点的纵坐标,target为目标函数,background为背景函数,x0为模糊处理中心点的横坐标,y0为模糊处理中心点的纵坐标。Where x is the horizontal coordinate of the pixel, y is the vertical coordinate of the pixel, target is the target function, background is the background function, x0 is the horizontal coordinate of the blur processing center point, and y0 is the vertical coordinate of the blur processing center point.
  20. 一种计算机可读存储介质,其中,所述计算机可读存储介质上存储 有视频压缩程序,所述视频压缩程序被处理器执行时实现如权利要求1至10中任一项所述视频压缩方法的步骤。A computer-readable storage medium, wherein a video compression program is stored on the computer-readable storage medium, and when the video compression program is executed by a processor, the video compression method according to any one of claims 1 to 10 is implemented A step of.
PCT/CN2019/126016 2018-12-17 2019-12-17 Video compression method and apparatus, and computer-readable storage medium WO2020125631A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811546877.5A CN109618173B (en) 2018-12-17 2018-12-17 Video compression method, device and computer readable storage medium
CN201811546877.5 2018-12-17

Publications (1)

Publication Number Publication Date
WO2020125631A1 true WO2020125631A1 (en) 2020-06-25

Family

ID=66010246

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/126016 WO2020125631A1 (en) 2018-12-17 2019-12-17 Video compression method and apparatus, and computer-readable storage medium

Country Status (2)

Country Link
CN (1) CN109618173B (en)
WO (1) WO2020125631A1 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112307968A (en) * 2020-10-30 2021-02-02 天地伟业技术有限公司 Face recognition feature compression method
CN112651883A (en) * 2021-01-18 2021-04-13 广东工业大学 Image high-speed scene recovery method, device and medium
CN112907457A (en) * 2021-01-19 2021-06-04 Tcl华星光电技术有限公司 Image processing method, image processing device and computer equipment
CN113824967A (en) * 2021-11-23 2021-12-21 环球数科集团有限公司 Video compression method based on deep learning
CN114565966A (en) * 2022-04-26 2022-05-31 全时云商务服务股份有限公司 Face video image processing method and device
CN116228606A (en) * 2023-05-09 2023-06-06 南京茂聚智能科技有限公司 Image optimization processing system based on big data
CN117857808A (en) * 2024-03-06 2024-04-09 深圳市旭景数字技术有限公司 Efficient video transmission method and system based on data classification compression

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109618173B (en) * 2018-12-17 2021-09-28 深圳Tcl新技术有限公司 Video compression method, device and computer readable storage medium
CN110059642B (en) * 2019-04-23 2020-07-31 北京海益同展信息科技有限公司 Face image screening method and device
CN112313700A (en) * 2019-11-26 2021-02-02 深圳市大疆创新科技有限公司 Image processing method and device
CN111246093B (en) * 2020-01-16 2021-07-20 Oppo广东移动通信有限公司 Image processing method, image processing device, storage medium and electronic equipment
CN112639867A (en) * 2020-05-07 2021-04-09 深圳市大疆创新科技有限公司 Image processing method and device
CN111626310B (en) * 2020-05-27 2023-08-29 百度在线网络技术(北京)有限公司 Image comparison method, device, equipment and storage medium
CN111626959A (en) * 2020-05-28 2020-09-04 深圳康佳电子科技有限公司 Image processing method, terminal and storage medium
CN112785512B (en) * 2020-06-30 2023-05-12 青岛经济技术开发区海尔热水器有限公司 Optimization method for Gaussian blur image processing
CN112488964B (en) * 2020-12-18 2024-04-16 深圳市镜玩科技有限公司 Image processing method, related device, equipment and medium for sliding list

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100266207A1 (en) * 2009-04-21 2010-10-21 ArcSoft ( Hangzhou) Multimedia Technology Co., Ltd Focus enhancing method for portrait in digital image
CN102348116A (en) * 2010-08-03 2012-02-08 株式会社理光 Video processing method, video processing device and video processing system
CN103152521A (en) * 2013-01-30 2013-06-12 广东欧珀移动通信有限公司 Effect of depth of field achieving method for mobile terminal and mobile terminal
CN103632132A (en) * 2012-12-11 2014-03-12 广西工学院 Face detection and recognition method based on skin color segmentation and template matching
CN104361558A (en) * 2014-10-24 2015-02-18 小米科技有限责任公司 Image processing method, device and equipment
CN104966266A (en) * 2015-06-04 2015-10-07 福建天晴数码有限公司 Method and system to automatically blur body part
CN107637072A (en) * 2015-03-18 2018-01-26 阿凡达合并第二附属有限责任公司 Background modification in video conference
CN108122194A (en) * 2017-11-28 2018-06-05 沈阳美行科技有限公司 A kind of method and device of image luminescence
CN109618173A (en) * 2018-12-17 2019-04-12 深圳Tcl新技术有限公司 Video-frequency compression method, device and computer readable storage medium

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060140445A1 (en) * 2004-03-22 2006-06-29 Cusack Francis J Jr Method and apparatus for capturing digital facial images optimally suited for manual and automated recognition
CN100568262C (en) * 2007-12-29 2009-12-09 浙江工业大学 Human face recognition detection device based on the multi-video camera information fusion
RU2633149C2 (en) * 2013-07-19 2017-10-11 Общество с ограниченной ответственностью "Мэйл.Ру" Method and system for automated generation of graphic user interface and computer media for method implementation using this system
CN103945118B (en) * 2014-03-14 2017-06-20 华为技术有限公司 Image weakening method, device and electronic equipment
CN106993112B (en) * 2017-03-09 2020-01-10 Oppo广东移动通信有限公司 Background blurring method and device based on depth of field and electronic device
CN106971165B (en) * 2017-03-29 2018-08-10 武汉斗鱼网络科技有限公司 A kind of implementation method and device of filter
US10147216B1 (en) * 2017-11-01 2018-12-04 Essential Products, Inc. Intelligent camera
CN108230243B (en) * 2018-02-09 2021-04-27 福州大学 Background blurring method based on salient region detection model

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100266207A1 (en) * 2009-04-21 2010-10-21 ArcSoft ( Hangzhou) Multimedia Technology Co., Ltd Focus enhancing method for portrait in digital image
CN102348116A (en) * 2010-08-03 2012-02-08 株式会社理光 Video processing method, video processing device and video processing system
CN103632132A (en) * 2012-12-11 2014-03-12 广西工学院 Face detection and recognition method based on skin color segmentation and template matching
CN103152521A (en) * 2013-01-30 2013-06-12 广东欧珀移动通信有限公司 Effect of depth of field achieving method for mobile terminal and mobile terminal
CN104361558A (en) * 2014-10-24 2015-02-18 小米科技有限责任公司 Image processing method, device and equipment
CN107637072A (en) * 2015-03-18 2018-01-26 阿凡达合并第二附属有限责任公司 Background modification in video conference
CN104966266A (en) * 2015-06-04 2015-10-07 福建天晴数码有限公司 Method and system to automatically blur body part
CN108122194A (en) * 2017-11-28 2018-06-05 沈阳美行科技有限公司 A kind of method and device of image luminescence
CN109618173A (en) * 2018-12-17 2019-04-12 深圳Tcl新技术有限公司 Video-frequency compression method, device and computer readable storage medium

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112307968A (en) * 2020-10-30 2021-02-02 天地伟业技术有限公司 Face recognition feature compression method
CN112651883A (en) * 2021-01-18 2021-04-13 广东工业大学 Image high-speed scene recovery method, device and medium
CN112651883B (en) * 2021-01-18 2023-04-07 广东工业大学 Image high-speed scene recovery method, device and medium
CN112907457A (en) * 2021-01-19 2021-06-04 Tcl华星光电技术有限公司 Image processing method, image processing device and computer equipment
CN113824967A (en) * 2021-11-23 2021-12-21 环球数科集团有限公司 Video compression method based on deep learning
CN113824967B (en) * 2021-11-23 2022-02-15 环球数科集团有限公司 Video compression method based on deep learning
CN114565966A (en) * 2022-04-26 2022-05-31 全时云商务服务股份有限公司 Face video image processing method and device
CN116228606A (en) * 2023-05-09 2023-06-06 南京茂聚智能科技有限公司 Image optimization processing system based on big data
CN117857808A (en) * 2024-03-06 2024-04-09 深圳市旭景数字技术有限公司 Efficient video transmission method and system based on data classification compression

Also Published As

Publication number Publication date
CN109618173A (en) 2019-04-12
CN109618173B (en) 2021-09-28

Similar Documents

Publication Publication Date Title
WO2020125631A1 (en) Video compression method and apparatus, and computer-readable storage medium
CN109272459B (en) Image processing method, image processing device, storage medium and electronic equipment
KR101802146B1 (en) Image processing apparatus and image processing method
US8244003B2 (en) Image preprocessing
US8254646B2 (en) Image preprocessing
US10565742B1 (en) Image processing method and apparatus
EP3327668A1 (en) Image-processing device and method for foreground mask correction for object segmentation
US8660323B2 (en) Image Preprocessing
US11138695B2 (en) Method and device for video processing, electronic device, and storage medium
US20140079319A1 (en) Methods for enhancing images and apparatuses using the same
US11917158B2 (en) Static video recognition
JP2004310475A (en) Image processor, cellular phone for performing image processing, and image processing program
US8244004B2 (en) Image preprocessing
CN111192205A (en) Image defogging method and system and computer readable storage medium
US9330340B1 (en) Noise estimation for images using polynomial relationship for pixel values of image features
CN114298935A (en) Image enhancement method, device and computer readable storage medium
WO2022111269A1 (en) Method and device for enhancing video details, mobile terminal, and storage medium
CN112839167B (en) Image processing method, device, electronic equipment and computer readable medium
CN115471413A (en) Image processing method and device, computer readable storage medium and electronic device
CN112215237B (en) Image processing method and device, electronic equipment and computer readable storage medium
CN110796629B (en) Image fusion method and system
KR20030091471A (en) YCrCb color based human face location detection method
CN113453017A (en) Video processing method, device, equipment and computer program product
WO2022246663A1 (en) Image processing method, device and system, and storage medium
JP2008147714A (en) Image processor and image processing method

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

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

Country of ref document: EP

Kind code of ref document: A1