Ce diaporama a bien été signalé.
Nous utilisons votre profil LinkedIn et vos données d’activité pour vous proposer des publicités personnalisées et pertinentes. Vous pouvez changer vos préférences de publicités à tout moment.

Guide: How to Build OpenCV 3.0.0

52 480 vues

Publié le

A tutorial teaching how to build and use OpenCV v.3.0.0 using Visual Studio 2013.

Publié dans : Technologie
  • ...My Scandalous Secret to Crushing The Odds So Effortlessly... ➤➤ https://bit.ly/2UD1pAx
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Sex in your area is here: ❤❤❤ http://bit.ly/369VOVb ❤❤❤
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Follow the link, new dating source: ❤❤❤ http://bit.ly/369VOVb ❤❤❤
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Dating direct: ♥♥♥ http://bit.ly/2Y8gKsI ♥♥♥
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici
  • Dating for everyone is here: ❤❤❤ http://bit.ly/2Y8gKsI ❤❤❤
       Répondre 
    Voulez-vous vraiment ?  Oui  Non
    Votre message apparaîtra ici

Guide: How to Build OpenCV 3.0.0

  1. 1. BUILDING OPENCV 3.0.0 YOURSELF André Moreira June, 2014
  2. 2. WHO I AM ... # My name is André de Souza Moreira; # Msc. Candidate at PUC-RIO; # Researcher at Instituto Tecgraf in Computer Graphics; # Before: Researcher at NCA in Medical Image Processing. andredsm.com
  3. 3. WHAT IS OPENCV? # It’s an open source library written in C++ for computer vision. # It was originally designed by Intel. # There are several bidings to others languagens like Python and Java. # Runs on Windows, Android, Linux, OS X and others. # Offers CUDA and OpenCL Interface. # Its last release version is 2.4.9 but you can acquire 3.0.0 version (under development) on github (June, 2014).
  4. 4. GOALS # Making a simple building of OpenCV 3.0.0 with Visual Studio 2013; # Running an OpenCV example; # Linking the library against a new project in Visual Studio 2013.
  5. 5. BEFORE YOU BUILD
  6. 6. Step : Get the Source Code # Available at https://github.com/Itseez/opencv # Option 1: Download directly from the website 1
  7. 7. Step : Get the Source COde # Option 2: Clone the git repository: # The advantage of this method consists of tracking changes from the original repository. So, you can rebuild the library whenever there is a new feature... 1 $ git clone git@github.com:Itseez/opencv.git
  8. 8. Step : Install dependencies # There are a lot dependencies you can use in opencv building, such as: Qt, Python, Opengl, pdflatex to generate the documentation, CUDA, OpenCL and others... # For example, you can install the python 2.7.x and numpy in order to build python wrapper. 2
  9. 9. # Install the Cmake Tool • Available on http://www.cmake.org/ # Open cmake-gui, configure where the library’s source code is (1) and where the project’s files will be generated (2). Finally, click in Configure button (3). Step : Preparing the Project 3 (1) (2) (3)
  10. 10. # Select the project that will be generated. • In our case is Visual Studio 2013. (No, I did not choose the wrong option, the generator for Visual Studio 2013 is really called Visual Studio 12!) ;P Step : Preparing the Project 3
  11. 11. # Cmake will show you some build options: • BUILD: set what gonna be built. • WITH: The library takes advantage of others technologies like CUDA. • INSTALL: Which files will be put in the installation folder. • CMAKE/CMAKE_INSTAL_PREFIX: Set the default installation folder. # After choosing, click Configure button again. If everything is OK, all the red background will disappear. # Finally, click in the Generate button. Step : Preparing the Project 3
  12. 12. My Options:
  13. 13. BUILDING THE PROJECT
  14. 14. # Go to the build folder and open the Visual Studio Solution (Opencv.sln) # Select the build mode (1) and then build the project ALL_BUILD (2). (This step will build all the projects shown in the Solution Explorer Guide) # If no errors occurs, build the INSTALL project (3). (Installs the artifacts) Step : Building the Project 4 (1) (2) (3)
  15. 15. # Copy all the .dll in {INSTALL_DIRECTORY} x64vc12bin to: • C:WindowsSystem32 if the library was built in x64 • C:WindowsSysWOW64 if the library was built in x86 # At this point, you can run any sample and it should works without error. # Copy all files in {INSTALL_DIRECTORY} x64vc12lib to {VISUALSTUDIO_DIRECTORY}VClib (x86) or {VISUALSTUDIO_DIRECTORY}VClibamd64 (x64) # Copy the two folders in {INSTALL_DIRECTORY} include to {VISUALSTUDIO_DIRECTORY}VCinclude Step : Installing the library 5
  16. 16. RUN THE SAMPLES # You can run the examples from {INSTALL_DIRECTORY} x64vc12samples* and check if everything is OK. • Running cppcpp-example-delaunay2.exe:
  17. 17. Link Against the Library # Create a new project (CTRL+SHIFT+N). # Go to DEBUG > {projectName} Properties (Alt + F7) # List the modules’ name you need in Linker > Input > Additional Dependencies: • Example:
  18. 18. Link Against the Library # Create a cpp file (CTRL+SHIFT+A) and run it (CTRL+F5): #include <opencv2/imgproc/imgproc.hpp> #include <opencv2/highgui/highgui.hpp> #include <opencv2/opencv.hpp> #include <stdlib.h> #include <stdio.h> using namespace cv; /** @function main */ int main(int argc, char** argv) { Mat src, src_gray, dst; int kernel_size = 3; int scale = 1; int delta = 0; int ddepth = CV_16S; char* window_name = "Laplace Demo"; /// Load your image src = imread("myImage.jpg"); if (!src.data) { return -1; } /// Remove noise by blurring with a Gaussian filter GaussianBlur(src, src, Size(3, 3), 0, 0, BORDER_DEFAULT); /// Convert the image to grayscale cvtColor(src, src_gray, COLOR_RGB2GRAY); /// Create window namedWindow(window_name, WINDOW_AUTOSIZE); /// Apply Laplace function Mat abs_dst; Laplacian(src_gray, dst, ddepth, kernel_size, scale, delta, BORDER_DEFAULT); convertScaleAbs(dst, abs_dst); /// Show what you got imshow(window_name, abs_dst); waitKey(0); return 0; }
  19. 19. The Result Ref: http://docs.opencv.org/doc/tutorials/imgproc/imgtrans/laplace_operator/laplace_operator.html
  20. 20. Need Help? # The Official Documentation: • http://www.teste.com # The Stackoverflow Community: • http://stackoverflow.com/questions/tagged/opencv # OpenCV’s Install Guide: • http://docs.opencv.org/trunk/doc/tutorials/introduction/windows_install/windows_install.html # This Great Book: ;) OpenCV Computer Vision Application Programming Cookbook (2nd Edition), Robert Laganiere. ISBN-13: 9781782161486 Publisher: Packt Publishing Publication date: 8/1/2014 Pages: 390

×