Skip to content

聚合sgm_util::CostAggregateLeftRight中的cost #16

@mxzhao

Description

@mxzhao

代码: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没有?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions