Код: Выделить всё
apt install libopencv-dev
Код: Выделить всё
#include
#include
using namespace cv;
int main() {
std::string image_path = "Downloads/my-image.jpeg";
Mat img = imread(image_path, IMREAD_COLOR);
imshow("Display window", img);
int k = waitKey(0); // Wait for a keystroke in the window
return 0;
}
После этого болезненного процесса я наконец смог скомпилировать файл opencv.cc... по крайней мере, я так думал. Ниже приведена ошибка (переведенная на английский язык), которую я получаю после запуска той же базовой команды g++, что и выше:
Код: Выделить всё
/usr/bin/ld: /tmp/ccMkLdrJ.o: in function "main":
opencv.cc:(.text+0x74): reference not set to "cv::imread(std::__cxx11::basic_string const&, int)"
/usr/bin/ld: opencv.cc:(.text+0xd2): reference not set to "cv::imshow(std::__cxx11::basic_string const&, cv::_InputArray const&)"
/usr/bin/ld: opencv.cc:(.text+0x109): reference not set to "cv::waitKey(int)"
/usr/bin/ld: opencv.cc:(.text+0x120): reference not set to "cv::Mat::~Mat()"
/usr/bin/ld: opencv.cc:(.text+0x1bc): reference not set to "cv::Mat::~Mat()"
collect2: error: ld returned 1 exit status
Подробнее здесь: https://stackoverflow.com/questions/798 ... ectory-pat
Мобильная версия