GPU resize Ubuntu 12.04
I installed OpenCV 2.4.6.1 on Ubuntu 12.04 with CUDA turned on. I have Cuda version 5.0 installed. While I can run the sample on http://opencv.willowgarage.com/wiki/OpenCV_GPU, when I try to run the following progrm:
#include <iostream>
#include "opencv2/opencv.hpp"
#include "opencv2/gpu/gpu.hpp"
using namespace cv;
int main (int argc, char* argv[])
{
try
{
std::cout << CV_VERSION ;
Mat src_host = imread("sunset.jpg", CV_LOAD_IMAGE_COLOR);
gpu::GpuMat dst, src;
src.upload(src_host);
gpu::resize(src, dst, Size(256, 256), 0, 0, INTER_CUBIC);
Mat dst_host(dst);
imwrite("out.jpeg", dst);
return 0;
}
catch(const cv::Exception& ex)
{
std::cout << "Error: " << ex.what() << std::endl;
}
return 0;
}
I get the following error: OpenCV Error: Assertion failed (k == STD_VECTOR_MAT) in getMat, file /home/opencv-2.4.6.1/modules/core/src/matrix.cpp, line 988 2.4.6.1Error: /home/opencv-2.4.6.1/modules/core/src/matrix.cpp:988: error: (-215) k == STD_VECTOR_MAT in function getMat
I have a GTX 460 which scores a 2.1 on the Nvidia compute capability score. Has any one else run into this problem?
I also get this sometimes: OpenCV Error: Gpu API call (out of memory) in mallocPitch, file /home/opencv-2.4.6.1/modules/core/src/gpumat.cpp, line 1415 2.4.6.1Error: /home/opencv-2.4.6.1/modules/core/src/gpumat.cpp:1415: error: (-217) out of memory in function mallocPitch Not sure when I get the previous error vs this one.
Are you sure the crash happens in gpu::resize or maybe it is Mat dst_host(dst)?
Actually passing a GpuMat instance to imwrite was the issue.