我是 C++ 新手,正在尝试阅读我在网上找到的一些 OpenCV 教程。我完全按照在 Visual Studio 2013 中找到的代码生成了代码,并且能够正确运行代码。但是,我不断收到错误消息:
(按重试调试应用程序)调试错误!
程序:...rface_Basics\x64\Debug\OpenCV_Basics_CPP_Interface_Basics.exe
R6025 - 纯虚函数调用
(按重试调试应用程序)
我正在阅读有关纯虚函数的内容,听起来您至少必须声明一个虚函数才能发生此错误,这只会导致更多混乱。下面是我的代码:
#include <opencv2\opencv.hpp>
#include <iostream>
using namespace cv;
using namespace std;
//main functions
void processImage();
void displayGraphics();
//images
Mat image;
Mat processedImage;
int main(int argc, char *argv[])
{
//create a window
namedWindow("Image");
namedWindow("ProcessedImage");
//load the image
if (argc > 1)
image = imread(argv[1]);
else
image = imread("lena.jpg");
if (image.empty())
exit(1);
processImage();
displayGraphics();
waitKey(0);
return 0;
}
void displayGraphics()
{
//display both images
imshow("Image", image);
imshow("ProcessedImage", processedImage);
}
void processImage()
{
int x, y;
Vec3b pixel;
unsigned char R, G, B;
processedImage = image.clone();
for (y = 0; y < processedImage.rows; y++)
{
for (x = 0; x < processedImage.cols; x++)
{
// Get the pixel at (x,y)
pixel = processedImage.at<Vec3b>(y, x);
// Get the separate colors
B = pixel[0];
G = pixel[1];
R = pixel[2];
// Assign the complement of each color
pixel[0] = 255 - B;
pixel[1] = 255 - G;
pixel[2] = 255 - R;
// Write the pixel back to the image
processedImage.at<Vec3b>(y, x) = pixel;
}
}
}
我尝试从主函数中删除参数并完成上面引用中提供的调试过程。但是,它只是调用这个 crt0msg.c 文件并突出显示 #ifdef _DEBUG 部分的案例 1。
任何解决此问题的帮助将不胜感激。