LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Linear fit not working as expected?

Solved!
Go to solution

Hi,

 

I'm using the NI_AALPro.lvlib:Linear Fit.vi on an array of vertically stacked points. However, the result makes absolutely no sense, the fitted line doesn't represent the input data.

 

But if I rotate the points by 1 degree, the fit seems to work...

Why is that and is there a function or a way to properly fit the points regarding their orientation?

 

Thanks in advance!

 

I have attached:

  • The VI itself
  • A screenshot of the VI
  • The test image (no rotation)
  • The test image (rotated 1 degree)
  • A screenshot of the fitting result (no rotation)
  • A screenshot of the fitting result (rotated 1 degree)

VI screenshot.PNG

 

Download All
0 Kudos
Message 1 of 22
(4,346 Views)
0 Kudos
Message 2 of 22
(4,343 Views)

Hi optimus,

 

can you attach your VI with a typical set of "blob coordinates" made default in the indicator?

 

What's the point of the FOR loop? Why not use simple math:

check.png

Best regards,
GerdW


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

Thanks for your quick reply! I adjusted the VI, it seems I thought a bit too complicated.

I included the blob coordinates (in the 1600x1200 px image) as a constant.

 

VI screenshot_new.PNG

0 Kudos
Message 4 of 22
(4,302 Views)

Unfortunately you did not attach the VI according to your image.

Please attach your VI with that "blob coordinates" constant!

Best regards,
GerdW


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

Sorry, my mistake. I'll upload it shortly

 

I adjusted the file paths, you might need to update them with the location of the test picture I uploaded if you want to use that.

Thanks again!

0 Kudos
Message 6 of 22
(4,184 Views)

Sorry, my mistake, here it is:

 

0 Kudos
Message 7 of 22
(4,250 Views)

Hi Optimus,

 

using a XY graph the interpolation looks quite ok. See attachment…

 

Best regards,
GerdW


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

Hm, yes it does. But why is it so weird in case of my blobs?

0 Kudos
Message 9 of 22
(4,232 Views)

Hi optimus,

 

I thought that "blob coordinates" constant were real blob coordinates?

Why should it display different on your IMAQ indicator than on my XY graph?

Best regards,
GerdW


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