I want to trigger an image capture every time a tyre of a set of moving vehicles appears just in front of the picamera. Is there any way to get this done automatically every time a tyre appears in front of the camera ?

  • There's like a zillion possibility to do that, you need to ask a more specific question. Do you want to recognize tire ? If so you can train a model to recognize just that. Is the camera fixed on something and the background picture remain the same ? Then you should probably try to detect edges and movement. .... – YCN- Jul 5 '19 at 8:40

Example from here :

import picamera
import picamera.array
import numpy as np

class MyMotionDetector(picamera.array.PiMotionAnalysis):
    def analyse(self, a):
        a = np.sqrt(
            np.square(a['x'].astype(np.float)) +
            ).clip(0, 255).astype(np.uint8)
        # If there're more than 10 vectors with a magnitude greater
        # than 60, then say we've detected motion
        if (a > 60).sum() > 10:
            print('Motion detected!')

with picamera.PiCamera() as camera:
    camera.resolution = (640, 480)
    camera.framerate = 30
        '/dev/null', format='h264',

New in version 1.5.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.