cannot see effect of tunning parameters of stereoBlockMatching using Opencv

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

cannot see effect of tunning parameters of stereoBlockMatching using Opencv

opencv-users mailing list


 
down votefavorite https://stackoverflow.com/questions/44104763/cannot-see-effect-of-tunning-parameters-of-stereoblockmatching-using-opencv# 1

 Here is the code of stereoBM matching with TrackBars for tunning parameters.
 int main() { int flat = 0; int PreFilterType = 0, PreFilterCap = 0, PreFilterSize = 5, MinDisparity = 0, UniqnessRatio = 0, TextureThreshold = 0, SpeckleRange = 0, SADWindowSize = 5, SpackleWindowSize = 0, numDisparities = 0, numDisparities2 = 0; StereoBM sbm; //Ptr<StereoBM> sbm = StereoBM::craete (numDisparities, SADWindowSize); Mat out1 = imread("aloeL.jpg"); Mat out2 = imread("aloeR.jpg"); Mat g1, g2, disp, disp8; cvtColor(out1, g1, CV_BGR2GRAY); cvtColor(out2, g2, CV_BGR2GRAY); namedWindow("Track Bar Window", CV_WINDOW_NORMAL); namedWindow("disp8", CV_WINDOW_NORMAL); sbm.state->SADWindowSize = 9; sbm.state->numberOfDisparities = 112; sbm.state->preFilterSize = 5; sbm.state->preFilterCap = 61; sbm.state->minDisparity = -39; sbm.state->textureThreshold = 507; sbm.state->uniquenessRatio = 0; sbm.state->speckleWindowSize = 0; sbm.state->speckleRange = 8; sbm.state->disp12MaxDiff = 1; /*sbm.state->SADWindowSize = SADWindowSize; sbm.state->numberOfDisparities = numDisparities; sbm.state->preFilterSize = PreFilterSize; sbm.state->preFilterCap = PreFilterCap; sbm.state->minDisparity = MinDisparity; sbm.state->textureThreshold = TextureThreshold; sbm.state->uniquenessRatio = UniqnessRatio; sbm.state->speckleWindowSize = SpackleWindowSize; sbm.state->speckleRange = SpeckleRange; sbm.state->disp12MaxDiff = 1;*/ while (1) { cvCreateTrackbar("Number of Disparities", "Track B-++++++++++++++++++++++++++++-----ar Window", &PreFilterType, 1, 0); cvCreateTrackbar("Pre Filter Size", "Track Bar Window", &PreFilterSize, 100); cvCreateTrackbar("Pre Filter Cap", "Track Bar Window", &PreFilterCap, 61); cvCreateTrackbar("Minimum Disparity", "Track Bar Window", &MinDisparity, 200); cvCreateTrackbar("Uniqueness Ratio", "Track Bar Window", &UniqnessRatio, 2500); cvCreateTrackbar("Texture Threshold", "Track Bar Window", &TextureThreshold, 10000); cvCreateTrackbar("Speckle Range", "Track Bar Window", &SpeckleRange, 500); cvCreateTrackbar("Block Size", "Track Bar Window", &SADWindowSize, 100); cvCreateTrackbar("Speckle Window Size", "Track Bar Window", &SpackleWindowSize, 200); cvCreateTrackbar("Number of Disparity", "Track Bar Window", &numDisparities, 500); if (PreFilterSize % 2 == 0) { PreFilterSize = PreFilterSize + 1; } if (PreFilterSize < 5) { PreFilterSize = 5; } if (SADWindowSize % 2 == 0) { SADWindowSize = SADWindowSize + 1; } if (SADWindowSize < 5) { SADWindowSize = 5; } if (numDisparities % 16 != 0) { numDisparities = numDisparities + (16 - numDisparities % 16); } sbm(g1, g2, disp); normalize(disp, disp8, 0, 255, CV_MINMAX, CV_8U); imshow("disp8", disp8); waitKey(0); } return 0; } But by tunning parameters, i cannot see any effect on disparity map.  https://i.stack.imgur.com/nSU4E.png
 Please suggest me if something missing or guide me in case of any problem.
 thanks


 

Loading...