First my Setup: Windows 10, Asus Notebook, Logitech C920 HD Pro Webcam, Opencv-Python 3.4.4.19
When I manually take a photo with the webcam using the Windows 10 Camera App, it is sharp. But if I program a code in Python and use OpenCV the taken photo is blurred (unsharp). When I press the space bar, a photo is taken.
I already tried to play with the contrast, brightness and FPS. Unfortunately this didn't lead to any result.
import cv2
import os
cam = cv2.VideoCapture(1)
cv2.namedWindow("test")
cam.set(3, 1920)
cam.set(4, 1080)
img_counter = 0
myfile="XXX"
if os.path.isfile(myfile):
os.remove(myfile)
else:
print("Error: %s file not found" % myfile)
while True:
ret, frame = cam.read()
cv2.imshow("test", frame)
if not ret:
break
k = cv2.waitKey(1)
if k%256 == 27:
print("Escape hit, closing...")
break
elif k%256 == 32:
img_name = "Bild{}.png".format(img_counter)
cv2.imwrite(img_name, frame)
print("{} written!".format(img_name))
img_counter += 1
cam.release()
cv2.destroyAllWindows()
Are there settings for OpenCv to get the image sharper? In the final stage I have 3 cameras which automatically take a photo one after the other.
Unsharp Image (OpenCV)
Sharp Image (Windows 10 Kamera App)
Image cv2.imshow