Hi
I can successfully use OpenCV on my laptop for reading/processing images in C++ using VisualStudio.
On the Google Colab however, I get into problem.
The OpenCV is pre-installed on Colab, so we should be able to use it simply, but I fail to do it!
Can anyone post me a simple imread/imshow in C++ on the Google Colab from scratch?
P.S.: I assume there is no need to install anything on Jupyter, since OpenCV 4.7.0 is already installed on the jupyter.
Here is a snapshot of my code which fails to run, because of this error: undefined reference to `cv::imread
=============================
%%cu
#include "cuda_runtime.h"
#include "device_launch_parameters.h"
#include <stdio.h>
#include <stdlib.h>
#include <cstdlib>
#include <time.h>
#include <chrono>
#include "../include/opencv4/opencv2/opencv_modules.hpp"
#include "../include/opencv4/opencv2/opencv.hpp"
#include "../include/opencv4/opencv2/core/core.hpp"
#include "../include/opencv4/opencv2/highgui/highgui.hpp"
#include "../include/opencv4/opencv2/imgproc/imgproc.hpp"
#include "iostream"
using namespace cv;
using namespace std;
#ifdef _DEBUG
#pragma comment (lib, "opencv_world412d.lib")
#else
#pragma comment (lib, "opencv_world412.lib")
#endif
#define CHANNELS 3
//#define run_serial 1//1=serial, 2=OpenCV, 3=GPU
//#define run_opencv 2//1=serial, 2=OpenCV, 3=GPU
#define run_gpu 3//1=serial, 2=OpenCV, 3=GPU
int main()
{
const char* img_color_name = "remastered-lena-512x512.tiff";
cv::Mat img;
img = cv::imread(img_color_name);
// wait for a key
cv::waitKey(0);
}
========================