Ask Your Question

Revision history [back]

How to set Parameters for StereoBM in Android/Java?

I am trying to make disparity map of two images that I took from the phone's camera. I have written the code in Android/Java (not using C++). I'm using stereoBM to calculate the disparity map but I am unable to set the parameters.

In C++, it can be done by

StereoBM sbm;
sbm.state->SADWindowSize 
sbm.state->numberOfDisparities
sbm.state->preFilterSize 
sbm.state->preFilterCap 
sbm.state->minDisparity 
sbm.state->textureThreshold 
sbm.state->uniquenessRatio 
sbm.state->speckleWindowSize 
sbm.state->speckleRange 
sbm.state->disp12MaxDiff

but in Android/Java, I can only set PRESET, SADWindowSize, and nDisparities using the constructor. Is there any way in which I can set these parameters?

And I also once tried StereoSGBM (the parameters can be set in that), but during USB debugging, while computing the disparity map, the application took too long and hung. So I am trying to stick to StereoBM.