TypeError:在plt.imshow()python中,无法将dtype对象的图像数据转换为浮点
我想读取在TypeError:在plt.imshow()python中,无法将dtype对象的图像数据转换为浮点,python,image,matplotlib,concatenation,cv2,Python,Image,Matplotlib,Concatenation,Cv2,我想读取在路径中创建的每个图像,并使用vconcat将它们连接起来。我犯了这个错误 回溯:在plt.imshow(im_v,cmap='inferno',aspect='auto',interpolation='nearest')类型错误:运行以下代码时,无法将数据类型对象的图像数据转换为float。怎么解决呢 任何帮助都将不胜感激 if nSpectogram <3765: for k in range (0,22): paths=
路径
中创建的每个图像,并使用vconcat
将它们连接起来。我犯了这个错误
回溯:在plt.imshow(im_v,cmap='inferno',aspect='auto',interpolation='nearest')类型错误:运行以下代码时,无法将数据类型对象的图像数据转换为float
。怎么解决呢
任何帮助都将不胜感激
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')
如果先由您自己将im\u v转换为float类型?你应该检查im_v有什么值…@ted930511 im_v没有值。我希望图像已连接。我不知道为什么我没有得到任何值通常我不使用cv,我使用numpyvstack
,hstack
或dstack
,为什么不在循环中打印imu v或img的形状?你有很多要尝试的。img肯定有问题,然后导致IMU v出现问题