我无法在CMOS中获得时间曝光

时间:2017-05-04 07:21:48

标签: matlab time

我正在使用Thorlabs相机(DDC3240M)。我可以使用手动命令获取图像,显示图像,选择位数并设置曝光时间。但是为了确保我在CMOS中设置的曝光时间,我真的希望获得时间曝光。在手册中建议使用以下命令:

语法:cam.Timing.Exposure.Get

说明:返回当前设定的曝光时间(以毫秒为单位)

因此,根据使用此命令的相机手册,我将能够以毫秒为单位获取曝光时间。但是当我使用它时,我从命令行得到的唯一响应是 ans =成功

根据手册的这种类型的响应意味着命令已成功执行。 但我看不出价值。我使用函数将值显示为(dfprintf)但我看不到值。

% Add NET assembly
% May need to change specific location of library
NET.addAssembly('C:\Program Files\Thorlabs\Scientific Imaging\DCx Camera Support\Develop\DotNet\uc480DotNet.dll');
%Some parametres for the camera
exposure_ms = input('What is the exposure time in ms:');
gain = input('What is the gain:');
% Create camera object handle
%cam = uc480.Camera;
cam = uc480.Camera;
% Open the 1st available camera
cam.Init(0);
% Set display mode to bitmap (DiB)
cam.Display.Mode.Set(uc480.Defines.DisplayMode.DiB);
% Set color mode to 8-bit RGB
% cam.PixelFormat.Set(uc480.Defines.ColorMode.RGBA8Packed);
cam.PixelFormat.Set(uc480.Defines.ColorMode.SensorRaw8);
%Sequence of images

   % Set trigger mode to software (single image acquisition)
cam.Trigger.Set(uc480.Defines.TriggerMode.Software);
% Allocate image memory
[~, MemId] = cam.Memory.Allocate(true);
%Set the parametrs for the camera
cam.Timing.Exposure.Set(exposure_ms);
cam.Gain.Hardware.Scaled.SetMaster(gain);

% Obtain image information
[~,Width, Height, Bits,~] = cam.Memory.Inquire(MemId);

tic
for t=1:100
% Acquire image
cam.Acquisition.Capture(uc480.Defines.DeviceParameter.Wait);
% Copy image from memory
[~, tmp] = cam.Memory.CopyToArray(MemId);
% Reshape image
Data = reshape(uint8(tmp), [1, Width, Height]);
% Data = Data(1:3, 1:Width, 1:Height);
Data = permute(Data, [3,2,1]);
image(Data); drawnow;
end;
toc


% Rename 
%eval(sprintf('Data%d=Data;',k));
% himg = imshow(Data);
% Save the image and Close camera
dlmwrite('C:\Users\DanielleCristina\Desktop\AprendendoMatLab\DadosMatLab\data3.txt',Data,'Delimiter','\t');
cam.Exit;    

1 个答案:

答案 0 :(得分:0)

cam.Timing.Exposure.Get返回两个参数。第一个是您正在阅读的标志,如果您想获得曝光值,请尝试使用。

[a,b] = cam.Timing.Exposure.Get;

b将保持曝光时间的值(以毫秒为单位)。