mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Merge pull request #20150 from rogday:svm_detector_test
This commit is contained in:
commit
bb3bbd192b
@ -122,6 +122,12 @@ void HOGDescriptor::setSVMDetector(InputArray _svmDetector)
|
|||||||
_svmDetector.getMat().convertTo(svmDetector, CV_32F);
|
_svmDetector.getMat().convertTo(svmDetector, CV_32F);
|
||||||
CV_Assert(checkDetectorSize());
|
CV_Assert(checkDetectorSize());
|
||||||
|
|
||||||
|
if (_svmDetector.empty())
|
||||||
|
{
|
||||||
|
oclSvmDetector = UMat();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Mat detector_reordered(1, (int)svmDetector.size(), CV_32FC1);
|
Mat detector_reordered(1, (int)svmDetector.size(), CV_32FC1);
|
||||||
|
|
||||||
size_t block_hist_size = getBlockHistogramSize(blockSize, cellSize, nbins);
|
size_t block_hist_size = getBlockHistogramSize(blockSize, cellSize, nbins);
|
||||||
|
@ -93,6 +93,25 @@ OCL_TEST_P(HOG, GetDescriptors)
|
|||||||
EXPECT_MAT_SIMILAR(cpu_desc, gpu_desc, 1e-1);
|
EXPECT_MAT_SIMILAR(cpu_desc, gpu_desc, 1e-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OCL_TEST_P(HOG, SVMDetector)
|
||||||
|
{
|
||||||
|
HOGDescriptor hog_first, hog_second;
|
||||||
|
|
||||||
|
// empty -> empty
|
||||||
|
hog_first.copyTo(hog_second);
|
||||||
|
|
||||||
|
// first -> both
|
||||||
|
hog_first.setSVMDetector(hog_first.getDefaultPeopleDetector());
|
||||||
|
hog_first.copyTo(hog_second);
|
||||||
|
|
||||||
|
// both -> both
|
||||||
|
hog_first.copyTo(hog_second);
|
||||||
|
|
||||||
|
// second -> empty
|
||||||
|
hog_first.setSVMDetector(cv::noArray());
|
||||||
|
hog_first.copyTo(hog_second);
|
||||||
|
}
|
||||||
|
|
||||||
OCL_TEST_P(HOG, Detect)
|
OCL_TEST_P(HOG, Detect)
|
||||||
{
|
{
|
||||||
HOGDescriptor hog;
|
HOGDescriptor hog;
|
||||||
|
Loading…
Reference in New Issue
Block a user