Opencv c++ stereoBM disparity map limited in distance












0














As I wrote in the title I have a problem with disparity generated from stereoBM.



The problem is that I can see disparities only in a range of distance, i.e. I can see me if I stand from 1 meter to 2 meters, before and after I see only black (holes, using the OpenCV's dictionary).



I need that I can create a depthmap with a distance greater than 2 meters and I don't know why there is this limitation.



Is there any problem related to the calibration or the rectify process?



I hope you can help me.



edit:



https://mega.nz/#!c5BnlCxT!U0EVi2cizy3fJbyfUF7m3haBibhz-SJpecdw0hYjFv8



https://mega.nz/#!RgBnhY4Z!v2CJKVRAPGK0cco1C02AFc8HeUgTCfhrTtWZs4aREqQ



https://mega.nz/#!IpJnRQSb!YVfd094W2KfRr6gdyiduiwJtkr2n13TVaGf1THvTM3A



here there are the raw images(undistorted), the dmap after the rectify process and the source code that i use to test the calibration is below.



    bm->setPreFilterType(StereoBM::PREFILTER_XSOBEL);
bm->setPreFilterSize(preFilterSize); //31
bm->setPreFilterCap(preFilterCap); //31
bm->setBlockSize(blockSize); //31
bm->setMinDisparity(minDisp); //-5
bm->setNumDisparities(numDisp); //16
bm->setTextureThreshold(textThres); //10
bm->setUniquenessRatio(uniqueRatio); //15
bm->setSpeckleWindowSize(speckleSize); //101
bm->setSpeckleRange(speckleRange); //32
bm->setDisp12MaxDiff(dispDiff); //1
cvtColor(img1,img1gray,CV_BGR2GRAY);
cvtColor(img2,img2gray,CV_BGR2GRAY);
bm->compute(img1gray, img2gray, disp);
disp.convertTo(disp8, CV_8UC1, 255/(numDisp*16.));
displayImages();


All the parameters are adjustable realtime with sliders and the value commented after each row is the default or initial value.



Thank you for your patience.










share|improve this question




















  • 1




    Please provide some codes.
    – Mosius
    Nov 21 '18 at 11:57










  • if possible, provide code and sample images
    – Micka
    Nov 21 '18 at 12:05










  • I edited the question with the information requested, thanks
    – UomoNero
    Nov 21 '18 at 15:35










  • You should take the time to add the images and relevant code (BM parameters) to the question. Nobody wants to download and read the whole source file.
    – jodis
    Nov 21 '18 at 21:22










  • @jodis sorry, i will edit my question. I can tell you that i'm using the sample code from opencv and modified in the manner that gets in input not a list of images but take the images in real time.
    – UomoNero
    Nov 22 '18 at 8:25
















0














As I wrote in the title I have a problem with disparity generated from stereoBM.



The problem is that I can see disparities only in a range of distance, i.e. I can see me if I stand from 1 meter to 2 meters, before and after I see only black (holes, using the OpenCV's dictionary).



I need that I can create a depthmap with a distance greater than 2 meters and I don't know why there is this limitation.



Is there any problem related to the calibration or the rectify process?



I hope you can help me.



edit:



https://mega.nz/#!c5BnlCxT!U0EVi2cizy3fJbyfUF7m3haBibhz-SJpecdw0hYjFv8



https://mega.nz/#!RgBnhY4Z!v2CJKVRAPGK0cco1C02AFc8HeUgTCfhrTtWZs4aREqQ



https://mega.nz/#!IpJnRQSb!YVfd094W2KfRr6gdyiduiwJtkr2n13TVaGf1THvTM3A



here there are the raw images(undistorted), the dmap after the rectify process and the source code that i use to test the calibration is below.



    bm->setPreFilterType(StereoBM::PREFILTER_XSOBEL);
bm->setPreFilterSize(preFilterSize); //31
bm->setPreFilterCap(preFilterCap); //31
bm->setBlockSize(blockSize); //31
bm->setMinDisparity(minDisp); //-5
bm->setNumDisparities(numDisp); //16
bm->setTextureThreshold(textThres); //10
bm->setUniquenessRatio(uniqueRatio); //15
bm->setSpeckleWindowSize(speckleSize); //101
bm->setSpeckleRange(speckleRange); //32
bm->setDisp12MaxDiff(dispDiff); //1
cvtColor(img1,img1gray,CV_BGR2GRAY);
cvtColor(img2,img2gray,CV_BGR2GRAY);
bm->compute(img1gray, img2gray, disp);
disp.convertTo(disp8, CV_8UC1, 255/(numDisp*16.));
displayImages();


All the parameters are adjustable realtime with sliders and the value commented after each row is the default or initial value.



Thank you for your patience.










share|improve this question




















  • 1




    Please provide some codes.
    – Mosius
    Nov 21 '18 at 11:57










  • if possible, provide code and sample images
    – Micka
    Nov 21 '18 at 12:05










  • I edited the question with the information requested, thanks
    – UomoNero
    Nov 21 '18 at 15:35










  • You should take the time to add the images and relevant code (BM parameters) to the question. Nobody wants to download and read the whole source file.
    – jodis
    Nov 21 '18 at 21:22










  • @jodis sorry, i will edit my question. I can tell you that i'm using the sample code from opencv and modified in the manner that gets in input not a list of images but take the images in real time.
    – UomoNero
    Nov 22 '18 at 8:25














0












0








0


1





As I wrote in the title I have a problem with disparity generated from stereoBM.



The problem is that I can see disparities only in a range of distance, i.e. I can see me if I stand from 1 meter to 2 meters, before and after I see only black (holes, using the OpenCV's dictionary).



I need that I can create a depthmap with a distance greater than 2 meters and I don't know why there is this limitation.



Is there any problem related to the calibration or the rectify process?



I hope you can help me.



edit:



https://mega.nz/#!c5BnlCxT!U0EVi2cizy3fJbyfUF7m3haBibhz-SJpecdw0hYjFv8



https://mega.nz/#!RgBnhY4Z!v2CJKVRAPGK0cco1C02AFc8HeUgTCfhrTtWZs4aREqQ



https://mega.nz/#!IpJnRQSb!YVfd094W2KfRr6gdyiduiwJtkr2n13TVaGf1THvTM3A



here there are the raw images(undistorted), the dmap after the rectify process and the source code that i use to test the calibration is below.



    bm->setPreFilterType(StereoBM::PREFILTER_XSOBEL);
bm->setPreFilterSize(preFilterSize); //31
bm->setPreFilterCap(preFilterCap); //31
bm->setBlockSize(blockSize); //31
bm->setMinDisparity(minDisp); //-5
bm->setNumDisparities(numDisp); //16
bm->setTextureThreshold(textThres); //10
bm->setUniquenessRatio(uniqueRatio); //15
bm->setSpeckleWindowSize(speckleSize); //101
bm->setSpeckleRange(speckleRange); //32
bm->setDisp12MaxDiff(dispDiff); //1
cvtColor(img1,img1gray,CV_BGR2GRAY);
cvtColor(img2,img2gray,CV_BGR2GRAY);
bm->compute(img1gray, img2gray, disp);
disp.convertTo(disp8, CV_8UC1, 255/(numDisp*16.));
displayImages();


All the parameters are adjustable realtime with sliders and the value commented after each row is the default or initial value.



Thank you for your patience.










share|improve this question















As I wrote in the title I have a problem with disparity generated from stereoBM.



The problem is that I can see disparities only in a range of distance, i.e. I can see me if I stand from 1 meter to 2 meters, before and after I see only black (holes, using the OpenCV's dictionary).



I need that I can create a depthmap with a distance greater than 2 meters and I don't know why there is this limitation.



Is there any problem related to the calibration or the rectify process?



I hope you can help me.



edit:



https://mega.nz/#!c5BnlCxT!U0EVi2cizy3fJbyfUF7m3haBibhz-SJpecdw0hYjFv8



https://mega.nz/#!RgBnhY4Z!v2CJKVRAPGK0cco1C02AFc8HeUgTCfhrTtWZs4aREqQ



https://mega.nz/#!IpJnRQSb!YVfd094W2KfRr6gdyiduiwJtkr2n13TVaGf1THvTM3A



here there are the raw images(undistorted), the dmap after the rectify process and the source code that i use to test the calibration is below.



    bm->setPreFilterType(StereoBM::PREFILTER_XSOBEL);
bm->setPreFilterSize(preFilterSize); //31
bm->setPreFilterCap(preFilterCap); //31
bm->setBlockSize(blockSize); //31
bm->setMinDisparity(minDisp); //-5
bm->setNumDisparities(numDisp); //16
bm->setTextureThreshold(textThres); //10
bm->setUniquenessRatio(uniqueRatio); //15
bm->setSpeckleWindowSize(speckleSize); //101
bm->setSpeckleRange(speckleRange); //32
bm->setDisp12MaxDiff(dispDiff); //1
cvtColor(img1,img1gray,CV_BGR2GRAY);
cvtColor(img2,img2gray,CV_BGR2GRAY);
bm->compute(img1gray, img2gray, disp);
disp.convertTo(disp8, CV_8UC1, 255/(numDisp*16.));
displayImages();


All the parameters are adjustable realtime with sliders and the value commented after each row is the default or initial value.



Thank you for your patience.







c++ opencv stereo-3d






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 10:41

























asked Nov 21 '18 at 11:44









UomoNero

11




11








  • 1




    Please provide some codes.
    – Mosius
    Nov 21 '18 at 11:57










  • if possible, provide code and sample images
    – Micka
    Nov 21 '18 at 12:05










  • I edited the question with the information requested, thanks
    – UomoNero
    Nov 21 '18 at 15:35










  • You should take the time to add the images and relevant code (BM parameters) to the question. Nobody wants to download and read the whole source file.
    – jodis
    Nov 21 '18 at 21:22










  • @jodis sorry, i will edit my question. I can tell you that i'm using the sample code from opencv and modified in the manner that gets in input not a list of images but take the images in real time.
    – UomoNero
    Nov 22 '18 at 8:25














  • 1




    Please provide some codes.
    – Mosius
    Nov 21 '18 at 11:57










  • if possible, provide code and sample images
    – Micka
    Nov 21 '18 at 12:05










  • I edited the question with the information requested, thanks
    – UomoNero
    Nov 21 '18 at 15:35










  • You should take the time to add the images and relevant code (BM parameters) to the question. Nobody wants to download and read the whole source file.
    – jodis
    Nov 21 '18 at 21:22










  • @jodis sorry, i will edit my question. I can tell you that i'm using the sample code from opencv and modified in the manner that gets in input not a list of images but take the images in real time.
    – UomoNero
    Nov 22 '18 at 8:25








1




1




Please provide some codes.
– Mosius
Nov 21 '18 at 11:57




Please provide some codes.
– Mosius
Nov 21 '18 at 11:57












if possible, provide code and sample images
– Micka
Nov 21 '18 at 12:05




if possible, provide code and sample images
– Micka
Nov 21 '18 at 12:05












I edited the question with the information requested, thanks
– UomoNero
Nov 21 '18 at 15:35




I edited the question with the information requested, thanks
– UomoNero
Nov 21 '18 at 15:35












You should take the time to add the images and relevant code (BM parameters) to the question. Nobody wants to download and read the whole source file.
– jodis
Nov 21 '18 at 21:22




You should take the time to add the images and relevant code (BM parameters) to the question. Nobody wants to download and read the whole source file.
– jodis
Nov 21 '18 at 21:22












@jodis sorry, i will edit my question. I can tell you that i'm using the sample code from opencv and modified in the manner that gets in input not a list of images but take the images in real time.
– UomoNero
Nov 22 '18 at 8:25




@jodis sorry, i will edit my question. I can tell you that i'm using the sample code from opencv and modified in the manner that gets in input not a list of images but take the images in real time.
– UomoNero
Nov 22 '18 at 8:25

















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411334%2fopencv-c-stereobm-disparity-map-limited-in-distance%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53411334%2fopencv-c-stereobm-disparity-map-limited-in-distance%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

404 Error Contact Form 7 ajax form submitting

How to know if a Active Directory user can login interactively

TypeError: fit_transform() missing 1 required positional argument: 'X'