LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Logging collection of Photos

Hi,

 

I am working on a project that involves photographing a sample at various magnetic fields. I have a for-loop set up that increases the mag-field, and then Snaps a picture of the sample. I have no problem obtaining this picture but am having trouble storing it somewhere for later viewing. 

 

I would like to know how to collect each image produced during each iteration of the for-loop (1 photo per iteration) into a file on my computer.

 

Any help would be greatly appreciated. Thanks!

0 Kudos
Message 1 of 14
(979 Views)

check Write JPEG file,  under graphics and sounds ->graphic formats

0 Kudos
Message 2 of 14
(975 Views)

I believe that the Write JPEG and IMAQ Snap are of different types so there is an error when connecting them

0 Kudos
Message 3 of 14
(962 Views)

Hi Nick,

 


@nickwest16 wrote:

I believe that the Write JPEG and IMAQ Snap are of different types so there is an error when connecting them


You did not mention IMAQ before nor did you attach any code…

 

IMAQ also offers functions to save images to files!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 14
(955 Views)

You may need to do some data manipulation

 

 

LVNinja_0-1687289829525.png 

LVNinja_1-1687289874207.png

 

 

Message 5 of 14
(953 Views)

I will have to try some manipulation, thank you.

 

Also, what functions are there for saving images to files? I've tried a few of them but none have seemed to work for me. For example, IMAQ Write File 2 doesn't seem to want to create its own location for each image meaning I would have to create hundreds of locations ahead of time for the pictures to fill. Don't worry about sounding condescending by overexplaining, I am very new to LabVIEW!

0 Kudos
Message 6 of 14
(943 Views)

you can use functions to create the file names/ path automatically then wire them to the save file vi. 

Check FILE/IO Pallete 

LVNinja_0-1687290612013.png

 

0 Kudos
Message 7 of 14
(931 Views)

You are also pretty new to the Forum.  You are using IMAQdx, one of the more complex "niches" in the LabVIEW world, where not everything is crystal clear, and not everything "works the first time".

 

You really should attach all of your LabVIEW code for this Project, so we can "see what you are doing" and tailor our comments appropriately for your level of understanding.  Please do the following:

  • Right-click on the Folder containing your LabVIEW Project (and, I hope, all of the code you wrote to accomplish this goal).
  • Choose "Send to:", "Compressed (zipped) folder.
  • Attach the .zip file to your reply.

There are two ways to save multiple images.  One is to do a lot of Snaps (which you've done), and for each Snap, do an IMAQdx Write 2, specifying the type of the Image and the format (BMP, JPEG, PNG, etc.) of the output file.  Each file will need a unique name, but you can easily take care of this by choosing names "intelligently", e.g. "Image 0001.png", with the next being Image 0002.png, etc.  You can easily construct the file name using the index of the While Loop where the Snapping takes place and using "Format into String" to combine the Index (1, 2, etc.) and "before and after" strings ("Image" and ".png") to make your Filename.  Note that the above naming scheme works for up to 9999 images -- if you have more, add another "0" or two to keep all the file names consistent (keeps things neater).

 

As you note, if you have a thousand images, that means a thousand files, but disk space is relatively cheap, as are large flash drives.  

 

The other way to save a lot of Images, but in a single file, is to save it as a video.  You probably do not want to do this, as if Image Processing is complicated, Video is even more so.

 

For more targeted help, please attach your code.

 

Bob Schor

Message 8 of 14
(911 Views)

You are correct, I am new to this Forum and appreciate being told the proper formatting for submitting questions. I've attached by code here as requested (apologies for how inefficient I'm sure it is). The first block of the flat sequence is working correctly to apply magnetic fields of increasing strength, while the second block is supposed to capture the images. What I have there now is just my latest (failed) attempt at getting it to work. 

 

Again, I really appreciate the time and help you all are giving.

0 Kudos
Message 9 of 14
(889 Views)

Oops.  I forgot to mention that I (and many other "old-timers") cannot read LabVIEW 2023 or 2022 files (we don't update every year -- the whole "team" updates every so often, usually).  Can't open your (single) VI.  Don't you have a LabVIEW Project, with a Project file, and all of the related VIs in a Project Folder?  It was the Project Folder (with all the VIs you are developing) that I was hoping to see, not just a single VI (unless that's all there is, in which case no need to compress, just "Save for Previous Version" and specify LabVIEW 2019 or 2021).

 

Bob "Oops" Schor

0 Kudos
Message 10 of 14
(808 Views)