|
|
@ -34,9 +34,9 @@ class Photography(Bureau):
|
|
|
|
prefix = "PX"
|
|
|
|
prefix = "PX"
|
|
|
|
version = 0
|
|
|
|
version = 0
|
|
|
|
landscape_pin = port.PB3
|
|
|
|
landscape_pin = port.PB3
|
|
|
|
a3_pin = port.PB4
|
|
|
|
a5_pin = port.PB5
|
|
|
|
a4_pin = port.PB5
|
|
|
|
a4_pin = port.PB4
|
|
|
|
a5_pin = port.PB6
|
|
|
|
a6_pin = port.PB6
|
|
|
|
doc_light_pin = port.PB7
|
|
|
|
doc_light_pin = port.PB7
|
|
|
|
|
|
|
|
|
|
|
|
def __init__(self):
|
|
|
|
def __init__(self):
|
|
|
@ -115,20 +115,23 @@ class Photography(Bureau):
|
|
|
|
#TODO: crop here to trim calibrated extra pixels
|
|
|
|
#TODO: crop here to trim calibrated extra pixels
|
|
|
|
|
|
|
|
|
|
|
|
xsize, ysize = img.size
|
|
|
|
xsize, ysize = img.size
|
|
|
|
if gpio.input(self.a3_pin) == 0:
|
|
|
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
if gpio.input(self.a4_pin) == 0:
|
|
|
|
if gpio.input(self.a4_pin) == 0:
|
|
|
|
|
|
|
|
print("scanning as A4")
|
|
|
|
offset = (xsize - ysize) / 2
|
|
|
|
offset = (xsize - ysize) / 2
|
|
|
|
box = (offset, 0, (offset + ysize), xsize / 2)
|
|
|
|
box = (offset, 0, (offset + ysize), xsize / 2)
|
|
|
|
img = img.crop(box)
|
|
|
|
img = img.crop(box)
|
|
|
|
elif gpio.input(self.a5_pin) == 0:
|
|
|
|
elif gpio.input(self.a5_pin) == 0:
|
|
|
|
|
|
|
|
print("scanning as A5")
|
|
|
|
offset = xsize / 4
|
|
|
|
offset = xsize / 4
|
|
|
|
box = (offset, 0, (offset + (xsize / 2)), ysize / 2)
|
|
|
|
box = (offset, 0, (offset + (xsize / 2)), ysize / 2)
|
|
|
|
img = img.crop(box)
|
|
|
|
img = img.crop(box)
|
|
|
|
else:
|
|
|
|
elif gpio.input(self.a6_pin) == 0:
|
|
|
|
|
|
|
|
print("scanning as A6")
|
|
|
|
offset = (xsize - (ysize / 2)) / 2
|
|
|
|
offset = (xsize - (ysize / 2)) / 2
|
|
|
|
box = (offset, 0, (offset + (ysize / 2)), xsize / 4)
|
|
|
|
box = (offset, 0, (offset + (ysize / 2)), xsize / 4)
|
|
|
|
img = img.crop(box)
|
|
|
|
img = img.crop(box)
|
|
|
|
|
|
|
|
else:
|
|
|
|
|
|
|
|
print("scanning as A3")
|
|
|
|
|
|
|
|
|
|
|
|
# rotate
|
|
|
|
# rotate
|
|
|
|
if gpio.input(self.landscape_pin) == 0:
|
|
|
|
if gpio.input(self.landscape_pin) == 0:
|
|
|
|