フィルターのクリア

ActiveX, Camera uEye

6 ビュー (過去 30 日間)
Jirka Kolben
Jirka Kolben 2011 年 9 月 2 日
コメント済み: Myrtle42 2018 年 6 月 13 日
Hello, i have uEye cam and i need control the camera by ActiveX interface in matlab.
code:
actxcontrollist
h=actxcontrol('UEYECAM.uEyeCamCtrl.1','position',[20 20 640 512]);
methods(h)
d=h.InitCamera(1)
But matlab show error dialog: ERROR while calling error function. Propably not initialized.
Please help me. Thanks
  1 件のコメント
Adam Wyatt
Adam Wyatt 2015 年 6 月 4 日
I've created a file exchange submission which should significantly aid you all: File ID: #51099

サインインしてコメントする。

採用された回答

Adam Wyatt
Adam Wyatt 2014 年 12 月 9 日
ActiveX uses the COM interface, which is now no longer supported by IDS (uEye cameras). It is now recommended to use the .NET interface, which is fairly similar to the end user). 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
  2 件のコメント
Yarden Allon
Yarden Allon 2015 年 7 月 26 日
Hi Adam, Do you know how to get a live video feed using the .NET interface?
Myrtle42
Myrtle42 2018 年 6 月 13 日
Hi Adam and Yarden -- I have the same question, wondering if anyone found a solution. I'd like to record video from an IDS uEye camera using the .NET interface in freerun mode to get the max framerate. Can anyone provide an example of 1) Configuring the camera in freerun mode and 2) Saving the resulting video as either .avi or mp4?

サインインしてコメントする。

その他の回答 (1 件)

Wolfgang
Wolfgang 2014 年 8 月 4 日
Hi Jirka, did you manage to control the camera? I'm having similar problems at the moment... Thank you for your help!

カテゴリ

Help Center および File ExchangeMATLAB Support Package for USB Webcams についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by