小编use*_*328的帖子

OpenCV CUDA运行速度比OpenCV CPU慢

当我从avi文件中读取视频时,我一直在努力让OpenCV CUDA提高性能,例如侵蚀/扩张,帧差异等.典型的是我在GPU(580gtx)上获得FPS的一半而不是CPU(AMD 955BE).在你问我是否正确测量fps之前,你可以用肉眼清楚地看到GPU上的延迟,特别是在使用高腐蚀/扩张水平时.

看来我不是在并行读取帧?这是代码:

#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/video/tracking.hpp>
#include <opencv2/gpu/gpu.hpp>
#include <stdlib.h>
#include <stdio.h>

using namespace cv;
using namespace cv::gpu;

Mat cpuSrc;
GpuMat src, dst;

int element_shape = MORPH_RECT;

//the address of variable which receives trackbar position update
int max_iters = 10;
int open_close_pos = 0;
int erode_dilate_pos = 0;

// callback function for open/close trackbar
void OpenClose(int)
{
     IplImage disp;
     Mat temp;
    int n = open_close_pos - max_iters;
    int an = n > 0 ? n : …
Run Code Online (Sandbox Code Playgroud)

c++ parallel-processing opencv cuda

5
推荐指数
1
解决办法
6126
查看次数

在linux上编译一个基本的OpenCV + Cuda程序

我过去曾在linux上使用opencv,但没有使用cuda.几个月来,我一直在努力解决以下编译错误.在尝试了许多解决方案后,我放弃了并使用了Windows.但是,我真的想在linux上工作.这是我用来编译opencv_gpu网站上给出的阈值示例的命令.

nvcc `pkg-config --libs opencv` -L. -L/usr/local/cuda/lib -lcuda -lcudart `pkg-config --cflags opencv` -I. -I/usr/local/cuda/include threshold.cpp -o threshold
Run Code Online (Sandbox Code Playgroud)

这是错误:

/tmp/tmpxft_0000171b_00000000-1_threshold.o: In function `main':
threshold.cpp:(.text+0x124): undefined reference to `cv::gpu::Stream::Null()'
threshold.cpp:(.text+0x156): undefined reference to `cv::gpu::threshold(cv::gpu::GpuMat const&, cv::gpu::GpuMat&, double, double, int, cv::gpu::Stream&)'
threshold.cpp:(.text+0x16d): undefined reference to `cv::gpu::GpuMat::download(cv::Mat&) const'
/tmp/tmpxft_0000171b_00000000-1_threshold.o: In function `cv::gpu::GpuMat::GpuMat(cv::Mat const&)':
threshold.cpp:(.text._ZN2cv3gpu6GpuMatC1ERKNS_3MatE[cv::gpu::GpuMat::GpuMat(cv::Mat const&)]+0x63): undefined reference to `cv::gpu::GpuMat::upload(cv::Mat const&)'
/tmp/tmpxft_0000171b_00000000-1_threshold.o: In function `cv::gpu::GpuMat::~GpuMat()':
threshold.cpp:(.text._ZN2cv3gpu6GpuMatD1Ev[cv::gpu::GpuMat::~GpuMat()]+0xd): undefined reference to `cv::gpu::GpuMat::release()'                                        
collect2: ld returned 1 exit status                                                                                                                                     
make: *** [all] Error 1   
Run Code Online (Sandbox Code Playgroud)

c c++ linux opencv cuda

2
推荐指数
1
解决办法
9299
查看次数

标签 统计

c++ ×2

cuda ×2

opencv ×2

c ×1

linux ×1

parallel-processing ×1