c++ - Assertion failed (image.type() == CV_32F). GPU convolution. OpenCV -
i got error when tried use gpu convolution.
opencv error: assertion failed (image.type() == cv_32f) in cv::gpu::convolve, file d:\opencv\sources\modules\gpu\src\imgproc.cpp, line 1413
i've converted image type cv_32 have issue. have similar issue when using gpu::filter2d.
(i have no problem using sobel or gaussianblur in gpu.)
however, when in main:
int a=image.type(); value of 21. not cv_32f.
please let me know how resolve issue! need help!! thank you!!!
using namespace cv; using namespace std; int main() { // read kernel text file int kernel_size=15; ifstream fin; fin.open ("psf00.txt"); float kernel0[15][15]; (int i=0; i<kernel_size; i++) { (int j=0; j<kernel_size; j++) { fin >> kernel0[i][j]; } } // save 2d kernel array mat format mat kernel = mat(kernel_size, kernel_size, cv_32f, kernel0); // load image mat image = imread("blurry_00.jpg"); image.convertto(image, cv_32f); // gpu gpu::gpumat gpu_input, gpu_input1, gpu_output, gpu_kernel; gpu_input.upload(image); gpu_kernel.upload(kernel); gpu_input.convertto(gpu_input1, cv_32f); gpu::convolve(gpu_input1, gpu_kernel, gpu_output); // download image gpu cpu mat dst(gpu_output); dst.convertto(dst, cv_8u); // create window display. namedwindow( "display window (gpu)", window_autosize ); imshow( "display window (gpu)", dst ); waitkey(0); return 0;
i think you've got answer, 21 cv_32f.
#define cv_maketype(depth,cn) (cv_mat_depth(depth) + (((cn)-1) << cv_cn_shift)) #define cv_8s 1 //depth #define cv_32f 5 //cn #define cv_mat_depth(flags) ((flags) & cv_mat_depth_mask) 0x21 -> cn = 5, depth = 1
Comments
Post a Comment