mirror of
https://github.com/opencv/opencv.git
synced 2025-08-01 02:18:01 +08:00
fixing segfaults occuring when launching those unit tests
This commit is contained in:
parent
0d10eb5173
commit
bacc210606
@ -1570,7 +1570,8 @@ void CV_StereoCalibrationTest::run( int )
|
|||||||
{
|
{
|
||||||
ts->printf( cvtest::TS::LOG, "The file %s can not be opened or has invalid content\n", filepath.c_str() );
|
ts->printf( cvtest::TS::LOG, "The file %s can not be opened or has invalid content\n", filepath.c_str() );
|
||||||
ts->set_failed_test_info( f ? cvtest::TS::FAIL_INVALID_TEST_DATA : cvtest::TS::FAIL_MISSING_TEST_DATA );
|
ts->set_failed_test_info( f ? cvtest::TS::FAIL_INVALID_TEST_DATA : cvtest::TS::FAIL_MISSING_TEST_DATA );
|
||||||
fclose(f);
|
if (f)
|
||||||
|
fclose(f);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,6 +138,9 @@ bool LogisticRegressionImpl::train(const Ptr<TrainData>& trainData, int)
|
|||||||
// return value
|
// return value
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
|
|
||||||
|
if (trainData.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
clear();
|
clear();
|
||||||
Mat _data_i = trainData->getSamples();
|
Mat _data_i = trainData->getSamples();
|
||||||
Mat _labels_i = trainData->getResponses();
|
Mat _labels_i = trainData->getResponses();
|
||||||
|
@ -618,6 +618,7 @@ protected:
|
|||||||
{
|
{
|
||||||
ts->printf(cvtest::TS::LOG, "File with spambase dataset cann't be read.\n");
|
ts->printf(cvtest::TS::LOG, "File with spambase dataset cann't be read.\n");
|
||||||
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
|
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Mat samples = data->getSamples();
|
Mat samples = data->getSamples();
|
||||||
|
@ -95,6 +95,11 @@ void CV_LRTest::run( int /*start_from*/ )
|
|||||||
string dataFileName = ts->get_data_path() + "iris.data";
|
string dataFileName = ts->get_data_path() + "iris.data";
|
||||||
Ptr<TrainData> tdata = TrainData::loadFromCSV(dataFileName, 0);
|
Ptr<TrainData> tdata = TrainData::loadFromCSV(dataFileName, 0);
|
||||||
|
|
||||||
|
if (tdata.empty()) {
|
||||||
|
ts->set_failed_test_info(cvtest::TS::FAIL_INVALID_TEST_DATA);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// run LR classifier train classifier
|
// run LR classifier train classifier
|
||||||
Ptr<LogisticRegression> p = LogisticRegression::create();
|
Ptr<LogisticRegression> p = LogisticRegression::create();
|
||||||
p->setLearningRate(1.0);
|
p->setLearningRate(1.0);
|
||||||
|
@ -83,6 +83,9 @@ protected:
|
|||||||
|
|
||||||
vector<PointType> convertContourType(const Mat& currentQuery) const
|
vector<PointType> convertContourType(const Mat& currentQuery) const
|
||||||
{
|
{
|
||||||
|
if (currentQuery.empty()) {
|
||||||
|
return vector<PointType>();
|
||||||
|
}
|
||||||
vector<vector<Point> > _contoursQuery;
|
vector<vector<Point> > _contoursQuery;
|
||||||
findContours(currentQuery, _contoursQuery, RETR_LIST, CHAIN_APPROX_NONE);
|
findContours(currentQuery, _contoursQuery, RETR_LIST, CHAIN_APPROX_NONE);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user