(Resolved) How do I fix the "TypeError: Image data of dtype object cannot be converted to float" error?

This is part of the code which I have used

def main():
img = cv2.imread(‘test.png’, cv2.IMREAD_GRAYSCALE)
img_aug = Preprocessor((256, 32), data_augmentation=True).process_img(img)
plt.subplot(1, 2, 1)
plt.imshow(np.real(img), cmap=‘gray’)
plt.subplot(1, 2, 2)
plt.imshow(cv2.transpose(img_aug) + 0.5, cmap=“gray”, vmin=0, vmax=1)
plt.show()

But the typeError shows up on the 5th line. How do I fix this error?

(Resolved)