Hi, I am working on a Compute Module with two cameras attached. In general, it's working fine. Today, I am trying some of the Advanced Recipes. In particular, I need motion detection and downstream processing when there's motion.
THRESH = 60
class MotionDetector(picamera.array.PiMotionAnalysis):
def analyse(self, data):
rho = np.sqrt(
np.square(data['x'].astype(np.float)) +
np.square(data['y'].astype(np.float))
).clip(0, 255).astype(np.uint8)
n = (rho > THRESH).sum()
if n > 10:
print('Motion: {:}!'.format(n))
with picamera.PiCamera() as camera:
camera.resolution = (1536, 864)
camera.framerate = 30
print('Starting recording...')
camera.start_recording(
'/dev/null', format='h264',
motion_output=MotionDetector(camera)
)
camera.wait_recording(30)
camera.stop_recording()
print('Done!')
The code above from 4.11. Custom Outputs works fine, but when I try it with
with picamera.PiCamera(stereo_mode='side-by-side') as camera:
I think the motion data is the difference of data from the two cameras, which makes the MotionDetector.analyse() think there's motion all the time. Can anyone please help? Thanks
Hi, I am working on a Compute Module with two cameras attached. In general, it's working fine. Today, I am trying some of the Advanced Recipes. In particular, I need motion detection and downstream processing when there's motion.
The code above from 4.11. Custom Outputs works fine, but when I try it with
with picamera.PiCamera(stereo_mode='side-by-side') as camera:
it goes haywire:
I think the motion data is the difference of data from the two cameras, which makes the
MotionDetector.analyse()
think there's motion all the time. Can anyone please help? Thanks