[go: up one dir, main page]

CN115705636A - Privacy protection method, device, equipment and medium - Google Patents

Privacy protection method, device, equipment and medium Download PDF

Info

Publication number
CN115705636A
CN115705636A CN202110903118.5A CN202110903118A CN115705636A CN 115705636 A CN115705636 A CN 115705636A CN 202110903118 A CN202110903118 A CN 202110903118A CN 115705636 A CN115705636 A CN 115705636A
Authority
CN
China
Prior art keywords
image
target
pixel
rgb image
pixel value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110903118.5A
Other languages
Chinese (zh)
Inventor
刘帅帅
马琳杰
杨雪洁
孙萁浩
张振铎
顾庆涛
高雪松
陈维强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hisense Group Holding Co Ltd
Original Assignee
Hisense Group Holding Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hisense Group Holding Co Ltd filed Critical Hisense Group Holding Co Ltd
Priority to CN202110903118.5A priority Critical patent/CN115705636A/en
Publication of CN115705636A publication Critical patent/CN115705636A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Image Processing (AREA)

Abstract

According to the embodiment of the application, before the RGBA image generated based on the original RGB image containing the user and the mask image corresponding to the user is uploaded to a cloud server, the background area in the original RGB image is replaced by the preset background, so that the background privacy of the user is protected, and the risk of privacy disclosure is reduced.

Description

一种隐私保护方法、装置、设备及介质A privacy protection method, device, equipment and medium

技术领域technical field

本申请涉及图像处理技术领域,尤其涉及一种隐私保护方法、装置、设备及介质。The present application relates to the technical field of image processing, and in particular to a privacy protection method, device, equipment and medium.

背景技术Background technique

伴随着虚拟现实技术的快速发展,远程多人虚拟会议、虚拟合照、虚拟舞台等丰富了人们的生活,且在远程多人虚拟会议、虚拟合照、虚拟舞台的过程中,需要将多个人合成在同一个背景中。With the rapid development of virtual reality technology, remote multi-person virtual meetings, virtual group photos, and virtual stages have enriched people's lives, and in the process of remote multi-person virtual meetings, virtual group photos, and virtual stages, it is necessary to synthesize multiple in the same background.

现有技术中,在将多个人合成在同一个背景的过程中,需要在设备端获得用户的原始RGB图像以及用户对应的掩膜图像(MASK),并基于该用户的RGB图像以及掩膜图像获得RGBA图像,将该RGBA图像上传到云端服务器,使得云端服务器基于各用户的RGBA图像,将该多个用户的图像合成在同一个背景中。由于通过图像分解可以从RGBA图像中解析出原始RGB图像,且该原始RGB图像中携带用户所处的真实环境信息,也就是说原始RGB图像中包含真实的背景信息,无法保证用户背景隐私,存在隐私泄露的风险。In the prior art, in the process of synthesizing multiple people in the same background, it is necessary to obtain the user's original RGB image and the user's corresponding mask image (MASK) on the device side, and based on the user's RGB image and mask image The RGBA image is obtained, and the RGBA image is uploaded to the cloud server, so that the cloud server synthesizes the images of the multiple users in the same background based on the RGBA images of each user. Since the original RGB image can be parsed from the RGBA image through image decomposition, and the original RGB image carries the real environment information of the user, that is to say, the original RGB image contains real background information, which cannot guarantee the privacy of the user's background. Risk of privacy breach.

发明内容Contents of the invention

本申请提供了一种隐私保护方法、装置、设备及介质,用以解决现有技术中直接基于包含背景区域的原始RGB图像以及对应的掩模图像生成的RGBA,无法保证用户背景隐私,存在隐私泄露的危险的问题。The present application provides a privacy protection method, device, device and medium, which are used to solve the problem that the RGBA generated directly based on the original RGB image including the background area and the corresponding mask image in the prior art cannot guarantee the privacy of the user's background, and there is privacy. Dangerous problem of leakage.

本申请提供了一种隐私保护方法,所述方法包括:The present application provides a privacy protection method, the method comprising:

获得包含用户的原始RGB图像,并基于人像分割算法,获得所述用户对应的掩模图像;Obtain the original RGB image containing the user, and obtain the mask image corresponding to the user based on the portrait segmentation algorithm;

根据所述原始RGB图像、所述掩模图像以及目标背景图像,确定将所述原始RGB图像中的背景区域替换为所述目标背景图像对应的区域得到的目标RGB图像;According to the original RGB image, the mask image and the target background image, determine the target RGB image obtained by replacing the background area in the original RGB image with the area corresponding to the target background image;

基于所述目标RGB图像以及所述掩膜图像,获得目标RGBA图像。Obtain a target RGBA image based on the target RGB image and the mask image.

本申请提供了一种隐私保护装置,所述装置包括:The present application provides a privacy protection device, the device comprising:

获取模块,用于获得包含用户的原始RGB图像,并基于人像分割算法,获得所述用户对应的掩模图像;The obtaining module is used to obtain the original RGB image containing the user, and based on the portrait segmentation algorithm, obtain the mask image corresponding to the user;

替换模块,用于根据所述原始RGB图像、所述掩模图像以及目标背景图像,确定将所述原始RGB图像中的背景区域替换为所述目标背景图像对应的区域得到的目标RGB图像;A replacement module, configured to determine, according to the original RGB image, the mask image and the target background image, a target RGB image obtained by replacing the background area in the original RGB image with the area corresponding to the target background image;

处理模块,用于基于所述目标RGB图像以及所述掩膜图像,获得目标RGBA图像。A processing module, configured to obtain a target RGBA image based on the target RGB image and the mask image.

本申请还提供了一种电子设备,所述电子设备至少包括处理器和存储器,所述处理器用于执行存储器中存储的计算机程序时实现如上述任一所述隐私保护方法的步骤。The present application also provides an electronic device, the electronic device includes at least a processor and a memory, and the processor is configured to implement the steps of any one of the privacy protection methods described above when executing a computer program stored in the memory.

本申请还提供了一种计算机可读存储介质,其存储有计算机程序,所述计算机程序被处理器执行时实现如上述任一所述隐私保护方法的步骤。The present application also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the steps of any one of the above-mentioned privacy protection methods are implemented.

本申请实施例中,获得包含用户的原始RGB图像,并基于人像分割算法,获得该用户对应的掩模图像,根据该原始RGB图像、该掩模图像以及目标背景图像,确定将该原始RGB图像中的背景区域替换为该目标背景图像对应的区域得到的目标RGB图像,基于该目标RGB图像以及该掩膜图像,获得目标RGBA图像。由于本申请实施例中,在将基于包含用户的原始RGB图像以及用户对应的掩膜图像生成的RGBA图像上传到云端服务器之前,先将原始RGB图像中的背景区域替换成预设的背景,进而保护了用户背景隐私,降低了隐私泄露的风险。In the embodiment of the present application, the original RGB image containing the user is obtained, and based on the portrait segmentation algorithm, the mask image corresponding to the user is obtained, and the original RGB image is determined according to the original RGB image, the mask image and the target background image. The background area in is replaced with the target RGB image obtained from the area corresponding to the target background image, and the target RGBA image is obtained based on the target RGB image and the mask image. Because in the embodiment of the present application, before uploading the RGBA image generated based on the original RGB image containing the user and the mask image corresponding to the user to the cloud server, first replace the background area in the original RGB image with the preset background, and then The user background privacy is protected and the risk of privacy leakage is reduced.

附图说明Description of drawings

为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简要介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域的普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings that need to be used in the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For Those of ordinary skill in the art can also obtain other drawings based on these drawings without any creative effort.

图1为本申请一些实施例提供的一种隐私保护方法的过程示意图;FIG. 1 is a schematic diagram of the process of a privacy protection method provided by some embodiments of the present application;

图2a为相关技术中合成RGBA图像的显示示意图;Fig. 2 a is the display schematic diagram of synthetic RGBA image in the related art;

图2b为相关技术中基于RGBA分解的显示示意图;Fig. 2b is a display schematic diagram based on RGBA decomposition in the related art;

