MODAL Examples

The frame grabber and image display

Start a tcl shell and load the package (output in orange):
% load MODAL
VideoServer: ready to serve
Frame size: 320 x 240

Grab a back ground image, bg,  and display it:
% md_newBg
% md_writeIm bg

Grab a new frame from the video to curr and display it:
% md_grabFrame
% md_writeIm curr

Calculate the absolute difference and display the resulting diff image:
% md_calcDiff
% md_writeIm diff

Threshold the diff image and display the resulting bin image:
% md_calcBin
% md_writeIm bin

Calculate the statistics, write a cross at (xmean, ymean) in the curr image, and display it:
% md_calcStat
% set x [md_getStat mean x];
% set y [md_getStat mean y];
% md_writeCross $x $y;
% md_writeIm curr

Script that compares a background image with new video input
# the next line restarts using wish \
exec wish "$0" "@" 
load MODAL
set areaThreshold 0.01
while {1} {
    if {[md_getStat area] > $areaThreshold} {
        set x [md_getStat mean x]
        set y [md_getStat mean y] 
        puts "Movement at: x = $x y = $y"
VideoServer: ready to serve
Frame size: 320 x 240
Movement at: x = 0.715089 y = 0.412059


Return to Modal Home Page

(Last updated October 22, 1998)