所以我在 Python(計算機視覺)中有這個專案,它將文本與影像的圖形(如紙質新聞影像)分開。
我的問題是檢測論文中這些數字的最佳方法是什么?(在 Python 中)。
紙張影像示例:
從結果影像中,您可以看到橙色框中的文本布局區域和白色框中的影像布局區域(圖)。這是用于影像識別的驚人的深度學習工具包。
uj5u.com熱心網友回復:
我將從 Python 中的 OpenCV 模塊開始,因為它有很多非常有用的影像識別工具。我會在這里鏈接它:
https://pypi.org/project/opencv-python/
https://github.com/opencv
轉到第一個鏈接下載模塊包,如果您需要幫助或有任何問題,請查看 github 鏈接。
uj5u.com熱心網友回復:
您可以使用影像分割方法。使用連接組件標記演算法,以便將所有文本和影像檢測為組件。可以將面積大于特定閾值的成分檢測為紙張中的影像。connectedcomponentswithstats方法可以幫助獲取組件并獲取所有組件的面積。
希望這可以幫助。
uj5u.com熱心網友回復:
import cv2
import numpy as np
# Read the image
image = cv2.imread('paper-news.png')
# Convert to grayscale
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
# Blur the image
blurred = cv2.GaussianBlur(gray, (5, 5), 0)
canny = cv2.Canny(blurred, 30, 150)
# Find contours in the image
contours, hierarchy = cv2.findContours(canny.copy(), cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
# Iterate over the contours
for contour in contours:
# Get the rectangle bounding the contour
# Draw the rectangle
cv2.rectangle(image, (x, y), (x w, y h), (36,255,12), 2)
# Show the image
cv2.imshow('Image with Figures Detected', image)
cv2.waitKey(0)
這會幫助你。
uj5u.com熱心網友回復:
- 簡單的方法是使用此資源檢測文本區域。
使用 Opencv 檢測影像中的文本區域
- 然后,在剩余區域中進行白色背景閾值處理和斑點檢測,以使用此資源查找影像。
使用 opencv 檢測和計數 blob/連接物件
轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/537225.html
上一篇:為什么卷積不適用于非標準化影像?
