how to set exposuretime in appdesigner with EditField?
8 次查看(过去 30 天)
显示 更早的评论
Hi,
I am trying to change the exposure time with an Edit Field, but I am problem accessing the camera properties wihin the app.
For example I define the camera properties as 'scr', then I set Camera Exposure and other properties when the camera starts.
% Code that executes after component creation
function startupFcn(app)
clc
delete(imaqfind);
% Create video object
imaqreset % resettar videoiput
app.VidObj = videoinput('gentl', 1, 'Mono12');
% camera properties
scr=getselectedsource(app.VidObj);
% setting the exposure time
scr.ExposureTimeAbs = 100000; % us 100 ms = 100'000 us
But then I want to add some kind of editable field (like EditField) where I can enter a number that will set the exposure time of the camera. Like, ..
function ExposureTimemsEditFieldValueChanged(app, event)
value = app.ExposureTimemsEditField.Value; % in ms
% 100 ms = 100'000us; 1 ms = 1000 us
% camera properties 'again'
scr=getselectedsource(app.VidObj);
scr.ExposureTimeAbs = value*1000; % anges i us
disp(['The exposure time was changed to ',num2str(value),' microseconds'])
However, the scr does not "exist" here as it is not a global property. I tried to add it as a global object, bu it didnt like the app.scr everywhere. So I call the scr again with getselectedsource function. Nothing seems to be happening though.
How can i change the exposure time "again" so it will change?
I have tried to change the exposuretime here with code above, but it seems to be nothing happening.
0 个评论
采纳的回答
Hope Q
2019-10-28
I suggest adding some diagnostic statements to assure that you have the desired source object and that is supports the ExposureTimeAbs property. I'm working on a simliar project that sets the FrameRate property.
You can also create an app property for the selected source that you don't have to keep calling getselectedsource().
For example:
app.videoCam = getselectedsource(obj.VidObj);
propertyList = set(obj.videoCame,'FrameRate'') % gives options for FrameRate
0 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Point Grey Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!