MATLAB IMAGE ACQUISITION TOOLBOX 3 Guida Utente Pagina 202

  • Scaricare
  • Aggiungi ai miei manuali
  • Stampa
Vedere la pagina 201
7 Using Events and Callbacks
function mem_mon(o bj,e vent)
out = imaqmem;
mem_left = out.FrameMe moryLimit - out.FrameMe moryUsed;
msg = 'Memory left for frames ';
msg2 = 'Memory load';
low_limit = 2000000;
if(mem_left > low_limi t)
sprintf('%s: %d \n%s: %d',msg, mem_left,msg2, out.MemoryLoa d)
else
disp('Memory avail abl e fo r frames getting low.');
disp('Stopping acq uis ition.')
stop(obj);
end
Running the Example
The example acquires frames until the amount of memory left for frame
storage reaches a lower limit specified in the callback function.
1 Create an im age acquisition object Th i s example creates a video
input o bj ect for a M atrox ima ge acquisition device. To run th is example on
your system, use the
imaqhwinfo function to get the object constructor for
your image acquisition device and substitute that syntax for the following
code.
vid = videoinput('mat rox',1);
2 Configure property values This example sets up a continuous
acquisition by setting the
FramesPerTrigger value to Inf.Theexample
also spe c ifies the timer e vent call back function
mem_mon, created in
“Creating the Memory Monitor Callback Function” on page 7-17, as the
value of the
TimerFcn callback. The object will execute the TimerFcn every
five seconds, as specified by the valu e of the
TimerPeriod property.
set(vid,'FramesPerTrigger',Inf);
set(vid,'TimerPeriod',5);
set(vid,'TimerFcn',{'mem_mon'});
7-18
Vedere la pagina 201
1 2 ... 197 198 199 200 201 202 203 204 205 206 207 ... 407 408

Commenti su questo manuale

Nessun commento