Ask Your Question

# Revision history [back]

### Converting GpuMat 32FC1 > 8UC1

Hello together,

i've got a problem with converting an GpuMat (the same problem i have, when i'm doing it with a cv::Mat). I want to delete some areas from a picture (gm_temp) where the threshold of the depth stored in another matrix (gm_depth) is under a certain value (sts.d_treshold). Because cuda::treshold converts the gm_mask to 32FC1, i need to convert it to 8UC1 to be able to multiply it with gm_temp. But after the conversion gm_mask only have zeros in its matrix, although it had the proper values before.

          cv::cuda::GpuMat gm_mask (gm_temp.rows, gm_temp.cols, CV_8UC1, 0.0);
gm_depth.upload(m_depth);
cuda::resize(gm_depth, gm_depth, Size(gm_temp.cols, gm_temp.rows));
cuda::threshold(gm_depth, gm_mask, sts.d_treshold, 1.0, THRESH_BINARY);
gm_mask.convertTo(gm_mask, CV_8UC1, 255.0/1.0, 0);
cuda::multiply(gm_temp, gm_mask, gm_temp);


### Converting GpuMat 32FC1 > 8UC1

Hello together,

i've got a problem with converting an GpuMat (the same problem i have, when i'm doing it with a cv::Mat). I want to delete some areas from a picture (gm_temp) where the threshold of the depth stored in another matrix (gm_depth) is under a certain value (sts.d_treshold). Because cuda::treshold converts the gm_mask to 32FC1, i need to convert it to 8UC1 to be able to multiply it with gm_temp. But after the conversion gm_mask only have zeros in its matrix, although it had the proper values before.

          cv::cuda::GpuMat gm_mask (gm_temp.rows, gm_temp.cols, CV_8UC1, 0.0);
gm_depth.upload(m_depth);
cuda::resize(gm_depth, gm_depth, Size(gm_temp.cols, gm_temp.rows));
cuda::threshold(gm_depth, gm_mask, sts.d_treshold, 1.0, THRESH_BINARY);
THRESH_BINARY); // Until here it's working fine.
gm_mask.convertTo(gm_mask, CV_8UC1, 255.0/1.0, 0);
cuda::multiply(gm_temp, gm_mask, gm_temp);


### Converting GpuMat 32FC1 > 8UC1

Hello together,

i've got a problem with converting an GpuMat (the same problem i have, when i'm doing it with a cv::Mat). I want to delete some areas from a picture (gm_temp) where the threshold of the depth depth, stored in another matrix (gm_depth) (gm_depth), is under a certain value (sts.d_treshold). Because cuda::treshold converts the gm_mask to 32FC1, i need to convert it to 8UC1 to be able to multiply it with gm_temp. But after the conversion gm_mask only have zeros in its matrix, although it had the proper values before.

          cv::cuda::GpuMat gm_mask (gm_temp.rows, gm_temp.cols, CV_8UC1, 0.0);
gm_depth.upload(m_depth);
cuda::resize(gm_depth, gm_depth, Size(gm_temp.cols, gm_temp.rows));
cuda::threshold(gm_depth, gm_mask, sts.d_treshold, 1.0, THRESH_BINARY); // Until here it's working fine.
gm_mask.convertTo(gm_mask, CV_8UC1, 255.0/1.0, 0);
cuda::multiply(gm_temp, gm_mask, gm_temp);


### Converting GpuMat 32FC1 > 8UC1

Hello together,

i've got a problem with converting an GpuMat (the same problem i have, when i'm doing it with a cv::Mat). I want to delete some areas from a picture (gm_temp) where the threshold of the depth, stored in another matrix (gm_depth), is under a certain value (sts.d_treshold). Because cuda::treshold converts the gm_mask to 32FC1, i need to convert it back to 8UC1 to be able to multiply it with gm_temp. But after the conversion gm_mask only have zeros in its matrix, although it had the proper values before.

          cv::cuda::GpuMat gm_mask (gm_temp.rows, gm_temp.cols, CV_8UC1, 0.0);
gm_depth.upload(m_depth);
cuda::resize(gm_depth, gm_depth, Size(gm_temp.cols, gm_temp.rows));
cuda::threshold(gm_depth, gm_mask, sts.d_treshold, 1.0, THRESH_BINARY); // Until here it's working fine.
gm_mask.convertTo(gm_mask, CV_8UC1, 255.0/1.0, 0);
cuda::multiply(gm_temp, gm_mask, gm_temp);

 5 retagged pklab 4284 ●7 ●30 ●60

### Converting GpuMat 32FC1 > 8UC1

Hello together,

i've got a problem with converting an GpuMat (the same problem i have, when i'm doing it with a cv::Mat). I want to delete some areas from a picture (gm_temp) where the threshold of the depth, stored in another matrix (gm_depth), is under a certain value (sts.d_treshold). Because cuda::treshold converts the gm_mask to 32FC1, i need to convert it back to 8UC1 to be able to multiply it with gm_temp. But after the conversion gm_mask only have zeros in its matrix, although it had the proper values before.

          cv::cuda::GpuMat gm_mask (gm_temp.rows, gm_temp.cols, CV_8UC1, 0.0);
gm_depth.upload(m_depth);
cuda::resize(gm_depth, gm_depth, Size(gm_temp.cols, gm_temp.rows));
cuda::threshold(gm_depth, gm_mask, sts.d_treshold, 1.0, THRESH_BINARY); // Until here it's working fine.
gm_mask.convertTo(gm_mask, CV_8UC1, 255.0/1.0, 0);
cuda::multiply(gm_temp, gm_mask, gm_temp);