Preview function looks darker after initial use
3 views (last 30 days)
Show older comments
Utku Gulbulak
on 5 Jan 2023
Commented: Image Analyst
on 6 Jan 2023
Hello,
I have been using the image acquisition toolbox with a GigE camera (Basler ace acA2000-50gm, 8-bit Mono). In the workflow, I use preview function to obtain a live image and then take a snapshot. When I first use the preview function the image looks bright (I am using the microscope's light to adjust the brightness), however, when I use the function again the image looks darker. I had to crank up the light to see what is going on in the image. Then, the acquisition starts and the image is all white. I realized that if I turn the camera on and off between trials the preview function shows the bright image.
I was wondering if there was a way to use preview function more efficiently?
Here are the code snippets that I use in my workflow:
imaqreset;
obj.vid = videoinput('gige', 1, 'Mono8');
obj.vid.FramesPerTrigger = 1;
obj.src = getselectedsource(obj.vid);
obj.src.PacketSize = 9000;
%obj.CamVideoRecord
obj.CamSingleShot(snapshot_file)
function CamSingleShot(obj,snapshot_file) %name for snapshot
snapshot_file = regexprep(snapshot_file,'.mat', '.png');
obj.vid.FramesPerTrigger = 1;
obj.vid.TriggerRepeat = Inf;
obj.src.AcquisitionFrameRateEnable = 'True';
obj.src.AcquisitionFrameRateAbs = 30.000300003;
preview(obj.vid)
[icondata,iconcmap] = imread("trees.tif");
uiwait(msgbox('Press OK to take a snapshot',...
"Message","custom",icondata,summer));
singleshot = getsnapshot(obj.vid);
imwrite(singleshot,snapshot_file)
stoppreview(obj.vid)
end
0 Comments
Accepted Answer
Image Analyst
on 5 Jan 2023
Have you tried setting the Exposure property to some known constant?
2 Comments
Image Analyst
on 6 Jan 2023
I'm not really sure but it could be that imaqreset just resets the properties of the adapter (middleware between MATLAB and your camera's hardware). It could be that nothing ever actually gets sent to the camera itself. You might have to work with the tech support team at Mathworks that specializes in cameras.
More Answers (0)
See Also
Categories
Find more on GigE Vision Hardware in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!