pysdic.optimize_chains_transformation_input_points#
- optimize_chains_transformation_input_points(seq_transformations, seq_chains, seq_outputs, guess, *, seq_kwargs=None, mode='rJ', loss=None, loss_scale=1.0, use_cache=False, **solve_kwargs)[source]#
Optimize the input points \(X\) such that their images by several chains of transformations match the given output points, with
pysolvegn.solve_batch.The problems are built with
pysdic.build_chains_transformation_input_points_term()(one independent problem per point) and the optimized points are returned with the batch shape ofguess:points, result = optimize_chains_transformation_input_points(seq_transformations, seq_chains, seq_outputs, guess, ...)
The
pysolvegn.BatchSolveResultgives the convergence information of each point (success,reasons,cost,n_iterations, …), with the points flattened along the first dimension: useresult.success.reshape(points.shape[:-1])to recover the batch shape.See also
Function
pysdic.build_chains_transformation_input_points_term()for the description of the arguments.Function
pysdic.optimize_transformation_input_points()for a single transformation.Function
pysdic.optimize_chains_transformation_parameters()to optimize the parameters instead.
- Parameters:
seq_transformations (Sequence[Transformation]) – See
pysdic.build_chains_transformation_input_points_term().seq_chains (Sequence[Sequence[Integral]]) – See
pysdic.build_chains_transformation_input_points_term().seq_outputs (Sequence[_Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]]) – See
pysdic.build_chains_transformation_input_points_term().guess (_Buffer | _SupportsArray[dtype[Any]] | _NestedSequence[_SupportsArray[dtype[Any]]] | complex | bytes | str | _NestedSequence[complex | bytes | str]) – See
pysdic.build_chains_transformation_input_points_term().seq_kwargs (Sequence[Dict[str, Any] | None] | None) – See
pysdic.build_chains_transformation_input_points_term().mode (str) – See
pysdic.build_chains_transformation_input_points_term().loss (str | Callable | None) – See
pysdic.build_chains_transformation_input_points_term().loss_scale (Real) – See
pysdic.build_chains_transformation_input_points_term().use_cache (bool) – See
pysdic.build_chains_transformation_input_points_term().**solve_kwargs – Additional keyword arguments passed to
pysolvegn.solve_batch(max_iteration,xtol,ptol,damping,verbosity,history, …). Theparametrizationargument is not supported here: build the term withpysdic.build_chains_transformation_input_points_term()and callpysolvegn.solve_batch.
- Returns:
numpy.ndarray – The optimized input points with shape \((\dots, n_i)\).
pysolvegn.BatchSolveResult – The result of
pysolvegn.solve_batch.
- Return type:
Examples
Triangulate 3D points seen by two calibrated cameras:
seq_transformations = [extrinsic_0, distortion_0, intrinsic_0, extrinsic_1, distortion_1, intrinsic_1] seq_chains = [(0, 1, 2), (3, 4, 5)] world_points, result = optimize_chains_transformation_input_points( seq_transformations, seq_chains, [image_points_0, image_points_1], guess, max_iteration=20, xtol=1e-10 )