OpenCV用thrust使用cv :: cuda :: GpuMat
用thrust使用cv :: cuda :: GpuMat
目标
Thrust是用于各种cuda加速算法的极其强大的库。但是,thrust被设计为可用于矢量,而不适用于倾斜矩阵。以下教程将讨论将cv :: cuda :: GpuMat包装到thrust迭代器中,该thrust迭代器可与thrust算法一起使用。
本教程应向您展示如何:
将GpuMat包装到thrust迭代器中
用随机数填充GpuMat
在适当位置对GpuMat的列进行排序
将大于0的值复制到新的GPU矩阵
用thrust推流
将GpuMat包装到thrust迭代器中
以下代码将为GpuMat生成一个迭代器
/*
@Brief GpuMatBeginItr returns a thrust compatible iterator to the beginning of a GPU mat's memory.
@Param mat is the input matrix
@Param channel is the channel of the matrix that the iterator is acce