Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

IMAQdx Read Attributes.vi WRITES .icd file if none exists - AWFUL!

I use "IMAQdx Read Attributes.vi" to load my GigE camera's configuration when the user wants to start grabbing frames.  I feed the path and filename into the "Filename" input as a string constant.  I just discovered that if I delete the .icd file from the disk, "IMAQdx Read Attributes.vi" does NOT throw an error (as I would expect when it can't find the file I told it), but instead just presses on with whatever configuration happens to be loaded in the camera's memory.  Then, to add insult to injury, this READ function takes it upon itself to just WRITE an .icd file out to disk containing the current camera configuration!

 

Oh no!

 

See, I don't want the user to be able to run with any configuration except that which is in the disk file.  With this functionality I've described, there is no warning that the user may not be running the correct configuration, PLUS the "sacred" location and filename on the disk which should only contain the pristine configuration file gets populated by some file that looks just right on the surface (has right filename, is in right location), but could contain whatever garbage was in the camera's memory!!

 

I recommend NI change the behavior of "IMAQdx Read Attributes.vi" such that it throws an error code if the file is not found, and NEVER writes files.  Writing .icd files should be accomplished with "IMAQdx Write Attributes.vi".

0 Kudos
Message 1 of 4
(5,619 Views)
Are you sure it isn't the Open that is creating the file? The behavior of Open will create a default ICD from the camera config if one does not exist. If it is doing it explicitly during the read, my guess is that it could be due to some implicit behavior of the Read VI. It also changes the IID file to point to that new file as the new default (more of a "switch camera file" rather than "read")". Since missing a default file is not allowed, it might be creating it.

You may want to explore related VIs to read/write the camera file directly to strings instead. I can't recall if these are on the pallete but they are in the LLB with the other VIs. This would give you a bit more low-level control since you could manage the file behavior yourself.
0 Kudos
Message 2 of 4
(5,613 Views)

Thank you for your reply, BlueCheese.

 

If by "the Open" you are referring to my use of "IMAQdx open camera.vi," then no, it is not that call which is creating the .icd file.  The text string showing the path and .icd filename is not fed to any vi until after my call to "IMAQdx open camera.vi," so that vi would not know where to write a "default" .icd.  I see in the Detailed Help for "IMAQdx open camera.vi" that it "loads a camera configuration file," but I do not know how you extrapolate from that that it "will create a default ICD from the camera config if one does not exist."  Maybe an "ICD" is not the .icd disk file, but rather the configuration set itself.

 

Regardless, I'm quite sure it is the "IMAQdx Read Attributes.vi" that is doing the disk file writing.  Programmatically, I know how to get around it, no problem.  I can put in code to go check for the file before invoking the "...Read Attributes.vi," but my point is I should not have to.  NI should write the "...Read Attributes.vi" such that if the file does not exist, you get that as an output error.  This is the safe and logical way to go.  It also highlights my biggest gripe about LabVIEW (which I do like, by the way :-):  The "Detailed Help" is really lacking in a lot of ways.  Shouldn't "What happens if the file is not found on the disk" behavior be documented?  It isn't.  You have to write a sample program to tease out the behavior of almost any NI-provided vi.  It's a big waste of time.

Message 3 of 4
(5,598 Views)

For anyone wondering about this, this is no longer the behavior in IMAQdx driver that comes with VAS January 2017.  It might have been fixed earlier.  You now get

Error -1074360288 occurred at IMAQdx Read Attributes.vi

Possible reason(s):

NI-IMAQdx: (Hex 0xBFF69020) Invalid camera file.

If you try to load an .icd file that is not there.  No .icd file is created by the IMAQdx Read Attributes VI

0 Kudos
Message 4 of 4
(2,828 Views)