WO2013013484A1 - 一种利用阿尔法通道的图像合成方法及系统 - Google Patents

一种利用阿尔法通道的图像合成方法及系统 Download PDF

Info

Publication number
WO2013013484A1
WO2013013484A1 PCT/CN2011/084221 CN2011084221W WO2013013484A1 WO 2013013484 A1 WO2013013484 A1 WO 2013013484A1 CN 2011084221 W CN2011084221 W CN 2011084221W WO 2013013484 A1 WO2013013484 A1 WO 2013013484A1
Authority
WO
WIPO (PCT)
Prior art keywords
image
value
matrix
alpha
current pixel
Prior art date
Application number
PCT/CN2011/084221
Other languages
English (en)
French (fr)
Inventor
王晶
Original Assignee
深圳市万兴软件有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳市万兴软件有限公司 filed Critical 深圳市万兴软件有限公司
Publication of WO2013013484A1 publication Critical patent/WO2013013484A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T11/002D [Two Dimensional] image generation
    • G06T11/60Editing figures and text; Combining figures or text

Definitions

  • the present invention relates to image processing techniques, and more particularly to an image synthesis method using an alpha channel.
  • Image synthesis technology belongs to the category of image processing. It mainly refers to two or more videos or pictures processed, superimposed or combined to create new image effects. Common image synthesis methods are:
  • Alpha blending using the alpha information of the foreground and background images, blending according to a certain ratio, and processing each pixel to obtain a synthesized image
  • Mask synthesis method the mask participates in the synthesis in the form of a separate layer, and controls the synthesis ratio of the foreground and the background, instead of an alpha channel information attached to the foreground image;
  • Three-dimensional spatial synthesis formed by adding the concept of depth Z-axis on the basis of two-dimensional, three-dimensional space synthesis introduces the modeling method similar to three-dimensional animation into the synthesis space.
  • alpha blending is more widely used in multimedia applications.
  • the color of each pixel is generally calculated by setting alpha information, for example, the color of each pixel is calculated by the following method:
  • R (Rb*(255-Alpha)+ Rf*Alpha)/255; // Alpha values range from 0 to 255
  • G (Gb *(255-Alpha)+ Gf *Alpha)/255; // Alpha values range from 0 to 255
  • B (Bb *(255-Alpha)+ Bf *Alpha)/255; // Alpha values range from 0 to 255
  • A Alpha; // Alpha values range from 0 to 255
  • the alpha value of the setting is usually a foreground or background image or a fixed alpha value
  • the synthesized image is also calculated for each pixel based on the foreground or background image or a fixed alpha value. Therefore, this image synthesis method only takes one of the alpha channels (foreground image or background image or a fixed value as an alpha channel) to calculate, and cannot simultaneously use the two alpha channel information of the foreground image and the background image.
  • the technical problem to be solved by the present invention is to provide an image synthesis method using an alpha channel, which can simultaneously utilize the above-mentioned defects of image synthesis by using the two alpha channel information of the foreground image and the background image at the same time.
  • the two alpha channel information of the foreground and background images are used for image synthesis.
  • the technical solution adopted by the present invention to solve the technical problem thereof is to construct an image synthesis method using an alpha channel, including:
  • the alpha value of each pixel of the synthesized image is sequentially calculated by the preset matrix A; according to the alpha channel of the foreground image, the alpha channel of the background image, and the color of the foreground image a color channel of the channel and the background image, and sequentially calculating a color value of each pixel of the synthesized image through a preset matrix S;
  • the synthesized image is obtained from the alpha value and the color value of each pixel of the synthesized image.
  • the step of sequentially calculating the alpha value of each pixel of the synthesized image by the preset matrix A further includes:
  • a (i, j) represents the element of matrix A, and int ( ) represents rounding;
  • the step of sequentially calculating the color value of each pixel of the synthesized image by the preset matrix S further includes:
  • S (i, j) represents the element of the matrix S.
  • the step S3 includes:
  • the alpha value of the current pixel of the foreground image is a row value
  • the alpha value of the current pixel of the background image is a column value
  • the corresponding element is found in the matrix A
  • the element found in the matrix A is found.
  • the alpha value of the current pixel point of the foreground image is a row value
  • the alpha value of the current pixel point of the background image is a column value
  • the corresponding element is searched in the matrix S
  • the current pixel of the synthesized image is calculated according to the following formula.
  • R R b + s*(R f -R b ) / 256
  • G G b + s*(G f -G b ) / 256
  • R is the R value of the current pixel of the synthesized image
  • G is the G value of the current pixel of the synthesized image
  • B is the B value of the current pixel of the synthesized image
  • s is the element found in the matrix S
  • R f is the R value of the current pixel of the foreground image
  • G f is the G value of the current pixel of the foreground image
  • B f is the B value of the current pixel of the foreground image
  • R b is the R value of the current pixel of the background image
  • G b For the G value of the current pixel of the background image
  • B b is the B value of the current pixel of the background image.
  • the invention also constructs an image synthesis system using an alpha channel, comprising:
  • a calculation module configured to sequentially calculate an alpha value of each pixel of the synthesized image according to an alpha channel of the foreground image and an alpha channel of the background image; and an alpha channel of the foreground image and an alpha channel of the background image according to the foreground image a color channel of the foreground image and a color channel of the background image, and sequentially calculating color values of each pixel of the synthesized image through a preset matrix S;
  • An image synthesis module is configured to obtain a synthesized image according to an alpha value and a color value of each pixel of the synthesized image.
  • the image composition system further includes:
  • the matrix A building block is used to construct the symmetric matrix A, and the model of the symmetric matrix A is:
  • a (i, j) represents the element of matrix A, and int ( ) represents rounding;
  • a matrix S building block for constructing a symmetric matrix S, and the model of the matrix S is:
  • S (i, j) represents the element of the matrix S.
  • the calculation module includes:
  • the alpha value determining unit is configured to use the alpha value of the current pixel point of the foreground image as a row value, and the alpha value of the current pixel point of the background image as a column value, and find the corresponding element in the matrix A, and will be in the matrix A.
  • the found element is used as the alpha value of the current pixel of the synthesized image;
  • a color value determining unit configured to use the alpha value of the current pixel point of the foreground image as a row value, and the alpha value of the current pixel point of the background image as a column value, and search for a corresponding element in the matrix S, and calculate according to the following formula
  • the color value of the current pixel of the synthesized image :
  • R R b + s*(R f -R b ) / 256
  • G G b + s*(G f -G b ) / 256
  • R is the R value of the current pixel of the synthesized image
  • G is the G value of the current pixel of the synthesized image
  • B is the B value of the current pixel of the synthesized image
  • s is the element found in the matrix S
  • R f is the R value of the current pixel of the foreground image
  • G f is the G value of the current pixel of the foreground image
  • B f is the B value of the current pixel of the foreground image
  • R b is the R value of the current pixel of the background image
  • G b For the G value of the current pixel of the background image
  • B b is the B value of the current pixel of the background image.
  • the synthesized image information when performing image synthesis, since the alpha channel and the alpha channel of the foreground image are simultaneously used to calculate the alpha channel and the color channel of the synthesized image, the synthesized image information includes the first two synthesized images. Information about the alpha channel of the image.
  • Embodiment 1 is a flow chart of Embodiment 1 of an image synthesizing method using an alpha channel of the present invention
  • Embodiment 2 is a flow chart of Embodiment 2 of an image synthesizing method using an alpha channel of the present invention
  • FIG. 3 is a flow chart of a preferred embodiment of step S3 of Figure 1;
  • Embodiment 4 is a logic structural diagram of Embodiment 1 of an image synthesizing system using an alpha channel of the present invention
  • Embodiment 2 is a logic structural diagram of Embodiment 2 of an image synthesizing system using an alpha channel of the present invention
  • Fig. 6 is a logic structural diagram of a third embodiment of an image synthesizing system using an alpha channel of the present invention.
  • an image includes four channels, three of which are color channels, which are R (red) channel, G (green) channel, and B (blue) channel.
  • the other channel is the alpha channel, which is used to record the transparency information of the image.
  • image processing it is performed pixel by pixel, and for each pixel, it has four values corresponding to four channels, and the four values are specifically: R value, G value, B Value and alpha value.
  • the method includes steps S3-S4, which are specifically described below.
  • step S3 according to the alpha channel of the foreground image and the alpha channel of the background image, the alpha value of each pixel of the synthesized image is sequentially calculated by the preset matrix A; according to the alpha channel of the foreground image, the alpha channel of the background image The color channel of the foreground image and the color channel of the background image sequentially calculate the color value of each pixel of the synthesized image through the preset matrix S.
  • step S4 the synthesized image is obtained based on the alpha value and the color value of each pixel of the synthesized image.
  • the synthesized image information includes synthesis. Information about the alpha channel of the first two images.
  • FIG. 2 is a flowchart of Embodiment 2 of an image synthesizing method using an alpha channel according to the present invention.
  • the image synthesizing method includes steps S1-S4, wherein steps S3-S4 are the same as steps S3-S4 in the first embodiment shown in FIG. , and details are not described herein again. Only steps S1-S2 will be described below.
  • step S1 before step S3 a symmetric matrix A is constructed, and the model of the symmetric matrix A is:
  • a (i, j) represents the element of matrix A
  • int ( ) represents rounding
  • the matrix A constructed according to the above formula is:
  • step S2 the matrix S is constructed, and the model of the matrix S is:
  • the matrix S includes the following features: 1) For the same row value, the larger the column value, the smaller the element value (except the first row and the last row); 2) For the same column value, the larger the row value, the larger the element value .
  • FIG 3 is a flow chart of a preferred embodiment of step S3 of Figure 1, the step S3 comprising:
  • Step S31 Taking the alpha value of the current pixel of the foreground image as a row value, the alpha value of the current pixel of the background image as a column value, finding the corresponding element in the matrix A, and synthesizing the element found in the matrix A as a composite The alpha value of the current pixel of the post image;
  • Step S32 The alpha value of the current pixel of the foreground image is the row value, the alpha value of the current pixel of the background image is the column value, the corresponding element is searched in the matrix S, and the current pixel of the synthesized image is calculated according to the following formula.
  • Color value is the alpha value of the current pixel of the foreground image.
  • R R b + s*(R f -R b ) / 256
  • G G b + s*(G f -G b ) / 256
  • R is the R value of the current pixel of the synthesized image
  • G is the G value of the current pixel of the synthesized image
  • B is the B value of the current pixel of the synthesized image
  • s is the element found in the matrix S
  • R f is the R value of the current pixel of the foreground image
  • G f is the G value of the current pixel of the foreground image
  • B f is the B value of the current pixel of the foreground image
  • R b is the R value of the current pixel of the background image
  • G b For the G value of the current pixel of the background image
  • B b is the B value of the current pixel of the background image.
  • the row value when the search is performed after determining the row value and the column value, since the matrix A and the matrix S are stored in rows when stored, for example, the first is stored first.
  • the elements of the row, followed by the second row, the third row, and so on, up to the last row, so when looking up, the row value should be multiplied by 256 plus the column value to determine the offset of the storage location.
  • the image synthesis system includes a calculation module 30 and an image synthesis module 40.
  • the calculation module 30 is configured to sequentially calculate, according to the alpha channel of the foreground image and the alpha channel of the background image, the alpha value of each pixel of the synthesized image through the preset matrix A; according to the alpha channel of the foreground image, the background image
  • the alpha channel, the color channel of the foreground image, and the color channel of the background image, the color values of each pixel of the synthesized image are sequentially calculated through the preset matrix S;
  • the image synthesis module 40 is configured to calculate each pixel of the synthesized image according to the calculation The alpha value and the color value of the point are obtained to obtain a synthesized image.
  • FIG. 5 is a logic structural diagram of Embodiment 2 of an image synthesis system using an alpha channel according to the present invention.
  • the image synthesis system includes a matrix A construction module 10, a matrix S construction module 20, a calculation module 30, and an image synthesis module 40, wherein the calculation module
  • the image synthesizing module 40 is the same as the computing module 30 and the image synthesizing module 40 in the first embodiment shown in FIG. 4, and details are not described herein again. Only the matrix A building block 10 and the matrix S building block 20 will be described below.
  • the matrix A building block 10 is used to construct a symmetric matrix A, and the model of the symmetric matrix A is:
  • a (i, j) represents the element of matrix A
  • int ( ) represents rounding.
  • the matrix S building block 20 is used to construct a symmetric matrix S, and the model of the matrix S is:
  • the image synthesis module 30 is configured to sequentially calculate an alpha value for each pixel of the synthesized image according to the matrix A, the matrix S, the alpha channel of the foreground image, the alpha channel of the background image, the color channel of the foreground image, and the color channel of the background image. And the color value to get the synthesized image.
  • Embodiment 3 is a logical structural diagram of Embodiment 3 of an image synthesizing system using an alpha channel according to the present invention.
  • the module 40 is the same and will not be described here.
  • the calculation module 30 specifically includes an alpha value determining unit 31 and a color value determining unit 32.
  • the alpha value determining unit 31 is configured to use the alpha value of the current pixel point of the foreground image as a row value, and the alpha value of the current pixel point of the background image as a column value, and find the corresponding element in the matrix A, and will be in the matrix.
  • the element found in A is the alpha value of the current pixel of the synthesized image.
  • the color value determining unit 32 is configured to use the alpha value of the current pixel point of the foreground image as a row value, the alpha value of the current pixel point of the background image as a column value, find the corresponding element in the matrix S, and calculate according to the following formula The color value of the current pixel of the synthesized image:
  • R R b + s*(R f -R b ) / 256
  • G G b + s*(G f -G b ) / 256
  • R is the R value of the current pixel of the synthesized image
  • G is the G value of the current pixel of the synthesized image
  • B is the B value of the current pixel of the synthesized image
  • s is the element found in the matrix S
  • R f is the R value of the current pixel of the foreground image
  • G f is the G value of the current pixel of the foreground image
  • B f is the B value of the current pixel of the foreground image
  • R b is the R value of the current pixel of the background image
  • G b For the G value of the current pixel of the background image
  • B b is the B value of the current pixel of the background image.

Landscapes

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

Abstract

本发明公开了一种利用阿尔法通道的图像合成方法和系统,该图像合成方法包括:根据前景图像的阿尔法通道以及背景图像的阿尔法通道,通过预设的矩阵A依次计算合成后图像的每个像素点的阿尔法值;根据前景图像的阿尔法通道、背景图像的阿尔法通道、前景图像的颜色通道和背景图像的颜色通道,通过预设的矩阵S依次计算合成后图像的每个像素点的颜色值;根据计算合成后图像的每个像素点的阿尔法值和颜色值,得到合成后的图像。本发明还构造一种利用阿尔法通道的图像合成系统。实施本发明的技术方案,能使合成后的图像信息同时包含合成前两个图像的阿尔法通道的信息。

Description

一种利用阿尔法通道的图像合成方法及系统 技术领域
本发明涉及图像处理技术,尤其涉及一种利用阿尔法通道的图像合成方法。
背景技术
图像合成技术,属于图像处理的范畴,主要是指两个或两个以上的视频或图片通过加工处理,叠加或组合在一起,创作出新的图像效果。常见的图像合成方法有:
1.阿尔法(Alpha)混合,利用前景和背景图的阿尔法信息,按照一定的比例融合,每个像素进行处理后得到合成的图像;
2.遮罩合成法,遮罩是以独立的层的形式参与合成,控制前景、背景的合成比例,而不是附属于前景图像的一个阿尔法通道信息;
3.三维空间合成,在二维的基础上加入深度Z轴的概念形成的,三维空间合成将近似于三维动画的建模方式引入合成空间。
其中,在多媒体应用中较为广泛的是阿尔法混合。在现有的阿尔法混合方式中,一般是通过设置阿尔法信息来计算每个像素的颜色,例如,通过下面的方式来计算每个像素的颜色:
R= (Rb*(255-Alpha)+ Rf*Alpha)/255; // Alpha取值范围从0到255
G= (Gb *(255-Alpha)+ Gf *Alpha)/255; // Alpha取值范围从0到255
B= (Bb *(255-Alpha)+ Bf *Alpha)/255; // Alpha取值范围从0到255
A= Alpha; // Alpha取值范围从0到255
而该设置的阿尔法值Alpha通常是取前景图或背景图或某一固定的阿尔法值,而合成后的图片也是根据前景图或背景图或某一固定的阿尔法值来计算每个像素。所以这种图像合成方法,只是取到其中的一个阿尔法通道(前景图或背景图或某一固定值作为阿尔法通道)来计算,无法同时利用前景图和背景图的两个阿尔法通道信息。
技术问题
本发明要解决的技术问题在于,针对现有技术的上述无法同时利用前景图和背景图的两个阿尔法通道信息来进行图像合成的缺陷,提供一种利用阿尔法通道的图像合成方法,能同时利用前景图和背景图的两个阿尔法通道信息来进行图像合成。
技术解决方案
本发明解决其技术问题所采用的技术方案是:构建一种利用阿尔法通道的图像合成方法,包括:
根据前景图像的阿尔法通道以及背景图像的阿尔法通道,通过预设的矩阵A依次计算合成后图像的每个像素点的阿尔法值;根据前景图像的阿尔法通道、背景图像的阿尔法通道、前景图像的颜色通道和背景图像的颜色通道,通过预设的矩阵S依次计算合成后图像的每个像素点的颜色值;
根据计算合成后图像的每个像素点的阿尔法值和颜色值,得到合成后的图像。
在本发明所述的图像合成方法中,所述通过预设的矩阵A依次计算合成后图像的每个像素点的阿尔法值的步骤之前还包括:
构建对称矩阵A,且对称矩阵A的模型为:
A(i,j) =int( i + j – i*j/255) ,0<=i<256,0<=j<256
其中,A (i,j)表示矩阵A的元素,int( )表示取整;
通过预设的矩阵S依次计算合成后图像的每个像素点的颜色值的步骤之前还包括:
构建矩阵S,且矩阵S的模型为:
S(i,j) =i/ A(i,j) ,0<=i<256,0<=j<256 且,
若A(i,j) =0, 则S(i,j)=0
其中,S(i,j) 表示矩阵S的元素。
在本发明所述的图像合成方法中,所述步骤S3包括:
S31.以前景图像的当前像素点的阿尔法值为行值,以背景图像的当前像素点的阿尔法值为列值,在矩阵A中查找对应的元素,并将在矩阵A中所查找到的元素作为合成后图像当前像素点的阿尔法值;
S32.以前景图像的当前像素点的阿尔法值为行值,以背景图像的当前像素点的阿尔法值为列值,在矩阵S中查找对应的元素,并根据下面的公式计算合成后图像当前像素点的颜色值:
R = Rb + s*(Rf-Rb) / 256
G = Gb + s*(Gf-Gb) / 256
B = Bb + s*(Bf-Bb) / 256
其中,R为合成后图像当前像素点的R值,G为合成后图像当前像素点的G值,B为合成后图像当前像素点的B值,s为在矩阵S中所查找到的元素,Rf为前景图像当前像素点的R值,Gf为前景图像当前像素点的G值,Bf为前景图像当前像素点的B值,Rb为背景图像当前像素点的R值,Gb为背景图像当前像素点的G值,Bb为背景图像当前像素点的B值。
本发明还构造一种利用阿尔法通道的图像合成系统,包括:
计算模块,用于根据前景图像的阿尔法通道以及背景图像的阿尔法通道,通过预设的矩阵A依次计算合成后图像的每个像素点的阿尔法值;根据前景图像的阿尔法通道、背景图像的阿尔法通道、前景图像的颜色通道和背景图像的颜色通道,通过预设的矩阵S依次计算合成后图像的每个像素点的颜色值;
图像合成模块,用于根据计算合成后图像的每个像素点的阿尔法值和颜色值,得到合成后的图像。
在本发明所述的图像合成系统中,所述图像合成系统还包括:
矩阵A构建模块,用于构建对称矩阵A,且对称矩阵A的模型为:
A(i,j) =int( i + j – i*j/255) ,0<=i<256,0<=j<256
其中,A(i,j)表示矩阵A的元素,int( )表示取整;
矩阵S构建模块,用于构建对称矩阵S,且矩阵S的模型为:
S(i,j) =i/ A(i,j) ,0<=i<256,0<=j<256 且,
若A(i,j) =0, 则S(i,j)=0
其中,S(i,j) 表示矩阵S的元素。
在本发明所述的图像合成系统中,所述计算模块包括:
阿尔法值确定单元,用于以前景图像的当前像素点的阿尔法值为行值,以背景图像的当前像素点的阿尔法值为列值,在矩阵A中查找对应的元素,并将在矩阵A中所查找到的元素作为合成后图像当前像素点的阿尔法值;
颜色值确定单元,用于以前景图像的当前像素点的阿尔法值为行值,以背景图像的当前像素点的阿尔法值为列值,在矩阵S中查找对应的元素,并根据下面的公式计算合成后图像当前像素点的颜色值:
R = Rb + s*(Rf-Rb) / 256
G = Gb + s*(Gf-Gb) / 256
B = Bb + s*(Bf-Bb) / 256
其中,R为合成后图像当前像素点的R值,G为合成后图像当前像素点的G值,B为合成后图像当前像素点的B值,s为在矩阵S中所查找到的元素,Rf为前景图像当前像素点的R值,Gf为前景图像当前像素点的G值,Bf为前景图像当前像素点的B值,Rb为背景图像当前像素点的R值,Gb为背景图像当前像素点的G值,Bb为背景图像当前像素点的B值。
有益效果
实施本发明的技术方案,在进行图像合成时,由于同时使用到前景图像的阿尔法通道和背景图像的阿尔法通道来计算合成后图像的阿尔法通道和颜色通道,因此合成后的图像信息包含合成前两个图像的阿尔法通道的信息。
附图说明
图1是本发明利用阿尔法通道的图像合成方法实施例一的流程图;
图2是本发明利用阿尔法通道的图像合成方法实施例二的流程图;
图3是图1中步骤S3优选实施例的流程图;
图4是本发明利用阿尔法通道的图像合成系统实施例一的逻辑结构图;
图5是本发明利用阿尔法通道的图像合成系统实施例二的逻辑结构图;
图6是本发明利用阿尔法通道的图像合成系统实施例三的逻辑结构图。
本发明的实施方式
首先说明的是,一个图像包括四个通道,其中三个是颜色通道,分别为R(红)通道、G(绿)通道、B(蓝)通道。另一个通道是阿尔法通道,用以记录图像的透明度信息。另外,在进行图像处理时,都是逐个像素点进行的,而针对每个像素点,其具有四个值,分别对应于四个通道,该四个值具体为:R值、G值、B值及阿尔法值。
如图1所示,在本发明利用阿尔法通道的图像合成方法实施例一的流程图中,该方法包括步骤S3-S4,下面具体说明。
在步骤S3中,根据前景图像的阿尔法通道以及背景图像的阿尔法通道,通过预设的矩阵A依次计算合成后图像的每个像素点的阿尔法值;根据前景图像的阿尔法通道、背景图像的阿尔法通道、前景图像的颜色通道和背景图像的颜色通道,通过预设的矩阵S依次计算合成后图像的每个像素点的颜色值。
在步骤S4中,根据计算合成后图像的每个像素点的阿尔法值和颜色值,得到合成后的图像。
实施图1所示的技术方案,在进行图像合成时,由于同时使用到前景图像的阿尔法通道和背景图像的阿尔法通道来计算合成后图像的阿尔法通道和颜色通道,因此合成后的图像信息包含合成前两个图像的阿尔法通道的信息。
图2是本发明利用阿尔法通道的图像合成方法实施例二的流程图,该图像合成方法包括步骤S1-S4,其中步骤S3-S4与图1所示的实施例一中的步骤S3-S4相同,在此不再赘述,以下仅说明步骤S1-S2。
在步骤S3之前的步骤S1中, 构建对称矩阵A,且对称矩阵A的模型为:
A(i,j) =int( i + j – i*j/255) ,0<=i<256,0<=j<256
其中,A (i,j)表示矩阵A的元素,int( )表示取整。
在该步骤中,按照上述公式构建出的矩阵A为:
Figure PCTCN2011084221-appb-M000001
该矩阵A为256*256的二维对称矩阵,即A = AT,(AT为A的转置矩阵),且该矩阵A包括以下特点:1)对称性;2)对同一列值,行值越大,元素值越大(最后一列除外);3)对应同一行值,列值越大,元素值越大(最后一行除外)。
在步骤S2中,构建矩阵S,且矩阵S的模型为:
S(i,j) =i/ A(i,j) ,0<=i<256,0<=j<256 且,
若A(i,j) =0, 则S(i,j)=0
其中,S(i,j) 表示矩阵A的元素;
在该步骤中,按照上述公式构建出的矩阵S为:
Figure PCTCN2011084221-appb-M000002
该矩阵S包括以下特点:1)对于同一行值,列值越大,元素值越小(除第一行和最后一行外);2)对于同一列值,行值越大,元素值越大。
图3是图1中步骤S3优选实施例的流程图,该步骤S3包括:
步骤S31. 以前景图像的当前像素点的阿尔法值为行值,以背景图像的当前像素点的阿尔法值为列值,在矩阵A中查找对应的元素,并将在矩阵A中所查找到的元素作为合成后图像当前像素点的阿尔法值;
步骤S32. 以前景图像的当前像素点的阿尔法值为行值,以背景图像的当前像素点的阿尔法值为列值,在矩阵S中查找对应的元素,并根据下面的公式计算合成后图像当前像素点的颜色值:
R = Rb + s*(Rf-Rb) / 256
G = Gb + s*(Gf-Gb) / 256
B = Bb + s*(Bf-Bb) / 256
其中,R为合成后图像当前像素点的R值,G为合成后图像当前像素点的G值,B为合成后图像当前像素点的B值,s为在矩阵S中所查找到的元素,Rf为前景图像当前像素点的R值,Gf为前景图像当前像素点的G值,Bf为前景图像当前像素点的B值,Rb为背景图像当前像素点的R值,Gb为背景图像当前像素点的G值,Bb为背景图像当前像素点的B值。
在图3所示的实施例中,还应当说明的是,在确定好行值和列值后进行查找时,因为矩阵A和矩阵S在存储时是按行存储的,例如,先存第一行的元素,接着第二行、第三行等等,直到最后一行,所以,在查找时,应将行值乘以256再加上列值来确定存储位置的偏移量。
图4是本发明利用阿尔法通道的图像合成系统实施例一的逻辑结构图,该图像合成系统包括计算模块30及图像合成模块40。其中,计算模块30用于根据前景图像的阿尔法通道以及背景图像的阿尔法通道,通过预设的矩阵A依次计算合成后图像的每个像素点的阿尔法值;根据前景图像的阿尔法通道、背景图像的阿尔法通道、前景图像的颜色通道和背景图像的颜色通道,通过预设的矩阵S依次计算合成后图像的每个像素点的颜色值;图像合成模块40用于根据计算合成后图像的每个像素点的阿尔法值和颜色值,得到合成后的图像。
图5是本发明利用阿尔法通道的图像合成系统实施例二的逻辑结构图,该图像合成系统包括矩阵A构建模块10、矩阵S构建模块20、计算模块30及图像合成模块40,其中,计算模块30及图像合成模块40与图4所示的实施例一中的计算模块30及图像合成模块40相同,在此不再赘述,以下仅说明矩阵A构建模块10和矩阵S构建模块20。在该图像合成系统中,矩阵A构建模块10用于构建对称矩阵A,且对称矩阵A的模型为:
A(i,j) =int( i + j – i*j/255) ,0<=i<256,0<=j<256
其中,A(i,j)表示矩阵A的元素,int( )表示取整。矩阵S构建模块20用于构建对称矩阵S,且矩阵S的模型为:
S(i,j) =i/ A(i,j) ,0<=i<256,0<=j<256 且,
若A(i,j) =0, 则S(i,j)=0
其中,S(i,j) 表示矩阵A的元素。图像合成模块30用于根据矩阵A、矩阵S、前景图像的阿尔法通道、背景图像的阿尔法通道、前景图像的颜色通道和背景图像的颜色通道,依次对合成后图像的每个像素点计算阿尔法值和颜色值,以得到合成后图像。
图6是本发明利用阿尔法通道的图像合成系统实施例三的逻辑结构图,该实施例相比图4所示的实施例一,其中的矩阵A构建模块10和矩阵S构建模块20、图像合成模块40是相同的,在此不再赘述,所不同的是,计算模块30具体包括:阿尔法值确定单元31和颜色值确定单元32。其中,阿尔法值确定单元31用于以前景图像的当前像素点的阿尔法值为行值,以背景图像的当前像素点的阿尔法值为列值,在矩阵A中查找对应的元素,并将在矩阵A中所查找到的元素作为合成后图像当前像素点的阿尔法值。颜色值确定单元32用于以前景图像的当前像素点的阿尔法值为行值,以背景图像的当前像素点的阿尔法值为列值,在矩阵S中查找对应的元素,并根据下面的公式计算合成后图像当前像素点的颜色值:
R = Rb + s*(Rf-Rb) / 256
G = Gb + s*(Gf-Gb) / 256
B = Bb + s*(Bf-Bb) / 256
其中,R为合成后图像当前像素点的R值,G为合成后图像当前像素点的G值,B为合成后图像当前像素点的B值,s为在矩阵S中所查找到的元素,Rf为前景图像当前像素点的R值,Gf为前景图像当前像素点的G值,Bf为前景图像当前像素点的B值,Rb为背景图像当前像素点的R值,Gb为背景图像当前像素点的G值,Bb为背景图像当前像素点的B值。
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的权利要求范围之内。

Claims (6)

  1. 一种利用阿尔法通道的图像合成方法,其特征在于,包括:
    根据前景图像的阿尔法通道以及背景图像的阿尔法通道,通过预设的矩阵A依次计算合成后图像的每个像素点的阿尔法值;根据前景图像的阿尔法通道、背景图像的阿尔法通道、前景图像的颜色通道和背景图像的颜色通道,通过预设的矩阵S依次计算合成后图像的每个像素点的颜色值;
    根据计算合成后图像的每个像素点的阿尔法值和颜色值,得到合成后的图像。
  2. 根据权利要求1所述的图像合成方法,其特征在于,所述通过预设的矩阵A依次计算合成后图像的每个像素点的阿尔法值的步骤之前还包括:
    构建对称矩阵A,且对称矩阵A的模型为:
    A(i,j) =int( i + j – i*j/255) ,0<=i<256,0<=j<256
    其中,A (i,j)表示矩阵A的元素,int( )表示取整;
    通过预设的矩阵S依次计算合成后图像的每个像素点的颜色值的步骤之前还包括:
    构建矩阵S,且矩阵S的模型为:
    S(i,j) =i/ A(i,j) ,0<=i<256,0<=j<256 且,
    若A(i,j) =0, 则S(i,j)=0
    其中,S(i,j) 表示矩阵S的元素。
  3. 根据权利要求1或2所述的图像合成方法,其特征在于,所述步骤S3包括:
    S31.以前景图像的当前像素点的阿尔法值为行值,以背景图像的当前像素点的阿尔法值为列值,在矩阵A中查找对应的元素,并将在矩阵A中所查找到的元素作为合成后图像当前像素点的阿尔法值;
    S32.以前景图像的当前像素点的阿尔法值为行值,以背景图像的当前像素点的阿尔法值为列值,在矩阵S中查找对应的元素,并根据下面的公式计算合成后图像当前像素点的颜色值:
    R = Rb + s*(Rf-Rb) / 256
    G = Gb + s*(Gf-Gb) / 256
    B = Bb + s*(Bf-Bb) / 256
    其中,R为合成后图像当前像素点的R值,G为合成后图像当前像素点的G值,B为合成后图像当前像素点的B值,s为在矩阵S中所查找到的元素,Rf为前景图像当前像素点的R值,Gf为前景图像当前像素点的G值,Bf为前景图像当前像素点的B值,Rb为背景图像当前像素点的R值,Gb为背景图像当前像素点的G值,Bb为背景图像当前像素点的B值。
  4. 一种利用阿尔法通道的图像合成系统,其特征在于,包括:
    计算模块,用于根据前景图像的阿尔法通道以及背景图像的阿尔法通道,通过预设的矩阵A依次计算合成后图像的每个像素点的阿尔法值;根据前景图像的阿尔法通道、背景图像的阿尔法通道、前景图像的颜色通道和背景图像的颜色通道,通过预设的矩阵S依次计算合成后图像的每个像素点的颜色值;
    图像合成模块,用于根据计算合成后图像的每个像素点的阿尔法值和颜色值,得到合成后的图像。
  5. 根据权利要求4所述的图像合成系统,其特征在于,所述图像合成系统还包括:
    矩阵A构建模块,用于构建对称矩阵A,且对称矩阵A的模型为:
    A(i,j) =int( i + j – i*j/255) ,0<=i<256,0<=j<256
    其中,A(i,j)表示矩阵A的元素,int( )表示取整;
    矩阵S构建模块,用于构建对称矩阵S,且矩阵S的模型为:
    S(i,j) =i/ A(i,j) ,0<=i<256,0<=j<256 且,
    若A(i,j) =0, 则S(i,j)=0
    其中,S(i,j) 表示矩阵S的元素。
  6. 根据权利要求4或5所述的图像合成系统,其特征在于,所述计算模块包括:
    阿尔法值确定单元,用于以前景图像的当前像素点的阿尔法值为行值,以背景图像的当前像素点的阿尔法值为列值,在矩阵A中查找对应的元素,并将在矩阵A中所查找到的元素作为合成后图像当前像素点的阿尔法值;
    颜色值确定单元,用于以前景图像的当前像素点的阿尔法值为行值,以背景图像的当前像素点的阿尔法值为列值,在矩阵S中查找对应的元素,并根据下面的公式计算合成后图像当前像素点的颜色值:
    R = Rb + s*(Rf-Rb) / 256
    G = Gb + s*(Gf-Gb) / 256
    B = Bb + s*(Bf-Bb) / 256
    其中,R为合成后图像当前像素点的R值,G为合成后图像当前像素点的G值,B为合成后图像当前像素点的B值,s为在矩阵S中所查找到的元素,Rf为前景图像当前像素点的R值,Gf为前景图像当前像素点的G值,Bf为前景图像当前像素点的B值,Rb为背景图像当前像素点的R值,Gb为背景图像当前像素点的G值,Bb为背景图像当前像素点的B值。
PCT/CN2011/084221 2011-07-26 2011-12-19 一种利用阿尔法通道的图像合成方法及系统 WO2013013484A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN 201110210305 CN102332158B (zh) 2011-07-26 2011-07-26 一种利用阿尔法通道的图像合成方法及系统
CN201110210305.1 2011-07-26

Publications (1)

Publication Number Publication Date
WO2013013484A1 true WO2013013484A1 (zh) 2013-01-31

Family

ID=45483923

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2011/084221 WO2013013484A1 (zh) 2011-07-26 2011-12-19 一种利用阿尔法通道的图像合成方法及系统

Country Status (2)

Country Link
CN (1) CN102332158B (zh)
WO (1) WO2013013484A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103531177A (zh) * 2013-10-08 2014-01-22 康佳集团股份有限公司 一种点阵字库抗锯齿显示的方法及系统
CN104899838A (zh) * 2015-05-29 2015-09-09 小米科技有限责任公司 调整图像的方法及装置
CN108428222A (zh) * 2018-05-21 2018-08-21 深圳市神飞电子科技有限公司 一种太赫兹图像与自然光图像叠加的系统
CN110047034A (zh) * 2019-03-27 2019-07-23 北京大生在线科技有限公司 在线教育场景下的抠图换背景方法、客户端及系统

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103366364B (zh) * 2013-06-07 2016-06-29 太仓中科信息技术研究院 一种基于颜色差异的抠图方法
CN105512133B (zh) * 2014-09-25 2019-03-15 腾讯科技(深圳)有限公司 一种网页图片合成方法、装置及图片合成网页
CN105513000B (zh) * 2015-11-30 2018-08-31 福州瑞芯微电子股份有限公司 一种图像处理的方法和装置
CN105719240B (zh) * 2016-01-21 2019-01-08 腾讯科技(深圳)有限公司 图片处理的方法和装置
CN107169973A (zh) * 2017-05-18 2017-09-15 深圳市优微视技术有限公司 一种图像的背景去除和合成方法及装置
CN108335260A (zh) * 2018-02-02 2018-07-27 网易(杭州)网络有限公司 一种游戏场景图像处理方法、装置、存储介质及电子装置
CN112581588A (zh) * 2020-12-23 2021-03-30 广东三维家信息科技有限公司 一种墙板喷绘方法、装置及计算机存储介质

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1936959A (zh) * 2005-09-23 2007-03-28 西门子公司 通过从两个图像之一消除背景像素而组合图像的方法
CN101030363A (zh) * 2006-02-27 2007-09-05 三菱电机株式会社 图像合成装置
CN101883218A (zh) * 2010-03-12 2010-11-10 浙江大学 一种基于摄像头的图像采集与艺术化处理的方法

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7081892B2 (en) * 2002-04-09 2006-07-25 Sony Computer Entertainment America Inc. Image with depth of field using z-buffer image data and alpha blending
JP2004086255A (ja) * 2002-08-22 2004-03-18 Canon Inc 画像処理方法および画像処理装置、記憶媒体、並びにコンピュータプログラム
CN100337473C (zh) * 2004-09-30 2007-09-12 中国科学院计算技术研究所 运动视频的全景图合成方法

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1936959A (zh) * 2005-09-23 2007-03-28 西门子公司 通过从两个图像之一消除背景像素而组合图像的方法
CN101030363A (zh) * 2006-02-27 2007-09-05 三菱电机株式会社 图像合成装置
CN101883218A (zh) * 2010-03-12 2010-11-10 浙江大学 一种基于摄像头的图像采集与艺术化处理的方法

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103531177A (zh) * 2013-10-08 2014-01-22 康佳集团股份有限公司 一种点阵字库抗锯齿显示的方法及系统
CN104899838A (zh) * 2015-05-29 2015-09-09 小米科技有限责任公司 调整图像的方法及装置
CN104899838B (zh) * 2015-05-29 2017-11-28 小米科技有限责任公司 调整图像的方法及装置
CN108428222A (zh) * 2018-05-21 2018-08-21 深圳市神飞电子科技有限公司 一种太赫兹图像与自然光图像叠加的系统
CN110047034A (zh) * 2019-03-27 2019-07-23 北京大生在线科技有限公司 在线教育场景下的抠图换背景方法、客户端及系统

Also Published As

Publication number Publication date
CN102332158B (zh) 2013-06-12
CN102332158A (zh) 2012-01-25

Similar Documents

Publication Publication Date Title
WO2013013484A1 (zh) 一种利用阿尔法通道的图像合成方法及系统
EP3475924A1 (en) Method, apparatus, and system for sharing virtual reality viewport
WO2018016720A1 (en) Image display device and image display method
TWI324011B (en) Method for compensating pixel of image
WO2018052259A1 (ko) 가상 현실 비디오 변환 및 스트리밍을 위한 시스템 및 방법
WO2013081429A1 (en) Image processing apparatus and method for subpixel rendering
EP3529686A1 (en) Method and apparatus for providing guidance in a virtual environment
DE60211870D1 (de) System und verfahren zur asymmetrischen entfernung des mosaikeffektes in rohbilddaten unter verwendung eines farbunterschiedausgleichs
WO2013111994A1 (en) Image processing method and apparatus for 3d video
WO2018040444A1 (zh) 一种双摄像头拍照控制方法、拍照控制装置及终端
CN108269238A (zh) 深度图像采集装置和深度图像采集系统及其图像处理方法
WO2018155824A1 (en) Display apparatus and control method thereof
WO2019041928A1 (zh) N基色显示屏的显示控制方法、装置及显示器件
WO2014178509A1 (en) Multi-projection system for extending visual element of main image
WO2020101420A1 (ko) 증강현실 기기의 광학 특성 측정 방법 및 장치
WO2023277253A1 (en) Automatic representation switching based on depth camera field of view
WO2016070401A1 (zh) 曲面显示面板及曲面显示装置
WO2019245118A1 (ko) 스테레오 카메라의 동기화 장치, 스테레오 카메라 및 스테레오 카메라의 동기화 방법
WO2017008338A1 (zh) 一种三维图像处理方法及装置
WO2017213335A1 (ko) 실시간 영상 합성 방법
CN105551069B (zh) 一种索引图像的实时快速生成方法及系统
WO2021054511A1 (ko) 전자 장치 및 그 제어 방법
WO2017086522A1 (ko) 배경스크린이 필요 없는 크로마키 영상 합성 방법
WO2017179912A1 (ko) 삼차원 정보증강 비디오 씨쓰루 디스플레이 장치 및 방법, 렉티피케이션 장치
CN104205018A (zh) 汉字输入方法

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 11869908

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

Country of ref document: EP

Kind code of ref document: A1