Issue with 2 cameras and the Imager Acquisition Toolbox - video objects vanish!
1 view (last 30 days)
Show older comments
Hello, I have been using the IMAQ toolbox for years and all works fine with 1 camera. Today I have hooked up a 2nd (identical but different serial number) camera and if I use each one seperately all is fine.
I used to just create a single video object (vidobj1) that all my code uses. Now as I have 2 cameras I have created a 2nd videoobject ("vidobj2")
Both these vidobj's are declared as:
properties (Access = public)
% Camera Properties
vidobj1 % 1st Video object
vidobj2 % 2nd Video object
I onoy want to actually take an image sequentially (i.e. with one camera at a time), so for my image capture command, depending on which camID I use (either 1 or 2), I want the appropriate vidobj to be used (all my commands use "vidobj" and I want this to be either vidobj1 or vidobj2. I thus created this function below.
function vidobj =getVidObj(app)
camID=str2num(app.CameraIDDropDown.Value); %either 1 or 2
switch camID
case 1
vidobj=app.vidobj1
case 2
vidobj=app.vidobj2
end
So this works fine for both cameras but only once, it then complains that trhe object no longer exists
My getCameraimage function is like this:
vid=getVidObj(app)
flushdata(vid);
start(vid);
%etc....
But at the flushdata(vid) line it says
Invalid Image Acquisition object.
This object is not associated with any hardware and
should be removed from your workspace using CLEAR.
Error using imaqdevice/flushdata
OBJ contains an invalid video input object at index 1.
Any idea whats happening?
Accepted Answer
More Answers (0)
See Also
Categories
Find more on National Instruments Frame Grabbers 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!