Image Pyramid-OpenCV

在前一篇Mulit-band Blending有提到Gaussian和Laplacian Pyramid怎麼建立,但裡面的Expand(或Up Sample)和Reduce(或Down Sample)怎麼實做呢?其實很簡單,只要一個5x5的Gaussian window就可以搞定了。

Pyramids_Tutorial_Pyramid_Theory  

Reduce。產生下一階(i+1)的Gaussian Pyramid,1.只要和Gaussian kernel 做 convolution。2.再把偶數的column和row給丟掉就好了。

reduce

 

 

 

[Reduce Guassian Kernel]

Expand。產生上一階(i-1)的Gaussian Pyramid,1.先把low resolution image上的pixel放在expand image的奇數位置,偶數位置都填零。2.再和下面的Gaussian kernel 做 convolution就可以了,注意這裡除的weight是16(256/4),是為了保持total energy不變。

expand

[Expand Guassian Kernel]


 Example。拿apple為例子,將原圖做reduce後,再expand,最後與原圖相減得到Laplacian Image。

01

[raw image]

01_r

[reduce image]

01_e

[expand image]

01_l

[laplacian image]

 

 

 

 

 

 


reference : http://docs.opencv.org/doc/tutorials/imgproc/pyramids/pyramids.html

Leave a Reply

Your email address will not be published. Required fields are marked *