Example: Simple Camera

The “Hello World” of APRON examples is the simple act of grabbing an image from a webcam and displaying it in the simulator. The script below uses the apron.webcam plugin. First the camera is initialised to capture images at a specific width and height. The program then loops repeatedly grabbing an image, and then displaying it.

!include('apron.aps')
!include('apron.webcam.aps')

!define(CAM_W, 128)
!define(CAM_H, 128)

!create('camera', REGISTER, CAM_W, CAM_H)

webcam.init(CAMW, CAM_H)
sim.display(r[camera])
sim.tile

#start
    r[camera] = webcam.getLuminance(0)
    r[camera] = r[camera] / 2
    sim.show(r[camera])
    jump(#start)
This entry was posted in Examples. Bookmark the permalink.

Leave a Reply