I have a numpy 2d matrix which represents a colored image. This matrix has some negative and floating point numbers but of course I can display the image using imshow(my_matrix).
I need to perform histogram equalization to this colored image so I found a code here in stackoverflow using cv2 (OpenCV Python equalizeHist colored image) but the problem is I am unable to convert the 2d matrix to cv matrix which takes three channels for RGB.
I was searching again but all I found is to convert regular 3d numpy matrix to cv2 matrix so how can numpy 2d matrix be converted to cv2 matrix which has 3 channels?
my_matrix.shape
? – akilat90np.reshape()
to convert this to a 3D array – akilat90new_img = np.reshape(img,(rows,cols/3,3)
– zindarod