之前一直以为是PyQT的getOpenFileNames方法不能读取中文路径的。多次尝试后发现不是,是OpenCV的问题。
self.selected_imgPaths, _ = QtWidgets.QFileDialog.getOpenFileNames(
self, "打开图片", "./pending_images", "*.jpg;;*.JPG;;*.png;;*.png;;All Files(*)")
OpenCV
image = cv2.imdecode(np.fromfile(self.selected_imgPaths[i],dtype=np.uint8),-1)