I want to try it by building a simple example of opencv using cuda. For example
#include <iostream>
#include "opencv2/opencv.hpp"
int main (int argc, char* argv[])
{
//Read Two Images
cv::Mat h_img1 = cv::imread("images/cameraman.tif");
cv::Mat h_img2 = cv::imread("images/circles.png");
//Create Memory for storing Images on device
cv::cuda::GpuMat d_result1,d_img1, d_img2;
cv::Mat h_result1;
//Upload Images to device
d_img1.upload(h_img1);
d_img2.upload(h_img2);
cv::cuda::add(d_img1,d_img2, d_result1);
//Download Result back to host
d_result1.download(h_result1);
cv::imshow("Image1 ", h_img1);
cv::imshow("Image2 ", h_img2);
cv::imshow("Result addition ", h_result1);
cv::imwrite("images/result_add.png", h_result1);
cv::waitKey();
return 0;
}
Package opencv was not found in the pkg-config search path.
Perhaps you should add the directory containing `opencv.pc'
to the PKG_CONFIG_PATH environment variable
No package 'opencv' found
one.cpp:2:10: fatal error: opencv2/opencv.hpp: No such file or directory
2 | #include "opencv2/opencv.hpp"
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated
Please advice.