0
A
回答
1
可以执行下列操作(OpenCV的3.0和aboove)
-
图像上
- 运行大津的阈值(http://docs.opencv.org/3.2.0/d7/d4d/tutorial_py_thresholding.html)
- 运行连通区域标记与上阈值的图像的统计数据。(How to use openCV's connected components with stats in python?)
- 对于每个连接的组件,使用您从步骤2获得的统计数据,为每个共用字体获取以下信息(cv2.CC_STAT_LEFT cv2.CC_STAT_TOP cv2.CC_STAT_WIDTH cv2.CC_STAT_HEIGHT)
- Usi边框从原始图像裁剪组件。
0
Amitay的真棒答案的一个补充。你应该使用
cv2.THRESH_BINARY_INV
捕捉到白纸上的黑字否定的形象。
另一个想法可能是MSER斑点检测这样的:
img = cv2.imread('path to image')
(h, w) = img.shape[:2]
image_size = h*w
mser = cv2.MSER_create()
mser.setMaxArea(image_size/2)
mser.setMinArea(10)
gray = cv2.cvtColor(filtered, cv2.COLOR_BGR2GRAY) #Converting to GrayScale
_, bw = cv2.threshold(gray, 0.0, 255.0, cv2.THRESH_BINARY | cv2.THRESH_OTSU)
regions, rects = mser.detectRegions(bw)
# With the rects you can e.g. crop the letters
for (x, y, w, h) in rects:
cv2.rectangle(img, (x, y), (x+w, y+h), color=(255, 0, 255), thickness=1)
这也导致了一个完整的信认。
相关问题
- 1. 从Python字符串到OpenCV的IplImage?
- 2. 使用tesseract和opencv进行python字符串比较
- 3. Python:从字符串中删除字符
- 4. 从字符串在Python
- 5. 从字符串剪切零字符(字符串[: - 0]) - Python
- 6. 使用python的宏字符串concat
- 7. 使用UTF-8的Python unicode字符串?
- 8. 的Python:使用格式字符串
- 9. 的Python:摆脱使用字符串XML
- 10. 使用xrange的Python字符串操作
- 11. Python使用unicode编码的字符串
- 12. Python:从字符串引用类?
- 13. 带字符串的Python字符串
- 14. 如何从Python中的字符串中提取子字符串?
- 15. 从Python中的字符串数组中提取子字符串
- 16. 如何从python中的字符串中删除子字符串?
- 17. 如何从Python中的字符串中删除字符串?
- 18. 使用Python openCV
- 19. 如何使用Python从字符串中删除符号?
- 20. 使从字符串
- 21. 使用python字典从字符串中创建flashcards
- 22. 使用sqlite和python从字符串中搜索关键字
- 23. 使用noskipws从ifstream读取字符串时的空字符串
- 24. Python字符串
- 25. python字典从字符串转换?
- 26. 从Python读取字节字符串
- 27. Python从字符串中删除字母
- 28. 使用Python Regex从字符串获取正确的输出
- 29. 从使用IronPython的python字符串获取CodeExpression?
- 30. 从使用Python的html文件中提取字符串(beautifulsoup?)
您已经提供了与sample和output1相同的链接。 – frederick99
@ frederick99对不起..现在请再次检查.... – Bits