1
I’m studying a little Iot and I’m trying to create a "door opener" by Qrcode(when someone shows a Qrcode to camera, it will identify and open the door)
But the camera I have at home is a Logitech C270(3MP and No Autofocus), the code I was able to do using the PyGame.camera
, but the picture gets very strange. Someone could help me?
The problem is in the code or in the camera?
Imagery:
Code:
SAVEDIR = "/home/pi/Desktop/Bot/Qr/"
import pygame, sys
import pygame.camera
import time, random
pygame.init()
pygame.camera.init()
cam = pygame.camera.Camera("/dev/video0", (1280,960))
print ("Taking a shot:")
cam.start()
image = cam.get_image()
cam.stop()
timestamp = time.strftime("%Y-%m-%d_%H%M%S", time.localtime())
filename = "%s/%s.jpg" % (SAVEDIR, timestamp)
print ("saving into %s" % filename)
pygame.image.save(image, filename)
`
OBS: THE Qrcode is 1cm high by 1.5cm wide.
The image quality is very bad, it is not possible to read because it is very blurred.
– Laerte
You need to focus manually by rotating the lens on the camera tip according to the distance
– nosklo
Unfortunately the camera does not have the focus =/ I am desperate already
– Erick Vieira