I've built a pre-processing script in OpenCV that takes user uploaded images as input. While trying to take DCT of an image, I get the following error
OpenCV Error: The function/feature is not implemented (Odd-size DCT's are not implemented) in dct, file /tmp/opencv-hd06/opencv-2.4.4/modules/core/src/dxt.cpp, line 2339
Here is how I'm taking the DCT:
img = cv2.imread(filepath)
gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
ret,thresholded = cv2.threshold(gray,200,255,cv2.THRESH_BINARY)
img = cv2.cvtColor(thresholded, cv2.COLOR_GRAY2BGR)
gray = thresholded
gray = gray.astype('float32')
dct=cv2.dct(gray) #this line throws error
The above error happens on this image:
The above code works fine on certain other images.