Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

c# smart camera "No interface found"

Hello!

 

I am testing SmartCamera NI1742 for my project.

 

I am planning to use C# and .NET 3.5 Framework.

 

I cannot start acquiring images:

 

 

This is my code:

 

 

private void button1_Click(object sender, EventArgs e)
{
axCWIMAQ1.Interface = "img0";
axCWIMAQ1.LoadInterfaceDefaults(); // <------ Exception:
axCWIMAQ1.AcquisitionType = CWIMAQAcquisitionTypes.cwimaqAcquisitionContinuous;
axCWIMAQ1.Images.RemoveAll();
axCWIMAQ1.Images.Add(1);

axCWIMAQViewer1.Attach(axCWIMAQ1.Images.Item(1));
axCWIMAQ1.Start();

}

private void button2_Click(object sender, EventArgs e)
{
axCWIMAQ1.Stop();
}

 

It throws an exception with message:

 

"Loading IMAQ operation
No interface found."

 

But, It can find it in Measurement & Automation Explorer

It finds interface "img0 : NI1742"

 

 

 

Am I doing something wrong?

 

I just need to get image form smartCamera and show it in imageviewer.

 

Any ideas?

 

Thanks,
Damjan

 

0 Kudos
Message 1 of 13
(5,710 Views)
0 Kudos
Message 2 of 13
(5,710 Views)

I am not sure I understand what you mean. Could you be more specific.

There is a problem and solution with LabView (I am using C#)

 

I guess you are implying that there is no interface img0 on my computer.

 

OK. I agree with this. But...

... if Measurement & Automation Explorer could grab a frame, why couldn't I do that.

 

I guess I just need the right approach.

 

Thanks for your answer.

0 Kudos
Message 3 of 13
(5,707 Views)
I was suggesting you to check whether you have added the smart camera to your created project ?
0 Kudos
Message 4 of 13
(5,707 Views)

Hi Damjan,

 

The Smart Camera can be programmed using Labview Real-Time and Vision Development module or configured with NI Vision Builder for Automated Inspection (VBAI).

 

The Smart Camera it's a real-time target, so you will see it Measurement and Automation Explorer under Remote Systems. In other words this resource is not available in your PC, it is a remote resource, and this would explain the error you receive. Programing the Smart Camera means that you create a real time application. Follow this link to see what you need and how you create a real-time application with NI hardware and software.

 

I hope this helps.

 

Regards,

Barna 

0 Kudos
Message 5 of 13
(5,665 Views)

Hey!

 

I didn't explain my problem.

 

I need to detect the edge of the road (asphalt : grass/sand/dirt). I configured SmartCamera with NI VisionBuilder 2009 and I get pretty good results.

Ok. Now the program is running on the remote target (SmartCamera).

 

I have 3 such cameras (in front of the wehicle, behind the wehicle and in the middle).

 

All SmartCameras have the same algorithm.

 

All I want to do now is:

- Write c# application to show the pictures from the cameras

- Make some exposure correction (from PC - C# app)

- If possible, get a single step status (pass/fail)

 

Maybe smart cameras are not suitable for the project, but I have one available for testing.

 

Any ideas, suggestions are very appreciated.

 

Thanks,

Damjan

 

0 Kudos
Message 6 of 13
(5,660 Views)

Hey Damjan,

 

I understand now what are you trying to accomplish. I also talked to my colleague Damjan Drozg, about your application (world is small :)).

In my opinion your approach is complicating the solution, and I'll explain why.

 

As I mentioned the Smart Camera is a real time target, which is able to acquire and process images and eventually drive digital line if needed, all this independently. This means that you would not need a PC with a C# application for image processing and decision making. However if you would need a PC (with a monitor connected to it) to visualize the acquired images through the Vision Builder interface. Long story short, if you would use the Smart Camera as you described, than actually you would not use it's processing power, "only" the objective and CCD.

 

 If you really want to use a PC and create the image processing application in C#, than the Smart Camera might not be the best solution for two reasons: 1. Smart Camera can not be programmed (accessed to read the acquired images on the fly) with C#; 2. It is easier to choose an industrial camera(FireWire, GigE, etc) to connect it directly to PC and perform image acquisition and processing on PC with the your C# application. 

 

What I would recommend you, since you have a Smart Camera for testing, is to evaluate Vision Builder for Automated Inspection software capabilities with respect to image processing and I/O communication. See this link to learn more about VBAI.

 

I hope I provided you with some useful informations.

 

Regards,

Barna

NI Eastern Europe 

 

0 Kudos
Message 7 of 13
(5,657 Views)

Hey Barna,

 

Wau, very cool. Since you already talked to Damjan Drozg, I guess you are familiar with the basic idea.

Thanks for doing overview of my options.

 

As you mentioned there are 2 ways doing this:

a) Using SmartCamera

