Ask Your Question

Carlos_Hinojosa's profile - activity

2015-02-03 07:41:32 -0600 commented answer how do I transcribe this code from python to c++?

thank you. I figured out the type of gaussian Numerator, it's CV_32FC1 as you mentioned. also I used Mat::mul operation instead of * and I got the same result as in python.

2015-02-03 07:10:43 -0600 commented answer how do I transcribe this code from python to c++?

thank you, but what I really want to know is how to translate that to Opencv c++. what type should be gaussianNumerator ? Mat type ? PD: sorry for my poor english.

2015-02-03 07:07:04 -0600 received badge  Editor (source)
2015-02-03 06:04:21 -0600 asked a question 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 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 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.

2015-01-30 07:14:57 -0600 asked a question How do I threshold this Image correctly?

Hello. I'm trying to threshold this image to get the characters more visible. I've used OTSU threshold but I don't get good results because when I convert the image to gray it is difficult to find a good threshold value. Would you please give me some ideas? Can I threshold an image on another colorspace ? thank you and sorry for my english.

Licence Plate

Gray Licence Plate

Threshold