asm = System.AppDomain.CurrentDomain.GetAssemblies;
if ~any(arrayfun(@(n) strncmpi(char(asm.Get(n-1).FullName), ...
'uEyeDotNet', length('uEyeDotNet')), 1:asm.Length))
NET.addAssembly(...
'C:\Program Files\IDS\uEye\Develop\DotNet\signed\uEyeDotNet.dll');
end
cam = uEye.Camera;
if ~strcmp(char(cam.Init), 'SUCCESS')
error('Could not initialize camera');
end
if ~strcmp(char(cam.Display.Mode.Set(uEye.Defines.DisplayMode.DiB)), ...
'SUCCESS')
error('Could not set display mode');
end
if ~strcmp(char(cam.PixelFormat.Set(uEye.Defines.ColorMode.SensorRaw8)), ...
'SUCCESS')
error('Could not set pixel format');
end
if ~strcmp(char(cam.Trigger.Set(uEye.Defines.TriggerMode.Software)), 'SUCCESS')
error('Could not set trigger format');
end
[ErrChk, img.ID] = cam.Memory.Allocate(true);
if ~strcmp(char(ErrChk), 'SUCCESS')
error('Could not allocate memory');
end
[ErrChk, img.Width, img.Height, img.Bits, img.Pitch] ...
= cam.Memory.Inquire(img.ID);
if ~strcmp(char(ErrChk), 'SUCCESS')
error('Could not get image information');
end
if ~strcmp(char(cam.Acquisition.Freeze(true)), 'SUCCESS')
error('Could not acquire image');
end
[ErrChk, tmp] = cam.Memory.CopyToArray(img.ID);
if ~strcmp(char(ErrChk), 'SUCCESS')
error('Could not obtain image data');
end
img.Data = reshape(uint8(tmp), [img.Width, img.Height, img.Bits/8]);
himg = imshow(img.Data, 'Border', 'tight');
for n=1:100
if ~strcmp(char(cam.Acquisition.Freeze(true)), 'SUCCESS')
error('Could not acquire image');
end
[ErrChk, tmp] = cam.Memory.CopyToArray(img.ID);
if ~strcmp(char(ErrChk), 'SUCCESS')
error('Could not obtain image data');
end
img.Data = reshape(uint8(tmp), [img.Width, img.Height, img.Bits/8]);
set(himg, 'CData', img.Data);
drawnow;
end
if ~strcmp(char(cam.Exit), 'SUCCESS')
error('Could not close camera');
end
Best Answer