图3a为本申请一些实施例提供的一种有利于隐私保护的合成RGBA图像的显示示意图;Figure 3a is a schematic display of a synthetic RGBA image that is beneficial to privacy protection provided by some embodiments of the present application;

图3b为本申请一些实施例提供的一种有利于隐私保护的合成RGBA图像分解的显示示意图;Figure 3b is a schematic display of a synthetic RGBA image decomposition that is beneficial to privacy protection provided by some embodiments of the present application;

图4a为相关技术中的一种人像分割与合成的过程示意图;Fig. 4a is a schematic diagram of a process of portrait segmentation and synthesis in the related art;

图4b为本申请一些实施例中提供的一种人像分割与合成的过程示意图;Fig. 4b is a schematic diagram of a process of portrait segmentation and synthesis provided in some embodiments of the present application;

图5为本申请一些实施例提供的一种隐私保护装置结构示意图;Fig. 5 is a schematic structural diagram of a privacy protection device provided by some embodiments of the present application;

图6为本申请一些实施例提供的一种电子设备的结构示意图。Fig. 6 is a schematic structural diagram of an electronic device provided by some embodiments of the present application.

具体实施方式Detailed ways

为了使本申请的目的、技术方案和优点更加清楚,下面将结合附图对本申请作进一步地详细描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其它实施例,都属于本申请保护的范围。In order to make the purpose, technical solution and advantages of the application clearer, the application will be further described in detail below in conjunction with the accompanying drawings. Apparently, the described embodiments are only some of the embodiments of the application, not all of them. Based on the embodiments in this application, all other embodiments obtained by persons of ordinary skill in the art without making creative efforts belong to the scope of protection of this application.

本申请实施例中,获得包含用户的原始RGB图像,并基于人像分割算法,获得该用户对应的掩模图像,根据该原始RGB图像、该掩模图像以及目标背景图像,确定将该原始RGB图像中的背景区域替换为该目标背景图像对应的区域得到的目标RGB图像,基于该目标RGB图像以及该掩膜图像,获得目标RGBA图像。由于本申请实施例中,在将基于包含用户的原始RGB图像以及用户对应的掩膜图像生成的RGBA图像上传到云端服务器之前,先将原始RGB图像中的背景区域替换成预设的背景,进而保护了用户背景隐私,降低了隐私泄露的风险。In the embodiment of the present application, the original RGB image containing the user is obtained, and based on the portrait segmentation algorithm, the mask image corresponding to the user is obtained, and the original RGB image is determined according to the original RGB image, the mask image and the target background image. The background area in is replaced with the target RGB image obtained from the area corresponding to the target background image, and the target RGBA image is obtained based on the target RGB image and the mask image. Because in the embodiment of the present application, before uploading the RGBA image generated based on the original RGB image containing the user and the mask image corresponding to the user to the cloud server, first replace the background area in the original RGB image with the preset background, and then The user background privacy is protected and the risk of privacy leakage is reduced.

为了保护用户背景隐私,降低隐私泄露的风险,本申请实施例提供了一种隐私保护方法、装置、设备及介质。In order to protect user background privacy and reduce the risk of privacy leakage, embodiments of the present application provide a privacy protection method, device, device, and medium.

图1为本申请一些实施例提供的一种隐私保护方法的过程示意图,该过程包括以下步骤:Figure 1 is a schematic diagram of the process of a privacy protection method provided by some embodiments of the present application, the process includes the following steps:

S101:获得包含用户的原始RGB图像,并基于人像分割算法,获得所述用户对应的掩模图像。S101: Obtain an original RGB image including a user, and obtain a mask image corresponding to the user based on a portrait segmentation algorithm.

本申请实施例提供的隐私保护方法应用于电子设备,该电子设备可以是智能终端、PC或者服务器等设备。The privacy protection method provided in the embodiment of the present application is applied to an electronic device, and the electronic device may be a device such as a smart terminal, a PC, or a server.

在存在将多人图像合成在同一个背景的需求时,比如,多人虚拟会议、虚拟合照、虚拟舞台等,电子设备则需要针对每个进行合成的用户,获得包含该用户的原始RGB图像,其中,该用户为需要合成在同一背景中的任一用户,其中,该原始RGB图像中可能包含一个用户也可能包含多个用户。在获得该包含用户的原始RGB图像后,在本申请中,基于该原始RGB图像以及人像分割算法,获得该用户对应的掩膜图像。When there is a need to synthesize multiple images on the same background, such as multi-person virtual meetings, virtual group photos, virtual stages, etc., the electronic device needs to obtain the original RGB image containing the user for each user who is synthesizing, Wherein, the user is any user who needs to be synthesized in the same background, and the original RGB image may contain one user or may contain multiple users. After obtaining the original RGB image containing the user, in this application, based on the original RGB image and a portrait segmentation algorithm, a mask image corresponding to the user is obtained.

具体的,通过该人像分割算法获得所述用户对应的掩模图像时,可以基于一个encoder-decoder模型实现,该模型中包括细节特征提取模块、全局特征提取模块、特征融合模块和像素分类模块,在获得该用户对应的掩模图像的过程中,先将该原始RGB图像输入到该模型中,细节特征提取模块对该原始RGB图像进行二维卷积(Conv2D)以及深度可分离卷积(DSConv)处理,得到第一特征图,全局特征模块对该第一特征图进行一些列的卷积、上采样等操作得到第二特征图,该特征融合模块对该第二特征图以及第一特征图通过卷积进行特征融合,得到第三特征图,最后像素分类模块对该第三特征图进行卷积处理,并通过softmax进行像素的分类,得到该用户对应的掩模图像。Specifically, when the mask image corresponding to the user is obtained through the portrait segmentation algorithm, it can be realized based on an encoder-decoder model, which includes a detail feature extraction module, a global feature extraction module, a feature fusion module and a pixel classification module. In the process of obtaining the mask image corresponding to the user, the original RGB image is first input into the model, and the detail feature extraction module performs two-dimensional convolution (Conv2D) and depth separable convolution (DSConv) on the original RGB image. ) processing to obtain the first feature map, the global feature module performs a series of convolution, upsampling and other operations on the first feature map to obtain the second feature map, the feature fusion module uses the second feature map and the first feature map The feature fusion is performed by convolution to obtain the third feature map, and finally the pixel classification module performs convolution processing on the third feature map, and performs pixel classification by softmax to obtain the mask image corresponding to the user.

S102:根据所述原始RGB图像、所述掩模图像以及目标背景图像,确定将所述原始RGB图像中的背景区域替换为所述目标背景图像对应的区域得到的目标RGB图像。S102: According to the original RGB image, the mask image and the target background image, determine a target RGB image obtained by replacing a background area in the original RGB image with an area corresponding to the target background image.

由于该原始RGB图像中除了包含用户对应的区域以外,该原始RGB图像中还包含背景区域,其中,该背景区域中包含采集这张原始RGB图像时该用户所处的真实背景环境信息,因此为了保护用户的背景隐私,在本申请中,可以将该原始RGB图像中包含的背景区域进行替换。Since the original RGB image includes not only the area corresponding to the user, but also the background area in the original RGB image, wherein the background area includes the real background environment information of the user when the original RGB image is collected, so for To protect the user's background privacy, in this application, the background area contained in the original RGB image can be replaced.

为了实现背景区域的替换,在本申请中,目标背景图像可以为预先保存在电子设备中,也可以在获得包含用户的原始RGB图像以及用户对应的掩模图像之后,电子设备获得该目标背景图像,该目标背景图像中包含待替换的背景的信息。具体的,根据该原始RGB图像,该掩膜图像以及该目标背景图像,对该原始RGB图像中的包含的背景区域进行替换,并确定将该原始RGB图像中的背景区域替换为该目标背景图像对应的区域得到的目标RGB图像。其中,该目标RGB图像中包含用户对应的区域以及替换后的背景区域,该替换后的背景区域中包含目标背景图像中背景信息。In order to replace the background area, in this application, the target background image can be pre-saved in the electronic device, or the electronic device can obtain the target background image after obtaining the original RGB image containing the user and the corresponding mask image of the user , the target background image contains the information of the background to be replaced. Specifically, according to the original RGB image, the mask image and the target background image, replace the background area contained in the original RGB image, and determine to replace the background area in the original RGB image with the target background image The corresponding region gets the target RGB image. Wherein, the target RGB image includes an area corresponding to the user and a replaced background area, and the replaced background area includes background information in the target background image.

S103:基于所述目标RGB图像以及所述掩膜图像,获得目标RGBA图像。S103: Obtain a target RGBA image based on the target RGB image and the mask image.

为了实现将多人图像合成在同一个背景,也就是说,为了保证远程多人虚拟会议、虚拟合照、虚拟舞台等技术的实现,电子设备在获得目标RGB图像之后,可以将根据该目标RGB图像以及该掩膜图像,获得目标RGBA图像,其中,该目标RGB图像为三通道图像,分别为R通道、G通道以及B通道,该掩膜图像为一通道图像,该目标RGBA图像为四通道图像。In order to realize the synthesis of multi-person images in the same background, that is to say, in order to ensure the realization of technologies such as remote multi-person virtual meeting, virtual group photo, virtual stage, etc., after the electronic device obtains the target RGB image, it can And the mask image, obtain the target RGBA image, wherein, the target RGBA image is a three-channel image, respectively R channel, G channel and B channel, the mask image is a one-channel image, and the target RGBA image is a four-channel image .

此外,在获得目标RGBA图像后,将该目标RGBA图像上传到云端服务器中。电子设备在将目标RGBA图像上传到云端服务器之后,云端服务器获取各个用户对应的目标RGBA图像,将该目标RGBA图像分解为目标RGB图像以及掩模图像,并基于场景合成算法以及每个用户的目标RGB图像将该每个用户的图像合成在相同的背景中,获得合成的图像,并将该合成图像在显示设备上进行显示。In addition, after the target RGBA image is obtained, the target RGBA image is uploaded to the cloud server. After the electronic device uploads the target RGBA image to the cloud server, the cloud server obtains the target RGBA image corresponding to each user, decomposes the target RGBA image into a target RGB image and a mask image, and based on the scene synthesis algorithm and each user's target The RGB image is combined with the images of each user in the same background to obtain a combined image, and the combined image is displayed on the display device.

其中,基于场景合成算法以及每个用户的目标RGB图像将每个用户合成在相同的背景中的过程为现有技术,在此不做赘述。Wherein, the process of synthesizing each user in the same background based on the scene synthesis algorithm and each user's target RGB image is a prior art, and will not be repeated here.

由于应用场景不同,针对每个用户,需要的包含该用户的原始RGB图像的数量也不相同,因此,该用户对应的掩膜图像的数量也不相同。比如,若应用场景为虚拟合照,则只需要获得每个用户的一张原始RGB图像即可,因此,各个用户对应的掩膜图像的数量也为一个,最终确定的目标RGBA图像的数量也为一个。若应用场景为虚拟舞台等,则需要针对每个用户,获得多张包含该用户的原始RGB图像,并获得该用户对应的多张掩膜图像,最终获得多张目标RGBA图像。在应用场景为虚拟舞台等需要多张包含用户的原始RGB图像的情况下,每张原始RGB图像进行背景区域替换的原理、以及基于每张原始RGB图像以及对应的掩膜图像确定对应的目标RGBA图像的原理都相同,因此,为了方便描述,本申请实施例中,针对获得到的任一张原始RGB图像的应用场景进行说明。Due to different application scenarios, for each user, the required number of original RGB images containing the user is also different, and therefore, the number of mask images corresponding to the user is also different. For example, if the application scenario is a virtual group photo, you only need to obtain one original RGB image for each user. Therefore, the number of mask images corresponding to each user is also one, and the number of final target RGBA images is also one. If the application scenario is a virtual stage, etc., for each user, it is necessary to obtain multiple original RGB images containing the user, obtain multiple mask images corresponding to the user, and finally obtain multiple target RGBA images. In the case where multiple original RGB images containing the user are required in the application scenario such as a virtual stage, the principle of background area replacement for each original RGB image, and the determination of the corresponding target RGBA based on each original RGB image and the corresponding mask image The principles of the images are the same. Therefore, for the convenience of description, in the embodiment of the present application, the application scenario of any obtained original RGB image will be described.

为了便于上传到云端服务器,在本申请中,若应用场景为虚拟舞台等,在获得每个用户的多张目标RGBA图像后,将该多张目标RGBA图像编码生成视频流,并将该视频流上传到云端服务器,其中,该将多张目标RGBA图像编码生成视频流的技术为现有技术,在此不做赘述。In order to facilitate uploading to the cloud server, in this application, if the application scenario is a virtual stage, etc., after obtaining multiple target RGBA images of each user, the multiple target RGBA images are encoded to generate a video stream, and the video stream Upload to the cloud server, wherein the technology of encoding multiple target RGBA images to generate a video stream is an existing technology, and will not be repeated here.

由于本申请实施例中,在将基于包含用户的原始RGB图像以及用户对应的掩膜图像生成的RGBA图像上传到云端服务器之前,先将原始RGB图像中的背景区域替换成预设的背景,进而保护了用户背景隐私,降低了隐私泄露的风险。Because in the embodiment of the present application, before uploading the RGBA image generated based on the original RGB image containing the user and the mask image corresponding to the user to the cloud server, first replace the background area in the original RGB image with the preset background, and then The user background privacy is protected and the risk of privacy leakage is reduced.

为了将原始RGB图像中的背景区域进行替换,进而保护用户的背景隐私,在上述实施例的基础上,在本申请实施例中,所述根据该原始RGB图像、该掩模图像以及目标背景图像,确定将该原始RGB图像中的背景区域替换为所述目标背景图像对应的区域得到的目标RGB图像包括:In order to replace the background area in the original RGB image, and then protect the background privacy of the user, on the basis of the above-mentioned embodiments, in the embodiment of the present application, the original RGB image, the mask image and the target background image , it is determined that the background region in the original RGB image is replaced with the region corresponding to the target background image, and the target RGB image obtained includes:

针对每个像素点,根据I=α*f+(1-α)*b,确定该像素点对应的目标像素值,其中,所述α为该掩模图像中该像素点对应的像素值,f为该原始RGB图像中该像素点的像素值,b为目标背景图像中该像素点对应的像素值。For each pixel point, according to I=α*f+(1-α)*b, determine the target pixel value corresponding to the pixel point, wherein, the α is the pixel value corresponding to the pixel point in the mask image, f is the pixel value of the pixel in the original RGB image, and b is the pixel value corresponding to the pixel in the target background image.

根据每个像素点对应的目标像素值,确定对应的目标RGB图像。According to the target pixel value corresponding to each pixel point, the corresponding target RGB image is determined.

为了实现将原始RGB图像中的背景区域进行替换,在本申请中,针对该原始RGB图像中包含的每个像素点,将背景区域中各个像素点对应的像素值替换为目标图像中对应的像素点对应的像素值。具体的,针对每个像素点,根据I=α*f+(1-α)*b,确定该像素点对应的目标像素值,其中,该α为该掩模图像中该像素点对应的像素值,f为该原始RGB图像中该像素点的像素值,b为目标背景图像中该像素点对应的像素值。其中,该掩膜图像中人像对应像素点的像素值为255,非人像对应像素点的像素值为0。In order to replace the background area in the original RGB image, in this application, for each pixel contained in the original RGB image, replace the pixel value corresponding to each pixel in the background area with the corresponding pixel in the target image The pixel value corresponding to the point. Specifically, for each pixel, according to I=α*f+(1-α)*b, determine the target pixel value corresponding to the pixel, where the α is the pixel value corresponding to the pixel in the mask image , f is the pixel value of the pixel in the original RGB image, and b is the pixel value corresponding to the pixel in the target background image. Wherein, the pixel value of the pixel point corresponding to the portrait in the mask image is 255, and the pixel value of the pixel point corresponding to the non-portrait is 0.

