Preview function looks darker after initial use
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre GigE Vision Hardware en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!