LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Objects detection using Non-Linear Curve Fit

Hi,

I'm having an image of two round objects located near a circular boundary. My objective is to get center coordinates of these objects. However the image I obtained is not in round shapes and I tried to use the nonlinear curve fit to obtain approximation of the round shapes. So far the approximation is good but with several problems:

a) I get an error code -20041:NI Gmath.lvlib:Nonlinear Curve Fit LM.vi:6620004. 

b) Using the same VI, how to perform the approximation if I have four objects near the circular boundary? 

I attached the files.I'm using LV2013

Thank you in advance!

0 Kudos
Message 1 of 4
(1,824 Views)

We are missing the subVIs (model, etc.)

0 Kudos
Message 2 of 4
(1,782 Views)

Hi,

Sorry. Attached are the requested subVis.

 

TQ

0 Kudos
Message 3 of 4
(1,778 Views)

(OK, somebody is chopping up my old code without giving credit or links to the source. Not nice at all! :()

 

There are many glaring errors:

  • Your parameter array does not match the number of parameters in the model.
  • You are not fitting only the circular region, so it would try to match the zeroes in the periphery with the model (might be able to set the weight to zero for all pixels where z=0. Maybe redo the model as xyz arrays instead).
  • You did not create a scalable solution by just duplicating code. reuse the core code! (e.g. add another loop and iterate over each parameter subset.
  • You could reshape after the summing. Less code!
  • Why do you need to pi's, two -180, etc.
  • Applying the "normalize gaussian" subVI to the reshaped image instead of the parameters makes absolutely no sense! In any case, it only works on one peak, so modify for two peaks (Do you understand what it does?).
  • The peaks are highly truncated with the max potentially outside. That might be a problem, depending on noise.

 

0 Kudos
Message 4 of 4
(1,767 Views)