Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

You can't access GpuMat element in cpu code. You should create Mat object first, fill it and upload it to gpu memory:

Mat host_mat(rows, cols, type);
// fill host_mat
GpuMat dev_mat;
dev_mat.upload(host_mat);

If you want to fill GpuMat with some value (ex. zero) you can use setTo method:

GpuMat dev_mat(rows, cols, type);
dev_mat.setTo(Scalar::all(0));