remove debug detect at scale method

This commit is contained in:
marina.kolpakova
2012-11-14 14:21:22 +04:00
parent 72e2b8b370
commit 8acfbde68e
6 changed files with 53 additions and 106 deletions

View File

@@ -195,55 +195,55 @@ GPU_TEST_P(SCascadeTestRoi, detect,
}
typedef ::testing::TestWithParam<std::tr1::tuple<cv::gpu::DeviceInfo, std::string, std::string, int> > SCascadeTestLevel;
GPU_TEST_P(SCascadeTestLevel, detect,
testing::Combine(
ALL_DEVICES,
testing::Values(std::string("cv/cascadeandhog/sc_cvpr_2012_to_opencv.xml")),
testing::Values(std::string("../cv/cascadeandhog/bahnhof/image_00000000_0.png")),
testing::Range(0, 47)
))
{
cv::gpu::setDevice(GET_PARAM(0).deviceID());
// typedef ::testing::TestWithParam<std::tr1::tuple<cv::gpu::DeviceInfo, std::string, std::string, int> > SCascadeTestLevel;
// GPU_TEST_P(SCascadeTestLevel, detect,
// testing::Combine(
// ALL_DEVICES,
// testing::Values(std::string("cv/cascadeandhog/sc_cvpr_2012_to_opencv.xml")),
// testing::Values(std::string("../cv/cascadeandhog/bahnhof/image_00000000_0.png")),
// testing::Range(0, 47)
// ))
// {
// cv::gpu::setDevice(GET_PARAM(0).deviceID());
cv::gpu::SCascade cascade;
// cv::gpu::SCascade cascade;
cv::FileStorage fs(perf::TestBase::getDataPath(GET_PARAM(1)), cv::FileStorage::READ);
ASSERT_TRUE(fs.isOpened());
// cv::FileStorage fs(perf::TestBase::getDataPath(GET_PARAM(1)), cv::FileStorage::READ);
// ASSERT_TRUE(fs.isOpened());
ASSERT_TRUE(cascade.load(fs.getFirstTopLevelNode()));
// ASSERT_TRUE(cascade.load(fs.getFirstTopLevelNode()));
cv::Mat coloredCpu = cv::imread(cvtest::TS::ptr()->get_data_path() + GET_PARAM(2));
ASSERT_FALSE(coloredCpu.empty());
// cv::Mat coloredCpu = cv::imread(cvtest::TS::ptr()->get_data_path() + GET_PARAM(2));
// ASSERT_FALSE(coloredCpu.empty());
typedef cv::gpu::SCascade::Detection Detection;
GpuMat colored(coloredCpu), objectBoxes(1, 100 * sizeof(Detection), CV_8UC1), rois(colored.size(), CV_8UC1);
rois.setTo(1);
// typedef cv::gpu::SCascade::Detection Detection;
// GpuMat colored(coloredCpu), objectBoxes(1, 100 * sizeof(Detection), CV_8UC1), rois(colored.size(), CV_8UC1);
// rois.setTo(1);
cv::gpu::GpuMat trois;
cascade.genRoi(rois, trois);
objectBoxes.setTo(0);
int level = GET_PARAM(3);
cascade.detect(colored, trois, objectBoxes, level);
// cv::gpu::GpuMat trois;
// cascade.genRoi(rois, trois);
// objectBoxes.setTo(0);
// int level = GET_PARAM(3);
// cascade.detect(colored, trois, objectBoxes, level);
cv::Mat dt(objectBoxes);
// cv::Mat dt(objectBoxes);
Detection* dts = ((Detection*)dt.data) + 1;
int* count = dt.ptr<int>(0);
// Detection* dts = ((Detection*)dt.data) + 1;
// int* count = dt.ptr<int>(0);
cv::Mat result(coloredCpu);
// cv::Mat result(coloredCpu);
printTotal(std::cout, *count);
for (int i = 0; i < *count; ++i)
{
Detection d = dts[i];
print(std::cout, d);
cv::rectangle(result, cv::Rect(d.x, d.y, d.w, d.h), cv::Scalar(255, 0, 0, 255), 1);
}
// printTotal(std::cout, *count);
// for (int i = 0; i < *count; ++i)
// {
// Detection d = dts[i];
// print(std::cout, d);
// cv::rectangle(result, cv::Rect(d.x, d.y, d.w, d.h), cv::Scalar(255, 0, 0, 255), 1);
// }
writeResult(result, level);
SHOW(result);
}
// writeResult(result, level);
// SHOW(result);
// }
TEST(SCascadeTest, readCascade)
{