Ask Your Question
1

GpuMat misses operators, and functions that compared with Mat

asked 2013-10-02 01:16:14 -0600

Compvis gravatar image

updated 2013-10-02 01:21:00 -0600

Hi, I build Opencv 3.0 from source. I want to implement operators: +, -, *, / with GpuMat but i can't find them.

GpuMat also misses function "at", "zeros" and else functions (compared to Mat). I want to implement:

GpuMat sm;

.... int id = sm.at<uchar>(x,y);

And also with "zeros" function

Thanks

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
4

answered 2013-10-02 04:24:26 -0600

Vladislav Vinogradov gravatar image

You can't use at method with GpuMat in CPU code. GpuMat data is located in GPU memory and can't be accessed from CPU code. You can only download data to host, modify it on host and upload back to GPU. Or implement your own CUDA kernel.

There is no expressions like +, -, *, / and zeros for GpuMat. But it is just a syntax sugar, you can use add, subtract, multiply, divide and setTo functions for that purpose.

edit flag offensive delete link more

Comments

Because of without "at" function, i want to implement a function below in GPU but i couldn't. Could you pls help me?

inline uchar lbp(const Mat& image, int x, int y) { uchar v = image.at<uchar>(y, x) + 4; }

Compvis gravatar imageCompvis ( 2013-10-02 09:25:19 -0600 )edit

Also with GpuMat, i couldn't implement GpuMat_ template with this:

cv::Mat_<float> m_transition_matrix = *(Mat_<float>(NUM_STATES, NUM_STATES) << 1, 0, DT, 0, 0, 0, 1, 0, DT, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1);

Compvis gravatar imageCompvis ( 2013-10-02 09:29:23 -0600 )edit

Question Tools

Stats

Asked: 2013-10-02 01:16:14 -0600

Seen: 582 times

Last updated: Oct 02 '13