We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
import cv2 import numpy as np
camera = cv2.VideoCapture(0)
while True: # Kameradan görüntü al ret, frame = camera.read() if not ret: break
# Görüntüyü gri tonlamaya çevir gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) # Görüntüyü eşikle _, threshold = cv2.threshold(gray, 127, 255, cv2.THRESH_BINARY) # Şekilleri algılamak için kontürleri bul contours, _ = cv2.findContours(threshold, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE) for contour in contours: # Kontur alanını kontrol ederek küçük nesneleri yok say if cv2.contourArea(contour) > 500: approx = cv2.approxPolyDP(contour, 0.02 * cv2.arcLength(contour, True), True) x = approx.ravel()[0] y = approx.ravel()[1] # Şekli belirle if len(approx) == 3: cv2.putText(frame, "Ucgen", (x, y), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0)) elif len(approx) == 4: cv2.putText(frame, "Dikdortgen", (x, y), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0)) elif len(approx) > 4: cv2.putText(frame, "Daire", (x, y), cv2.FONT_HERSHEY_SIMPLEX, 1, (0, 255, 0)) # Görüntüyü ekranda göster cv2.imshow("Kamera", frame) # 'q' tuşuna basıldığında çık if cv2.waitKey(1) & 0xFF == ord('q'): break
camera.release() cv2.destroyAllWindows()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
import cv2
import numpy as np
Kamerayı başlat
camera = cv2.VideoCapture(0)
Şekilleri algılamak için sürekli döngü
while True:
# Kameradan görüntü al
ret, frame = camera.read()
if not ret:
break
camera.release()
cv2.destroyAllWindows()
The text was updated successfully, but these errors were encountered: