TypeError: Image data cannot be converted to float

import numpy as np

import cv2.cv2 as cv

from matplotlib import pyplot as plt

import tkinter as tk
from tkinter import filedialog

root = tk.Tk()
root.withdraw()
file_path2 = filedialog.askopenfilename()# 选择图片

 

img = cv.imread(file_path2)

plt.imshow(img) 

 

TypeError: Image data cannot be converted to float

关于这个问题,主要是因为路径中含有中文文件夹名,改成英文的就行了

 

你可能感兴趣的:(TypeError: Image data cannot be converted to float)