Decode Qrcode

Asked

Viewed 67 times

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:

inserir a descrição da imagem aqui

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.

  • 1

    The image quality is very bad, it is not possible to read because it is very blurred.

  • You need to focus manually by rotating the lens on the camera tip according to the distance

  • Unfortunately the camera does not have the focus =/ I am desperate already

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.