In this example, we will make a loop for continuous acquisition and per channel contrast adjustment of frames from our camera. We will time the process using the profile function of MATLAB so that we demonstrate the bottleneck of our process. This way, you can get an idea of the time issues arising when performing video processing in MATLAB. Bear in mind that the machine used for these experiments had a Q9550 Quad-Core CPU, at 2.8 GHz:
First off, we get our hardware ready:
>> imaqreset >> vid = videoinput('winvideo', 1, 'dvsd_720x576');
Now, we preallocate space for the matrix that will hold our frames. For our experiment, 100 frames will be enough:
>> test = uint8(zeros(576,720,3,100));
We then start the MATLAB profiler, which will analyze the time spent on each of our functions:
>>profile on
Next, we write the
for
loop that will make it all happen:>> for i = 1:100 temp = getsnapshot(vid); % Acquire a frame fprintf...