cant read image from .cu

asked 2018-07-11 04:12:57 -0600

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;
}
edit retag flag offensive close merge delete

Comments

no, you can't rename arbitrary c++ code to .cu, and expect it to run with cuda.

berak gravatar imageberak ( 2018-07-11 04:17:39 -0600 )edit

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

psanjaya gravatar imagepsanjaya ( 2018-07-11 04:38:02 -0600 )edit

Is it possible to read the jpg file thru .cu and allocate to CPU memory first using opencv?

psanjaya gravatar imagepsanjaya ( 2018-07-11 04:40:07 -0600 )edit

Is it possible to read the jpg file based on .cu

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

berak gravatar imageberak ( 2018-07-11 04:43:18 -0600 )edit