So uhm… I got an error saying "OSError: File Corrupted…
Now, I got the error after I included the self argument in the init method and now I have no idea how I’m supposed to solve this.
Here’s my code if anyone is curious:
import sensor, time, image
#initialization of the camera, resolution: 160, 120
sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QQVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()
class Detection:
def __init__(self):
self.img = sensor.snapshot()
self.H = image.Image("/H.png")
self.S = image.Image("/S.png")
self.U = image.Image("/U.png")
def HSU(self):
clock.tick()
self.harmed = image.find_template(template=self.H, threshold=0.5, search=image.SEARCH_EX)
if self.harmed:
rect.draw_rectangle(self.harmed, thickness=1)
self.send
self.safe = image.find_template(template=self.S, threshold=0.5, search=image.SEARCH_EX)
if self.safe:
rect.draw_rectangle(self.safe, thickness=1)
self.send
self.unharmed = image.find_template(template=self.U, threshold=0.5, search=image.SEARCH_EX)
if self.unharmed:
rect.draw_rectangle(self.unharmed, thickness=1)
self.send
def send(self):
self.HSU
detection = Detection()