MATLAB Answers

Initializing Image Acquisition with FLIR Black Fly camera

조회 수: 14(최근 30일)
Mike
Mike 2021년 1월 11일
댓글: Mike 2021년 1월 19일
I am using Image Acquisition tools set with a FLIR Blackfly S BFS-U3-515SM camera. In my code I perform the following steps to initialize:
% Connect camera
cam = videoinput('mwspinnakerimaq', 1, 'Mono12Packed');
camProps = getselectedsource(cam);
% Set exposure and Gain
camProps.ExposureAuto = 'Off';
camProps.GainAuto = 'Off';
camProps.ExposureTime = 30001;
The first time I run this code after conencting the camera (USB3) I get the following error message:
Attempt to modify currently read-only or inaccessible property: ExposureTime.
Use IMAQHELP(OBJ, 'ExposureTime') for information.
If I run IMAQTOOL, select my camera in Mono 12 bit packed mode, and then click on "Start Preview" I see the image, and the camera is clearly working properly. I next click on "Stop Preview" and then I exit IMAQTOOL.
Once I have previewed the image in IMAQTOOL the above code suddenly works.
Is there an initialization step I am missing?

채택된 답변

Anshika Chaurasia
Anshika Chaurasia 2021년 1월 19일
Hi Mike,
You can refer to the following similar MATLAB Answer post:
Hope it helps you!
  댓글 수: 1
Mike
Mike 2021년 1월 19일
Thanks Anshika,
I can work around the issue by doing the following:
imaqreset;
cam = videoinput('mwspinnakerimaq', 1, 'Mono12Packed');
camProps = getselectedsource(cam);
preview(cam);
closepreview(cam);
One "preview" executes it leaves the camera in a state where I can control all aspects. It works but it definitely lacks elegance. There is obviously a known methodology to properly initialize the camera otherwise the preview function would fail. The above steps are a hack. It would be nice if someone, be it MathWorks or FLIR actually documented their products so that it was possible to use them properly.

댓글을 달려면 로그인하십시오.

추가 답변(0개)

Community Treasure Hunt

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

Start Hunting!

Translated by