OpenCV - DLL missing, but it's not?

后端 未结 14 805
陌清茗
陌清茗 2020-12-04 17:50

I am trying just a basic program with OpenCV with the following code:

#include \"cv.h\"
#include \"highgui.h\"

int main()
{
    IplImage* newImg;
    newImg         


        
相关标签:
14条回答
  • 2020-12-04 18:29

    I have had numerous problems with opencv and only succeded after a gruesome 4-6 months. This is the last problem I have had, but all of the above didn't work. What worked for me was just copying and pasting the opencv_core2*.dll (and opencv_highgui2*.dll which it will ask for since you included this as well) into the release (or debug folder - I'm assuming. Haven't tested this) folder of your project, where your application file is.

    Hope this helps!

    0 讨论(0)
  • 2020-12-04 18:30

    Just for your information,after add the "PATH",for my win7 i need to reboot it to get it work.

    0 讨论(0)
  • 2020-12-04 18:32

    This might be like resurrecting a dead horse. But just so it's out there, the reason why the answer to these types of questions to simply put dll's into the system32 folder is because that folder is in the os's system path.

    It's actually best practice to provide the os with a path link.

    With windows 10

    1. open up file explorer
    2. right click on "this pc" and select "properties"
    3. Now in the "Control Panel\System and Security\System" window that comes up, click on "Advanced System Settings" from the left hand panel.
    4. At the bottom of the next window, click on the "Environment Variables" button.
    5. On the next window, there are two panels, the top one is for modifying variables to the current user, and the bottom panel is for modifying variables to the system. On the bottom panel, find the variable "Path" and click it to select it, then click on the "edit" button.
    6. Here you can then create, edit, delete, or update the different paths for the system. For example, to add mingw32-make to the system so you can access that command via command prompt, click new, then paste in the path to the bin. Example path, "D:\Qt\Tools\mingw730_64\bin", no quotation marks nor additional whitespaces.
    7. Click ok on all the windows so that the changes are saved, then reboot your computer for the changes to be loaded.
    0 讨论(0)
  • 2020-12-04 18:32

    The ".a" at the end of your DLL files is a problem, and those are there because you didn't use CMAKE to build OpenCV 2.0. Additionally you do not link to the DLL files, you link to the library files, and again, the reason you do not see the correct library files is because you didn't use CMAKE to build OpenCV 2.0. If you want to use OpenCV 2.0 you must build it for it to work correctly in Visual Studio. If you do not want to build it then I would suggest downgrading to OpenCV 1.1pre, it comes pre-built and is much more forgiving in Visual Studio.

    Another option (and the one I would recommend) is to abandon OpenCV and go with EmguCV. I have been playing with OpenCV for about a year and things got much easier when I switched to EmguCV because EmguCV works with .NET, so you can use a language like C# that does not come with all the C++ baggage of pointers, header files, and memory allocation problem.

    And as for the question of 64bit vs. 32bit, OpenCV does not officially support 64bit. To be on the safe side open your project properties and change the "Platform Target" under the "Build" tab from "Any CPU" to "X86". This should be done any time you do anything with OpenCV, even if you are using a wrapper like EmguCV.

    0 讨论(0)
  • 2020-12-04 18:33

    Just copy the .dll files to C:\windows\system32\

    0 讨论(0)
  • 2020-12-04 18:42

    No need to do any of that. It is a visual studio error.

    just go here: http://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=31354

    and download the appropriate fix for your computer's OS

    close visual studio, run the fix and then restart VS

    The code should run without any error.

    0 讨论(0)
提交回复
热议问题