I'm calculating the DCT of a image with the following code:
img = cv2.imread(imgName,0)
imf = np.float32(img)
dctimg = cv2.dct(imf)
The problem is when saving the image with OpenCV's imwrite function I'm getting the desired output.
cv2.imwrite('output-dct.png',dctimg)
But while saving with matplotlib as plt.imshow(dctimg, cmap='gray') I get a completely black image.

I understand that OpenCV is converting it to 8bit image. So I tried to do the same using normalization
cv2.normalize(orgDct, dctimg,alpha=0, beta=1,
norm_type=cv2.NORM_MINMAX, dtype=cv2.CV_8U)
dctimg = np.uint8(dctimg)*255
plt.imshow(dctimg, cmap='gray')
But the results are not the same.

How to achieve the same effect as imwrite when plotting with matplotlib ?
