Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Accessing images in array

Hello gurus,
 
I'm attempting to place 10 acquired images into an array and retrieve one at a time for individual inspection.  In essence, I want to pull one at a time, inspect it and if it meets inspection criteria, display it.  I'm then going to stop looking after I've received two qualifiers.
 
I don't have any problems with the acquisition, but with the array.  Even if I specify the index of the array, it pulls the last image that I acquired.  I think it's in the structure of the array, but I'm confused since my array length tells me it's 10.  This seems like it should be really easy but I might be missing something with an array of images?
 
I've attached a bitmap showing the structure of my code and would welcome any assistance.
 
Many thanks,
 
VisionGumby
0 Kudos
Message 1 of 5
(3,627 Views)
Hi VisionGumby

You must be aware that the IMAQ Image data type does not actually pass the whole image on the wire. Instead, it only passes a reference to the image. In your code, you are using the same image reference for grabbing of all the images. Thus, you are still overwriting the same memory location. To really create 10 different images, you must call IMAQ Create 10 times and each time specify a different image name. You can then save the references returned by IMAQ Create to an array and use them for grabbing, one each time.

Vladimir



Message Edited by Vladimir Drzik on 11-14-2007 08:24 AM

View my profile on LinkedIn
0 Kudos
Message 2 of 5
(3,621 Views)

Thanks Vladimir - I appreciate your help.

- VG

0 Kudos
Message 3 of 5
(3,613 Views)
Hello all,
 
I have some additional questions about the image arrays and this is more out of my ignorance of how the image arrays function in NI.  I've attached a bitmap showing what is going on.
 
I have my array of 10 images - I'm inspecting image index 0 for figuring out where regions of interest are, etc. and I do this by running it thru a grayscale threshold, differentiation filter, and finally a geometric pattern match.  I write this information out to be used later.
 
When I access the same image index 0 later in the program it appears that the thresholding is still applied and I don't have a raw image anymore.  I suspect it's due to the fact it's merely a reference to the image and any vision operations I'm performing are being applied to this image.
 
With that in mind:
  • Is there something I can do to prevent this?  Am I missing something?
  • I thought about making a "shadow" array, but I'm using multiple thresholds for different inspections.  I think I could take my ten images and store them in an "unused" array, and then make a copy of whatever I need.  I don't know the best way to do this and could use a code snippet from someone.

Anyhow - any ideas on how to best approach this would be appreciated.  Inspection time is getting to be a consideration for me as well and I need to minimize the overhead as much as possible.

Thanks gurus.

VisionGumby 

 
 
0 Kudos
Message 4 of 5
(3,531 Views)

Please disregard the question - I figured this out.

0 Kudos
Message 5 of 5
(3,521 Views)