b) Using GigE or Firewire camera.

 

a) Smart Camera

 

As I mentioned, I am testing smartcamera right now. So far I learned some things about making decision, overlays,...

I am familiar with image processing algorithms.

I understand the idea behind those algorithms, so configuring algorithm's parameters is not causing me any troubles.

 

I am aware of the idea behind SmartCamera (I think so). Here is the main idea:

-
Let's SmartCamera do all the hard work (it is what it's made for,
right). Run image processing, filtering,... to find the best edge
approximation.

- Then transfer the result parameters to PC
(using TCP/IP). For example: Line points (A,B), angle, number of edge
points found on the left/right side of line(edge),...

- Make some intelligent decisions from those parameters.

-
Since the driver (all those cameras will be mounted on the car - more
like tractor), can't see what is going on. I must show him the image
from the camera.

 

Advantages:

+ Smart camera is doing all the work (fast & efficient)

+ I need standard ethernet cable + power supply cable (only 2 cables, they will connect/disconnect the machine to/from the car)

+ IP65 protection level is highly recommended since there are vibrations, water, dust,... involved.

 

Disadvantages:

- No image (so far)

- Variable factors (weather: sunny, cloudy, raining,...) --> need to adjust the exposure time dynamically

- Also need to do some adjustment to algorithms parameter on SmartCamera (for example: lower threshold if the weather is sunny)

0 Kudos
Message 8 of 13
(5,644 Views)
b) GigE camera

 

Because
of the very unstable conditions regarding to the weather and damages on
the asphalt (edge), we started to think that SmartCamera is not the
right choice.

So Damjan suggested another solution -> using GigE technology.

 

Although I like the idea very much, I have some second thoughts:


 


+/- GigE is not working over the standard gigabit ethernet, so we need to install another cable (and that means another connector one the front and rear side)

      (ok this is not a major problem, however we need to make things easier and not demand to be Einstein to connect the system)

 

    - Basler GigE cameras have protection level IP30 (which is not suitable, if we consider the conditions it will be operating)

    - Auto adjustable exposure time would be a great help

 



Ok. So idea behind this is:

a) Using Labview

    We need NI Vision Development Module DevSuite, which contains all (I hope) those algorithms we can found on SmartCamera.

    We need NI Vision Development Module Runtime

     It seems to be the best (and only) solution

 

 

b) Using Visual Studio .NET C(prefered)

    The way I see this:

    Let's connect 3 GigE cameras.

    Use some kind of driver (SDK),... to get images into buffer using C#

 
  Use NI Vision Development Module (algorithms) to process the images (find
edges).  (I am not sure, but I think I cannot use Vision Development Module in C# -
it's just for labview)

    Make decisions, show some stuff on monitor (user - machine interaction)

 

 


Well that is for now. I think there is a smoke coming out of my brain now :smileywink:

I will appreciate if you could leave me your contact at   forum-dv[a]kompozit[REMOVE]emra.si


Damjan
Message Edited by forum-dv on 12-23-2009 01:51 PM
0 Kudos
Message 9 of 13
(5,643 Views)

Hi Damjan,

 

Happy New Year!

 

 

Thanks for describing your thought process on this application. You brought up quite few advantages and disadvantages of different solutions. However in my opinion you could do much more processing and decision making on the smart camera, but since you you will need a monitor to display the image you will need a PC as well (at least a Panel PC). For this reason and for cost saving, I was also suggesting to use a different kind of camera (Fire Wire or GigE), without knowing that you have an IP protection requirement.

 

Also I don't really understand your concern related to GigE using non standard Ethernet.  What do you mean by Standard Ethernet? From what I know you can use the same ethernet network for GigE and for Ethernet, so you should not need different cables or connectors for GigE.

 

Regarding the software options you could use, I would like to clarify a few things, which might answer your concerns:

Vision Development Module, contains all the algorithms  for image processing and other tools to acquire images from different cameras. DevSuite (NI Developer Suite) it is a bundle of NI softwares. NI Vision Developer Module Runtime it is a license to run the applications developed with Vision Development Module. The Smart Camera by default comes with Vision Builder for Automated Inspection an interactive configurable image acquisition and processing software.

Vision Development Module will contain the image processing algorithms available in Vision Builder AI, so you can program the Smart Camera with this module. Moreover Vision Development Module has C# support as well, so you should be able to use the algorithms in C# environment.

 

Finally I want to let you know that you can write your technical questions to our (East European) support team through www.ni.com/ask and we can work together to find the best solution for you.

 

Thanks,

Barna 

 

 

0 Kudos
Message 10 of 13
(5,516 Views)