改成
img_bgr = cv2.imdecode(np.fromfile(img_path, dtype=np.uint8), -1)
这段代码演示了如何利用OpenCV的cv2.imdecode函数,结合numpy,从文件路径(img_path)读取并解码图像数据,dtype设置为np.uint8,-1参数表示保持原始颜色空间。
改成
img_bgr = cv2.imdecode(np.fromfile(img_path, dtype=np.uint8), -1)

被折叠的 条评论
为什么被折叠?