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_util::CostAggregateLeftRight中的cost #16

Open
mxzhao opened this issue Feb 15, 2023 · 1 comment
Open

聚合sgm_util::CostAggregateLeftRight中的cost #16

mxzhao opened this issue Feb 15, 2023 · 1 comment

Comments

@mxzhao
Copy link

mxzhao commented Feb 15, 2023

代码:147-157行in sgm_util.cpp
// 自方向上第2个像素开始按顺序聚合
for (sint32 j = 0; j < width - 1; j++) {
gray = *img_row;
uint8 min_cost = UINT8_MAX;
for (sint32 d = 0; d < disp_range; d++){
// Lr(p,d) = C(p,d) + min( Lr(p-r,d), Lr(p-r,d-1) + P1, Lr(p-r,d+1) + P1, min(Lr(p-r))+P2 ) - min(Lr(p-r))
const uint8 cost = cost_init_row[d];
const uint16 l1 = cost_last_path[d + 1];
const uint16 l2 = cost_last_path[d] + P1;
const uint16 l3 = cost_last_path[d + 2] + P1;
const uint16 l4 = mincost_last_path + std::max(P1, P2_Init / (abs(gray - gray_last) + 1));
这里面的l1-l3
难道不应该是:
const uint16 l1 = cost_last_path[d - 1] + P1;
const uint16 l2 = cost_last_path[d] ;
const uint16 l3 = cost_last_path[d + 1] + P1;
为啥cost_last_path的d的索引偏差一个而cost_init_row没有?

@Mickeyyyang
Copy link

代码:147-157行in sgm_util.cpp // 自方向上第2个像素开始按顺序聚合 for (sint32 j = 0; j < width - 1; j++) { gray = *img_row; uint8 min_cost = UINT8_MAX; for (sint32 d = 0; d < disp_range; d++){ // Lr(p,d) = C(p,d) + min( Lr(p-r,d), Lr(p-r,d-1) + P1, Lr(p-r,d+1) + P1, min(Lr(p-r))+P2 ) - min(Lr(p-r)) const uint8 cost = cost_init_row[d]; const uint16 l1 = cost_last_path[d + 1]; const uint16 l2 = cost_last_path[d] + P1; const uint16 l3 = cost_last_path[d + 2] + P1; const uint16 l4 = mincost_last_path + std::max(P1, P2_Init / (abs(gray - gray_last) + 1)); 这里面的l1-l3 难道不应该是: const uint16 l1 = cost_last_path[d - 1] + P1; const uint16 l2 = cost_last_path[d] ; const uint16 l3 = cost_last_path[d + 1] + P1; 为啥cost_last_path的d的索引偏差一个而cost_init_row没有?

您好呀,请问您测过耗时吗,想知道一下这个算法的性能大概如何

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