LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

3D nonlinear fit + smoothing

Hello,
 I am trying to fit or smooth a 3D set of data which comes from a CCD image (saved as a 32 bit bitmap ). I need to get rid of the small fringes that you can see in the bitmap attached ( hence smoothing of my data) and  find the phase of the sin function that describes the 3 big fringes . These big  fringes will shift for other CCD images that I have. The function that I need to fit with is a 2D gaussian multiplied by a sin(bx+cy+phase), where x and y are the pixels of the CCD. I was looking at the example of fitting 2D gaussian  surface with offset, but I am lost.
 
 Any ideas where to start from/ or the best solution for my problem?
 
Thank you,
 Andrea
0 Kudos
Message 1 of 14
(6,603 Views)
Fitting a curve or surface can be broken down into three steps:
1. Make a reasonable first estimate of the parameters.
2. Improve your estimate of the parameters.
3. Repeat step 2 until the improvements don't improve things that much any more.

In your case (I think) you would be fitting z[i,j] = f(x[i],y[j];(m1,s1,m2,s2,A,b,c,d) where

f(x,y;(a1,m1,s1,a2,m2,s2,A,b,c,d) = A * exp((x-m1)^2/s1^2 + (y-m2)^2/s2^2) * sin(b*x + c*y +d).

Your biggest problem will be step 1: making a reasonable guess of the value of (m1,s1,m2,s2,A,b,c,d).

It sounds like a more interesting problem that the stuff I am working on lately. I hope you enjoy it.Smiley Very Happy
0 Kudos
Message 2 of 14
(6,581 Views)

Years ago on a hard drive that has since then joined the dead...

I did that by first seperating the three color components and then ran each scan line through a low pass filter, first in the X and then in the Y.

Afterwards, I recombined the three color components and I ws plesed with the results.

New Picture5 of the teddy bear shown in post #3 of this thread, shows the results of the above described filtering.

Lets see if I can link it here!

Ben



Message Edited by Ben on 03-05-2008 02:21 PM
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 3 of 14
(6,568 Views)

Note about the above.

If you look at the top left corner of 2,3,4, and 6, you will see the response of the low pass fiter to the step at the edge of the image.

There, now I feel better. Smiley Happy

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 4 of 14
(6,561 Views)

Thank you all for the suggestions. I will try to implement your input.

Ben, do you still have the vi with the low pass filter applied to the your picture? I am fairly new to Labview, I will try to figure out by myself, but it will take some time that unfortunately don't have 😞

Thank you again,

 Andrea

 

0 Kudos
Message 5 of 14
(6,548 Views)
" Ben, do you still have the vi with the low pass filter applied to the your picture? "
 
No.
 
Sorry.
 
Ben
Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 6 of 14
(6,541 Views)
Can you attach a typical dataset?
0 Kudos
Message 7 of 14
(6,538 Views)

Sure. I saved it as an xls file. Please let me know if it doesn't work.

 Thanks,

 Andrea

0 Kudos
Message 8 of 14
(6,530 Views)
Dear All,
 I have tried to take a 2D FFT for my data, and manually remove the nonzero values by adjusting the two values xcorner and y corner. However, this may not be optimal for this type of empirical 2D filter. Is there a way to improve the filtering by some sort of optimization process?
 I attach the vi ( sorry, I didn't have time to make it look nice), and a bitmap sample. The question of getting the phase shift  for the filtered siganl still remains:(
 Thank you,
 Andrea
Download All
0 Kudos
Message 9 of 14
(6,519 Views)
Well, way too much code!!! 😄
 
Remember that the Fourier tools take 2D arrays directly. Here's a "quick and dirty" attempt:
 
You should be able to get the frequency and phase of the components directly from the peaks in the complex FT.
 
 
 
 
 


Message Edited by altenbach on 03-05-2008 05:11 PM
0 Kudos
Message 10 of 14
(6,514 Views)