Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Sequential Numbering of images

Hello,

 

I'm looking for a way to sequentially number images as part of their file name and have the program pick up where it left off based on the last image acquired and its number after it has been closed and then reopened.  The main purpose for this is to prevent overwriting of an existing image with the same name, as well as an easy way to tell the number of images that were acquired.  I am currently having the vi write to a text file that contains a number of parameters associated with each image collected including the image name and number.  I'm guessing that I could read from the text file somehow and have it start numbering the upcoming images based on the last image's number in the text file.  I just don't know if this would be the most efficient, because the text file could have up to a couple thousand lines, but each line would likely be less than 100 characters.

 

Let me know what you think.

 

Thanks!

0 Kudos
Message 1 of 3
(2,735 Views)

Hello,

 

There are a number of ways to do this but it is up to you to decide what is best for you application. If you are using text files already, that is one way to accomplish the goal but as you already noted, this will become less efficient as your text file becomes larger. The most efficient file type that you could write would be a binary file - which you can also do random access reads a writes to. The idea here would be that you change some information at the beginning of the binary file that tells you where to look in the file for the last image's filename. This would be much more efficient than a standard text file. Another way would be to use a function such as List Folder to get an array of all image file names in the folder. From this array, you could then determine the next filename to write.

 

-Zach

Message 2 of 3
(2,718 Views)

Thanks for all the great information!  I like the idea of creating an array of the image names.  I'm assuming I'll have to figure out a way to tell it to find the end of the array and use that info to name the next image.  I'll work on it and get something put together to post.

 

Thanks again!

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