ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

create multiple ROI viewer c#/.net

hi

 

i am working on my engineer project and i have a few questions:

 

is it possible to create multiple ROI's into one viewer, give them a name and save them for the viewer (so each image loaded into that viewer has the previously declared ROI's)?

 

does anyone has a c# / vb example for this?

 

would be very nice

 

regards kumi

0 Kudos
Message 1 of 2
(4,719 Views)

Hi Kumi,

 

unfortunately I am not a C# expert but I can give you some hints from my LabVIEW perspective. Things should be almost identical in C# when using the Vision Development Module's library.

Here is what I did:

 

 

 

1. Load an image and extract its luminance color plane (not necessary, just to make it work with the windows example pics)

2. Use the IMAQ select rectangle function to draw a rectangle on my image where I want the ROI to be.

(The ROI info output will be needed later on, notice the brown wire)

3. Convert the rectangle info to a ROI descriptor (so that the following function can process the info correctly)

4. Draw the ROI as an overlay over my image

 

Now I want to have the same ROI in future images at the exact same position. I will need to store that information somewhere to have it available in the future. I did this with the configuration file functions to create an INI file where I can create multiple sections (Here I only have one section called "Rect ROI") and write the ROI value keys into those sections. The brown wire is the ROI info that is bundled in a cluster. I unbundle this cluster to get the single elements in there.

 

 

 

When I later load a different file I can read out the INI file and apply the values to my overlay function or whatever function that expects ROI information to process on a specified area.

 

Hope this helps.

 

Best regards,

David

Message Edited by TroubleTheShoot on 03-16-2009 05:46 AM
Download All
Message 2 of 2
(4,635 Views)