Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Has anyone tried to develop a Visual Studio .Net C# program which acquire images using ni vision libraries ?

Hi everybody !
I am a new C# developper and I have been trying to develop a program which acquire images from a NI-1411  acquisition board in the new Visual Studio .NET environnement and I find it very difficult.
All functions in NI vision seems to have been written in "C" language and it is very hard to include that code in my C# program.
At the moment, I have been writing a C++ dll in Visual Studio 6.0 and I am importing those functions from my dll in my C# program. It doesn' work very easyly because the data types in C# and C++ are differents (names and size), and also C# doesn't like pointers.
Has any of you another solution ?
 
Thank you very much in advance !
Cecile
0 Kudos
Message 1 of 11
(6,290 Views)

Hi Cecile,

If you look for documentation, you can find it there : Start>>All Programs>>National Instruments>>Vision>>Documentation>> ... (Have a look there and search the appropriate files you are looking for).

However I give you the link where you can find the examples code :http://forums.ni.com/ni/board/message?board.id=200&message.id=9205

I hope that can help you,

Best Regards,

Julien Roland - District Sales Manager
NI Belgium - Technical Support

Don't forget to rate a good answer
Message 2 of 11
(6,254 Views)

Thank you for your response,

I found earlier on how to insert objects in my C# program. I just don't understand why all documentation and examples are for Visual Basic. Even if the examples are easy to understand, it is not so easy to use the same functions in C#.

Should I have written my program in Visual Basic ?

Cécile

0 Kudos
Message 3 of 11
(6,251 Views)
Hi Céline,
 
Maybe you should. But if your usual workaround is C#, don't change your programmaton language. Of course there is not a lot of documentation about C# programmation. (Maybe there is a documentation who's came with Measurement Studio??)  Start >> All Programs  >> Measurement Studio >> a file of the kind "C # Function Help".
 
If you can choice, maybe is it easier to program in Visual Basic because there is more documentation and examples...
 
Success for the future,
 
PS: I have asked to our US engineers if there are an existing C# documentation to help you. I'll send it to you via the forum if I have a positive answer.
 
Julien Roland - District Sales Manager
NI Belgium - Technical Support

Don't forget to rate a good answer
0 Kudos
Message 4 of 11
(6,234 Views)
Hi Céline,
 
As i thought it isn't existing any documentation precisly on your subject but I found a example who can help you.
 
Software Requirements
Application Software: None
Toolkits and Add-ons: IMAQ Vision for Measurement Studio 7.1
Additional Software: Visual Studio .NET 2003
Language(s): C#

Hardware Requirements
Hardware Group: Vision (IMAQ)
Model: IMAQ Vision for Measurement Studio
Driver: NI-IMAQ 3.1
 
Here is this example (attachements)
 
Regards,
Julien Roland - District Sales Manager
NI Belgium - Technical Support

Don't forget to rate a good answer
0 Kudos
Message 5 of 11
(6,126 Views)

Hi Cécile,

The reply of the US Support Team about the your question.

We have VB.NET examples that get installed with the driver (if you include .NET support).  Also, you can refer to NI Vision for Visual Basic Reference Help.  The functions that you refer to are methods of the CWIMAQVision control.

As for the C# documentation, you use the same activeX calls in C# that you use in Visual Basic, so most of the time you can refer to the VB help as well.  I just did a quick search and did find a C# image acquisition example on-line.  Here is the link to help you find it.
http://venus.ni.com/stage/utf8/niepd_web_display.DISPLAY_EPD4?p_answer=&p_guid=FD8400A1657D2D7EE0340...

I hope it help you.

Regards,

Julien Roland - District Sales Manager
NI Belgium - Technical Support

Don't forget to rate a good answer
Message 6 of 11
(6,102 Views)

I would really like to get an example of C# implementing the .Net vision components.  However, "hardware.zip" gets a runtime error (load error) while the link does not work.  I am VS2005 and the latest Vision module (8.2).

 

Thank you.

0 Kudos
Message 7 of 11
(5,603 Views)

Hi cecilemx,

 

How about you C# program already running smoohtly?

I also tried to make C# program using NI libraries and use same PCI-1411 card.

I already can snap or grab the picture, but still have problem to make pattern matching.

I can give my source code if you want..(i using VS2005)

 

0 Kudos
Message 8 of 11
(5,397 Views)
The following message has an example of a working C# program using NI Vision libraries.

http://forums.ni.com/ni/board/message?board.id=200&message.id=14440&query.id=30581#M14440
0 Kudos
Message 9 of 11
(5,373 Views)
this link doesent work any more?

can you update it? i mean the one of :

Hi Cécile,

The reply of the US Support Team about the your question.

We have VB.NET examples that get installed with the driver (if you include .NET support).  Also, you can refer to NI Vision for Visual Basic Reference Help.  The functions that you refer to are methods of the CWIMAQVision control.

As for the C# documentation, you use the same activeX calls in C# that you use in Visual Basic, so most of the time you can refer to the VB help as well.  I just did a quick search and did find a C# image acquisition example on-line.  Here is the link to help you find it.
http://venus.ni.com/stage/utf8/niepd_web_display.DISPLAY_EPD4?p_answer=&p_guid=FD8400A1657D2D7EE0340...

I hope it help you.

Regards,




Message Edited by kumi on 07-15-2008 08:58 AM
0 Kudos
Message 10 of 11
(4,811 Views)