Ask Your Question

Revision history [back]

How to use cuda::cvtColor?

Hello, for testing purposes, I want to capture an image from a webcam, upload it to the gpu, cuda::cvtColor, cuda::threshold, and then display it. I have the capture working fine, im stuck at cuda::cvtColor. my includes are this:

#include "opencv2/core.hpp"
#include "opencv2/opencv.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/core/cuda.hpp"
#include "opencv2/cudaimgproc.hpp"

#include <iostream>

and here is the code that is giving me trouble:

cuda::cvtColor(gpuMat, grayGpuMat, cuda::COLOR_RGB2GRAY);

The error is this:

error: ‘COLOR_RGB2GRAY’ is not a member of ‘cv::cuda’
     cuda::cvtColor(gpuMat, grayGpuMat, cuda::COLOR_RGB2GRAY);

it suggests to use cv::COLOR_RGB2GRAY.

So, what am I doing wrong.

How to use cuda::cvtColor?

Hello, for testing purposes, I want to capture an image from a webcam, upload it to the gpu, cuda::cvtColor, cuda::threshold, and then display it. I have the capture working fine, im stuck at cuda::cvtColor. my includes are this:

#include "opencv2/core.hpp"
#include "opencv2/opencv.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/videoio.hpp"
#include "opencv2/core/cuda.hpp"
#include "opencv2/cudaimgproc.hpp"

#include <iostream>

and here is the code that is giving me trouble:

cuda::cvtColor(gpuMat, grayGpuMat, cuda::COLOR_RGB2GRAY);

The error is this:

error: ‘COLOR_RGB2GRAY’ is not a member of ‘cv::cuda’
     cuda::cvtColor(gpuMat, grayGpuMat, cuda::COLOR_RGB2GRAY);

it suggests to use cv::COLOR_RGB2GRAY.

So, what am I doing wrong.

UPDATE: I now have determined that I cannot link properly, error being:

/usr/bin/ld: cannot find -lopencv_cudaimgproc