The first errors of OpenCV 245

I downloaded opencv-2.4.5 sources and I followed the tutorial (on the opencv website for Windows) about installing all my own libraries. OK. I created the opencv.sln file with cmake, after which I opened it with visual studio 2010 professional, and I clicked the build solution, but only 9 succeeded. Most of 200 failed, and most errors in tbbd.lib were not found, and opencv_core245d.lib was not found with error LNK1104. I try to solve it in how many days. I tried to show the ways of the files ... Can anyone help? It's about my dissertation. (Build with No Common Language Support)

+6
source share
3 answers

collapse

I spent about 15 hours or so getting my homework using OpenCV. 14.5 hours were spent setting it up correctly. I watched about 7 tutorial videos, some tuning tips, and read hundreds of messages containing permissions to the same erros I received. Therefore, I understand that simply installing OpenCV is not a trivial task, and there are several steps for this. So here is a simple tutorial on setting up if you want to use openCV.

It is important to understand how everything works, how well it fits together. There are three types of files, your headers that you include, DLLs that contain functions, and libraries that contain instructions on how to call functions in a DLL. Therefore, here, and do not add only DLL files depending on the input linker, we are going to add lib files. Then we create a System Environment variable that tells the machine where to look for DLL files when they are referenced by the corresponding library files. We will create a Property Sheet so that when creating a new project, we can simply add the settings to our project by clicking "Add an existing property sheet" instead of adding a new one. So we no longer have to go through this.

FOLLOW THESE STEPS EXACTLY AND MAKE SURE THE VISUAL STUDIO IS CLOSED BEFORE CONTINUING

NOTE. When the text is enclosed in quotation marks with instructions for copying the specified text, do not include quotation marks.

  • First of all, the simple part is to download OpenCV 2.4.5 from your website. http://opencv.org/ and click OpenCV for Windows. It will download OpenCV 2.4.5.exe.

Install OpenCV

  • After the download is complete, double-click OpenCV-2.4.5.exe to start it.

  • When you are asked where to extract the files, enter in the text box: "C: \"

  • C: \ opencv should be created upon completion. Go there to make sure.

Installation Environment Settings

  • WINDOWS 8 USERS:

    - Right click the bottom left corner of your screen when the start icon pops up. - Click "Command Prompt (Admin)" - Type "SETX -m OPENCV_DIR C:\opencv\build" and press enter to set the opencv build directory as a System Environment Variable. Wait for the console to give you confirmation that it is set. - Right click the bottom left corner of your screen when the "Start" icon pops up. Click System -> Advanced System Settings -> Environment Variables - In the "System Variables" list box, under the "Variable" collumn, find "Path". - Highlight the "Path" row and click edit. - Click in the "Variable Value" text box and hit the "end" key on your keyboard to scroll to the end of the line and add a semicolon. - Type the following: "C:\opencv\build\x86\vc10\bin;C:\opencv\build\x86\vc10" and click "OK". This will add the openCV bin directory to the system path. 
  • WINDOWS 7 USERS:

    Follow the same steps. The only difference is how you get to the command line and system settings. Google how to set the environment variable in Windows 7, if necessary.

Setting up Visial Studio

NOTE. I highly recommend VS2012 Professional because of its enhanced syntax highlighting, which makes life easier when programming C ++. This version can be downloaded and installed for free for DreamSpark. Just make a student account and keep it in mind. However, the steps for VS2010 and VS2012 are the same.

  • Open Visual Studio

    • Click "New Project", and in the "C ++" section, select "Win32 Console Application".
  • When the window opens, click "Next", mark "Empty project" and click "Finish". It is very important that you start with an EMPTY PROJECT without a precompiled header.

  • Find "Property Manager". By default, this should be a tab that is sometimes difficult to miss. Alternatively, you can access it by clicking on the View toolbar β†’ Property Manager.

  • Right-click Debug | Win32 and select Add New Project Properties Sheet. Name it "OpenCVProps" and click "Add."

  • Right-click the new property sheet and select Properties.

  • In the left column, go to "C / C ++" β†’ "General" and in the list on the right, select "Additional inclusion directories" and click "Change."

  • Add the following three directories:

    • "$ (OPENCV_DIR) \ include"

    • "$ (OPENCV_DIR) \ include \ OpenCV"

    • "$ (OPENCV_DIR) \ include \ opencv2"

  • In the left column, go to "Linker" β†’ "General", and in the list on the right, select "Additional library directories" and click "Change."

  • Add the following directory:

    • "$ (OPENCV_DIR) \ x86 \ VC10 \ Lib"
  • In the left column, go to "Linker" β†’ "Input", and in the list on the right, select "Additional Dependenies" and click "Edit".

  • Add the following .lib files depending. You can do this by copying and pasting them into this edit box. I did not specifically include a marker to make it easier for you to copy this data.

    opencv_core245d.lib opencv_imgproc245d.lib opencv_highgui245d.lib opencv_ml245d.lib opencv_video245d.lib opencv_features2d245d.lib opencv_calib3d245d.lib opencv_objdetect245db524 libdv5db524 libdv5db524 libdv5v lib24vdlbbdlb24 libdlbc lib5v lib24vdl5

NOTE. If you are creating for release, these steps are the same. However, when copying and pasting these files, remove the "d" from the end of each of them. "D" means that it is a release library and links to the .dll release.

  • Congrats! The hard part is almost ready! Click "OK" to close the window.

