Having trouble getting OPEN CV 4.12 working on VS22

GoodNewsJim
Sun, 17 Aug 2025 02:57:17 +0000
Uncategorized

Hello,

I was able to get OPENCV to make an image and save it, but loading an image always says:

[ WARN:0@0.060] global loadsave.cpp:275 cv::findDecoder imread_(‘’): can’t open/read file: check file path/integrity
OpenCV failed to load image

I tried .jpg, .bmp, .png Nothing loads…

My code:

std::string path = “C:\\openCvProject1\\openCvProject1\\ms_test.png”;

cv::Mat img = cv::imread(path, cv::IMREAD_COLOR); // Load as color image

if (img.empty()) {
std::cout << "Failed to load image at: " << path << std::endl;
return -1;
}

std::cout << "Image loaded successfully: " << img.cols << “x” << img.rows << std::endl;

cv::imshow(“Loaded Image”, img);
cv::waitKey(0);

return 0;

If anyone can help, that’d be great, I’m making an tracker for a robot that should be easy, one big color to look for.

5 posts - 2 participants