Unable to detect IDS uEye camera

21 vues (au cours des 30 derniers jours)
Manuel
Manuel le 27 Nov 2014
Commenté : sanjoy khawas le 22 Août 2018
Hi,
I have a matlab 2012b installation with the Image Acquisition Toolbox Version 4.4 and want to record from my IDS uEye camera which should be DirectShow compatible.
Using the detectedDecice Uitility from mathwork ( http://de.mathworks.com/hardware-support/directshow.html ) the camera is detected by the winvideo driver.
But if I run imaghwinfo('winvideo') there is no camera found.
I tried to get this Webcam support package ( http://www.mathworks.com/matlabcentral/fileexchange/45182-matlab-support-package-for-usb-webcams ) but it seems to be available only for Matlab 2014>
Do you have any suggestions on how to access this camera?
Thank you! Manuel
  2 commentaires
Adam Wyatt
Adam Wyatt le 4 Juin 2015
Modifié(e) : Adam Wyatt le 7 Déc 2016
Have a look at my blog for information on how to do this:
  1. .NET interface
  2. mex interface
sanjoy khawas
sanjoy khawas le 22 Août 2018
Hi Adam,
Thank you for sharing the code. I am also trying to connect the ueye camera through Matlab by the protocol(using max file) mentioned by you. However, I am able to connect the camera but matlab did not display any images.
The output of the command windows shows --- Number of connected cameras: 1 ============================================================ # CamID DevID Sens On Serial Model Status ============================================================ 0 1 1 558 0 4103146965 UI318xCP-M 0 ============================================================
Initializing first available camera ... Setting colormode to monochrome ... Setting display mode to bitmap (DIB) ...
============================================================ Camera information ============================================================ Camera #: 1 Sensor Name: UI318xCP-M Monochrome: 1 Max Width: 2592 Max Height: 2048 Global Shutter: 1 Pixel Size [um]: 4.800000 ============================================================
Error using uEye_Test Requested 11132555233280x10x64 (6635520.0GB) array exceeds maximum array size preference. Creation of arrays greater than this limit may take a long time and cause MATLAB to become unresponsive. See array size limit or preference panel for more information.
Any ideas or suggestions are highly appreciated.

Connectez-vous pour commenter.

Réponse acceptée

Adam Wyatt
Adam Wyatt le 9 Déc 2014
I didn't get far using this route (it was my initial plan and I purchased the IMAQ toolbox just for this purpose). Anyway, the way to go is to connect through the .NET interface, here is an example:
Using the .NET assembly is not quite as straightforward as with C# because Matlab does not directly support pointers, but there is a workaround as pointed out below.
Remember to "EXIT" your camera before trying to re-initialise the same camera
% Add NET assembly if it does not exist
% May need to change specific location of library
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
% Create camera object handle
cam = uEye.Camera;
% Open 1st available camera
% Returns if unsuccessful
if ~strcmp(char(cam.Init), 'SUCCESS')
error('Could not initialize camera');
end
% Set display mode to bitmap (DiB)
if ~strcmp(char(cam.Display.Mode.Set(uEye.Defines.DisplayMode.DiB)), ...
'SUCCESS')
error('Could not set display mode');
end
% Set colormode to 8-bit RAW
if ~strcmp(char(cam.PixelFormat.Set(uEye.Defines.ColorMode.SensorRaw8)), ...
'SUCCESS')
error('Could not set pixel format');
end
% Set trigger mode to software (single image acquisition)
if ~strcmp(char(cam.Trigger.Set(uEye.Defines.TriggerMode.Software)), 'SUCCESS')
error('Could not set trigger format');
end
% Allocate image memory
[ErrChk, img.ID] = cam.Memory.Allocate(true);
if ~strcmp(char(ErrChk), 'SUCCESS')
error('Could not allocate memory');
end
% Obtain image information
[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
% Acquire image
if ~strcmp(char(cam.Acquisition.Freeze(true)), 'SUCCESS')
error('Could not acquire image');
end
% Extract image
[ErrChk, tmp] = cam.Memory.CopyToArray(img.ID);
if ~strcmp(char(ErrChk), 'SUCCESS')
error('Could not obtain image data');
end
% Reshape image
img.Data = reshape(uint8(tmp), [img.Width, img.Height, img.Bits/8]);
% Draw image
himg = imshow(img.Data, 'Border', 'tight');
% Acquire & draw 100 times
for n=1:100
% Acquire image
if ~strcmp(char(cam.Acquisition.Freeze(true)), 'SUCCESS')
error('Could not acquire image');
end
% Extract image
[ErrChk, tmp] = cam.Memory.CopyToArray(img.ID);
if ~strcmp(char(ErrChk), 'SUCCESS')
error('Could not obtain image data');
end
% Reshape image
img.Data = reshape(uint8(tmp), [img.Width, img.Height, img.Bits/8]);
% Draw image
set(himg, 'CData', img.Data);
drawnow;
end
% Close camera
if ~strcmp(char(cam.Exit), 'SUCCESS')
error('Could not close camera');
end
  1 commentaire
Myrtle42
Myrtle42 le 7 Juin 2018
Thanks for the well-commented example code! I realize this is old but had a similar problem with an IDS camera and tried out this solution. Note: I had to change "strcmp" to "strcmpi" because it was actually outputting the word "Success" not "SUCCESS". Now it works great.
As written, this gives me only 10 fps with a 1920 x 1200 IDS camera (nominal max 180 fps). I realize this is slowed down by the image plotting and moving the data from memory. Could you post an example of how to write images to disk using the NET framework as quickly as possible (using free running)?

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB Support Package for USB Webcams dans Help Center et File Exchange

Produits

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by