运行以下简单代码时遇到了一些问题: http://docs.opencv.org/doc/tutorials/introduction/display_image/display_image.html
系统:Windows 7 x64 Microsoft Visual Studio 2013(免费使用) 项目为32位。
我有很多种链接错误,如LNK2001和LNK2019。 当我在" Configuration Prosperities">下添加这些库时,所有这些都得到了解决。 "接头" > "输入"
答案 0 :(得分:-1)
“配置繁荣”下的库> “链接器”> “输入”:
opencv_calib3d300.lib
opencv_core300.lib
opencv_features2d300.lib
opencv_flann300.lib
opencv_hal300.lib
libtiff.lib
libpng.lib
libjpeg.lib
libjasper.lib
IlmImf.lib
zlib.lib
opencv_highgui300.lib
opencv_imgproc300.lib
opencv_imgcodecs300.lib
opencv_ml300.lib
opencv_objdetect300.lib
opencv_photo300.lib
opencv_shape300.lib
opencv_stitching300.lib
opencv_ts300.lib
opencv_video300.lib
opencv_videostab300.lib
ippicvmt.lib
libwebp.lib
我使用了这段代码:
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/core/core.hpp>
#include <iostream>
#include <stdlib.h>
#include "stdafx.h"
#include <opencv2/opencv.hpp>
#include <opencv2/shape.hpp>
using namespace cv;
using namespace std;
int main(int argc, char** argv)
{
if (argc != 2)
{
cout << " Usage: display_image ImageToLoadAndDisplay" << endl;
return -1;
}
Mat image;
image = imread(argv[1], IMREAD_COLOR); // Read the file
if (!image.data) // Check for invalid input
{
cout << "Could not open or find the image" << std::endl;
return -1;
}
namedWindow("Display window", WINDOW_AUTOSIZE); // Create a window for display.
imshow("Display window", image); // Show our image inside it.
waitKey(0); // Wait for a keystroke in the window
return 0;
}