Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing a PCI-1422 using Visual Studio 2008

What is required to connect to a PCI-1422 card using Visual Studio 2008?

 

I am trying to do two things through the PCI card:

 

1) control camera settings (or connect to the camera, I have the SDK that contains the camera functionality)

2) read image data from the camera to be able to save it to my own file for later analysis.

0 Kudos
Message 1 of 10
(5,586 Views)

You will need the IMAQ driver which is part of the Vision Acquisition Software.  You can download it from the link below:

 

NI Vision Acquisition Software 8.6 - Windows 2000/Vista x64/Vista x86/XP

http://joule.ni.com/nidu/cds/view/p/id/1099/lang/en

 

You can check camera functionality in Measurement and Automation Explorer and then use IMAQ functions to perform image acquisition in Visual Studio.

 

 

Nick Keel 

Applications Engineering 

National Instruments

Nick Keel
Product Manager - NI VeriStand and Model Interface Toolkit
National Instruments
0 Kudos
Message 2 of 10
(5,559 Views)

I currently have NI-IMAQ 2.5.1 installed, and use IRVista 2.51 to "use" my camera.

 

Will upgrading my NI-IMAQ software have any effect on this?

 

 

Also, I cannot find how to add NI-IMAQ to the toolbox in Visual Studio...

Message Edited by vs3@tamu on 09-09-2009 07:15 PM
0 Kudos
Message 3 of 10
(5,503 Views)

Upgrading your IMAQ driver could have an effect on your program.  Upgrading from NI-IMAQ 2.5.1 to the newest driver is a large update, and the driver has advanced quite a bit.  

 

Below is a link to a KnowledgeBase article that will help you program in VB:

 

 

Do NI-IMAQ and NI Vision Support Microsoft Visual Studio .NET?

http://digital.ni.com/public.nsf/allkb/B16A906B761B216F86256F4A0077258C?OpenDocument

 

 

Nick Keel 

Applications Engineering 

National Instruments

Nick Keel
Product Manager - NI VeriStand and Model Interface Toolkit
National Instruments
0 Kudos
Message 4 of 10
(5,489 Views)

I am getting down to programming now, and just wondering.

 

Is this the most recent version of the IMAQ driver?

 

Are there any examples of c++ code for acquiring images, and sending serial commands?

0 Kudos
Message 5 of 10
(5,178 Views)

The most recent version of the driver is available at the link below:

 

 

NI Vision Acquisition Software 2009.11 - Windows 2000/7 x64/7 x86/Vista x64/Vista x86/XP x86

http://joule.ni.com/nidu/cds/view/p/id/1524/lang/en

 

As of LabVIEW 2009, there is native .net support in the Vision Development module.  Examples come with the download and can be found on your C drive a:

 

C:\Program Files\National Instruments\Vision\Examples\dotNET

 

These examples are for either C# or VB .net, so the C# examples should be able to be modified for C++.

 

 

Nick Keel 

Applications Engineering 

National Instruments

Nick Keel
Product Manager - NI VeriStand and Model Interface Toolkit
National Instruments
0 Kudos
Message 6 of 10
(5,156 Views)

Hi vs3,

 

I'm not sure where Nick was going with his answer, as the C# examples are unlikely to be much use to you if you are looking to write a C/C++ application (unless you're looking to write a C++/CLI .NET app, but that is unlikely). He also pointed you to the Vision examples, not the Vision Acquisition ones.

 

We do in fact give examples for Microsoft Visual Studio that are written in C. You can find the Vision Acquisition examples here:

 

C:\Users\Public\Documents\National Instruments\NI-IMAQ\Examples\MSVC (Vista and later)

or here

C:\Documents and Settings\All Users\National Instruments\NI-IMAQ\Examples\MSVC (XP and 2000)

 

Hope this helps,

Eric 

0 Kudos
Message 7 of 10
(5,150 Views)

I've installed the latest version of the IMAQ drivers, but none of the paths that have been presented exist.

 

 

I'm using XP, and wishing to program a few image collection functions that can be called from a main program.

Basically, I am looking to snap an image (via PCI-1422), then turn a filter wheel (via serial connection).

I will possibly later add my own image processing functions, but those are already written and work.

 

I do not see an "Examples" folder in "C:\Program Files\National Instruments\NI-IMAQ\" 

There is nothing NI related in "C:\Documents and Settings\All Users\"

 

It might not be relevant, but during the install of this version (and the previous version 8.6.1) I got an error during installation that "Windows could not load the installer for IMAQ. Contact your hardware vendor for assistance."  I clicked OK and it continued along with the install.

 

EDIT:

 

still looking i found an example folder here:

"C:\Documents and Settings\All Users\Documents\National Instruments\NI-IMAQ\Examples\"  with the MSVC and .NET directories under it.

 

Thank you for your help thus far

Message Edited by vs3@tamu on 12-31-2009 01:07 PM
0 Kudos
Message 8 of 10
(5,147 Views)

Up to this point, I can use the examples to snap an image, and can slightly manipulate the code within the examples to better suit my needs...

 

I used an example code that NI provides on an older tutorial, but cannot build my solution.

 

My attempt at coding a simple snap & save operation:

 

#include "niimaq.h"

 

int main(int argc, char* argv[]) {

 

  INTERFACE_ID iid;

  SESSION_ID sid;

  Int8* ImaqBuffer = NULL;

 

  imgInterfaceOpen("img0", &iid);

  imgSessionOpen(iid, &sid);

  imgSnap(sid, (void**)&ImaqBuffer);

  imgSessionSaveBufferEx(sid, &ImaqBuffer, "C:\\IMAGES\\SNAP.PNG");

  imgClose(iid, TRUE);

}

 

This code will compile, but when I try to build the project each of the img____ functions triggers an "LNK2019: Unresolved External Symbol" error.

0 Kudos
Message 9 of 10
(4,985 Views)

It was as simple as adding C:\Program Files\National Instruments\NI-IMAQ\Lib\MSVC\imaq.lib to my project

 

compiles, and builds...   tomorrow we'll see if I get an image!

0 Kudos
Message 10 of 10
(4,981 Views)