Hi!
I´d like to reduce my CPU-Load during image Acquisition.
I´m using a Logitech C910 for acquiring images. My Code looks like this:
function [Vid] = InitCAM()
Vid = videoinput( 'winvideo', 1, 'RGB24_1600x1200');
triggerconfig(Vid, 'manual');
Vid.FramesPerTrigger = 1;
Vid.ReturnedColorSpace = 'grayscale';
set(Vid, 'SelectedSourceName', 'input1')
VidSrc = getselectedsource( Vid);
VidSrc.BacklightCompensation = 'on';
VidSrc.FrameRate = '5';
VidSrc.ExposureMode = 'auto';
VidSrc.FocusMode = 'auto';
VidSrc.Gain = 64;
VidSrc.Pan = 0;
VidSrc.Saturation = 32;
VidSrc.Sharpness = 72;
VidSrc.Tilt = 0;
set(VidSrc,'WhiteBalanceMode','auto');
end
After Initialisation i´m starting a GUI where the acquired frames are displayed in an axes.
set(Vid,'TimerPeriod', 0.3, 'TimerFcn','BufferImages(Vid, PMMFClient);');
start(Vid)
The TimerFcn looks like this:
function BufferImages(Vid, PMMFClient)
global CurFrame
global OldFrame
global DifFrame
global once
global OldStatusLine
CurFrame.Image = getsnapshot(Vid);
PMMFClient.Data(1).Image = CurFrame.Image;
t = now;
c = datevec ( t );
s = datestr ( c, 0 );
CurFrame.TimeStamp = s;
PMMFClient.Data(1).TimeStamp = uint8(CurFrame.TimeStamp);
imagesc( CurFrame.Image, 'Parent', GuiHandles.axes1);
set(GuiHandles.axes1,'YTick',[],'XTick',[]);
end
I´m using an TimerFcn because i´m doing different image processing things in in the TimerFcn which must be cyclic for each frame.
I want to acquire every 0.3 seconds only one image and process it. My CPU load is now 40% using Intel Core 2Duo 2,8GHZ. For my opinion it´s too much.
Have you any idea reducing the cpu load to do this image acquire?
Many thanks in advance!