Commit 9d148c76 authored by Alexander Smorkalov's avatar Alexander Smorkalov

Merge pull request #4033 from jet47:gpu-tests-fix

parents b9792fdc d58d2777
...@@ -138,14 +138,16 @@ namespace ...@@ -138,14 +138,16 @@ namespace
bool was; bool was;
do do
{ {
subset[i] = rand() % num_points; subset[i] = cv::theRNG().uniform(0, num_points);
was = false; was = false;
for (int j = 0; j < i; ++j) for (int j = 0; j < i; ++j)
{
if (subset[j] == subset[i]) if (subset[j] == subset[i])
{ {
was = true; was = true;
break; break;
} }
}
} while (was); } while (was);
} }
} }
......
...@@ -340,7 +340,8 @@ bool nvidia_NPPST_Integral_Image(const std::string& test_data_path, OutputLevel ...@@ -340,7 +340,8 @@ bool nvidia_NPPST_Integral_Image(const std::string& test_data_path, OutputLevel
bool nvidia_NPPST_Squared_Integral_Image(const std::string& test_data_path, OutputLevel outputLevel) bool nvidia_NPPST_Squared_Integral_Image(const std::string& test_data_path, OutputLevel outputLevel)
{ {
path = test_data_path; path = test_data_path;
ncvSetDebugOutputHandler(devNullOutput); if (outputLevel != OutputLevelFull)
ncvSetDebugOutputHandler(devNullOutput);
NCVAutoTestLister testListerSII("NPPST Squared Integral Image", outputLevel); NCVAutoTestLister testListerSII("NPPST Squared Integral Image", outputLevel);
...@@ -354,7 +355,8 @@ bool nvidia_NPPST_Squared_Integral_Image(const std::string& test_data_path, Outp ...@@ -354,7 +355,8 @@ bool nvidia_NPPST_Squared_Integral_Image(const std::string& test_data_path, Outp
bool nvidia_NPPST_RectStdDev(const std::string& test_data_path, OutputLevel outputLevel) bool nvidia_NPPST_RectStdDev(const std::string& test_data_path, OutputLevel outputLevel)
{ {
path = test_data_path; path = test_data_path;
ncvSetDebugOutputHandler(devNullOutput); if (outputLevel != OutputLevelFull)
ncvSetDebugOutputHandler(devNullOutput);
NCVAutoTestLister testListerRStdDev("NPPST RectStdDev", outputLevel); NCVAutoTestLister testListerRStdDev("NPPST RectStdDev", outputLevel);
...@@ -368,7 +370,8 @@ bool nvidia_NPPST_RectStdDev(const std::string& test_data_path, OutputLevel outp ...@@ -368,7 +370,8 @@ bool nvidia_NPPST_RectStdDev(const std::string& test_data_path, OutputLevel outp
bool nvidia_NPPST_Resize(const std::string& test_data_path, OutputLevel outputLevel) bool nvidia_NPPST_Resize(const std::string& test_data_path, OutputLevel outputLevel)
{ {
path = test_data_path; path = test_data_path;
ncvSetDebugOutputHandler(devNullOutput); if (outputLevel != OutputLevelFull)
ncvSetDebugOutputHandler(devNullOutput);
NCVAutoTestLister testListerResize("NPPST Resize", outputLevel); NCVAutoTestLister testListerResize("NPPST Resize", outputLevel);
...@@ -384,7 +387,8 @@ bool nvidia_NPPST_Resize(const std::string& test_data_path, OutputLevel outputLe ...@@ -384,7 +387,8 @@ bool nvidia_NPPST_Resize(const std::string& test_data_path, OutputLevel outputLe
bool nvidia_NPPST_Vector_Operations(const std::string& test_data_path, OutputLevel outputLevel) bool nvidia_NPPST_Vector_Operations(const std::string& test_data_path, OutputLevel outputLevel)
{ {
path = test_data_path; path = test_data_path;
ncvSetDebugOutputHandler(devNullOutput); if (outputLevel != OutputLevelFull)
ncvSetDebugOutputHandler(devNullOutput);
NCVAutoTestLister testListerNPPSTVectorOperations("NPPST Vector Operations", outputLevel); NCVAutoTestLister testListerNPPSTVectorOperations("NPPST Vector Operations", outputLevel);
...@@ -398,7 +402,8 @@ bool nvidia_NPPST_Vector_Operations(const std::string& test_data_path, OutputLev ...@@ -398,7 +402,8 @@ bool nvidia_NPPST_Vector_Operations(const std::string& test_data_path, OutputLev
bool nvidia_NPPST_Transpose(const std::string& test_data_path, OutputLevel outputLevel) bool nvidia_NPPST_Transpose(const std::string& test_data_path, OutputLevel outputLevel)
{ {
path = test_data_path; path = test_data_path;
ncvSetDebugOutputHandler(devNullOutput); if (outputLevel != OutputLevelFull)
ncvSetDebugOutputHandler(devNullOutput);
NCVAutoTestLister testListerTranspose("NPPST Transpose", outputLevel); NCVAutoTestLister testListerTranspose("NPPST Transpose", outputLevel);
...@@ -414,7 +419,8 @@ bool nvidia_NPPST_Transpose(const std::string& test_data_path, OutputLevel outpu ...@@ -414,7 +419,8 @@ bool nvidia_NPPST_Transpose(const std::string& test_data_path, OutputLevel outpu
bool nvidia_NCV_Vector_Operations(const std::string& test_data_path, OutputLevel outputLevel) bool nvidia_NCV_Vector_Operations(const std::string& test_data_path, OutputLevel outputLevel)
{ {
path = test_data_path; path = test_data_path;
ncvSetDebugOutputHandler(devNullOutput); if (outputLevel != OutputLevelFull)
ncvSetDebugOutputHandler(devNullOutput);
NCVAutoTestLister testListerVectorOperations("Vector Operations", outputLevel); NCVAutoTestLister testListerVectorOperations("Vector Operations", outputLevel);
...@@ -429,7 +435,8 @@ bool nvidia_NCV_Vector_Operations(const std::string& test_data_path, OutputLevel ...@@ -429,7 +435,8 @@ bool nvidia_NCV_Vector_Operations(const std::string& test_data_path, OutputLevel
bool nvidia_NCV_Haar_Cascade_Loader(const std::string& test_data_path, OutputLevel outputLevel) bool nvidia_NCV_Haar_Cascade_Loader(const std::string& test_data_path, OutputLevel outputLevel)
{ {
path = test_data_path; path = test_data_path;
ncvSetDebugOutputHandler(devNullOutput); if (outputLevel != OutputLevelFull)
ncvSetDebugOutputHandler(devNullOutput);
NCVAutoTestLister testListerHaarLoader("Haar Cascade Loader", outputLevel); NCVAutoTestLister testListerHaarLoader("Haar Cascade Loader", outputLevel);
...@@ -441,7 +448,8 @@ bool nvidia_NCV_Haar_Cascade_Loader(const std::string& test_data_path, OutputLev ...@@ -441,7 +448,8 @@ bool nvidia_NCV_Haar_Cascade_Loader(const std::string& test_data_path, OutputLev
bool nvidia_NCV_Haar_Cascade_Application(const std::string& test_data_path, OutputLevel outputLevel) bool nvidia_NCV_Haar_Cascade_Application(const std::string& test_data_path, OutputLevel outputLevel)
{ {
path = test_data_path; path = test_data_path;
ncvSetDebugOutputHandler(devNullOutput); if (outputLevel != OutputLevelFull)
ncvSetDebugOutputHandler(devNullOutput);
NCVAutoTestLister testListerHaarAppl("Haar Cascade Application", outputLevel); NCVAutoTestLister testListerHaarAppl("Haar Cascade Application", outputLevel);
...@@ -455,7 +463,8 @@ bool nvidia_NCV_Haar_Cascade_Application(const std::string& test_data_path, Outp ...@@ -455,7 +463,8 @@ bool nvidia_NCV_Haar_Cascade_Application(const std::string& test_data_path, Outp
bool nvidia_NCV_Hypotheses_Filtration(const std::string& test_data_path, OutputLevel outputLevel) bool nvidia_NCV_Hypotheses_Filtration(const std::string& test_data_path, OutputLevel outputLevel)
{ {
path = test_data_path; path = test_data_path;
ncvSetDebugOutputHandler(devNullOutput); if (outputLevel != OutputLevelFull)
ncvSetDebugOutputHandler(devNullOutput);
NCVAutoTestLister testListerHypFiltration("Hypotheses Filtration", outputLevel); NCVAutoTestLister testListerHypFiltration("Hypotheses Filtration", outputLevel);
...@@ -469,7 +478,8 @@ bool nvidia_NCV_Hypotheses_Filtration(const std::string& test_data_path, OutputL ...@@ -469,7 +478,8 @@ bool nvidia_NCV_Hypotheses_Filtration(const std::string& test_data_path, OutputL
bool nvidia_NCV_Visualization(const std::string& test_data_path, OutputLevel outputLevel) bool nvidia_NCV_Visualization(const std::string& test_data_path, OutputLevel outputLevel)
{ {
path = test_data_path; path = test_data_path;
ncvSetDebugOutputHandler(devNullOutput); if (outputLevel != OutputLevelFull)
ncvSetDebugOutputHandler(devNullOutput);
NCVAutoTestLister testListerVisualize("Visualization", outputLevel); NCVAutoTestLister testListerVisualize("Visualization", outputLevel);
......
...@@ -278,18 +278,20 @@ struct SolvePnPRansac : testing::TestWithParam<cv::gpu::DeviceInfo> ...@@ -278,18 +278,20 @@ struct SolvePnPRansac : testing::TestWithParam<cv::gpu::DeviceInfo>
GPU_TEST_P(SolvePnPRansac, Accuracy) GPU_TEST_P(SolvePnPRansac, Accuracy)
{ {
cv::Mat object = randomMat(cv::Size(5000, 1), CV_32FC3, 0, 100); // Use RNG with fixed seed to be reproducable
cv::Mat camera_mat = randomMat(cv::Size(3, 3), CV_32F, 0.5, 1); cv::RNG rng(123456789);
cv::theRNG() = rng;
cv::Mat object = cvtest::randomMat(rng, cv::Size(5000, 1), CV_32FC3, 0, 100, false);
cv::Mat camera_mat = cvtest::randomMat(rng, cv::Size(3, 3), CV_32FC1, 0.5, 1, false);
camera_mat.at<float>(0, 1) = 0.f; camera_mat.at<float>(0, 1) = 0.f;
camera_mat.at<float>(1, 0) = 0.f; camera_mat.at<float>(1, 0) = 0.f;
camera_mat.at<float>(2, 0) = 0.f; camera_mat.at<float>(2, 0) = 0.f;
camera_mat.at<float>(2, 1) = 0.f; camera_mat.at<float>(2, 1) = 0.f;
std::vector<cv::Point2f> image_vec; std::vector<cv::Point2f> image_vec;
cv::Mat rvec_gold; cv::Mat rvec_gold = cvtest::randomMat(rng, cv::Size(3, 1), CV_32F, 0, 1, false);
cv::Mat tvec_gold; cv::Mat tvec_gold = cvtest::randomMat(rng, cv::Size(3, 1), CV_32F, 0, 1, false);
rvec_gold = randomMat(cv::Size(3, 1), CV_32F, 0, 1);
tvec_gold = randomMat(cv::Size(3, 1), CV_32F, 0, 1);
cv::projectPoints(object, rvec_gold, tvec_gold, camera_mat, cv::Mat(1, 8, CV_32F, cv::Scalar::all(0)), image_vec); cv::projectPoints(object, rvec_gold, tvec_gold, camera_mat, cv::Mat(1, 8, CV_32F, cv::Scalar::all(0)), image_vec);
cv::Mat rvec, tvec; cv::Mat rvec, tvec;
......
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