TypeError: Image data of dtype object cannot be converted to float in plt.imshow() python

Viewed 520

I want to read each image founded in paths and concatenate them using vconcat. I got this error Traceback : in plt.imshow(im_v,cmap='inferno', aspect='auto', interpolation='nearest') TypeError: Image data of dtype object cannot be converted to float while running the below code. How to solve it ??

Any help would be appreciated.

if nSpectogram <3765:
            for k in range (0,22):
                paths=FirstPartPathOutput+SecondPartPathOutput+'/spec_'+isPreictal+'_'+str(nSpectogram+1)+'_'+str(k)
                for f1 in paths:
                    img = cv2.imread(f1)
                    im_v=cv2.vconcat(img)
                plt.imshow(im_v,cmap='inferno', aspect='auto', interpolation='nearest')

            plt.axis('off') 
            plt.savefig(FirstPartPathOutput+SecondPartPathOutput+'/spec_'+isPreictal+'_'+str(nSpectogram+1)+'_'+str(k+1)+'.png')
0 Answers
Related