cant read image from .cu
why i cant run this code in .cu file while in cpp file is working?
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
Mat image;
image = imread("D://1.jpg", CV_LOAD_IMAGE_COLOR);
if (!image.data)
{
return -1;
}
namedWindow("Display window", WINDOW_AUTOSIZE);
imshow("Display window", image);
waitKey(0);
return 0;
}
no, you can't rename arbitrary c++ code to .cu, and expect it to run with cuda.
This is the first step before i allocate the data to GPU memory. I want to reload image in cpu first from .cu. i did the same for other type of data (.csv). But this case is jpg file
Is it possible to read the jpg file thru .cu and allocate to CPU memory first using opencv?
no. cuda kernels go into cu files, not cpp code for loading images (or uploading those to the gpu)
have a look at the cuda samples