flanggut / smvs

Shading-aware Multi-view Stereo
BSD 3-Clause "New" or "Revised" License
250 stars 75 forks source link

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

Closed s-wtnb closed 7 years ago

s-wtnb commented 7 years ago

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.

flanggut commented 7 years ago

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

s-wtnb commented 7 years ago

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.

flanggut commented 7 years ago

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

Thanks again!