Creating and building a test project

  • Go to our solution explorer. This can be focused from the toolbar via "View" β†’ "Solution Explorer"

  • Right-click Source Files and choose Add β†’ New Item.

  • Select "C ++ File (.cpp)" and name the file "main.cpp". Click Add.

  • Copy and paste the following program and press "F7" on your keyboard and look in the lower left corner of the screen to see if the message "Build after success" has appeared. If so, there is only one step left before compiling and running! If not, repeat the steps or comments below, and maybe I can help.

  #include & ltopencv \ cv.h & gt
     #include & ltopencv \ highgui.h & gt

     int main (int argc, char * argv) 
     {// openCV .image object
         cv :: Mat inputImage;

         // Create a Window
         cv :: namedWindow ("window", 1);

         // Initialize our image.
         inputImage = cv :: imread ("Lenna.png");

         // Always check to make sure that image has data.
         if (inputImage.empty ())
         {
             std :: cout & lt & lt "Image Failed to Load.";
             return -1;
         }
         else
         {
             // All is well, display me.
             cv :: imshow ("window", inputImage);

             // Wait for user to press a key to exit.
             cvWaitKey (0);
         }

         return 0; 
     } 
  • If the assembly is successful, then all that remains is to add the image to your folder. Accommodation is very important. I copied directoy into which I put mine. Follow the same directory scheme.

    • "C: \ Users \ Josh \ Documents \ Visual Studio 2012 \ Projects \ ConsoleApplication3 \ ConsoleApplication3 \ Lenna.png"
  • Now press "Ctrl + F5". To compile, compile and run to watch your image in the window!

* IF YOU HAVE WEBCAM *

  • Copy and paste the following code to check if OpenCV works without the need to add an image. This is useful because if the above code does not work, but this code does, then you know that you have placed the image in the wrong folder.
  #include 
     #include 

     int main (int argc, char * argv) 
     {// openCV .image object
         cv :: Mat image;

         // Create a Window
         cv :: namedWindow ("window", 1);

         // Create the capture object.
         cv :: VideoCapture device;

         // Open your webcam.
         device.open (0);

         while (1)
         {
             // Read data from your device and store it to the image frame.
             device >> image;

             // Always check to make sure that image has data.
             if (image.empty ())
             {
                 std :: cout & lt & lt "Image Failed to Load.";
                 return -1;
             }
             else
             {
                 // All is well, display me.
                 cv :: imshow ("window", image);

                 // Wait for user to press a key to exit.
                 cvWaitKey (33);
             }
         }

         return 0; 
     } 

Happy coding !! Let me know if something didn’t work, so I can fix it!

+7
source

Quick response

I managed to compile OpenCV with TBB support using the tutorial here .

Features: Visual Studio 2012 / Win 7 (64 bit) / OpenCV 2.4.5 / CUDA 5

I downloaded the latest version of TBB and extracted it in C: / src / OpenCV / dep (as indicated in the tutorial above).

You should use the following TBB settings in CMake (adapt depending on your file paths):

 TBB_LIB_DIR :: C:/src/OpenCV/dep/tbb41_20130314oss/lib/intel64/vc11 TBB_INCLUDE_DIRS :: C:/src/OpenCV/dep/tbb41_20130314oss/include/ TBB_STDDEF_PATH :: C:/src/OpenCV/dep/tbb41_20130314oss/include/tbb/tbb_stddef.h WITH_TBB :: checked BUILD_TBB :: unchecked 

Additional Information

Initially, I also wanted to install OpenCV with CUDA 5 support, but it seems that CUDA 5 is not compatible with VS2012. This is the error I received while compiling OpenCV:

 Building NVCC (Device) object modules/core/CMakeFiles/cuda_compile.dir/src/cuda/Debug/cuda_compile_generated_matrix_operations.cu.obj nvcc : fatal error : nvcc cannot find a supported cl version. Only MSVC 9.0 and MSVC 10.0 are supported 

The good news is that you are using VS2010, which can be used with CUDA, as suggested here . VS2012 can be configured to create projects with CUDA, but there is currently no way (AFAIK) to compile OpenCV with CUDA support for VS2012 (read this for more information).

In conclusion, people who need CUDA support should compile and use OpenCV with VS2010.

In addition, when compiling OpenCV, I received the following errors:

 error C3859: virtual memory range for PCH exceeded; please recompile with a command line option of '-Zm118' or greater fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit 

I used the instructions here to finally compile OpenCV. I created a property sheet that had /Zm130 as an additional option in Common Properties> C / C ++> Command Line and added it to all the generated OpenCV projects.

For your reference, I also add the CMake configuration and the CMakeCache.txt file that I used (CUDA is disabled because I use VS2012):

I hope this helps and please comment if you need me to elaborate on any step.

+6
source

I installed opencv-master, opencv-2.4.5 and opencv-2.4.7 again on a new laptop. The OpenCV-2.4.7 reverse lookup function always returned null, but C-cvImageLoad worked well, and opencv-master cvLoadImage did not work cvImageLoad or I missed something. But TBB dir should be ... / bin / ia 32 not intel64 my OS is 64-bit, but VS201x is 32-bit, it was my mistake. And I get gpu stitching and errors, and the visual studio says the error, and this is usually a memory limit limitation, and I did the same as your @dilgenter, and now it works fine, but only 2.4.5 and python_d. a lib error can occur, this is not a problem in debug mode, which I read about this on many forum sites. I will try to find out why 2.4.7 imread returns a null Mat element. But now I'm too busy, and that's

0
source

Source: https://habr.com/ru/post/943569/


All Articles