为了方便描述,假如该原始RGB图像包含四个像素点,分别为像素点1、像素点2、像素点3以及像素点4,该像素点1、像素点2、像素点3以及像素点4在原始RGB图像中对应的像素值分别为0,255,0,255,该像素点1、像素点2、像素点3以及像素点4在掩膜图像中对应的像素值为分别为255,255,0,0,该像素点1、像素点2、像素点3以及像素点4在目标背景图像中对应的像素值可以为255,0,255,255,则像素点1、像素点2、像素点3以及像素点4在目标背景图像中对应的目标像素值分别为0,255,255,255。For the convenience of description, if the original RGB image contains four pixels, namely pixel 1, pixel 2, pixel 3 and pixel 4, the pixel 1, pixel 2, pixel 3 and pixel 4 are in The corresponding pixel values in the original RGB image are 0, 255, 0, 255 respectively, and the corresponding pixel values of pixel 1, pixel 2, pixel 3 and pixel 4 in the mask image are 255, 255, respectively, 0, 0, the corresponding pixel values of pixel 1, pixel 2, pixel 3 and pixel 4 in the target background image can be 255, 0, 255, 255, then pixel 1, pixel 2, pixel The corresponding target pixel values of 3 and 4 in the target background image are 0, 255, 255, 255 respectively.

为了获得目标RGBA图像,在上述各实施例的基础上,在本申请实施例中,所述基于所述目标RGB图像以及所述掩膜图像,获得目标RGBA图像包括:In order to obtain the target RGBA image, on the basis of the above-mentioned embodiments, in the embodiment of the present application, the obtaining the target RGBA image based on the target RGB image and the mask image includes:

根据所述目标RGB图像包含的像素点在各通道中的像素值、所述掩膜图像包含的像素点的像素值以及预设的函数,获得每个像素点对应的目标像素值;Obtain the target pixel value corresponding to each pixel according to the pixel value of the pixel contained in the target RGB image in each channel, the pixel value of the pixel contained in the mask image and a preset function;

根据所述每个像素点对应的目标像素值,确定目标RGBA图像。A target RGBA image is determined according to the target pixel value corresponding to each pixel point.

在本申请中,在根据目标RGB图像以及该掩膜图像,获得目标RGBA图像的过程中,可以根据该目标RGB图像包含的像素点在R通道的像素值、该目标RGB图像包含的像素点在G通道的像素值、该目标RGB图像包含的像素点在B通道的像素值、该掩膜图像包含的像素点的像素值以及预设的函数,获得每个像素点对应的目标像素值,然后根据每个像素点对应的目标像素值确定目标RGBA图像,也就是说,针对每个像素点,该像素点对应的目标像素值也就是目标RGBA图像中该像素点对应的像素值。In this application, in the process of obtaining the target RGBA image according to the target RGB image and the mask image, it can be based on the pixel values of the pixels contained in the target RGB image in the R channel, the pixels contained in the target RGB image in The pixel value of the G channel, the pixel value of the pixel contained in the target RGB image in the B channel, the pixel value of the pixel contained in the mask image, and the preset function to obtain the target pixel value corresponding to each pixel, and then The target RGBA image is determined according to the target pixel value corresponding to each pixel, that is, for each pixel, the target pixel value corresponding to the pixel is the pixel value corresponding to the pixel in the target RGBA image.

为了获得每个像素点对应的目标像素值,在上述各实施例的基础上,在本申请实施例中,所述根据该目标RGB图像包含的像素点在各通道中的像素值、该掩膜图像包含的像素点的像素值以及预设的函数,获得每个像素点对应的目标像素值包括:In order to obtain the target pixel value corresponding to each pixel, on the basis of the above-mentioned embodiments, in the embodiment of the present application, according to the pixel value of the pixel contained in the target RGB image in each channel, the mask The pixel values of the pixels contained in the image and the preset functions to obtain the target pixel values corresponding to each pixel include:

针对每个像素点,根据所述目标RGB图像中该像素点每个通道的像素值所述掩膜图像中该像素点的像素值、每个通道对应的权重值及所述掩膜图像对应的权重值,确定该像素点对应的权重和,并将该权重和确定为该像素点对应的目标像素值。For each pixel, according to the pixel value of each channel of the pixel in the target RGB image, the pixel value of the pixel in the mask image, the weight value corresponding to each channel, and the corresponding weight value of the mask image The weight value is to determine the weight sum corresponding to the pixel point, and determine the weight sum as the target pixel value corresponding to the pixel point.

由于RGB图像有R、G、B三个通道,RGB图像的每个像素点在这三个通道都有对应的像素值,且RGB图像中像素点对应的像素值根据该像素点在R、G、B三个通道对应的像素值确定的,具体的,在基于R、G、B三个通道对应的像素值确定该像素点在RGB图像中对应的像素值过程中,一般采用RGB函数确定,其中,该RGB函数为Red+256*Green+65536*Blue,根据该RGB函数确定该像素点在RGB图像中对应的像素值,其中,Red为该像素点在R通道对应的像素值,Green为该像素点在G通道对应的像素值,Blue为该像素点在B通道对应的像素值。Since the RGB image has three channels of R, G, and B, each pixel of the RGB image has a corresponding pixel value in these three channels, and the pixel value corresponding to the pixel in the RGB image is based on the pixel in R, G The pixel values corresponding to the three channels of R, B, and B are determined. Specifically, in the process of determining the pixel value corresponding to the pixel point in the RGB image based on the pixel values corresponding to the R, G, and B channels, the RGB function is generally used. Wherein, the RGB function is Red+256*Green+65536*Blue, and the pixel value corresponding to the pixel point in the RGB image is determined according to the RGB function, wherein, Red is the pixel value corresponding to the pixel point in the R channel, and Green is The pixel value corresponding to the pixel point in the G channel, and Blue is the pixel value corresponding to the pixel point in the B channel.

在本申请中,可以基于三通道的目标RGB图像以及一通道的掩膜图像,生成一个四通道的目标RGBA图像。具体的,在生成目标RGBA图像的过程中,针对每个像素点,该像素点在R通道、G通道、B通道、掩膜图像对应的通道都分别对应一个像素值,基于该像素点在该四个通道对应的像素值,确定该像素点对应的目标像素值,然后基于该目标像素点确定目标RGBA图像,也就是说,针对每个像素点,根据该目标RGB图像中该像素点每个通道的像素值、该掩膜图像中该像素点的像素值、每个通道对应的权重值及该掩膜图像对应的权重值,确定像素值的权重和,并将该权重和确定为该像素点对应的目标像素值。In this application, a four-channel target RGBA image can be generated based on a three-channel target RGB image and a one-channel mask image. Specifically, in the process of generating the target RGBA image, for each pixel, the pixel corresponds to a pixel value in the channel corresponding to the R channel, G channel, B channel, and mask image. The pixel values corresponding to the four channels, determine the target pixel value corresponding to the pixel, and then determine the target RGBA image based on the target pixel, that is, for each pixel, according to each pixel in the target RGB image The pixel value of the channel, the pixel value of the pixel in the mask image, the weight value corresponding to each channel and the weight value corresponding to the mask image, determine the weight sum of the pixel values, and determine the weight sum as the pixel The target pixel value corresponding to the point.

比如,像素点A在目标RGB图像中的R通道的像素值为255,像素点A在目标RGB图像中的G通道的像素值为0,像素点A在目标RGB中的B通道的像素值为0,像素点A在掩膜图像中的像素值为0,R、G、B每个通道对应的权重值分别为1、256、65536、1,则该像素点A在目标RGBA图像中的像素值为255。For example, the pixel value of the R channel of pixel A in the target RGB image is 255, the pixel value of the G channel of pixel A in the target RGB image is 0, and the pixel value of the B channel of pixel A in the target RGB image is 0, the pixel value of pixel A in the mask image is 0, and the weight values corresponding to each channel of R, G, and B are 1, 256, 65536, and 1 respectively, then the pixel value of the pixel A in the target RGBA image The value is 255.

