LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I perform background subtraction in a smart way?

I've been trying to figure this out for quite some time and it si driving me crazy.

 

I have a camera that spits out a 1D array every second.  I can plot this easily, and it changes every second as expected.  I use an optical chopper to block the laser every other shot so that one shot has signal while the next is just background (and this repeats over and over again). Can I store two pictures at a time in a double array so I can subtract one from the other?

 

Currently the program bilds a very long 2D array where it stores all the spectra (limited to less than 10000 by labview memory) and then subsequently performs the subtraction.

 

Kogru

 

 

0 Kudos
Message 1 of 8
(3,889 Views)

Change your loop so that it collects 2 images, subtracts them & stores the result in an array.  This will let you store twice the useful images.  Of course, whether this is feasible depends on the timing of the data collection.

 

 

0 Kudos
Message 2 of 8
(3,873 Views)

Ultimately, the camera will run at 1 kHz, and I would like to acquire data for about 20 minutes or so.   Currently I can only collect data for ten seconds at most.

0 Kudos
Message 3 of 8
(3,869 Views)

It sounds like you want to record a video.  

 

If you are hardset on recording individual images, you'll have to save them periodically to clear some memory.

0 Kudos
Message 4 of 8
(3,867 Views)

These are the VIs that I am currently working on.  In the Subsequent_Spectra_Subtraction I sort of duplicate the actions of the camera by generating waves.  The DataGrabber is a sub VI that I am currently implementing.  It runs a for loop for the total number of pictures that I want to take.  There has to be a better way.

Download All
0 Kudos
Message 5 of 8
(3,860 Views)

About the spectra subtraction draft:

 

  • Since you know the number of iterations from the beginning, you should use a FOR loop.
  • You can keep the background in a shift register to be subtracted from the next signal.
  • (most of your code makes little sense to me. Here's a quick rewrite (LV8.5). Modify as needed.)
Message 6 of 8
(3,841 Views)

Hi all,

I have a similar problem. I would like to:

- collect a fixed reference spectrum (blank) with a spectrometer, and store it in memory

- acquire a new spectrum every second

- at each acquisition subtract the blank

- monitor in a graph the difference of the two spectra for each acquisition (once per second)

This part of the program should be added to this sub-vi for use it in a bigger project.

Can someone help me?

Thanks,

V.

0 Kudos
Message 7 of 8
(3,702 Views)

All you have to do is check to see if it is the first acquisition.  If it is, then you store the read spectrum in a shift register.  If it is after the first acquisition, then you subtract your read spectrum from the spectrum stored in your shift register.  The result goes to your waveform graph.  Make sure you keep your "blank" spectrum in the shift register.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 8
(3,691 Views)