Python OpenCV Webcam in richtiger Auflösung abfragen
Hallo,
ich habe ein kleines phyton script, das eine Webcam anspricht und dann ein Bild davon speichert.
Das Ganze funktioniert auch soweit.
Allerdings hat das Bild nur eine Größe von 640*480px.
Ich weiß aber, dass die Kamera sehr viel mehr kann.
Für VideoCapture scheint es keine Option zu geben, wie man die Größe definieren kann.
Vllt. hat da jemand eine Idee zu.
Danke schon mal für eure Antworten.
ich habe ein kleines phyton script, das eine Webcam anspricht und dann ein Bild davon speichert.
Das Ganze funktioniert auch soweit.
Allerdings hat das Bild nur eine Größe von 640*480px.
Ich weiß aber, dass die Kamera sehr viel mehr kann.
import cv2
import time
def grabImage():
cap = cv2.VideoCapture(0)
ret, frame = cap.read()
time.sleep(3)
cv2.imwrite("frame1.jpg" , frame)
cap.release()
return
grabImage()
Für VideoCapture scheint es keine Option zu geben, wie man die Größe definieren kann.
Vllt. hat da jemand eine Idee zu.
Danke schon mal für eure Antworten.
Please also mark the comments that contributed to the solution of the article
Content-Key: 373225
Url: https://administrator.de/contentid/373225
Printed on: April 26, 2024 at 01:04 o'clock
3 Comments
Latest comment
Moin,
gefühlte zwei Sekunden googeln ergab das:
aus: https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_gui/py_video_displa ...
hth
Erik
gefühlte zwei Sekunden googeln ergab das:
For example, I can check the frame width and height by cap.get(3) and cap.get(4). It gives me 640x480 by default. But I want to modify it to 320x240. Just use ret = cap.set(3,320) and ret = cap.set(4,240).
aus: https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_gui/py_video_displa ...
hth
Erik