Commit 53b0df87 authored by cuda-geek's avatar cuda-geek Committed by OpenCV Buildbot

Merge pull request #385 from etalanin:bug2607

parents bf53ebd5 50c2f87a
......@@ -138,7 +138,7 @@ void HOGDescriptor::write(FileStorage& fs, const String& objName) const
<< "gammaCorrection" << gammaCorrection
<< "nlevels" << nlevels;
if( !svmDetector.empty() )
fs << "SVMDetector" << "[:" << svmDetector << "]";
fs << "SVMDetector" << svmDetector;
fs << "}";
}
......
......@@ -461,5 +461,30 @@ int CV_HOGDetectorTest::detectMultiScale( int di, const Mat& img,
return cvtest::TS::OK;
}
//----------------------------------------------- HOGDetectorReadWriteTest -----------------------------------
TEST(Objdetect_HOGDetectorReadWrite, regression)
{
// Inspired by bug #2607
Mat img;
img = imread(cvtest::TS::ptr()->get_data_path() + "/cascadeandhog/images/karen-and-rob.png");
ASSERT_FALSE(img.empty());
HOGDescriptor hog;
hog.setSVMDetector(HOGDescriptor::getDefaultPeopleDetector());
string tempfilename = cv::tempfile(".xml");
FileStorage fs(tempfilename, FileStorage::WRITE);
hog.write(fs, "myHOG");
fs.open(tempfilename, FileStorage::READ);
remove(tempfilename.c_str());
FileNode n = fs["opencv_storage"]["myHOG"];
ASSERT_NO_THROW(hog.read(n));
}
TEST(Objdetect_CascadeDetector, regression) { CV_CascadeDetectorTest test; test.safe_run(); }
TEST(Objdetect_HOGDetector, regression) { CV_HOGDetectorTest test; test.safe_run(); }
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