|  |  | 
builtins.object
NonlinearLeastSquares
 
 
| class NonlinearLeastSquares(builtins.object)
 |  |  | NonlinearLeastSquares(*args, **kwargs) 
 
 
 |  |  | Methods defined here: 
 __init__(self, *args, **kwargs)constructor
 bundle_adjust(self, *args, **kwargs)This is an implementation of the "bundle adjustment" version of the Levenberg-Marquardt algorithm for nonlinearleast-squares.  Bundle adjustment takes advantage of the sparsity of the Jacobian that one sees in
 applications such as estimating the scene structure with the images recorded with uncalibrated cameras.
 The implementation shown here is based on the now celebrated paper "SBA: A Software Package for Generic
 Sparse Bundle Adjustment" by Manolis Lourakis and Antonis Argyros that appeared in ACM Transactions on
 Mathematical Software, March 2009.
 
 This function is used in the following scripts
 
 bundle_adjust_sfm_with_uncalibrated_cameras_translations_only.py
 
 in the ExamplesStructureFromCameraMotion directory of the distribution.
 
 Note that since bundle_adjust() is written in a generic manner, it is not called directly by the example
 scripts listed above.  As shown in the scripts, you need to first construct an instance of the class
 ProjectiveCamera that is a co-class of the main module class NonlinearLeastSquares in the distribution.
 grad_descent(self)This is an implementation of the basic gradient descent algorithm for nonlinear least-squares as described in my Lecture 13 notes at the lecture-notes website for Purdue University's ECE661: Computer Vision
 leven_marq(self)This is an implementation of the Levenberg-Marquardt algorithm for nonlinear least-squares as described in my Lecture 13 notes at the lecture-notes website for Purdue University's ECE661: Computer Vision
 
 This function is used the following scripts in the ExamplesOptimizedSurfaceFit directory of the distro:
 
 leven_marq.py
 
 leven_marq_with_partial_derivatives.py
 
 It is important to note that the above two scripts do NOT call leven_marq() function directly.  AS
 stated in the main document page for the NonlinearLeastSquares module, the code in the file
 NonlinearLeastSquares.py is written in a domain agnostic manner.  So you need a domain adaptation
 class that knows how to package the arguments for calling leven_marq().  For the case of the two scripts
 listed above, that domain-specific class in the distro is OptimizedSurfaceFit.  It is a co-class of
 the main module class NonlinearLeastSquares in the distribution.
 
 The function leven_marq() defined here is ALSO used in the following two scripts
 
 sfm_with_calibrated_cameras_translations_only.py
 sfm_with_uncalibrated_cameras_translations_only.py
 
 in the ExamplesStructureFromCameraMotion directory of the distribution.  Again, these example scripts
 do NOT directly call the leven_marq() function.  As shown in the two scripts, they must first construct
 an instance of the ProjectiveCamera class that knows how to bundle the arguments together for calling
 the leven_marq() function.
 leven_marq_v1_5(self)This is the implementation of the leven_marq() function as it existed in Version 1.5.  On account of thefact that I made significant changes to this function in Version 2.0.0 of the module, I have retained the
 old version for the old-time users of my module.
 set_Fvec(self, Fvector)This method supplies the NonlinearLeastSquares class with the prediction vectorwhose each element is a functional form of the prediction in the observed data vector
 X.  Note that  Fvec is a column vector --- meaning a numpy matrix with just one column.
 set_Fvec_BA(self, Fvector_BA)You need to call this method for providing the NonlinearLeastSquares class with theprediction vector if you are going to be using the bundle-adjustment capabilities
 of the class.
 set_X(self, X)
 set_X_BA(self, X_BA)
 set_debug(self, debug)
 set_display_function(self, display_function)
 set_initial_params(self, initial_params_dict)
 set_jacobian_functionals_array(self, jacobian_functionals_array)This method expects for its argument an Nxp matrix of functionals for the partial derivatives needed for the Jacobian matrix.  N is the number of measurements in
 the X vector and p is the number of parameters in the model.  If you are using
 nonlinear least-squares to fit optimal surfaces to noisy measurements over the
 xy-plane, each element of the X vector would correspond to one such measurement at
 some (x,y) coordinates. And an element the argument jacobian_functionals_array chararray
 would correspond to the partial derivative of the model functional that already
 has incorporated the (x,y) coordinates corresponding to that row and that is
 a partial derivative of the model with respect to the parameter corresponding to
 the column.
 set_num_measurements(self, how_many_measurements)
 set_num_parameters(self, how_many_parameters)
 set_params_arranged_list(self, params_list)
 set_params_ordered_list(self, params_list)
 set_problem(self, prob)If you are using this module to solve structure from camera motion (sfm) problems, use this methodto set 'self.problem' to 'sfm_N' where 'N' is the number of world points you are tracking.   This
 is needed because sfm needs the specialized display function defined for the ProjectiveCamera class.
 Data descriptors defined here:
 
 __dict__dictionary for instance variables (if defined)
 __weakref__list of weak references to the object (if defined)
 |  |