Possible bug in modules/calib3d/test/test_stereomatching.cpp?

asked 2017-09-01 17:38:40 -0600

Using an experimental new analysis technique, we (GrammaTech) identified what appears to be a bug in CV_StereoMatchingTest::processStereoMatchingResults, in modules/calib3d/test/test_stereomatching.cpp:

            // get masks for unknown ground truth disparity values 
            Mat leftUnknMask, rightUnknMask; 
            DatasetParams params = datasetsParams[caseDatasets[caseIdx]]; 
            absdiff( trueLeftDisp, Scalar(params.dispUnknVal), leftUnknMask ); 
            leftUnknMask = leftUnknMask < numeric_limits<float>::epsilon(); 
            assert(leftUnknMask.type() == CV_8UC1); 

            if( !trueRightDisp.empty() ) 
            { 
                absdiff( trueRightDisp, Scalar(params.dispUnknVal), rightUnknMask ); 
                rightUnknMask = rightUnknMask < numeric_limits<float>::epsilon(); 
                assert(leftUnknMask.type() == CV_8UC1); // HERE! should be rightUnknMask?
            }

The block in the "if" appears to be a copy of the block immediately before that "if", with "left" changed to "right", except on the line with the HERE! comment. Logically, it seems like this line should be applying the same test to rightUnknMask that the earlier line applied to leftUnknMask, rather than testing left again. Can someone knowledgeable take a look?

edit retag flag offensive close merge delete

Comments

@MysteriousBugOracle will you submit a patch?

sturkmen gravatar imagesturkmen ( 2017-09-02 17:43:38 -0600 )edit

We don't actually use this code, so we're not in a position to create or test a fix. We just run our static analysis to detect problems. I can submit a bug through your bug system, or you could just make the one-line fix yourself without an official bug.

MysteriousBugOracle gravatar imageMysteriousBugOracle ( 2017-09-02 18:58:33 -0600 )edit

OK. i will submit a patch. thank you.

sturkmen gravatar imagesturkmen ( 2017-09-02 19:24:04 -0600 )edit