begann kürzlich mit der Entwicklung einer grundlegenden ANPR -Anwendung mit OpenCV und Pytesseract. Die Gesamtkonturierung und das Zuschneiden scheint zu funktionieren, aber es gibt ein eklatantes Problem, dass ich nicht herausfinden kann, wie ich das Grün aus dem Bild entfernen soll.image = f'home/folder/car.jpg'
image = cv2.imread(image)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) #frame filtered again
canny = cv2.Canny(gray, 100, 200)
contours, _ = cv2.findContours(canny, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
cv2.drawContours(image, contours, -1, (0, 255, 0), 3)
for contour in contours:
approx = cv2.approxPolyDP(contour, 0.02 * cv2.arcLength(contour, True), True)
if len(approx) == 4:
x, y, w, h = cv2.boundingRect(approx)
aspectratio = w / float(h) #aspect ratio
area = w * h
if 2 < aspectratio < 5 and area > 2000:
cropped = image[y:y+h, x:x+w]
cv2.imwrite('contour.png', cropped)
< /code>
car.jpg. Keine Filter:
car.jpg. Konturiert:
car.jpg. Konturiert und geschnitten:
Ich bin ziemlich neu bei OpenCV und Python.>
Ernte vom Bild mit OpenCV ohne Einbeziehung von Grün - OpenCV & Python ⇐ Python
-
- Similar Topics
- Replies
- Views
- Last post
-
-
Kompilieren Sie Fehler bei der Einbeziehung von Boost 1.79.0 Bimap mit Unreal 5
by Anonymous » » in C++ - 0 Replies
- 12 Views
-
Last post by Anonymous
-