1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-30 07:43:03 +04:00

created wrappers for new NPP functions

removed void integral(const GpuMat& src, GpuMat& sum, GpuMat& sqsum, Stream& stream) - it fails with NPP_NOT_IMPLEMENTED error
updated docs, accuracy and performance tests
This commit is contained in:
Vladislav Vinogradov
2012-02-22 10:00:53 +00:00
parent e426dfc396
commit 2d30480982
37 changed files with 1984 additions and 566 deletions
+1 -1
View File
@@ -247,7 +247,7 @@ inline int clamp(int val, int minVal, int maxVal)
return max(min(val, maxVal), minVal);
}
void PointCloudRenderer::onMouseEvent(int event, int x, int y, int flags)
void PointCloudRenderer::onMouseEvent(int event, int x, int y, int /*flags*/)
{
static int oldx = x;
static int oldy = y;
+68
View File
@@ -0,0 +1,68 @@
#include <iostream>
#include "opencv2/core/opengl_interop.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/gpu/gpu.hpp"
using namespace std;
using namespace cv;
using namespace cv::gpu;
int main()
{
cout << "This program demonstrates using alphaComp" << endl;
cout << "Press SPACE to change compositing operation" << endl;
cout << "Press ESC to exit" << endl;
namedWindow("First Image", WINDOW_NORMAL);
namedWindow("Second Image", WINDOW_NORMAL);
namedWindow("Result", WINDOW_OPENGL);
setGlDevice();
Mat src1(640, 480, CV_8UC4, Scalar::all(0));
Mat src2(640, 480, CV_8UC4, Scalar::all(0));
rectangle(src1, Rect(50, 50, 200, 200), Scalar(0, 0, 255, 128), 30);
rectangle(src2, Rect(100, 100, 200, 200), Scalar(255, 0, 0, 128), 30);
GpuMat d_src1(src1);
GpuMat d_src2(src2);
GpuMat d_res;
imshow("First Image", src1);
imshow("Second Image", src2);
int alpha_op = ALPHA_OVER;
const char* op_names[] =
{
"ALPHA_OVER", "ALPHA_IN", "ALPHA_OUT", "ALPHA_ATOP", "ALPHA_XOR", "ALPHA_PLUS", "ALPHA_OVER_PREMUL", "ALPHA_IN_PREMUL", "ALPHA_OUT_PREMUL",
"ALPHA_ATOP_PREMUL", "ALPHA_XOR_PREMUL", "ALPHA_PLUS_PREMUL", "ALPHA_PREMUL"
};
while (true)
{
cout << op_names[alpha_op] << endl;
alphaComp(d_src1, d_src2, d_res, alpha_op);
imshow("Result", d_res);
char key = static_cast<char>(waitKey());
if (key == 27)
break;
if (key == 32)
{
++alpha_op;
if (alpha_op > ALPHA_PREMUL)
alpha_op = ALPHA_OVER;
}
}
return 0;
}
+1 -1
View File
@@ -226,7 +226,7 @@ int main(int argc, const char* argv[])
break;
case 'S':
if (currentFrame < frames.size() - 1)
if (currentFrame < static_cast<int>(frames.size()) - 1)
++currentFrame;
imshow("Interpolated frame", frames[currentFrame]);
+3 -3
View File
@@ -26,7 +26,7 @@ void colorizeFlow(const Mat &u, const Mat &v, Mat &dst)
minMaxLoc(v, &vMin, &vMax, 0, 0);
uMin = ::abs(uMin); uMax = ::abs(uMax);
vMin = ::abs(vMin); vMax = ::abs(vMax);
float dMax = ::max(::max(uMin, uMax), ::max(vMin, vMax));
float dMax = static_cast<float>(::max(::max(uMin, uMax), ::max(vMin, vMax)));
dst.create(u.size(), CV_8UC3);
for (int y = 0; y < u.rows; ++y)
@@ -111,11 +111,11 @@ int main(int argc, char **argv)
s.str("");
s << "opt. flow FPS: " << cvRound((getTickFrequency()/(tc1-tc0)));
putText(image, s.str(), Point(5, 65), FONT_HERSHEY_SIMPLEX, 1., Scalar(255,0,255), 2.);
putText(image, s.str(), Point(5, 65), FONT_HERSHEY_SIMPLEX, 1., Scalar(255,0,255), 2);
s.str("");
s << "total FPS: " << cvRound((getTickFrequency()/(t1-t0)));
putText(image, s.str(), Point(5, 105), FONT_HERSHEY_SIMPLEX, 1., Scalar(255,0,255), 2.);
putText(image, s.str(), Point(5, 105), FONT_HERSHEY_SIMPLEX, 1., Scalar(255,0,255), 2);
imshow("flow", image);
+1 -1
View File
@@ -63,7 +63,7 @@ void TestSystem::finishCurrentSubtest()
double cpu_time = cpu_elapsed_ / getTickFrequency() * 1000.0;
double gpu_time = gpu_elapsed_ / getTickFrequency() * 1000.0;
double speedup = static_cast<double>(cpu_elapsed_) / std::max((int64)1, gpu_elapsed_);
double speedup = static_cast<double>(cpu_elapsed_) / std::max(1.0, gpu_elapsed_);
speedup_total_ += speedup;
printMetrics(cpu_time, gpu_time, speedup);
+4 -2
View File
@@ -127,8 +127,10 @@ private:
std::stringstream cur_subtest_description_;
bool cur_subtest_is_empty_;
int64 cpu_started_, cpu_elapsed_;
int64 gpu_started_, gpu_elapsed_;
int64 cpu_started_;
int64 gpu_started_;
double cpu_elapsed_;
double gpu_elapsed_;
double speedup_total_;
int num_subtests_called_;
+1 -1
View File
@@ -1199,7 +1199,7 @@ TEST(FarnebackOpticalFlow)
if (frame1.empty()) throw runtime_error("can't open " + datasets[i] + "2.png");
gpu::FarnebackOpticalFlow calc;
calc.fastPyramids = fastPyramids;
calc.fastPyramids = fastPyramids != 0;
calc.flags |= useGaussianBlur ? OPTFLOW_FARNEBACK_GAUSSIAN : 0;
gpu::GpuMat d_frame0(frame0), d_frame1(frame1), d_flowx, d_flowy;