Hi,

I have tried example opencv\samples\cpp\stitching_detailed.cpp and I have got an problem with parameters --ba_refine_mask (mask). in this sample five parameters are defined at line 534-538

if (ba_refine_mask[0] == 'x') refine_mask(0, 0) = 1;


If we look now in code of opencv\modules\stitching\src\motion_estimators.cpp at line 407, 417, 427 and 437 only refine_mask(0, 0), refine_mask(0, 2), refine_mask(1, 1) and refine_mask(1, 2) are used.

So In opencv\samples\cpp\stitching_detailed.cpp parameter ba_refine_mask[1] seems to be unused. Is ir right?

edit retag close merge delete

Sort by » oldest newest most voted

No, that is not right. If you need a confirm, you can look at the very beginning of the tutorial, where the printUsage() function is. Right after, you can see the default setting is xxxxx.

The refinement mask contains five parameters (in this order):

<fx>
<skew>
<ppx>
<aspect>
<ppy>


if set to x the parameter is corrected by the adjuster (if the adjuster can do so, otherwise the parameter is skipped).

As you are stating, thanks for having the patience to discuss this, even if the <skew> parameter is set in the stitching_detailed tutorial, only BundleAdjusterReproj, out of all the types of BundleAdjusters actually cares for the values of the mask, and it does not take into account the <skew> possibility.

Thus yes, the parameter is set, but actually not used by any class.

Some more thoughts: the BundleAdjusterRay description opens a way of possible future implementation of the refine_mask. That was true in opencv 2.4 and it is still the same in opencv 3.1 documentation.

In Line 172 of motion_estimators.hpp, the file from where the documentation is derived, the refinement_mask is described by a 3x3 matrix. That is not right, right? Shouldn't it be a 2x3, instead? Am I missing something now?

more

This message is rather old. take care about file history of stitching_detailed and stitching module too in git

( 2016-10-26 13:58:18 -0500 )edit

Last commit for stitching is 4 days ago. I think your answer is wrong and my comments is good because at those lines only four values are used. Where value refine_mask(0,1) is used in source code ?

( 2016-10-26 15:07:05 -0500 )edit

I see your point, now. I was assuming another type of bundleAdjuster would have used the refine_mask(0,1) parameter, but, as far as I can understand (and research with provided tools), refinement_mask is a parameter only BundleAdjusterReproj is aware of. I am editing my answer to reflect this.

Also, one should notice that refine_mask is a 3x3 matrix, thus one row of values is always set to 0 and never accessed. (what have I just read?)

( 2016-10-26 15:59:40 -0500 )edit

I think refinement_mask was introduced 5 years ago in 2.4.0. And it is written

"If bundle\n"
"      adjustment doesn't support estimation of selected parameter then\n"
"      the respective flag is ignored.\n"


mean some options are in progress...but not finished yet

( 2016-10-27 02:11:09 -0500 )edit

Official site

GitHub

Wiki

Documentation