fixstars / libSGM

Stereo Semi Global Matching by cuda
Apache License 2.0
623 stars 189 forks source link

What is the min_disp param which was added in the recent version for ? #51

Closed NiuKeke closed 5 years ago

NiuKeke commented 5 years ago

I have found it that the recent version add the min_disp param,but I don't understand what it is for.Could you please explain it?

sotsuka-fixstars commented 5 years ago

Hi, @NiuKeke

https://github.com/fixstars/libSGM/issues/36#issuecomment-485328370 might help you. This parameter has the same meaning as minDisparity of OpenCV's StereoSGBM. We can also apply min_disp for https://github.com/fixstars/libSGM/issues/34.

Sincerely,

NiuKeke commented 5 years ago

Hi, @NiuKeke

36 (comment) might help you.

This parameter has the same meaning as minDisparity of OpenCV's StereoSGBM. We can also apply min_disp for #34. Sincerely,

If the disparity range of my data is 512 - 640 which the min disparity 512 is bigger than the max disparity which the code support,so for the correct result i should give the min disparity param that is 512.Am i right?It is just like that every pixel has a base disparity,and at last it should plus the base disparity for the correct result.

sotsuka-fixstars commented 5 years ago

If the disparity range of my data is 512 - 640 which the min disparity 512 is bigger than the max disparity which the code support,so for the correct result i should give the min disparity param that is 512.Am i right?

Yes. Note that if min_disp and disparity_size are 512 and 128 respectively, libSGM search from 512 to 639 inclusive.

at last it should plus the base disparity for the correct result.

No. Because libSGM adds base disparity, outputted disparity value is from 512 to 639 inclusive. We need not to add base disparity. This operation can be seen by following.

https://github.com/fixstars/libSGM/blob/ffccd89ac2d88d13717d72f4250bea53703a23e2/src/correct_disparity_range.cu#L30-L36

NiuKeke commented 5 years ago

If the disparity range of my data is 512 - 640 which the min disparity 512 is bigger than the max disparity which the code support,so for the correct result i should give the min disparity param that is 512.Am i right?

Yes. Note that if min_disp and disparity_size are 512 and 128 respectively, libSGM search from 512 to 639 inclusive.

at last it should plus the base disparity for the correct result.

No. Because libSGM adds base disparity, outputted disparity value is from 512 to 639 inclusive. We need not to add base disparity. This operation can be seen by following.

  libSGM/src/correct_disparity_range.cu

    Lines 30 to 36
  in
  ffccd89

       uint16_t d = d_disp[y * pitch + x]; 

       if (d == sgm::INVALID_DISP) { 

          d = invalid_disp_scaled; 

       } else { 

          d += min_disp_scaled; 

       } 

       d_disp[y * pitch + x] = d;

Thank you very much! Thank you for your job.I got it.

sotsuka-fixstars commented 5 years ago

@NiuKeke

Thank you very much! Thank you for your job.I got it.

We will close this issue. If we faced with related this issue, reopen it.