我尝试使用以下命令安装pypdfocr:
pip install pypdfocr
pip install -i https://pypi.anaconda.org/pypi/simple pypdfocr
Run Code Online (Sandbox Code Playgroud)
但我不断收到错误消息:
File "C:\Users\888537\AppData\Local\Temp\pip-build-b4mwr93n\evernote\setup
.py", line 6
exec x
^
SyntaxError: Missing parentheses in call to 'exec'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\888537\A
ppData\Local\Temp\pip-build-b4mwr93n\evernote\
Run Code Online (Sandbox Code Playgroud)
以下是安装日志:
[Anaconda3] C:\Users\888537>pip install -i https://pypi.anaconda.org/pypi/simple
pypdfocr
Collecting pypdfocr
Downloading https://pypi.anaconda.org/pypi/simple/pypdfocr/0.7.6/pypdfocr-0.7.
6.tar.gz
Requirement already satisfied (use --upgrade to upgrade): pillow>=2.2 in d:\anac
onda3\lib\site-packages (from pypdfocr)
Requirement already satisfied (use --upgrade to upgrade): reportlab>=2.7 in d:\a
naconda3\lib\site-packages (from pypdfocr)
Collecting watchdog>=0.6.0 (from pypdfocr) …Run Code Online (Sandbox Code Playgroud) 我正在尝试按照教程将 WaterShed 算法应用于图像:OpenCv WaterShed Docs。我早些时候在灰度图像上应用了高斯滤波和形态变换之后的大津阈值处理,以根据代码提高图像质量:
img = cv2.imread('Results\Feb_16-0.jpg',0)
kernel = np.ones((1,1),np.uint8)
opening = cv2.morphologyEx(img, cv2.MORPH_OPEN, kernel)
blur = cv2.GaussianBlur(opening,(1,1),0)
ret3,th4 = cv2.threshold(blur,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
Run Code Online (Sandbox Code Playgroud)
根据代码,将距离变换应用为分水岭算法的第一阶段:
# sure background area
sure_bg = cv2.dilate(opening,kernel,iterations=1)
# Finding sure foreground area
dist_transform = cv2.distanceTransform(opening,cv2.DIST_L2,3)
Run Code Online (Sandbox Code Playgroud)
创建错误:
error: (-215) src.type() == CV_8UC3 && dst.type() == CV_32SC1 in function cv::watershed
Run Code Online (Sandbox Code Playgroud)
其中尝试将8位3通道图像转换为32位单通道图像。如何防止这种情况发生并使用距离变换?
我在OpenCV中使用拉普拉斯变换进行边缘检测,然后使用霍夫线变换检测其中的线.这些识别的线最终需要从图像中移除.
import cv2
import numpy as np
from matplotlib import pyplot as plt
img = cv2.imread('Feb_16-0.jpg',0)
kernel = np.ones((1,1),np.uint8)
opening = cv2.morphologyEx(img, cv2.MORPH_OPEN, kernel)
blur = cv2.GaussianBlur(opening,(1,1),0)
ret3,th4 = cv2.threshold(blur,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU)
laplacian = cv2.Laplacian(th4,cv2.CV_8UC1)
cst = cv2.cvtColor(img,cv2.COLOR_GRAY2BGR)
minLineLength = 100
maxLineGap = 10
lines = cv2.HoughLinesP(laplacian,1,np.pi/180,100,minLineLength,maxLineGap)
for x1,y1,x2,y2 in lines[0]:
cv2.line(cst,(x1,y1),(x2,y2),(0,255,0),2)
cv2.imwrite('houghlines5.jpg',cst)
Run Code Online (Sandbox Code Playgroud)
拉普拉斯边缘检测的结果如下:
而Hough Line Transform返回的结果只标识了下图中绿线所标记的一条线:

任何人都可以帮我弄清楚代码中需要进行哪些修改,以便识别出互联网法案的所有大胆的横向/纵向线?
python opencv image-processing computer-vision hough-transform
通过pip安装安装了pypdfocr和ghostscript.但是,当在命令提示符下运行pypdfocr时:
[env27] C:\Users\888537>pypdfocr Hotel.pdf
ERROR: Could not find Ghostscript in the usual place; please specify it using your config file
Run Code Online (Sandbox Code Playgroud)
请求帮助链接这些库需要做些什么?
python ×3
ocr ×2
opencv ×2
anaconda ×1
linker ×1
opencv3.0 ×1
python-2.7 ×1
python-3.x ×1
watershed ×1
windows ×1