Reporjection error.

46 views
Skip to first unread message

AD

unread,
May 27, 2023, 2:45:43 AM5/27/23
to Ceres Solver
Hello, I am new to Ceres. 
While solving the bundle adjustment problem, I have the following question. To define the optimization task itself, I need to add a ResidualBlock for each point by passing the camera parameters and point coordinates into it. This needs to be done for each point. But I have a question, every time I call AddResidualBlock I pass the same data for the camera and different points, how does Ceres understand in the solution process that the camera values passed to it need to be optimized as one for the whole problem ? Isn't it the case that after the staging, because I pass camera parameters each time to AddResidualBlock, it is considered each time as a new parameter (and not a global parameter for the whole problem) and in the end after solving the problem I get the answer, for camera coordinates only by one of the ResidualBlock, and not by all?

Dmitriy Korchemkin

unread,
May 27, 2023, 2:55:14 AM5/27/23
to ceres-...@googlegroups.com
Hi,

There is a std::map parameter_block_map_ from double* to ceres::ParameterBlock* inside ceres::ProblemImpl.
Each time ceres::Problem::AddResidualBlock is called, this map is queried, and if there is no such data pointer yet - a new parameter block is added.

Check out https://github.com/ceres-solver/ceres-solver/blob/master/internal/ceres/problem_impl.cc#L122-L174 for details (there are optional checks for size & aliasing).

On Fri, May 26, 2023 at 11:45 PM AD <quan...@gmail.com> wrote:
Hello, I am new to Ceres. 
While solving the bundle adjustment problem, I have the following question. To define the optimization task itself, I need to add a ResidualBlock for each point by passing the camera parameters and point coordinates into it. This needs to be done for each point. But I have a question, every time I call AddResidualBlock I pass the same data for the camera and different points, how does Ceres understand in the solution process that the camera values passed to it need to be optimized as one for the whole problem ? Isn't it the case that after the staging, because I pass camera parameters each time to AddResidualBlock, it is considered each time as a new parameter (and not a global parameter for the whole problem) and in the end after solving the problem I get the answer, for camera coordinates only by one of the ResidualBlock, and not by all?

--
You received this message because you are subscribed to the Google Groups "Ceres Solver" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ceres-solver...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ceres-solver/8d237d2e-b4ef-4a81-9dc3-2a5c1ff20e4fn%40googlegroups.com.


--
Dmitriy A Korchemkin

AD

unread,
May 27, 2023, 3:01:45 AM5/27/23
to Ceres Solver
Thanks for the quick response. 
That is, when solving bundleadjustment between 2 consecutive frames, when adding new ResidualBlocks with the same camera parameters (because they are 2 consecutive frames, not some set) and different points, optimizations for camera parameters will be performed on all points because Ceres works on pointers and the Map you specified will see that this parameter is present in all ResidualBlocks and will optimize over the whole problem. 
Do I understand you correctly? 

суббота, 27 мая 2023 г. в 09:55:14 UTC+3, Dmitriy Korchemkin:

Dmitriy Korchemkin

unread,
May 27, 2023, 4:35:40 AM5/27/23
to Ceres Solver
Yes, if you pass the same data pointer into two different AddResidualBlock calls - those residual blocks will reference the same parameter block (for parameters with matching data pointers).
Reply all
Reply to author
Forward
0 new messages