how to set exposuretime in appdesigner with EditField?
조회 수: 4 (최근 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에서 MATLAB Support Package for IP Cameras에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!