此外,还可以基于opencv的merge函数、目标RGB图像对应的矩阵以及掩模图像对应的矩阵,确定目标RGBA图像,其中,该目标RGB图像对应的矩阵中各个元素为该目标RGB图像中各个像素点对应的像素值,该掩模图像对应的矩阵中各个元素为该掩膜图像中各个像素点对应的像素值,其中,基于opencv的merge函数、目标RGB图像对应的矩阵、掩模图像对应的矩阵,确定目标RGBA图像的过程为现有技术,在此不做赘述。In addition, the target RGBA image can also be determined based on the merge function of opencv, the matrix corresponding to the target RGB image, and the matrix corresponding to the mask image, wherein each element in the matrix corresponding to the target RGB image is each pixel in the target RGB image The corresponding pixel value, each element in the matrix corresponding to the mask image is the pixel value corresponding to each pixel in the mask image, wherein, based on the merge function of opencv, the matrix corresponding to the target RGB image, and the matrix corresponding to the mask image , the process of determining the target RGBA image is a prior art, and will not be repeated here.

图2a为相关技术中合成RGBA图像的显示示意图,图2b为相关技术中基于RGBA分解的显示示意图,图3a为本申请一些实施例提供的一种有利于隐私保护的合成RGBA图像的显示示意图,图3b为本申请一些实施例提供的一种有利于隐私保护的合成RGBA图像分解的显示示意图,现针对图2a、图2b、图3a和图3b进行说明:Figure 2a is a schematic display diagram of a composite RGBA image in the related art, Figure 2b is a schematic display diagram based on RGBA decomposition in the related art, and Figure 3a is a schematic display diagram of a composite RGBA image that is beneficial to privacy protection provided by some embodiments of the present application, Figure 3b is a schematic display of a synthetic RGBA image decomposition that is beneficial to privacy protection provided by some embodiments of the present application, and is now described for Figure 2a, Figure 2b, Figure 3a and Figure 3b:

图2a中RGB为获得的包含用户的原始RGB图像,α为该用户对应的掩膜图像,现有技术中,直接基于该原始RGB图像以及该掩膜图像获得RGBA图像。图2b中RGBA图像分解为包含背景区域的原始RGB图像以及掩模图像,其中,该背景区域包含用户的背景隐私。In Fig. 2a, RGB is the obtained original RGB image including the user, and α is the mask image corresponding to the user. In the prior art, the RGBA image is obtained directly based on the original RGB image and the mask image. The RGBA image in Figure 2b is decomposed into the original RGB image containing the background area, which contains the user's background privacy, and the mask image.

图3a中RGB为获得的包含用户的原始RGB图像背景区域像素被替换后的RGB图像,也就是目标RGB图像,α为该用户对应的掩膜图像,本申请中基于该背景区域像素被替换后获得的目标RGB图像以及该掩膜图像获得目标RGBA图像,也就是说,基于目标RGB图像以及该掩膜图像获得目标RGBA图像,图3b中目标RGBA图像分解为该背景区域像素被替换后获得的目标RGB图像以及该掩膜图像,该背景区域像素被替换后获得的目标RGB图像中不包含用户的背景隐私。In Figure 3a, RGB is the obtained RGB image containing the replaced pixels in the background area of the original RGB image of the user, that is, the target RGB image, and α is the mask image corresponding to the user. In this application, based on the replaced pixels in the background area The obtained target RGB image and the mask image obtain the target RGBA image, that is to say, the target RGBA image is obtained based on the target RGB image and the mask image, and the target RGBA image in Figure 3b is decomposed into the obtained after the pixels in the background area are replaced The target RGB image and the mask image, the target RGB image obtained after replacing pixels in the background area does not contain the user's background privacy.

图4a为相关技术中的一种人像分割与合成的过程示意图,图4b为本申请一些实施例中提供的一种人像分割与合成的过程示意图,现针对图4a和图4b进行说明:Fig. 4a is a schematic diagram of a process of portrait segmentation and synthesis in the related art, and Fig. 4b is a schematic diagram of a process of portrait segmentation and synthesis provided in some embodiments of the present application. Now, we will describe Fig. 4a and Fig. 4b:

以应用场景为虚拟舞台等需要多张包含用户的原始RGB图像的应用场景为例,在现有技术中,电子设备获得多张包含用户的原始RGB图像,并采用人像分割算法以及原始RGB图像分割前景人像,获得多张掩模图像,针对每个原始RGB图像以及该原始RGB图像对应的掩模图像,将该原始RGB图像和该掩模图像组成目标RGBA图像,并将该目标RGBA图像编码生成视频流上传到云端服务器。云端服务器接收该各个用户对应的视频流,针对每个视频流,基于该视频流获得目标RGBA图像,将该目标RGBA图像分解生成原始RGB图像和掩模图像,并通过场景合成算法、原始RGB图像和掩模图像,将多人图像合成到同一个背景中,并将合成的图像推送到显示端显示。Taking the application scene as an example where multiple original RGB images containing the user are needed, such as a virtual stage, in the prior art, the electronic device obtains multiple original RGB images containing the user, and uses the portrait segmentation algorithm and the original RGB image segmentation Foreground portrait, obtain multiple mask images, for each original RGB image and the mask image corresponding to the original RGB image, form the original RGB image and the mask image into a target RGBA image, and encode the target RGBA image to generate The video stream is uploaded to the cloud server. The cloud server receives the video stream corresponding to each user, and for each video stream, obtains the target RGBA image based on the video stream, decomposes the target RGBA image to generate the original RGB image and mask image, and uses the scene synthesis algorithm, the original RGB image and mask image, synthesize multiple images into the same background, and push the synthesized image to the display terminal for display.

本申请实施例中,电子设备获得多张包含用户的原始RGB图像,并采用人像分割算法以及原始RGB图像分割前景人像,获得多张掩模图像,针对每个原始RGB图像,对该原始RGB图像的背景区域做像素替换,生成目标RGB图像,将该目标RGB图像和该掩模图像组成目标RGBA图像,并将该目标RGBA图像编码生成视频流上传到云端服务器。云端服务器接收该各个用户对应的视频流,针对每个视频流,基于该视频流获得目标RGBA图像,将该目标RGBA图像分解生成目标RGB图像和掩模图像,并通过场景合成算法、目标RGB图像和掩模图像,将多个人合成到同一个背景中,并将合成的图像推送到显示端显示。In the embodiment of the present application, the electronic device obtains multiple original RGB images containing the user, and uses the portrait segmentation algorithm and the original RGB image to segment the foreground portrait to obtain multiple mask images. For each original RGB image, the original RGB image Perform pixel replacement in the background area to generate a target RGB image, combine the target RGB image and the mask image into a target RGBA image, and encode the target RGBA image to generate a video stream and upload it to the cloud server. The cloud server receives the video stream corresponding to each user, for each video stream, obtains the target RGBA image based on the video stream, decomposes the target RGBA image to generate the target RGB image and mask image, and uses the scene synthesis algorithm, the target RGB image and mask image, multiple people are synthesized into the same background, and the synthesized image is pushed to the display terminal for display.

图5为本申请一些实施例提供的一种隐私保护装置结构示意图,该装置包括:Fig. 5 is a schematic structural diagram of a privacy protection device provided by some embodiments of the present application, the device includes:

获取模块501,用于获得包含用户的原始RGB图像,并基于人像分割算法,获得所述用户对应的掩模图像;The obtaining module 501 is used to obtain the original RGB image including the user, and obtain the mask image corresponding to the user based on the portrait segmentation algorithm;

替换模块502,用于根据所述原始RGB图像、所述掩模图像以及目标背景图像,确定将所述原始RGB图像中的背景区域替换为所述目标背景图像对应的区域得到的目标RGB图像;A replacement module 502, configured to, according to the original RGB image, the mask image, and the target background image, determine a target RGB image obtained by replacing the background area in the original RGB image with the area corresponding to the target background image;

处理模块503,用于基于所述目标RGB图像以及所述掩膜图像,获得目标RGBA图像。The processing module 503 is configured to obtain a target RGBA image based on the target RGB image and the mask image.

