c++ - Gaussian Pyramid Out of Bounds -


i trying write own codes gaussian pyramid using c++.

i tried both reduce , expand equations stated in http://persci.mit.edu/pub_pdfs/pyramid83.pdf, equation (1) , (2). however, array index out of bounds when trying access

[2i + m][2j + n] , [(i - m) / 2][(j - n) / 2], respectively.

my gaussian kernel: 5x5 matrix; g1image: original image reduced 1 level, both row , column half of dimensions of original image's.

my m , n set -2 < m/n <= 2, when access gaussian kernel, add 2 index, becoming

w[m + 2][n + 2] * original_image[2i + m][2j + n] 

i did try set m , n 0 < m/n <=4 well, equation becomes

w[m][n] * original_image[2i + m][2j + n] or w[m][n] * original_image[2i + m - 2][2j + n - 2] 

any of mentioned equations out of bounds.

w[m][n] * original_image[2i][2j] reduce equation , w[m][n] * g1image[i / 2][j / 2] expand equation working though.

however, displayed image seems there no smoothing effect.

can explain me how should set image dimension each gaussian pyramid reduction, gaussian pyramid expansion , m , n boundaries?

i have solved problem including line

index1 = (2 * h) + m; index2 = (2 * w) + n;  if(index1  >= 0 && index1 < height && index2 >= 0 && index2 < width)      temp = w[m + 2][n + 2] * original_image[index1][index2]; 

more information @ :
http://www.songho.ca/dsp/convolution/convolution.html


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -