Merhaba, okul projesi için otonom araç yetiştirmeye çalışıyorum fakat uzun zamandır python'a uzak kaldığım için tek başıma yapmakta sorun yaşıyorum. O yüzden opencv konusunda chatgpt'den yardım alarak yaptım fakat tam olarak istediğim gibi olmadı. Görüntü sağdan ve solda sıkıştırılmış şekilde duruyor. Yardımcı olur musunuz?
Python:
import cv2
import numpy as np
# Define the source and destination points for perspective transformation
src = np.float32([(0, 480), (640, 480), (640, 350), (0, 350)])
dst = np.float32([(200, 480), (440, 480), (440, 0), (200, 0)])
# Initialize the camera
cap = cv2.VideoCapture(1)
while True:
# Capture an image from the camera
ret, img = cap.read()
# Apply perspective transformation
M = cv2.getPerspectiveTransform(src, dst)
birdseye = cv2.warpPerspective(img, M, (640, 480))
# Display the original and bird's eye view images
cv2.imshow('Original', img)
cv2.imshow('Birdseye', birdseye)
# Exit on 'q' key press
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# Release the camera and destroy all windows
cap.release()
cv2.destroyAllWindows()