Error in nlinfit function - UAV Processing Toolbox

2 次查看(过去 30 天)
Hi! I’m working on a drone-based image processing project using the UAV Toolbox, where we georeference GCPs from aerial images. I’m having trouble with the camera’s extrinsic parameters, which are estimated using nonlinear regression (nlinfit) inside the function GUIforUAVtoolbox.m, the code fails with this error:
Error using nlinfit (line 247)
No usable observations after removing NaNs in Y and in the result of evaluating MODELFUN at the initial value BETA0.
Error in GUIforUAVtoolbox>buttonFirstframe_CallBack (line 1592)
nlinfit(xyz, [UV(:,1); UV(:,2)], 'findUVnDOF', inputs.beta0, options);
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Error while evaluating UIControl Callback.
If anyone has a suggestion about where the problem might be, I’d really appreciate the help. Thanks, Ana Luisa
  1 个评论
Star Strider
Star Strider 2025-4-30
I have no experience with that function or toolbox, however if 'UV' is an input to it (use its actual variable name and prior to calling the function with it, since the actual variable is probably assigned to 'UV' as a function argument), you can experiiment with:
UV = fillmissing(UV, 'nearest');
to see if that improves things.
That should at least eliminate the problem with the NaN values, although it could result in estimated parameters being nonsensical. You will have to do that experiment to find out.

请先登录,再进行评论。

回答(1 个)

Gayathri
Gayathri 2025-5-12
编辑:Gayathri 2025-5-12
Consider the following usage of a function and variable names:
beta = nlinfit(X,Y,modelfun,beta0)
As per the "nlnfit" documentation, it treats NaN values in "Y" or "modelfun(beta0,X)" as missing data, and ignores the corresponding observations. This point is mentioned as the first point under "Algorithms" section in the function documentation.
So, as per the error statement in the question, I believe that either "[UV(:,1); UV(:,2)]" or "findUVnDOF(inputs.beta0, xyz)" contain NaN values, leaving behind no valid observations. Please try to observe these two outputs and then do the needful to provide valid input to the "nlinfit" function.
Please refer to the below MATLAB Answer's question for more insights:

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by