08-30-2018 07:07 AM
In an interferometric experiment straight finge pattern are generated and acquired using NI PCI paltform and Color CCD camera in grayscale mode. during acquisition using line profile spectrum are seen and decided how many pixels are matching to one fringe pattern by counting. Target is to fit 4 pixels to one fringe. We tried FFT on line profile to extract spatial frequency in terms of pixels. Can anyone help any easy solution so that we can find exact value of Pixels per Fringe.
Solved! Go to Solution.
08-31-2018 09:40 AM
What you describe sounds reasonable. Doesn't it work for you? Note that we really don't know what you did (only what you say you "tried"). I hope you are not working with .jpg (compressed) images when you do the analysis!
The Forum is not a place where we do your work for you (that's called "Hiring a LabVIEW Developer"). If you need suggests or have questions about LabVIEW code that you developed, then please post your code so we can inspect and maybe even try it. In your case, you should also include an uncompressed Test Image similar to ones you acquire from your Camera.
Bob Schor
09-04-2018 06:37 AM
I used example file from VISION on line profile. I did get line profile of the image and as my fringe is periodic I tried FFT to get its spatial frequency where I don't know if I can get periodicity of this fringe pattern. For line profile no problem seen for jpg image. Code used by me is attached and hope you can help. In MATLAB I used fft on any row matrix out of these to get it.
09-04-2018 10:49 AM
Thank you. I apologize for not taking a closer look earlier, but I've now run your VI along with the data you attached earlier, and can explain the multiple "mis-understandings" you had that resulted in incorrect code. I'll also attach the corrected code that calculates the FFT in two ways, one being the FFT you were attempting to make of the entire 2D Image (which has nothing to do with an ROI and a line profile) and the other of the correct way
This is (a slightly-modified version of) the VI you submitted, derived from the LabVIEW Vision Examples:
When you select a line ROI across the top of the "fringed" Image that you submitted (pointed to by File Path), you correctly display the Line Profile and the summary Line Information. If you look at the Line Profile, you'll see a sinusoidal intensity plot that looks rather like the fringe intensity (as it should!). But then you go astray. IMAQ FFT computes the 2D FFT of the original Image. It requires, as a second input (Image Dst) a complex Image. So here is the first "confusion" -- what does IMAQ mean by "Image"?
In one sense, an Image is a 2D array of pixels that, when viewed and displayed, form an "image" (or a picture). In IMAQ, it also can refer to a pointer where such an array of Pixels is stored in memory, or, perhaps, in the Driver for an IMAQ or IMAQdx Camera. It can also refer to the Front Panel Image Display, or to the wire (of type IMAQImage) that connects all of these things.
What IMAQ FFT requires for its Image Dst input is an Image "buffer", a place to store the resulting 2D Complex FFT this function will produce. You create this using the IMAQ Create function, being sure to specify the Complex Image type. The output, Image Dst Out, should be a Front Panel Image Display so you can look at the 2D FFT.
So what about the Line Profile you created? This is in the form of a Waveform Cluster, which you (correctly) plotted on a Waveform Graph. It is a 1D array of pixels, and can be sent to a Waveform FFT Transform to get the Amplitude spectrum.
Here is a modified and corrected version of your routine. I moved the two FFT computations outside the While loop just for neatness. You'll also notice that I used the selection of the ROI as the signal to exit the While loop (just to simplify the code a bit). You'll see the creation of the buffer to compute the 2D FFT, the Image Display (labeled FFT) to show it (the bottom indicator called FFT -- I didn't notice I named an Image and a Graph both "FFT"), while the computation of the Line Profile's FFT is shown above.
(Aha -- the Snippet named the Complex FFT Image Display "FFT 2")
Drat -- I was going to show you what the Front Panel looks like, so you can see the Line Profile with its oscillating Intensities, the Line Profile FFT with a peak at DC (because the data are not zero-meaned), another at 0.1 (full scale is 0.5, with the units needing to be converted in order to get out Frequency), a 2D FFT that is mostly black, but with a short bright vertical streak about a third of the way in from the left and centered (more-or-less) vertically (again, I don't have scaling on these plots, but you should be able to work it out).
Bottom line -- there is quite a bit of power in the NI Vision Module, but the documentation and examples don't always explain things fully. Experimentation and Experience are the best teachers.
Bob Schor
09-05-2018 10:58 PM
Thanks Sir,
can you please attach modified VI . I hope it will work.
09-06-2018 08:56 AM
@AjayShankar wrote:can you please attach modified VI . I hope it will work.
No, I've already deleted it. You'll have to do a little work on your own. Open the Post so you can see the Block Diagram, open LabVIEW, then either have both the LabVIEW Block Diagram and the Post image available on a large monitor or tab between them. It's basically "your code, revised and improved".
Bob Schor
09-07-2018 04:15 AM
Thanks again for your response. Crerated VI which together with output is attached. It is not showing any X-axis value of FFT. How to get X Scale in terms of Pixel no so that I can find periodicity or spatial frequency of this fringe from FFT. Pl help
09-07-2018 09:44 PM
Well, you need to understand what a Spectrum is, how it is scaled, what the numbers mean. One thing you could do is generate a known waveform, taking its spectrum, vary the frequency, see how the spectrum changes, then (if you don't know about spectra and FFTs) figure out how scaling works. See if it makes sense with the data you are analyzing (it better ...).
Bob Schor