Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SGM Parameter #1103

Open
Rongke-Wei opened this issue Feb 3, 2024 · 2 comments
Open

SGM Parameter #1103

Rongke-Wei opened this issue Feb 3, 2024 · 2 comments

Comments

@Rongke-Wei
Copy link

I would like to ask about the SGM method, where the formulas for the P1 and P2 penalty terms come from, and how the parameters in the formula are determined.

openMVS/libs/MVS
/SemiGlobalMatcher.cpp

// - P1 and P2s are algorithm constants very similar to those from the original SGM algorithm;
// they are set to defaults according to the patch size
// - alpha & beta form the final P2 as P2*(1+alphae^(-DI^2/(2beta^2)))
// where DI is the difference in image intensity I(x)-I(x_prev) in [0,255] range
// - subpixelSteps represents how much sub-pixel accuracy is searched/stored;
// if 1 no sub-pixel precision, if for example 4 a 0.25 sub-pixel accuracy is stored;
// the stored value is quantized and represented as integer: val=(float)valStored/subpixelSteps
SemiGlobalMatcher::SemiGlobalMatcher(SgmSubpixelMode _subpixelMode, Disparity _subpixelSteps, AccumCost _P1, AccumCost P2, float P2alpha, float P2beta)
:
subpixelMode(_subpixelMode),
subpixelSteps(_subpixelSteps),
P1(_P1), P2s(GenerateP2s(P2, P2alpha, P2beta))
{
}

openMVS/libs/MVS
/SemiGlobalMatcher.h

SemiGlobalMatcher(SgmSubpixelMode subpixelMode=SUBPIXEL_LC_BLEND, Disparity subpixelSteps=4, AccumCost P1=3, AccumCost P2=4, float P2alpha=14, float P2beta=38);

@cdcseacave
Copy link
Owner

this code is following the paper SemiGlobalMatcher

@Rongke-Wei
Copy link
Author

Thank you very much for your reply.

But there is a difference between P2 in this paper and P2 in the code.

In this paper:
图片2

In code:
图片1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants