From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Displaying multiple images using VBAI .NET

Solved!
Go to solution

I am using the .NET api to  grab multiple images from my VBAI inspection profile.

In my VBAI inspection profile I have set 3 image variables and set them to the images I want to access in C# .NET.

 

Using the method

CapturedImage1 = engine.GetInspectionImage(Image1GUID, 1, 1, out newImageAvailable);

Where Image1GUID is the variable name I set. That works but when I tried to grab the next image CapturedImage2 = engine.GetInspectionImage(Image2GUID, 1, 1, out newImageAvailable);

it overwrites CapturedImage1 and now it seems like they are just pointing to the same image reference.

 

How do I grab multiple images without overwriting the old image so I can display 3 different images?

0 Kudos
Message 1 of 3
(2,799 Views)
Solution
Accepted by Txoov35lis

Currently there is just a single image created behind the scenes for each dotNET VBAI engine created. I just modified the dll to include a new GetInspectionImage function that allows you to pass in your own image. Now you can have:

(Call this once when app starts)

VisionImage image1 = new VisionImage();
VisionImage image2 = new VisionImage();

...

(call this to get the images from inspection)

engine.GetInspectionImage(Image1GUID, 1, 1, image1, out newImageAvailable);

engine.GetInspectionImage(Image2GUID, 1, 1, image2, out newImageAvailable);

 

Hope this helps,

Brad

Message 2 of 3
(2,773 Views)

That worked!

0 Kudos
Message 3 of 3
(2,720 Views)