Commit 397a6353 authored by Alexey Spizhevoy's avatar Alexey Spizhevoy

fixed bug in performance test matrix generation

parent 7e3c69c8
...@@ -4,22 +4,12 @@ ...@@ -4,22 +4,12 @@
using namespace std; using namespace std;
using namespace cv; using namespace cv;
void Test::gen(Mat& mat, int rows, int cols, int type) void Test::gen(Mat& mat, int rows, int cols, int type, Scalar low, Scalar high)
{
mat.create(rows, cols, type);
Mat mat8u(rows, cols * mat.elemSize(), CV_8U, mat.data, mat.step);
RNG rng(0);
rng.fill(mat, RNG::UNIFORM, Scalar(0), Scalar(256));
}
void Test::gen(Mat& mat, int rows, int cols, int type, double low, double high)
{ {
mat.create(rows, cols, type); mat.create(rows, cols, type);
RNG rng(0); RNG rng(0);
rng.fill(mat, RNG::UNIFORM, Scalar::all(low), Scalar::all(high)); rng.fill(mat, RNG::UNIFORM, low, high);
} }
......
...@@ -14,8 +14,8 @@ public: ...@@ -14,8 +14,8 @@ public:
const std::string& name() const { return name_; } const std::string& name() const { return name_; }
void gen(cv::Mat& mat, int rows, int cols, int type); void gen(cv::Mat& mat, int rows, int cols, int type,
void gen(cv::Mat& mat, int rows, int cols, int type, double low, double high); cv::Scalar low, cv::Scalar high);
virtual void run() = 0; virtual void run() = 0;
......
#include <opencv2/imgproc/imgproc.hpp> #include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/gpu/gpu.hpp> #include <opencv2/gpu/gpu.hpp>
#include "performance.h" #include "performance.h"
...@@ -8,7 +9,7 @@ using namespace cv; ...@@ -8,7 +9,7 @@ using namespace cv;
TEST(matchTemplate) TEST(matchTemplate)
{ {
Mat image, templ, result; Mat image, templ, result;
gen(image, 3000, 3000, CV_32F); gen(image, 3000, 3000, CV_32F, 0, 1);
gpu::GpuMat d_image(image), d_templ, d_result; gpu::GpuMat d_image(image), d_templ, d_result;
...@@ -16,7 +17,7 @@ TEST(matchTemplate) ...@@ -16,7 +17,7 @@ TEST(matchTemplate)
{ {
SUBTEST << "img " << image.rows << ", templ " << templ_size << ", 32F, CCORR"; SUBTEST << "img " << image.rows << ", templ " << templ_size << ", 32F, CCORR";
gen(templ, templ_size, templ_size, CV_32F); gen(templ, templ_size, templ_size, CV_32F, 0, 1);
CPU_ON; CPU_ON;
matchTemplate(image, templ, result, CV_TM_CCORR); matchTemplate(image, templ, result, CV_TM_CCORR);
...@@ -43,7 +44,7 @@ TEST(minMaxLoc) ...@@ -43,7 +44,7 @@ TEST(minMaxLoc)
{ {
SUBTEST << "img " << size << ", 32F, no mask"; SUBTEST << "img " << size << ", 32F, no mask";
gen(src, size, size, CV_32F); gen(src, size, size, CV_32F, 0, 1);
CPU_ON; CPU_ON;
minMaxLoc(src, &min_val, &max_val, &min_loc, &max_loc); minMaxLoc(src, &min_val, &max_val, &min_loc, &max_loc);
...@@ -67,9 +68,9 @@ TEST(remap) ...@@ -67,9 +68,9 @@ TEST(remap)
{ {
SUBTEST << "img " << size << " and 8UC1, 32FC1 maps"; SUBTEST << "img " << size << " and 8UC1, 32FC1 maps";
gen(src, size, size, CV_8UC1); gen(src, size, size, CV_8UC1, 0, 256);
gen(xmap, size, size, CV_32FC1, 0, size); gen(xmap, size, size, CV_32F, 0, size);
gen(ymap, size, size, CV_32FC1, 0, size); gen(ymap, size, size, CV_32F, 0, size);
CPU_ON; CPU_ON;
remap(src, dst, xmap, ymap, INTER_LINEAR); remap(src, dst, xmap, ymap, INTER_LINEAR);
...@@ -91,11 +92,11 @@ TEST(dft) ...@@ -91,11 +92,11 @@ TEST(dft)
Mat src, dst; Mat src, dst;
gpu::GpuMat d_src, d_dst; gpu::GpuMat d_src, d_dst;
for (int size = 1000; size <= 4000; size += 1000) for (int size = 1000; size <= 4000; size *= 2)
{ {
SUBTEST << "size " << size << ", 32FC2, complex-to-complex"; SUBTEST << "size " << size << ", 32FC2, complex-to-complex";
gen(src, size, size, CV_32FC2); gen(src, size, size, CV_32FC2, Scalar::all(0), Scalar::all(1));
CPU_ON; CPU_ON;
dft(src, dst); dft(src, dst);
...@@ -119,7 +120,7 @@ TEST(cornerHarris) ...@@ -119,7 +120,7 @@ TEST(cornerHarris)
{ {
SUBTEST << "size " << size << ", 32FC1"; SUBTEST << "size " << size << ", 32FC1";
gen(src, size, size, CV_32FC1); gen(src, size, size, CV_32F, 0, 1);
CPU_ON; CPU_ON;
cornerHarris(src, dst, 5, 7, 0.1, BORDER_REFLECT101); cornerHarris(src, dst, 5, 7, 0.1, BORDER_REFLECT101);
......
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