Skip to content

Conversation

@DumDereDum
Copy link
Member

@DumDereDum DumDereDum commented Jun 3, 2021

Pull Request Readiness Checklist

Add info about ICP algorithm in RGBD

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • To the best of my knowledge, the proposed patch is not based on a code under GPL or other license that is incompatible with OpenCV
  • The PR is proposed to proper branch
  • There is reference to original bug report and related work
  • There is accuracy test, performance test and test data in opencv_extra repository, if applicable
    Patch to opencv_extra has the same branch name.
  • The feature is well documented and sample code can be built with the project CMake
force_builders_only=docs

@DumDereDum DumDereDum added category: documentation Documentation fix or update, does not affect code category: rgbd labels Jun 3, 2021
@mshabunin
Copy link
Contributor

Why is this documentation added to the rgbd module? I can see that ICP algorithm is implemented in the surface_matching module: https://docs.opencv.org/master/dc/d9b/classcv_1_1ppf__match__3d_1_1ICP.html

I propose extracting this section to separate page and referring it in the rgbd and ICP descriptions. In order to do it you have to add a page to the <module>/doc folder and use @ref Doxygen references to link to it (e.g. https://github.com/opencv/opencv_contrib/tree/master/modules/bioinspired/doc).

The Iterative closest point (ICP) function minimizes the PointToPlane Distance (PPD) between the corresponding points in two clouds of points and normals.
Specifically, it is the distance from the point ***P*** to the plane with the normal ***N*** in which the point ***Q*** located

The main equetion, which it needs to minimize:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*equation

Need to add the notion about projective correspondence:
"Two points P and Q are considered correspondent if given current camera pose they are projected in the same pixel"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*which needs to be minimized


***q*** - i'th point in the old cloud of points

***n*** - i'th normal in the old cloud of normals
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*i'th normal in the point Q in the old point cloud


***ppd(...)***- is the distance ergo its formula is the dot product of (difference between ***p*** and ***q***) and (***n***):

<img src="https://render.githubusercontent.com/render/math?math=dot(T_{p2q}(p)-q, n)=dot((R\cdot p+t)-q,n)=[(R\cdot p+t)-q]^{T}\cdot n">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

plus sign is not rendered here

Where ***R*** - rotation, ***t*** - translation.

We use the Gauss-Newton method for the minimization of function.
In the beginning, we will perform some mathematical operations:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to say something like "Here's a formula we're going to minimize by changing R and t:"


***n*** - i'th normal in the old cloud of normals

***ppd(...)***- is the distance ergo its formula is the dot product of (difference between ***p*** and ***q***) and (***n***):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*is the point-to-plane distance ergo ...

In the beginning, we will perform some mathematical operations:

<img src="https://render.githubusercontent.com/render/math?math=E=\sum\left\|[(R\cdot p %2B t)-q]^{T}\cdot n\right\|_{2}">

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's better to add something like this:
In Gauss-Newton method we do sequential steps by changing R and t in the direction of the function E decrease, i.e. in the direction of its gradient:

  1. At each step we approximate the function E linearly as its current value plus Jacobian matrix multiplied by delta x which is concatenated delta R and delta t vectors.
  2. We find delta R and delta t by solving the equation E_approx(delta_x) = 0
  3. We apply delta R and delta t to current Rt transform and proceed to next iteration

To linearize E, let's approximate it in infinitesimal neighborhood.


<img src="https://render.githubusercontent.com/render/math?math=E = \sum \left \| [f(x, p) %2B p- q]^{T} \cdot n \right \|_{2}">

Let's find out differential of ***E***:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*E is mininal when its differential is zero:

@savuor savuor self-requested a review July 4, 2021 21:01
@savuor savuor self-assigned this Jul 4, 2021
@alalek alalek merged commit d5317d6 into opencv:master Jul 4, 2021
@alalek alalek mentioned this pull request Oct 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: documentation Documentation fix or update, does not affect code category: rgbd

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants