Corrected the case where channel == -1
This commit is contained in:
parent
e4184195a2
commit
01f40cfafc
@ -42,7 +42,10 @@ template<typename T>
|
|||||||
thrust::permutation_iterator<thrust::device_ptr<T>, thrust::transform_iterator<step_functor<T>, thrust::counting_iterator<int>>> GpuMatBeginItr(cv::cuda::GpuMat mat, int channel = 0)
|
thrust::permutation_iterator<thrust::device_ptr<T>, thrust::transform_iterator<step_functor<T>, thrust::counting_iterator<int>>> GpuMatBeginItr(cv::cuda::GpuMat mat, int channel = 0)
|
||||||
{
|
{
|
||||||
if (channel == -1)
|
if (channel == -1)
|
||||||
|
{
|
||||||
mat = mat.reshape(1);
|
mat = mat.reshape(1);
|
||||||
|
channel = 0;
|
||||||
|
}
|
||||||
CV_Assert(mat.depth() == cv::DataType<T>::depth);
|
CV_Assert(mat.depth() == cv::DataType<T>::depth);
|
||||||
CV_Assert(channel < mat.channels());
|
CV_Assert(channel < mat.channels());
|
||||||
return thrust::make_permutation_iterator(thrust::device_pointer_cast(mat.ptr<T>(0) + channel),
|
return thrust::make_permutation_iterator(thrust::device_pointer_cast(mat.ptr<T>(0) + channel),
|
||||||
@ -59,7 +62,10 @@ template<typename T>
|
|||||||
thrust::permutation_iterator<thrust::device_ptr<T>, thrust::transform_iterator<step_functor<T>, thrust::counting_iterator<int>>> GpuMatEndItr(cv::cuda::GpuMat mat, int channel = 0)
|
thrust::permutation_iterator<thrust::device_ptr<T>, thrust::transform_iterator<step_functor<T>, thrust::counting_iterator<int>>> GpuMatEndItr(cv::cuda::GpuMat mat, int channel = 0)
|
||||||
{
|
{
|
||||||
if (channel == -1)
|
if (channel == -1)
|
||||||
|
{
|
||||||
mat = mat.reshape(1);
|
mat = mat.reshape(1);
|
||||||
|
channel = 0;
|
||||||
|
}
|
||||||
CV_Assert(mat.depth() == cv::DataType<T>::depth);
|
CV_Assert(mat.depth() == cv::DataType<T>::depth);
|
||||||
CV_Assert(channel < mat.channels());
|
CV_Assert(channel < mat.channels());
|
||||||
return thrust::make_permutation_iterator(thrust::device_pointer_cast(mat.ptr<T>(0) + channel),
|
return thrust::make_permutation_iterator(thrust::device_pointer_cast(mat.ptr<T>(0) + channel),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user