Mọi người cho em hỏi chút ạ em mới dùng opencv nên cũng chưa rõ tức là em đang viết code trên Visual studio 2019.Em đã setup mọi thứ ổn thỏa theo hướng dẫn rồi nhưng lúc em chạy chường trình sau
#include <opencv2/imgcodecs.hpp>
#include <opencv2/highgui.hpp>
#include <opencv2/imgproc.hpp>
#include <iostream>
using namespace cv;
using namespace std;
///////////////// Images //////////////////////
int main()
{
string path = "C:\Users\acer\Pictures\anh vui\Hacker.jpg";
Mat img = imread(path);
imshow("Image", img);
//waitKey(0);
return 0;
}
Lúc chạy debug thì nó ra như vậy
Console trả về một đống linh tinh mà em không hiểu là gì luôn.
[ INFO:0] global c:\build\master_winpack-build-win64-vc15\opencv\modules\highgui\src\registry.impl.hpp (114) cv::highgui_backend::UIBackendRegistry::UIBackendRegistry UI: Enabled backends(4, sorted by priority): GTK(1000); GTK3(990); GTK2(980); WIN32(970) + BUILTIN(WIN32UI)
[ INFO:0] global c:\build\master_winpack-build-win64-vc15\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load D:\opencv\build\x64\vc15\bin\opencv_highgui_gtk453_64.dll => FAILED
[ INFO:0] global c:\build\master_winpack-build-win64-vc15\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load opencv_highgui_gtk453_64.dll => FAILED
[ INFO:0] global c:\build\master_winpack-build-win64-vc15\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load D:\opencv\build\x64\vc15\bin\opencv_highgui_gtk3453_64.dll => FAILED
[ INFO:0] global c:\build\master_winpack-build-win64-vc15\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load opencv_highgui_gtk3453_64.dll => FAILED
[ INFO:0] global c:\build\master_winpack-build-win64-vc15\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load D:\opencv\build\x64\vc15\bin\opencv_highgui_gtk2453_64.dll => FAILED
[ INFO:0] global c:\build\master_winpack-build-win64-vc15\opencv\modules\core\src\utils\plugin_loader.impl.hpp (67) cv::plugin::impl::DynamicLib::libraryLoad load opencv_highgui_gtk2453_64.dll => FAILED
[ INFO:0] global C:\build\master_winpack-build-win64-vc15\opencv\modules\highgui\src\backend.cpp (90) cv::highgui_backend::createUIBackend UI: using backend: WIN32 (priority=970)
[ INFO:0] global C:\build\master_winpack-build-win64-vc15\opencv\modules\highgui\src\window_w32.cpp (3009) cv::impl::Win32BackendUI::createWindow OpenCV/UI: Creating Win32UI window: Image (1)
OpenCV(4.5.3) Error: Assertion failed (!_src.empty()) in cv::cvtColor, file C:\build\master_winpack-build-win64-vc15\opencv\modules\imgproc\src\color.cpp, line 182
OpenCV: terminate handler is called! The last OpenCV error is:
OpenCV(4.5.3) Error: Assertion failed (!_src.empty()) in cv::cvtColor, file C:\build\master_winpack-build-win64-vc15\opencv\modules\imgproc\src\color.cpp, line 182
D:\Project\Project Germany\x64\Debug\Project Germany.exe (process 13836) exited with code 3.
Press any key to close this window . . .
Em cảm ơn ạ.