【问题标题】:Difficulties configuring openCV library in Visual C++在 Visual C++ 中配置 openCV 库的困难
【发布时间】:2011-09-10 23:58:45
【问题描述】:

我正在尝试将我的 Visual C++ 配置为使用 openCV 库。我已按照 OpenCV 网站 http://opencv.willowgarage.com/wiki/VisualC%2B%2B...

上的说明进行操作
// OpenCV_Helloworld.cpp : Defines the entry point for the console application.
// Created for build/install tutorial, Microsoft Visual Studio and OpenCV 2.2.0

#include "stdafx.h"

#include <cv.h>
#include <cxcore.h>
#include <highgui.h>

int _tmain(int argc, _TCHAR* argv[])
{
        // Open the file.
        IplImage *img = cvLoadImage("photo.jpg");
        if (!img) {
                printf("Error: Couldn't open the image file.\n");
                return 1;
        }

        // Display the image.
        cvNamedWindow("Image:", CV_WINDOW_AUTOSIZE);
        cvShowImage("Image:", img);

        // Wait for the user to press a key in the GUI window.
        cvWaitKey(0);

        // Free the resources.
        cvDestroyWindow("Image:");
        cvReleaseImage(&img);

        return 0;
}

我已更改属性页内 VC++ 目录中的 include 和 library 目录,并添加了其他依赖项。但是,当我尝试使用与示例代码相同的头文件加载图像时,它说 cvLoadImage 未定义,cvNamedWindow 也是如此

IplImage *img = cvLoadImage("JellyFish.jpg");

关于我可能遇到问题的任何建议?

【问题讨论】:

    标签: c++ visual-studio visual-studio-2010 visual-c++ opencv


    【解决方案1】:

    您可以尝试确保您的项目的代码生成是多线程 DLL(或多线程调试 DLL)。

    【讨论】:

    • 该死!好吧,我现在只是猜测......尝试将项目的字符集更改为未设置。
    • 不,也没有运气。未设置不会改变任何内容。
    • 好吧,对不起,我没有看到你确切的 VS2010 项目文件的想法。如果您找出原因,请务必在此处发布答案!
    【解决方案2】:

    您需要使用 CMake 进行配置。获取 OpenCV 2.2 并尝试以下分步指南。

    http://kaushalsolanki.com/2011/01/compile-and-set-up-opencv-for-visual-studio-2010-with-64-bits-support-ipp-7-0-and-tbb/

    【讨论】:

      【解决方案3】:

      我遇到了同样的错误,但我终于修复了它 我正在使用 opencv 2.3 我所做的是我改变了所有额外的依赖 从 opencv_core220d.lib 到 opencv_core231d.lib 我们需要以相同的方式更改所有依赖项

      然后我将所有 *.dll 文件从我的 bin>>debug 文件夹复制到 我有新项目的地方 你好世界>>你好世界

      例如 C:\opencv\build\bin\debug 将所有 *.dll 文件复制到 C:\opencv\Projects\helloworld\helloworld

      【讨论】:

        猜你喜欢
        • 2021-06-16
        • 2010-12-12
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2016-04-18
        • 2011-02-22
        • 1970-01-01
        相关资源
        最近更新 更多