This time, we will repeat the previous experiment, with a minor adjustment; we will add a preview
command in our code. Let's try it:
First, we will repeat steps 1 to 3 from the previous example:
>> imaqreset >> vid = videoinput('winvideo', 1, 'dvsd_720x576'); >> test = uint8(zeros(576,720,3,100)); >> profile on
Now, we will invoke the Preview window using the following command:
>>preview(vid);
And then, we will once more type in the acquisition-processing nested
for
loops:>> for i = 1:100 temp = getsnapshot(vid); % Acquire a frame fprintf('Processing frame number %d… \n',i) % Announcement for k = 1:3 % For all 3 color channels test(:,:,k,i) = imadjust(temp(:,:,k)); % Adjust contrast end subplot(1,2,1),imshow(temp ) % Display current frame subplot(1,2,2),imshow(test(:,:,:,i)) % Display processed frame end
Finally, we will close and display the profiling results:
>> profile off % Close profiler >> profile...