Issues with Properly exiting camera

조회 수: 2 (최근 30일)
Bera
Bera 2025년 1월 28일
Hey All
I have a uEye 148x camera. Essentially I am doing all the proper deleting and clearing but when I open the app back up it says no device connected. This only happens when it thinks Matlab or python is still using it. I have been able to exit the camera and have the app work via Python but I haven't had much luck with properly exiting via Matlab.
This is my code
% -------------------- INITIALIZE CAMERA --------------------
clc; clear; close all;
% Set up camera
info = imaqhwinfo;
if isempty(info.InstalledAdaptors)
error('No cameras found. Connect a camera and try again.');
end
adaptor = info.InstalledAdaptors{1};
camInfo = imaqhwinfo(adaptor);
deviceID = camInfo.DeviceInfo(1).DeviceID;
vid = videoinput(adaptor, deviceID, camInfo.DeviceInfo(1).SupportedFormats{1});
src = getselectedsource(vid);
% Set camera parameters
% vid.FramesPerTrigger = 1;
% src.Exposure = -6;
% src.Gain = 10;
% adding an itial delay to make sure everything is working as expected
pause(1)
preview(vid)
% Capture initial image
img = getsnapshot(vid);
imshow(img)
closepreview(vid)
stop(vid)
delete(vid)
clear vid
Any help would be much appreciated

답변 (0개)

제품


릴리스

R2024a

Community Treasure Hunt

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

Start Hunting!

Translated by