LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Missing camera attribute (Gain) in NI MAX

I have a USB camera that appears in NI MAX, but it is missing control of gain (all other relevant settings are listed and controllable). I can control this setting through the company's software, but I would like to go through IMAQdx.

 

1) I tried adding an attribute like CameraAttributes::Gain::Value = "0" to the icd file, but this does not seem to add the attribute. In fact if I delete everything in the icd file this seems to also have no effect.

2) I tried using Camera File Generator (CFG) to edit the icd, but when I try to open it I get a message: "Camera files cannot be read or saved to a directory other than ni-imaq\data.". When I move the file to the NI-IMAQ folder it says: "This camera file is not a digital camera file..."

3) I have tried creating my own camera file using CFG from scratch, but the snap and grab buttons are always disabled. I believe this is because my camera uses USB and not serial.

 

If anyone has any suggestions, please let me know. And thank you in advance!

 

Specs:

Windows 10 64-bit

LabVIEW 2021

NI-IMAQdx, IMAQ, IMAQ I/O all v21.0.0

Vision Development 2021

 

0 Kudos
Message 1 of 15
(1,421 Views)

There is an IMAQdx function called "IMAQdx Enumerate Attributes".  It returns all of the Attributes the camera supports, notes whether they are readable and (or) writeable, and an Enum telling the type of the Attribute.  You can write a little utility to list them all, and once you know what attributes the Camera supports, you can write a little VI to set any of the Attributes to an allowed value.

 

Have you tried using MAX to examine and/or set the Attributes?

 

Bob Schor

0 Kudos
Message 2 of 15
(1,401 Views)

Hi Bob,

 

When enumerating through the attributes, I see the same attributes as in the icd file. I do not have a problem setting these values, but instead I want to add the ability to control Gain (which is not listed in the icd).

0 Kudos
Message 3 of 15
(1,371 Views)

Have you tried adjusting the Bayer gains?

0 Kudos
Message 4 of 15
(1,359 Views)

Hi Gregory,

 

Those seem to have no affect on the image output. I have also tried changing the Bayer algorithm and Bayer pattern.

0 Kudos
Message 5 of 15
(1,354 Views)
Is this camera from AmScope? Did you try it with their software to verify you can set the gain?
0 Kudos
Message 6 of 15
(1,349 Views)

Yes, it is from AmScope and I can indeed control gain through their software. I would like to use IMAQdx to achieve the same control.

0 Kudos
Message 7 of 15
(1,344 Views)

Well, I went down a rabbit hole and downloaded the Windows SDK from AmScope. Under the "extras" folder I found a broken LabVIEW example that calls some DLLs. But even their example only has a control for "brightness", not analog gain. If you're really intent on this, you might try to contact their tech support.

0 Kudos
Message 8 of 15
(1,340 Views)

OK, I've done a little more "investigating" and have some "answers" that I'm not sure fit any "questions", but here's what I can tell you, based on my own "experiments".

 

I'm currently at work, where there is a Logitech C920 Webcam that identifies itself to LabVIEW as "HD Pro Webcam C920 (#<128 bit ID goes here, shown as a Text string>).icd.  This ID is stored in C:\Users\Public\Public Documents\National Instruments\NI-IMAQdx\Data.  I'm making a Note to Myself to remember to attach this, and some additional files, to this Reply "for your viewing pleasure".  Also in this folder is a file "cam1.iid" which in its [CAMERA_INTERFACE_DATA] has the filename of the .icd Camera File saved as "CameraFile = "HD Pro Webcam C920 (etc.).icd".

 

The ICD contains two Sections, [NIIMAQ HEADER] and {CAMERA DATA],  The first section has two entries, the second has 40 entries.  The IID file is much smaller:  its [NIIMAQ HEADER] is the same as the ICD, and its [CAMERA_INTERFACE_DATA] has 7 entries that identify the Camera and provide a link (by filename) to the ICD.

 

As I mentioned to you, I had written (a few years ago, when I was struggling to try to use a fancy USB 3 camera made by FLIR, for which I was able to get IMAQdx to open (after I disabled the native Driver), but could not get to take satisfactory videos using IMAQdx) a utility that uses IMAQdx functions to get all of the Camera Attributes, and write them to a .csv file.  This is attached as "cam1 Attributes.csv".  The file lists the name of the Attribute, the Type of the Attribute, its Read/Write status, and its default value.  Note that this file has 55 entries, 15 more than the Attributes shown in the .icd file.  My brain is already hurting too much having to review the pain of trying to get this camera to work for me -- I'll let you study the listings and see if you can understand why they differ.  [My guess is it's a "GenICam" thing gone awry ...].

 

Finally, there are those tricky Enums, which take on "Vendor-specific values"] (I think).  I wrote another little utility to list the (ordered) values of the Enums (again, which I never ended up using as I abandoned this Project].  That's attached as "cam1 Enum Attribs.txt".

 

So you should be able to find the first two files (.icd and .iid) in your Public Documents folder, and can get a hint of what Camera Attributes and Enum definitions are used for the Logitech C920 camera, some (or all?) of which should be visible in MAX (I haven't checked this out -- too tedious).

 

I hope this is useful.  I do like LabVIEW, and when I can use an "old-fashioned" WebCam or IP Camera for modest Vision applications, I'm not afraid to get my fingers dirty, but otherwise tackling NI Vision is not for the Faint of Heart, and definitely not for the "one-man shop" -- you really need at least two people talking/arguing/trying things out to maintain your sanity.

 

Bob Schor

 

 

 

 

 

 

Attach:  HD Pro Webcam C920 (stuff).icd

             cam1.iid

             cam1 Attributes.csv

             Enum Attribs.txt

             

Message 9 of 15
(1,330 Views)

Hi Gregory,

 

Yeah... that's why I went down the path of using IMAQdx instead of their SDK. I have tried using their Matlab, Python, and C++ files too, but all are broken (I believe their DLL is the issue). I've been trying to get support from them for over 3 weeks now, but here I am lol.

 

Thank you for digging into further! I do appreciate it.

0 Kudos
Message 10 of 15
(1,322 Views)