图像数据无法转换为浮点数

问题描述 投票:1回答:2
#import required python modules
import cv2 # opencv
import pytesseract # tesseract
import matplotlib.pyplot as plt
import numpy as np

#read the text image using imread

org_img = cv2.imread("Poem.png")
plt.imshow(org_img) #display the read image

此代码有什么问题??我收到以下错误:“ 图像数据无法转换为浮点数>>”

<<

首先将图像转换为RGB:

org_img = cv2.imread("Poem.png") org_img = cv2.cvtColor(org_img , cv2.COLOR_BGR2RGB) plt.imshow(org_img) plt.show()

这在Python / OpenCV中对我有用。您忘记在plt.show()]之后添加plt.imshow(org_img)

#import required python modules import cv2 # opencv import pytesseract # tesseract import matplotlib.pyplot as plt import numpy as np #read the text image using imread org_img = cv2.imread("Poem.png") plt.imshow(org_img) #display the read image plt.show()

tesseract cv2
2个回答
0
投票
首先将图像转换为RGB:

0
投票
这在Python / OpenCV中对我有用。您忘记在plt.show()]之后添加plt.imshow(org_img)

#import required python modules import cv2 # opencv import pytesseract # tesseract import matplotlib.pyplot as plt import numpy as np #read the text image using imread org_img = cv2.imread("Poem.png") plt.imshow(org_img) #display the read image plt.show()

© www.soinside.com 2019 - 2024. All rights reserved.