Commit 862e03c4 authored by Vladislav Sovrasov's avatar Vladislav Sovrasov

Fix segFault when no lines found in BinaryDescriptor

parent f3ca1a2f
......@@ -2196,6 +2196,11 @@ int BinaryDescriptor::EDLineDetector::EdgeDrawing( cv::Mat &image, EdgeChains &e
"numofedgePixel1 = " << offsetPFirst << ", numofedgePixel2 = " << offsetPSecond << ", MaxNumOfEdgePixel=" << edgePixelArraySize << std::endl;
return -1;
}
if( !(offsetPFirst && offsetPSecond) )
{
std::cout << "Edge drawing Error: lines not found" << std::endl;
return -1;
}
/*now all the edge information are stored in pFirstPartEdgeX_, pFirstPartEdgeY_,
*pFirstPartEdgeS_, pSecondPartEdgeX_, pSecondPartEdgeY_, pSecondPartEdgeS_;
......
......@@ -372,3 +372,18 @@ TEST( BinaryDescriptor_Descriptors, regression )
CV_BD_DescriptorsTest<Hamming> test( std::string( "lbd_descriptors_cameraman" ), 1 );
test.safe_run();
}
/****************************************************************************************\
* Other tests *
\****************************************************************************************/
TEST( BinaryDescriptor, no_lines_found )
{
Mat Image = Mat::zeros(100, 100, CV_8U);
Ptr<line_descriptor::BinaryDescriptor> binDescriptor =
line_descriptor::BinaryDescriptor::createBinaryDescriptor();
std::vector<cv::line_descriptor::KeyLine> keyLines;
binDescriptor->detect(Image, keyLines);
ASSERT_EQ(keyLines.size(), 0u);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment