8.3.0.3.1. (effect-sdl-demo eff)
(packages/video4linux/demos/effect-sdl-demo.lsh)


This starts a real-time video effect demo that uses video4linux for grabbing video and SDL for displaying. The eff parameter must be an instance of a subclass of effect . Several subclasses are provided including edge detection, laplacian, image difference, etc...

This function uses three global variables to configure the video grabbing. Their names are: *video-device* *video-standard* and *video-input* , and their default values are respectively "/dev/video", "NTSC", 1 (1 is the composite input on most TV cards). The default values can be changed by defvar ing those variables to the desired value before loading the present file. Example:

(effect-sdl-demo (new effect-trail 320 240 20))
(effect-sdl-demo (new effect-edge 320 240))



8.3.0.3.1.0. Video Effects
(packages/video4linux/demos/effect-sdl-demo.lsh)


Video effect classes are subclasses of the effect class. Video effects are used by calling the fprop method which takes one input (RGBA image) and one output (RGBA image). The effect is applied to the input image and written into the output image. The input and output must be height x width x4 idx3 of ubytes. If used with effect-sdl-demo The alpha channel of the output image will determine the blending of the output image with the previously displayed image. Set all the alphas to 255 for full opacity. Effect subclasses must have a constructor that takes at least a width and height parameter (and possibly other initialization parameters). They must have width and height methods that return the width and height.

8.3.0.3.1.0.0. (new effect width height)
[CLASS] (packages/video4linux/demos/effect-sdl-demo.lsh)


noop effect: simply copies the input to the output unaffected

8.3.0.3.1.0.1. (new effect-edge width height)
[CLASS] (packages/video4linux/demos/effect-sdl-demo.lsh)


performs a simple edge detection by applying an on-center/off-surround convolution filter and rectifying, amplifying and saturating the result.

8.3.0.3.1.0.2. (new effect-trail width height hl)
[CLASS] (packages/video4linux/demos/effect-sdl-demo.lsh)


simply change the transparency to create a "trail" effect. hl is the "half life" of the trail: 0 leaves no trail, 1 leaves a trail that decays by half at each frame, and 20 looks funny. Example:
(new effect-diff 320 240 20)


8.3.0.3.1.0.3. (new effect-laplace width height gain)
[CLASS] (packages/video4linux/demos/effect-sdl-demo.lsh)


this applies a sort-of laplacian filter (really a set-of-your-pant on-center/off-surround filter) to each RGB component of the image. The gain paramter determines the gain of the output. Values around 1 are reasonable.

8.3.0.3.1.0.4. (new effect-diff width height alpha)
[CLASS] (packages/video4linux/demos/effect-sdl-demo.lsh)


computes a simple difference between consecutive images. alpha is the transparency with which the difference image is painted. Setting it to 255 will make it opaque, setting it to 128 will leave a short trail.

8.3.0.3.1.0.5. (new effect-bgsubst width height imagefile erosion dilation thres)
[CLASS] (packages/video4linux/demos/effect-sdl-demo.lsh)


performs background substitution. This compares the current grabbed image with an image computed as the average of the first 10 frames. If the Euclidean distance in RGB space of a pixel to the average is larger than thres , the corresponding pixel of the currently grabbed image is drawn, otherwise the corresponding pixel in the image imagefile is drawn. thres should be between 500 and 5000 for normal lighting conditions. erosion and dilation are used to erode and dilate the mask so as to eliminate rogue foreground pixels. Suggested values are 3 and 2 respectively.