在一种可能的实施方式中,所述替换模块502,具体用于针对每个像素点,根据I=α*f+(1-α)*b,确定该像素点对应的目标像素值,其中,所述α为该掩模图像中该像素点对应的像素值,f为该原始RGB图像中该像素点的像素值,b为目标背景图像中该像素点对应的像素值;根据每个像素点对应的目标像素值,确定对应的目标RGB图像。In a possible implementation manner, the replacement module 502 is specifically configured to, for each pixel point, determine the target pixel value corresponding to the pixel point according to I=α*f+(1-α)*b, wherein, Said α is the corresponding pixel value of the pixel in the mask image, f is the pixel value of the pixel in the original RGB image, and b is the corresponding pixel value of the pixel in the target background image; according to each pixel The corresponding target pixel value is used to determine the corresponding target RGB image.

在一种可能的实施方式中,所述处理模块503,具体用于根据所述目标RGB图像包含的像素点在各通道中的像素值、所述掩膜图像包含的像素点的像素值以及预设的函数,获得每个像素点对应的目标像素值;根据所述每个像素点对应的目标像素值,确定目标RGBA图像。In a possible implementation manner, the processing module 503 is specifically configured to, according to the pixel values of the pixels contained in the target RGB image in each channel, the pixel values of the pixels contained in the mask image, and the preset The function is set to obtain the target pixel value corresponding to each pixel point; according to the target pixel value corresponding to each pixel point, the target RGBA image is determined.

在一种可能的实施方式中,所述处理模块503,具体用于针对每个像素点,根据所述目标RGB图像中该像素点每个通道的像素值所述掩膜图像中该像素点的像素值、每个通道对应的权重值及所述掩膜图像对应的权重值,确定该像素点对应的权重和,并将该权重和确定为该像素点对应的目标像素值。In a possible implementation manner, the processing module 503 is specifically configured to, for each pixel, according to the pixel value of each channel of the pixel in the target RGB image, the pixel in the mask image The pixel value, the weight value corresponding to each channel and the weight value corresponding to the mask image, determine the weight sum corresponding to the pixel point, and determine the weight sum as the target pixel value corresponding to the pixel point.

在上述各实施例的基础上,本申请一些实施例还提供了一种电子设备,如图6所示,包括:处理器601、通信接口602、存储器603和通信总线604,其中,处理器601,通信接口602,存储器603通过通信总线604完成相互间的通信。On the basis of the foregoing embodiments, some embodiments of the present application also provide an electronic device, as shown in FIG. 6 , including: a processor 601, a communication interface 602, a memory 603, and a communication bus 604, wherein , the communication interface 602 and the memory 603 communicate with each other through the communication bus 604 .

所述存储器603中存储有计算机程序,当所述程序被所述处理器601执行时,使得所述处理器601执行如下步骤:A computer program is stored in the memory 603, and when the program is executed by the processor 601, the processor 601 is made to perform the following steps:

获得包含用户的原始RGB图像,并基于人像分割算法,获得所述用户对应的掩模图像;Obtain the original RGB image containing the user, and obtain the mask image corresponding to the user based on the portrait segmentation algorithm;

根据所述原始RGB图像、所述掩模图像以及目标背景图像,确定将所述原始RGB图像中的背景区域替换为所述目标背景图像对应的区域得到的目标RGB图像;According to the original RGB image, the mask image and the target background image, determine the target RGB image obtained by replacing the background area in the original RGB image with the area corresponding to the target background image;

基于所述目标RGB图像以及所述掩膜图像,获得目标RGBA图像。Obtain a target RGBA image based on the target RGB image and the mask image.

进一步地,所述处理器601,还用于针对每个像素点,根据Further, the processor 601 is also configured for each pixel according to

I=α*f+(1-α)*b,确定该像素点对应的目标像素值,其中,所述α为该掩模图像中该像素点对应的像素值,f为该原始RGB图像中该像素点的像素值,b为目标背景图像中该像素点对应的像素值;根据每个像素点对应的目标像素值,确定对应的目标RGB图像。I=α*f+(1-α)*b, determine the target pixel value corresponding to the pixel point, wherein, the α is the pixel value corresponding to the pixel point in the mask image, and f is the pixel value corresponding to the pixel point in the original RGB image The pixel value of the pixel point, b is the pixel value corresponding to the pixel point in the target background image; according to the target pixel value corresponding to each pixel point, the corresponding target RGB image is determined.

进一步地,所述处理器601,还用于根据所述目标RGB图像包含的像素点在各通道中的像素值、所述掩膜图像包含的像素点的像素值以及预设的函数,获得每个像素点对应的目标像素值;根据所述每个像素点对应的目标像素值,确定目标RGBA图像。Further, the processor 601 is further configured to obtain the pixel values of the pixels contained in the target RGB image in each channel, the pixel values of the pixels contained in the mask image, and a preset function to obtain each The target pixel value corresponding to each pixel point; according to the target pixel value corresponding to each pixel point, the target RGBA image is determined.

进一步地,所述处理器601,还用于针对每个像素点,根据所述目标RGB图像中该像素点每个通道的像素值所述掩膜图像中该像素点的像素值、每个通道对应的权重值及所述掩膜图像对应的权重值,确定该像素点对应的权重和,并将该权重和确定为该像素点对应的目标像素值。Further, the processor 601 is further configured to, for each pixel, according to the pixel value of the pixel in the mask image, each channel The corresponding weight value and the weight value corresponding to the mask image determine the weight sum corresponding to the pixel point, and determine the weight sum as the target pixel value corresponding to the pixel point.

上述服务器提到的通信总线可以是外设部件互连标准(Peripheral ComponentInterconnect,PCI)总线或扩展工业标准结构(Extended Industry StandardArchitecture,EISA)总线等。该通信总线可以分为地址总线、数据总线、控制总线等。为便于表示,图中仅用一条粗线表示,但并不表示仅有一根总线或一种类型的总线。The communication bus mentioned in the above server may be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (Extended Industry Standard Architecture, EISA) bus or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

通信接口602用于上述电子设备与其他设备之间的通信。The communication interface 602 is used for communication between the electronic device and other devices.

存储器可以包括随机存取存储器(Random Access Memory,RAM),也可以包括非易失性存储器(Non-Volatile Memory,NVM),例如至少一个磁盘存储器。可选地,存储器还可以是至少一个位于远离前述处理器的存储装置。The memory may include a random access memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-Volatile Memory, NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

上述处理器可以是通用处理器,包括中央处理器、网络处理器(NetworkProcessor,NP)等;还可以是数字指令处理器(Digital Signal Processing,DSP)、专用集成电路、现场可编程门陈列或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。Above-mentioned processor can be general-purpose processor, comprises central processing unit, network processor (NetworkProcessor, NP) etc.; Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc.

在上述各实施例的基础上,本申请一些实施例还提供了一种计算机可读存储介质,所述计算机可读存储介质内存储有可由电子设备执行的计算机程序,当所述程序在所述电子设备上运行时,使得所述电子设备执行时实现如下步骤:On the basis of the above-mentioned embodiments, some embodiments of the present application also provide a computer-readable storage medium, where a computer program executable by an electronic device is stored in the computer-readable storage medium. When the program is in the When running on the electronic device, the following steps are implemented when the electronic device is executed:

所述存储器中存储有计算机程序,当所述程序被所述处理器执行时,使得所述处理器执行如下步骤:A computer program is stored in the memory, and when the program is executed by the processor, the processor is made to perform the following steps:

获得包含用户的原始RGB图像,并基于人像分割算法,获得所述用户对应的掩模图像;Obtain the original RGB image containing the user, and obtain the mask image corresponding to the user based on the portrait segmentation algorithm;

根据所述原始RGB图像、所述掩模图像以及目标背景图像,确定将所述原始RGB图像中的背景区域替换为所述目标背景图像对应的区域得到的目标RGB图像;According to the original RGB image, the mask image and the target background image, determine the target RGB image obtained by replacing the background area in the original RGB image with the area corresponding to the target background image;

基于所述目标RGB图像以及所述掩膜图像,获得目标RGBA图像。Obtain a target RGBA image based on the target RGB image and the mask image.

进一步地,所述根据该原始RGB图像、该掩模图像以及目标背景图像,确定将该原始RGB图像中的背景区域替换为所述目标背景图像对应的区域得到的目标RGB图像包括:Further, according to the original RGB image, the mask image and the target background image, determining the target RGB image obtained by replacing the background area in the original RGB image with the area corresponding to the target background image includes:

针对每个像素点,根据I=α*f+(1-α)*b,确定该像素点对应的目标像素值,其中,所述α为该掩模图像中该像素点对应的像素值,f为该原始RGB图像中该像素点的像素值,b为目标背景图像中该像素点对应的像素值;根据每个像素点对应的目标像素值,确定对应的目标RGB图像。For each pixel point, according to I=α*f+(1-α)*b, determine the target pixel value corresponding to the pixel point, wherein, the α is the pixel value corresponding to the pixel point in the mask image, f is the pixel value of the pixel in the original RGB image, and b is the corresponding pixel value of the pixel in the target background image; according to the target pixel value corresponding to each pixel, determine the corresponding target RGB image.

进一步地,所述基于所述目标RGB图像以及所述掩膜图像,获得目标RGBA图像包括:Further, said obtaining the target RGBA image based on the target RGB image and the mask image includes:

根据所述目标RGB图像包含的像素点在各通道中的像素值、所述掩膜图像包含的像素点的像素值以及预设的函数,获得每个像素点对应的目标像素值;Obtain the target pixel value corresponding to each pixel according to the pixel value of the pixel contained in the target RGB image in each channel, the pixel value of the pixel contained in the mask image and a preset function;

根据所述每个像素点对应的目标像素值,确定目标RGBA图像。A target RGBA image is determined according to the target pixel value corresponding to each pixel point.

进一步地,所述根据该目标RGB图像包含的像素点在各通道中的像素值、该掩膜图像包含的像素点的像素值以及预设的函数,获得每个像素点对应的目标像素值包括:Further, according to the pixel values of the pixels contained in the target RGB image in each channel, the pixel values of the pixels contained in the mask image and the preset function, obtaining the target pixel value corresponding to each pixel includes :

针对每个像素点,根据所述目标RGB图像中该像素点每个通道的像素值所述掩膜图像中该像素点的像素值、每个通道对应的权重值及所述掩膜图像对应的权重值,确定该像素点对应的权重和,并将该权重和确定为该像素点对应的目标像素值。For each pixel, according to the pixel value of each channel of the pixel in the target RGB image, the pixel value of the pixel in the mask image, the weight value corresponding to each channel, and the corresponding weight value of the mask image The weight value is to determine the weight sum corresponding to the pixel point, and determine the weight sum as the target pixel value corresponding to the pixel point.

由于本申请实施例中,在将基于包含用户的原始RGB图像以及用户对应的掩膜图像生成的RGBA图像上传到云端服务器之前,先将原始RGB图像中的背景区域替换成预设的背景,进而保护了用户背景隐私,降低了隐私泄露的风险。Because in the embodiment of the present application, before uploading the RGBA image generated based on the original RGB image containing the user and the mask image corresponding to the user to the cloud server, first replace the background area in the original RGB image with the preset background, and then The user background privacy is protected and the risk of privacy leakage is reduced.

本领域内的技术人员应明白,本申请的实施例可提供为方法、系统、或计算机程序产品。因此,本申请可采用完全硬件实施例、完全软件实施例、或结合软件和硬件方面的实施例的形式。而且,本申请可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器、CD-ROM、光学存储器等)上实施的计算机程序产品的形式。Those skilled in the art should understand that the embodiments of the present application may be provided as methods, systems, or computer program products. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) having computer-usable program code embodied therein.

本申请是参照根据本申请的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to the present application. It should be understood that each procedure and/or block in the flowchart and/or block diagram, and a combination of procedures and/or blocks in the flowchart and/or block diagram can be realized by computer program instructions. These computer program instructions may be provided to a general purpose computer, special purpose computer, embedded processor, or processor of other programmable data processing equipment to produce a machine such that the instructions executed by the processor of the computer or other programmable data processing equipment produce a An apparatus for realizing the functions specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing apparatus to operate in a specific manner, such that the instructions stored in the computer-readable memory produce an article of manufacture comprising instruction means, the instructions The device realizes the function specified in one or more procedures of the flowchart and/or one or more blocks of the block diagram.

这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。These computer program instructions can also be loaded onto a computer or other programmable data processing device, causing a series of operational steps to be performed on the computer or other programmable device to produce a computer-implemented process, thereby The instructions provide steps for implementing the functions specified in the flow chart or blocks of the flowchart and/or the block or blocks of the block diagrams.

显然,本领域的技术人员可以对本申请进行各种改动和变型而不脱离本申请的精神和范围。这样,倘若本申请的这些修改和变型属于本申请权利要求及其等同技术的范围之内,则本申请也意图包含这些改动和变型在内。Obviously, those skilled in the art can make various changes and modifications to the application without departing from the spirit and scope of the application. In this way, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalent technologies, the present application is also intended to include these modifications and variations.

Claims (10)

1.一种隐私保护方法,其特征在于,所述方法包括:1. A privacy protection method, characterized in that the method comprises: 获得包含用户的原始RGB图像,并基于人像分割算法,获得所述用户对应的掩模图像;Obtain the original RGB image containing the user, and obtain the mask image corresponding to the user based on the portrait segmentation algorithm; 根据所述原始RGB图像、所述掩模图像以及目标背景图像,确定将所述原始RGB图像中的背景区域替换为所述目标背景图像对应的区域得到的目标RGB图像;According to the original RGB image, the mask image and the target background image, determine the target RGB image obtained by replacing the background area in the original RGB image with the area corresponding to the target background image; 基于所述目标RGB图像以及所述掩膜图像,获得目标RGBA图像。Obtain a target RGBA image based on the target RGB image and the mask image. 2.根据权利要求1所述的方法,其特征在于,所述根据该原始RGB图像、该掩模图像以及目标背景图像,确定将该原始RGB图像中的背景区域替换为所述目标背景图像对应的区域得到的目标RGB图像包括:2. The method according to claim 1, wherein, according to the original RGB image, the mask image and the target background image, it is determined to replace the background area in the original RGB image with the target background image corresponding The regions of the resulting target RGB image include: 针对每个像素点,根据I=α*f+(1-α)*b,确定该像素点对应的目标像素值,其中,所述α为该掩模图像中该像素点对应的像素值,f为该原始RGB图像中该像素点的像素值,b为目标背景图像中该像素点对应的像素值;For each pixel point, according to I=α*f+(1-α)*b, determine the target pixel value corresponding to the pixel point, wherein, the α is the pixel value corresponding to the pixel point in the mask image, f Be the pixel value of the pixel point in the original RGB image, b is the pixel value corresponding to the pixel point in the target background image; 根据每个像素点对应的目标像素值,确定对应的目标RGB图像。According to the target pixel value corresponding to each pixel point, the corresponding target RGB image is determined. 3.根据权利要求1所述的方法,其特征在于,所述基于所述目标RGB图像以及所述掩膜图像,获得目标RGBA图像包括:3. The method according to claim 1, wherein said obtaining a target RGBA image based on said target RGB image and said mask image comprises: 根据所述目标RGB图像包含的像素点在各通道中的像素值、所述掩膜图像包含的像素点的像素值以及预设的函数,获得每个像素点对应的目标像素值;Obtain the target pixel value corresponding to each pixel according to the pixel value of the pixel contained in the target RGB image in each channel, the pixel value of the pixel contained in the mask image and a preset function; 根据所述每个像素点对应的目标像素值,确定目标RGBA图像。A target RGBA image is determined according to the target pixel value corresponding to each pixel point. 4.根据权利要求3所述的方法,其特征在于,所述根据该目标RGB图像包含的像素点在各通道中的像素值、该掩膜图像包含的像素点的像素值以及预设的函数,获得每个像素点对应的目标像素值包括:4. The method according to claim 3, characterized in that, according to the pixel values of the pixels contained in the target RGB image in each channel, the pixel values of the pixels contained in the mask image and the preset function , obtaining the target pixel value corresponding to each pixel includes: 针对每个像素点,根据所述目标RGB图像中该像素点每个通道的像素值所述掩膜图像中该像素点的像素值、每个通道对应的权重值及所述掩膜图像对应的权重值,确定该像素点对应的权重和,并将该权重和确定为该像素点对应的目标像素值。For each pixel, according to the pixel value of each channel of the pixel in the target RGB image, the pixel value of the pixel in the mask image, the weight value corresponding to each channel, and the corresponding weight value of the mask image The weight value is to determine the weight sum corresponding to the pixel point, and determine the weight sum as the target pixel value corresponding to the pixel point. 5.一种隐私保护装置,其特征在于,所述装置包括:5. A privacy protection device, characterized in that the device comprises: 获取模块,用于获得包含用户的原始RGB图像,并基于人像分割算法,获得所述用户对应的掩模图像;The obtaining module is used to obtain the original RGB image containing the user, and based on the portrait segmentation algorithm, obtain the mask image corresponding to the user; 替换模块,用于根据所述原始RGB图像、所述掩模图像以及目标背景图像,确定将所述原始RGB图像中的背景区域替换为所述目标背景图像对应的区域得到的目标RGB图像;A replacement module, configured to, according to the original RGB image, the mask image and the target background image, determine a target RGB image obtained by replacing the background area in the original RGB image with the area corresponding to the target background image; 处理模块,用于基于所述目标RGB图像以及所述掩膜图像,获得目标RGBA图像。A processing module, configured to obtain a target RGBA image based on the target RGB image and the mask image. 6.根据权利要求5所述的装置,其特征在于,所述替换模块,具体用于针对每个像素点,根据I=α*f+(1-α)*b,确定该像素点对应的目标像素值,其中,所述α为该掩模图像中该像素点对应的像素值,f为该原始RGB图像中该像素点的像素值,b为目标背景图像中该像素点对应的像素值;根据每个像素点对应的目标像素值,确定对应的目标RGB图像。6. The device according to claim 5, wherein the replacement module is specifically configured to, for each pixel, determine the target corresponding to the pixel according to I=α*f+(1-α)*b Pixel value, wherein, said α is the pixel value corresponding to the pixel point in the mask image, f is the pixel value of the pixel point in the original RGB image, and b is the pixel value corresponding to the pixel point in the target background image; According to the target pixel value corresponding to each pixel point, the corresponding target RGB image is determined. 7.根据权利要求5所述的装置,其特征在于,所述处理模块,具体用于根据所述目标RGB图像包含的像素点在各通道中的像素值、所述掩膜图像包含的像素点的像素值以及预设的函数,获得每个像素点对应的目标像素值;根据所述每个像素点对应的目标像素值,确定目标RGBA图像。7. The device according to claim 5, wherein the processing module is specifically configured to use pixel values in each channel according to the pixel points contained in the target RGB image, and the pixel points contained in the mask image to The pixel value and the preset function to obtain the target pixel value corresponding to each pixel point; according to the target pixel value corresponding to each pixel point, determine the target RGBA image. 8.根据权利要求7所述的装置,其特征在于,所述处理模块,具体用于针对每个像素点,根据所述目标RGB图像中该像素点每个通道的像素值所述掩膜图像中该像素点的像素值、每个通道对应的权重值及所述掩膜图像对应的权重值,确定该像素点对应的权重和,并将该权重和确定为该像素点对应的目标像素值。8. The device according to claim 7, wherein the processing module is specifically configured to, for each pixel, according to the pixel value of each channel of the pixel in the target RGB image, the mask image The pixel value of the pixel, the weight value corresponding to each channel and the weight value corresponding to the mask image, determine the weight sum corresponding to the pixel point, and determine the weight sum as the target pixel value corresponding to the pixel point . 9.一种电子设备,其特征在于,所述电子设备包括处理器,所述处理器用于执行存储器中存储的计算机程序时实现如权利要求1-4中任一所述方法的步骤。9. An electronic device, characterized in that the electronic device comprises a processor, and the processor is configured to implement the steps of the method according to any one of claims 1-4 when executing the computer program stored in the memory. 10.一种计算机可读存储介质,其特征在于,其存储有计算机程序,所述计算机程序被处理器执行时实现如权利要求1-4中任一所述方法的步骤。10. A computer-readable storage medium, characterized in that it stores a computer program, and when the computer program is executed by a processor, the steps of the method according to any one of claims 1-4 are implemented.
CN202110903118.5A 2021-08-06 2021-08-06 Privacy protection method, device, equipment and medium Pending CN115705636A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110903118.5A CN115705636A (en) 2021-08-06 2021-08-06 Privacy protection method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110903118.5A CN115705636A (en) 2021-08-06 2021-08-06 Privacy protection method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN115705636A true CN115705636A (en) 2023-02-17

Family

ID=85179083

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110903118.5A Pending CN115705636A (en) 2021-08-06 2021-08-06 Privacy protection method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN115705636A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5781198A (en) * 1995-12-22 1998-07-14 Intel Corporation Method and apparatus for replacing a background portion of an image
CN107154046A (en) * 2017-04-06 2017-09-12 南京邮电大学 A kind of method of video background processing and secret protection
CN109151489A (en) * 2018-08-14 2019-01-04 广州虎牙信息科技有限公司 live video image processing method, device, storage medium and computer equipment
CN109348226A (en) * 2017-04-08 2019-02-15 腾讯科技(深圳)有限公司 A kind of photograph document handling method and intelligent terminal
CN109800698A (en) * 2019-01-11 2019-05-24 北京邮电大学 Icon detection method based on depth network
CN111292337A (en) * 2020-01-21 2020-06-16 广州虎牙科技有限公司 Image background replacing method, device, equipment and storage medium

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5781198A (en) * 1995-12-22 1998-07-14 Intel Corporation Method and apparatus for replacing a background portion of an image
CN107154046A (en) * 2017-04-06 2017-09-12 南京邮电大学 A kind of method of video background processing and secret protection
CN109348226A (en) * 2017-04-08 2019-02-15 腾讯科技(深圳)有限公司 A kind of photograph document handling method and intelligent terminal
CN109151489A (en) * 2018-08-14 2019-01-04 广州虎牙信息科技有限公司 live video image processing method, device, storage medium and computer equipment
CN109800698A (en) * 2019-01-11 2019-05-24 北京邮电大学 Icon detection method based on depth network
CN111292337A (en) * 2020-01-21 2020-06-16 广州虎牙科技有限公司 Image background replacing method, device, equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
魏彬 等: "Windows3.0软件开发指南 3 库函数及数据结构", 31 May 1991, pages: 406 *

Similar Documents

Publication Publication Date Title
JP7645917B2 (en) A technique for capturing and editing dynamic depth images
US12243124B2 (en) Personalized machine learning system to edit images based on a provided style
CN113436284B (en) Image processing method, device, computer equipment and storage medium
CN105874506B (en) Blurred images with detail preservation
CN110062176B (en) Method and device for generating video, electronic equipment and computer readable storage medium
CN107204034B (en) An image processing method and terminal
CN110503703A (en) Method and device for generating images
CN114782659B (en) Image processing methods, apparatus, devices and storage media
TW201438463A (en) Techniques for adding interactive features to videos
CN112053417B (en) Image processing method, device and system and computer readable storage medium
CN107622504A (en) Method and device for processing pictures
CN108833877A (en) Image processing method and device, computer installation and readable storage medium storing program for executing
CN112262570B (en) Method and computer system for automatically modifying high-resolution video data in real time
US10140557B1 (en) Increasing network transmission capacity and data resolution quality and computer systems and computer-implemented methods for implementing thereof
CN113225606A (en) Video barrage processing method and device
US10650488B2 (en) Apparatus, method, and computer program code for producing composite image
CN115293994B (en) Image processing method, image processing device, computer equipment and storage medium
US20170032505A1 (en) Image filter
CN114549281A (en) Image processing method, image processing device, electronic equipment and storage medium
CN115705636A (en) Privacy protection method, device, equipment and medium
CN114040129A (en) Video generation method, device, equipment and storage medium
CN111739112A (en) Image processing method, device, computer equipment and storage medium
CN113691835B (en) Video implantation method, apparatus, apparatus, and computer-readable storage medium
CN114298891B (en) A picture processing method based on OpenGL ES architecture
CN117097983A (en) Image processing methods and devices

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination