CN101764914B - Method of alpha channel boundary corrosion - Google Patents

Method of alpha channel boundary corrosion Download PDF

Info

Publication number
CN101764914B
CN101764914B CN2008102394360A CN200810239436A CN101764914B CN 101764914 B CN101764914 B CN 101764914B CN 2008102394360 A CN2008102394360 A CN 2008102394360A CN 200810239436 A CN200810239436 A CN 200810239436A CN 101764914 B CN101764914 B CN 101764914B
Authority
CN
China
Prior art keywords
threshold value
alpha channel
alpha
value
pixel
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.)
Expired - Fee Related
Application number
CN2008102394360A
Other languages
Chinese (zh)
Other versions
CN101764914A (en
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.)
China Digital Video Beijing Ltd
Original Assignee
China Digital Video Beijing 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 China Digital Video Beijing Ltd filed Critical China Digital Video Beijing Ltd
Priority to CN2008102394360A priority Critical patent/CN101764914B/en
Publication of CN101764914A publication Critical patent/CN101764914A/en
Application granted granted Critical
Publication of CN101764914B publication Critical patent/CN101764914B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The present invention relates to a method of alpha channel boundary corrosion, which belongs to the technical field of image and video processing. In the existing method, box blur and Gaussian blur both can soften a boundary, but the whole boundary can be blurred, and the position on an original boundary with small alpha value place can become big now. In the method of alpha channel boundary corrosion, all the pixels in original alpha channel images are described pixels in the boundary and out the boundary by a threshold, and then, different coefficient matrixes are used for the multiplicative summation of pixels in neighborhoods aiming to different categories. By using the method of alpha channel boundary corrosion, ideal alpha channel corrosion effect can be realized; and the method is simple, and is easy to optimize.

Description

A kind of method of alpha channel boundary corrosion
Technical field
The invention belongs to image and technical field of video processing, be specifically related to the method for a kind of Alpha (alpha) channel boundary corrosion.
Background technology
In the image/video treatment technology, it is a kind of that often run into and use demand very widely that a certain class color in the image/video is scratched.The given a kind of color of the essence of these class methods (also may add other parameter) all calculates a key assignments to each pixel in the image, the neutralize key assignments of the identical or approaching color pixel of this color of image is zero or smaller, and it is bigger or be 1 that color differs the key assignments of bigger pixel.This key assignments just can be used as this image and the background image alpha passage when synthesizing so, thereby reaches the purpose of scratching picture.
The key image (back is referred to as the alpha channel image) that is drawn by the key method often has more sharp-pointed border, and this border just is made of the very big alpha value of contrast, and very big such as the pixel alpha value of the inside, border, the alpha value of outside is very little.When this alpha channel image of image applications and background image were synthesized, prospect and background also can be bigger in the boundary contrast of alpha passage.But sometimes people wish boundary contrast not so not greatly or so sharp-pointed, this just requires the boundary of alpha passage is carried out the processing of softening.
Box in the existing method fuzzy (box blur) can reach the effect that makes the border softening with Gaussian Blur (gaussian blur).But they all have a problem, be exactly that their are whole border can be thickened unclear, and the very little place of original borderline alpha value can become now very big (this place that just makes the prospect of composograph to occur also appears at final composograph and suffered).And people's demand is: after the softening of border, the border is still more high-visible, but inside, border (place that the alpha value is very big) carries out softening (also can be described as corrosion) to the inside; External boundary (place that the alpha value is very little) is to outside softening, and the alpha value has a certain upgrade, but can not excessive (also can be described as a kind of corrosion to external boundary).
Summary of the invention
At the defective that exists in the prior art, the purpose of this invention is to provide a kind of method of alpha channel boundary corrosion.This method can realize more satisfactory alpha passage corrosive effect, and this method is fairly simple, is very easy to optimize.
For reaching above purpose, the technical solution used in the present invention is: a kind of method of alpha channel boundary corrosion comprises the steps:
(1) at first the alpha value that is in the original alpha channel image between (0,255) is reduced;
(2) try to achieve greater than threshold value weighted sum coefficient;
Calculating is as follows greater than the formula of the weighted sum coefficient of threshold value:
(x y) is not equal to central point (x as fruit dot 0, y 0), then
Figure GSB00000494773300021
(x y) equals central point (x as fruit dot 0, y 0), then
Factor (x 0Y 0)=1-∑ (factor (x, y) | x 0-width≤x≤x 0+ width, y 0-width≤y≤y 0+ width, and (x, y) ≠ (x 0, y 0))
In the above-mentioned formula, the span of width is [0,30], and unit is a pixel; X be point (x, abscissa y), y be point (x, ordinate y), e are natural logrithms, σ=3width;
(3) try to achieve less than threshold value weighted sum coefficient;
Calculating is as follows less than the formula of threshold value weighted sum coefficient:
(x y) is not equal to central point (x as fruit dot 0, y 0), then
Figure GSB00000494773300022
(x y) equals central point (x as fruit dot 0, y 0), then
Figure GSB00000494773300023
(4) each pixel is divided greater than threshold value and is weighted summation less than two kinds of situations of threshold value obtain final result.
Further, in the step (1), will be in the formula that the alpha value between (0,255) all dwindles and be: (alpha/255) 1.6* 255.
Further, in step (2) and the step (3), the span of described threshold value is [max/2-30, max/2+30], and wherein, max is a maximum gradation value.
Further, described threshold value is max/2, and wherein max is a maximum gradation value.
Further, step (4) is achieved in that
1) all pixels in the original alpha channel image are carried out neighborhood territory pixel and the processing of multiplying each other and suing for peace greater than pairing that weighted sum coefficient of threshold value, the result puts into an intermediate images I1;
2) all pixels in the original alpha channel image are carried out neighborhood territory pixel and the processing of multiplying each other and suing for peace less than pairing that weighted sum coefficient of threshold value, the result puts into an intermediate images I2;
3) all pixels of alpha channel image are carried out following processing: if the pixel value of original alpha channel image greater than threshold value, then the respective pixel values among the intermediate images I1 is put into target image; If the pixel value of original alpha channel image is less than threshold value, then the respective pixel values among the intermediate images I2 is put into target image.
Effect of the present invention is: adopt method of the present invention, can realize more satisfactory alpha passage corrosive effect, and this method is fairly simple, be very easy to optimize.Therefore, this method is specially adapted in the special effect processing and synthetic technology of high quality and high efficiency video and image.
Description of drawings
Fig. 1 is the flow chart of step in the specific embodiment of the invention (4);
Fig. 2 is original input picture;
Fig. 3 is the schematic diagram that adopts after the method for the invention is handled input picture.
Embodiment
Below in conjunction with the drawings and specific embodiments the present invention is further described.
Method of the present invention is that all pixels of alpha passage are divided in the border and the border exterior pixel by certain threshold value, uses different coefficient matrixes to the multiply each other process of summation of the pixel in its neighborhood at their different classifications then.
A kind of method of alpha channel boundary corrosion comprises the steps:
(1) at first the alpha value that is in the original alpha channel image between (0,255) is reduced;
In the present embodiment, the alpha passage is 8bit, and wherein 0 and 255 still keep initial value, will be in [0,255) between the alpha value all dwindle, dwindle formula and be: (alpha/255) 1.6* 255;
(1) tries to achieve greater than threshold value weighted sum coefficient;
The span of described threshold value is [max/2-30, max/2+30], and for the 8bit image, the span of threshold value is 98-158, but preferably maximum gradation value half promptly 128, in the present embodiment, threshold value is 128.For the image of other bit wide, be in half adjacent threshold of maximum gradation value, to get threshold value in principle, but from experimental result, it is best to get peaked half effect of gray value.
Calculating is as follows greater than the formula of the weighted sum coefficient of threshold value:
(x y) is not equal to central point (x as fruit dot 0, y 0), then
Figure GSB00000494773300041
(x y) equals central point (x as fruit dot 0, y 0), then
Factor (x 0Y 0)=1-∑ (factor (x, y) | x 0-width≤x≤x 0+ width, y 0-width≤y≤y 0+ width, and (x, y) ≠ (x 0, y 0))
In the above-mentioned formula, the span of width is [0,30], and unit is a pixel; X be point (x, abscissa y), y be point (x, ordinate y), e are natural logrithms, σ=3width;
(3) try to achieve less than threshold value weighted sum coefficient;
Calculating is as follows less than the formula of threshold value weighted sum coefficient:
(x y) is not equal to central point (x as fruit dot 0, y 0), then
(x y) equals central point (x as fruit dot 0, y 0), then
Figure GSB00000494773300052
In the above-mentioned formula, the span of width is [0,30], and unit is a pixel.Parameter width has determined the degree of softening, and the big more then softening degree of parameter width value is more dark, and promptly boundary corrosion must be dark more.In the present embodiment, the width value is 30.
(4) each pixel divided greater than threshold value and is weighted summation less than two kinds of situations of threshold value obtain final result, concrete steps as shown in Figure 1:
1) all pixels in the original alpha channel image are carried out neighborhood territory pixel and the processing of multiplying each other and suing for peace greater than pairing that matrix coefficient of threshold value (promptly greater than threshold value weighted sum coefficient), the result puts into an intermediate images I1;
2) all pixels in the original alpha channel image are carried out neighborhood territory pixel and the processing of multiplying each other and suing for peace less than pairing that matrix coefficient of threshold value (promptly less than threshold value weighted sum coefficient), the result puts into an intermediate images I2;
3) all pixels of alpha channel image are carried out following processing: if the pixel value of original alpha channel image greater than threshold value, then the respective pixel values among the intermediate images I1 is put into target image; If the pixel value of original alpha channel image is less than threshold value, then the respective pixel values among the intermediate images I2 is put into target image.
As shown in Figures 2 and 3, Fig. 2 is original alpha channel image, and Fig. 3 is the image that adopts after method of the present invention is handled.By the foregoing description as can be seen, adopt method proposed by the invention can realize more satisfactory alpha passage corrosive effect, and this method is fairly simple, is very easy to optimize.
Method and system of the present invention is not limited to the embodiment described in the embodiment, and those skilled in the art's technical scheme according to the present invention draws other execution mode, belongs to technological innovation scope of the present invention equally.

Claims (3)

1. the method for an alpha channel boundary corrosion comprises the steps:
(1) at first the alpha value that is in the original alpha channel image between (0,255) is reduced, will be in the formula that the alpha value between (0,255) all dwindles and be: (alpha/255) 1.6* 255;
(2) try to achieve greater than threshold value weighted sum coefficient;
Calculating is as follows greater than the formula of the weighted sum coefficient of threshold value:
(x y) is not equal to central point (x as fruit dot 0, y 0), then
Figure FSB00000494773200011
(x y) equals central point (x as fruit dot 0, y 0), then
Factor (x 0Y 0)=1-∑ (factor (x, y) | x 0-width≤x≤x 0+ width, y 0-width≤y≤y 0+ width, and (x, y) ≠ (x 0, y 0))
In the above-mentioned formula, the span of width is [0,30], and unit is a pixel; X be point (x, abscissa y), y be point (x, ordinate y), e are natural logrithms, σ=3width;
(3) try to achieve less than threshold value weighted sum coefficient;
Calculating is as follows less than the formula of the weighted sum coefficient of threshold value:
(x y) is not equal to central point (x as fruit dot 0, y 0), then
Figure FSB00000494773200012
(x y) equals central point (x as fruit dot 0, y 0), then
Figure FSB00000494773200013
(4) each pixel is divided greater than threshold value and is weighted summation less than two kinds of situations of threshold value obtain final result, its concrete grammar is:
1) all pixels in the original alpha channel image are carried out neighborhood territory pixel and the processing of multiplying each other and suing for peace greater than pairing that weighted sum coefficient of threshold value, the result puts into an intermediate images I1;
2) all pixels in the original alpha channel image are carried out neighborhood territory pixel and the processing of multiplying each other and suing for peace less than pairing that weighted sum coefficient of threshold value, the result puts into an intermediate images I2;
3) all pixels of alpha channel image are carried out following processing: if the pixel value of original alpha channel image greater than threshold value, then the respective pixel values among the intermediate images I1 is put into target image; If the pixel value of original alpha channel image is less than threshold value, then the respective pixel values among the intermediate images I2 is put into target image.
2. the method for a kind of alpha channel boundary corrosion as claimed in claim 1 is characterized in that: in step (2) and the step (3), the span of described threshold value is [max/2-30, max/2+30], and wherein, max is a maximum gradation value.
3. the method for a kind of alpha channel boundary corrosion as claimed in claim 3 is characterized in that: described threshold value is max/2, and wherein max is a maximum gradation value.
CN2008102394360A 2008-12-10 2008-12-10 Method of alpha channel boundary corrosion Expired - Fee Related CN101764914B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008102394360A CN101764914B (en) 2008-12-10 2008-12-10 Method of alpha channel boundary corrosion

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008102394360A CN101764914B (en) 2008-12-10 2008-12-10 Method of alpha channel boundary corrosion

Publications (2)

Publication Number Publication Date
CN101764914A CN101764914A (en) 2010-06-30
CN101764914B true CN101764914B (en) 2011-07-27

Family

ID=42495889

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008102394360A Expired - Fee Related CN101764914B (en) 2008-12-10 2008-12-10 Method of alpha channel boundary corrosion

Country Status (1)

Country Link
CN (1) CN101764914B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105678724A (en) * 2015-12-29 2016-06-15 北京奇艺世纪科技有限公司 Background replacing method and apparatus for images
CN107230182B (en) * 2017-08-03 2021-11-09 腾讯科技(深圳)有限公司 Image processing method and device and storage medium
CN108198128B (en) * 2017-12-12 2021-12-03 北京美摄网络科技有限公司 Method and device for alpha channel boundary corrosion

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1716311A (en) * 2004-06-28 2006-01-04 微软公司 System and process for generating a two-layer, 3D representation of a scene

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1716311A (en) * 2004-06-28 2006-01-04 微软公司 System and process for generating a two-layer, 3D representation of a scene

Also Published As

Publication number Publication date
CN101764914A (en) 2010-06-30

Similar Documents

Publication Publication Date Title
CN112288658B (en) Underwater image enhancement method based on multi-residual joint learning
CN108961186B (en) Old film repairing and reproducing method based on deep learning
CN101727659B (en) Method and system for enhancing image edge
CN102014279B (en) Method and device for intensifying video image contrast
JP2018526755A (en) Image contrast enhancement method
CN102496152A (en) Self-adaptive image contrast enhancement method based on histograms
CN104574328A (en) Color image enhancement method based on histogram segmentation
CN105825489A (en) Infrared image enhancement method based on combination of gray translation and linear stretching
CN109949234B (en) Video restoration model training method and video restoration method based on deep network
CN105809643A (en) Image enhancing method based on self-adaptive block channel stretching
CN107833182A (en) The infrared image super resolution ratio reconstruction method of feature based extraction
CN101764914B (en) Method of alpha channel boundary corrosion
CN110189266A (en) A kind of adaptive rapid image Enhancement Method
CN109919859A (en) A kind of Outdoor Scene image defogging Enhancement Method calculates equipment and its storage medium
CN103514588B (en) Image enchancing method and system
CN103295205A (en) Low-light-level image quick enhancement method and device based on Retinex
CN108521535B (en) A kind of Information hiding transmission method based on image blend processing
CN104915933B (en) A kind of Misty Image Enhancement Method based on APSO-BP coupling algorithm
CN106952236B (en) Fisheye lens shot image distortion correction method based on BP neural network
CN117422653A (en) Low-light image enhancement method based on weight sharing and iterative data optimization
CN116823686B (en) Night infrared and visible light image fusion method based on image enhancement
CN116029944B (en) Self-adaptive contrast enhancement method and device for gray level image
CN104252695A (en) Self-adaption stretching method for infrared image
CN104952052A (en) Method for enhancing EMCCD image
CN107680068A (en) A kind of digital image enhancement method for considering image naturalness

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
ASS Succession or assignment of patent right

Owner name: BEIJING CULTURAL AND SCIENTIFIC FINANCING LEASE CO

Free format text: FORMER OWNER: XIN'AOTE(BEIJING) VIDEO TECHNOLOGY CO., LTD.

Effective date: 20150326

C41 Transfer of patent application or patent right or utility model
COR Change of bibliographic data

Free format text: CORRECT: ADDRESS; FROM: 100080 HAIDIAN, BEIJING TO: 100044 SHUNYI, BEIJING

TR01 Transfer of patent right

Effective date of registration: 20150326

Address after: 100044, room 2, building 1, No. 401, Golden Sail Road, Beijing, Shunyi District

Patentee after: Beijing culture science and technology finance leasing Limited by Share Ltd

Address before: 100080 Beijing city Haidian District xicaochang No. 1 Beijing Silicon Valley computer city 15 1501-1506 room

Patentee before: China Digital Video (Beijing) Limited

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20171012

Address after: 100143 Beijing city Haidian District xicaochang No. 1 Silicon Valley computer city 15 1501-1506 room

Patentee after: China Digital Video (Beijing) Limited

Address before: 100044, room 2, building 1, No. 401, Golden Sail Road, Beijing, Shunyi District

Patentee before: Beijing culture science and technology finance leasing Limited by Share Ltd

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20110727

Termination date: 20161210