I used cvtColor for converting int16 2D numpy array into BGR color image. But when view it via imshow() it giving distorted picture. Here is the code snippet i made conversion.
import cv2 as cv
color_image = cv.cvtColor(np.float32(ct_scan), cv.COLOR_GRAY2BGR)
plt.imshow(color_image)
plt.show()
plt.imshow(np.float32(ct_scan),cmap=plt.cm.gray)
plt.show()
The source image, ct_scan is a int16 2D numpy array. The conversion of ct_scan into float32 was done to compatible with the cvtColor function. The results are showing in figure 1-The converted color image and figure 2-source image converted to float32 dtype
But as you can see the converted image is distorted. Can you please help to identify the error behind, or suggest a method to convert the 2D numpy array to a color image.
First image Second image