flanggut / smvs

Shading-aware Multi-view Stereo

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[lib] diff size between pixels & depths in depth_optimizer.cc

s-wtnb opened this issue · comments

hi,

depth_optimizer.cc

double
DepthOptimizer::ncc_for_patch (std::size_t patch_id, std::size_t sub_id)
{
    ~~
    for (std::size_t i = 0; i < pixels.size(); ++i)
    {
        /* top */
        if (min[1] > 2 && pixels[i][1] == min[1])
        {
            pixels.emplace_back(pixels[i][0], pixels[i][1] - 2);
            pixels.emplace_back(pixels[i][0], pixels[i][1] - 1);
            depths.emplace_back(depths[i]);
        }

pixels.size() == depths.size() * 2

for (std::size_t i = 0; i < pixels.size(); ++i)
{
Correspondence C(this->Mi[sub_id], this->ti[sub_id],
pixels[i][0] + 0.5, pixels[i][1] + 0.5, depths[i]);

Is it correct?

thanks.

I don't understand your question. Can you please post links to the actual code instead of random fragments?

https://github.com/flanggut/smvs/blob/master/lib/depth_optimizer.cc#L828

pixels.emplace_back(pixels[i][0], pixels[i][1] - 2);
pixels.emplace_back(pixels[i][0], pixels[i][1] - 1);
depths.emplace_back(depths[i]);

pixels.emplace_back() is twice
depth.emplace_back() is once

https://github.com/flanggut/smvs/blob/master/lib/depth_optimizer.cc#L866

    for (std::size_t i = 0; i < pixels.size(); ++i)
    {
        Correspondence C(this->Mi[sub_id], this->ti[sub_id],
            pixels[i][0] + 0.5, pixels[i][1] + 0.5, depths[i]);

i is larger than depths.size().

Is it correct?

thanks.

Thanks for clarifying, this is indeed a bug. I fixed it in 2d0a6fc.

Thanks again!