OpenCV Q&A Forum - RSS feedhttp://answers.opencv.org/questions/OpenCV answersenCopyright <a href="http://www.opencv.org">OpenCV foundation</a>, 2012-2018.Tue, 03 Feb 2015 06:04:21 -0600how do I transcribe this code from python to c++?http://answers.opencv.org/question/54408/how-do-i-transcribe-this-code-from-python-to-c/Hello. I was looking how to segmenting license plate characters and [I found this post](http://stackoverflow.com/questions/24731810/segmenting-license-plate-characters) where propose to use homomorphic filter. I am trying to transcribe the python code shown in the post but I don't know how to transcribe this part:
# Create Gaussian mask of sigma = 10
M = 2*rows + 1
N = 2*cols + 1
sigma = 10
(X,Y) = np.meshgrid(np.linspace(0,N-1,N), np.linspace(0,M-1,M))
centerX = np.ceil(N/2)
centerY = np.ceil(M/2)
gaussianNumerator = (X - centerX)**2 + (Y - centerY)**2
# Low pass and high pass filters
Hlow = np.exp(-gaussianNumerator / (2*sigma*sigma))
Hhigh = 1 - Hlow
# Move origin of filters so that it's at the top left corner to
# match with the input image
HlowShift = scipy.fftpack.ifftshift(Hlow.copy())
HhighShift = scipy.fftpack.ifftshift(Hhigh.copy())
# Filter the image and crop
If = scipy.fftpack.fft2(imgLog.copy(), (M,N))
Ioutlow = scipy.real(scipy.fftpack.ifft2(If.copy() * HlowShift, (M,N)))
Iouthigh = scipy.real(scipy.fftpack.ifft2(If.copy() * HhighShift, (M,N)))
I found how to create a meshgrid in opencv in [this post](http://answers.opencv.org/question/11788/is-there-a-meshgrid-function-in-opencv/) and I have already implemented it but I don't have any idea how to translate this to OpenCV/c++:
gaussianNumerator = (X - centerX)**2 + (Y - centerY)**2
Would you please give me some ideas ? thank you very much. Carlos_HinojosaTue, 03 Feb 2015 06:04:21 -0600http://answers.opencv.org/question/54408/