1 / 31

91.204.201 Computing IV

91.204.201 Computing IV. Visual C++ 2010 Introduction with OpenCV 2.4.3 Example Xinwen Fu. Reading Assignment. Chapter one of the tutorials. http://finance.yahoo.com/news/the-college-degrees-with-the-highest-starting-salaries-204949790.html. Outline.

gamba
Download Presentation

91.204.201 Computing IV

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 91.204.201 Computing IV Visual C++ 2010 Introduction with OpenCV 2.4.3 Example Xinwen Fu

  2. Reading Assignment • Chapter one of the tutorials http://finance.yahoo.com/news/the-college-degrees-with-the-highest-starting-salaries-204949790.html By Dr. Xinwen Fu

  3. Outline • Installing and configuring Visual Studio 2010 to run an OpenCV example • Visual studio concepts • Tips of using Visual C++ • Example code By Dr. Xinwen Fu

  4. Demo http://www.youtube.com/watch?v=cgo0UitHfp8

  5. How to install OpenCV 2.4.3 on Visual Studio 2010 • OpenCV for Windows • Version 2.4.3 • Visit http://kylehounslow.com/?page_id=75 for source code: there is some bug • Some copy and pastables:Additional Include Directories: $(OPENCV_BUILD)\includeAdditional Library Directories: $(OPENCV_BUILD)\x86\vc10\lib By Dr. Xinwen Fu

  6. How to install OpenCV 2.4.3 on Visual Studio 2010 (Cont’d) • Debug Additional Dependencies: opencv_core243d.libopencv_imgproc243d.libopencv_highgui243d.libopencv_ml243d.libopencv_video243d.libopencv_features2d243d.libopencv_calib3d243d.lib • Release Additional Dependencies (same thing but without 'd' at the end):opencv_core243.libopencv_imgproc243.libopencv_highgui243.libopencv_ml243.libopencv_video243.libopencv_features2d243.libopencv_calib3d243.lib By Dr. Xinwen Fu

  7. Differences between .dll , .lib, .h files? • .h - header file • a source file containing declarations (as opposed to .cpp .cxx etc. containing implementations) • .lib - static library • may contain code or just links to a dynamic library • compiled code that you link with your program • The static library is included in your .exe at link time. • .dll - dynamic library • Just like a static one but you need to deploy it with your .exe file because its loaded at run time By Dr. Xinwen Fu

  8. Configuration tips • No need of care about your systems is 64 bits or 32 bits • 32 bits applications can run on 64 bits machines without problems • Use 32 bits OpenCV library By Dr. Xinwen Fu

  9. Troubleshooting • If it does not work following the video tutorial, you must have done one of the steps wrong • Double check it By Dr. Xinwen Fu

  10. Outline • Installing and configuring Visual Studio 2010 to run an OpenCV example • Visual studio concepts • Tips of using Visual C++ • Example code By Dr. Xinwen Fu

  11. Solutions and Projects • Visual Studio provides two containers to help you efficiently manage the items that are required by your development effort, such as references, data connections, folders, and files. • These containers are called solutions and projects. • Visual Studio provides Solution Folders to organize related projects into groups and then perform actions on those groups of projects. • Solution Explorer, an interface for viewing and managing these containers and their associated items, is part of the integrated development environment (IDE). By Dr. Xinwen Fu

  12. Items • Items can be files and other parts of your project such as references, data connections, or folders • In Solution Explorer, items can be organized • as project items, which are items that compose your project, such as forms, source files, and classes within a project in Solution Explorer. • as solution items for files that are applicable to your solution as a whole in the Solution Items folder of Solution Explorer. • as miscellaneous files that are not associated with either a project or a solution and that can be displayed in a Miscellaneous Files folder By Dr. Xinwen Fu

  13. Solutions as Containers • Visual Studio implements conceptual containers called solutions and projects to enable the integrated development environment (IDE) to apply its wide range of tools, designers, templates, and settings • Visual Studio automatically generates a solution when you create a new project By Dr. Xinwen Fu

  14. Advantages • Solutions allow you to concentrate on developing and deploying your projects, instead of sorting through all the details of managing project files, components, and objects. • Each Visual Studio solution allows you to: • Work on multiple projects within same instance of IDE. • Work on items using settings and options that apply to an entire set of projects. • Use Solution Explorer to help develop and deploy your application. • Manage additional files opened outside the context of a solution or project. By Dr. Xinwen Fu

  15. Definition Files • Visual Studio stores the definition for a solution in two files: .sln and .suo • In previous versions of Visual Studio, you might have noticed the group (.vbg) or workspace (.dsw) files in Visual Basic and Visual C++, respectively. • The solution definition file (.sln) stores the metadata that defines your solution: • Projects that are associated with the solution. • Items available at the solution level that are not associated with a particular project. • Solution build configurations that set which project configurations to apply in each type of build. By Dr. Xinwen Fu

  16. Definition Files (Cont’d) • The metadata stored in the .suo file as you construct a solution and set its properties is used to customize the IDE whenever the solution is active. By Dr. Xinwen Fu

  17. Projects as Containers • To help you to organize and perform common tasks on the items that you are developing, Visual Studio projects are used as containers within a solution to logically manage, build, and debug the items that comprise your application. • The output of a project is usually an executable program (.exe), a dynamic-link library (.dll) file or a module, among others. By Dr. Xinwen Fu

  18. Create a Visual Studio Solution • In Visual Studio, click File, point to New, and then click Project. • In the New Project dialog box, in the Project types pane, click Other Project Types, and then click Visual Studio Solutions. • In the Templates pane, click Blank Solution. • Enter the name of your project in the Name field, and then click OK. By Dr. Xinwen Fu

  19. Outline • Installing and configuring Visual Studio 2010 to run an OpenCV example • Visual studio concepts • Tips of using Visual C++ • Example code By Dr. Xinwen Fu

  20. Align C++ code in VS 2010 • Often code is copied into a .cpp file and the formatting is lost • Reformatting the code – within vc++ • Edit -> Advanced -> Format Selection By Dr. Xinwen Fu

  21. Enable Line Numbers in Visual C++/C# 2010 • Tools -> Options -> Text Editor -> C/C++ -> check Line Numbers -> OK By Dr. Xinwen Fu

  22. StartUp project in a soluton • Select a StartUp project and click to debug it • Right click the project and select it By Dr. Xinwen Fu

  23. Debugging with command-line parameters in Visual Studio • In VS 2008, 2010, or 2012, right-click the project, choose properties, go to the Debugging section • there is a box for command line arguments By Dr. Xinwen Fu

  24. Zoom in/out with Visual Studio 2010 editor • Zoom in, Ctrl+Shift+period • Zoom out, Ctrl+Shift+comma By Dr. Xinwen Fu

  25. Change the color of ink of Powerpoint • Change the color of ink before starting a slide show • On the Slide Show menu, click Set Up Show. • In the Pen color box, click the color you want, and then click OK. • Change the ink color during a slide show • On the Slide Show toolbar, click or tap the pointer arrow, point to Ink Color, and then click the color you want. • Note   Changing the color of the ink during the slide show affects the ink for the ballpoint and felt tip pens only. • Change the color of ink on a Tablet PC • Select the ink you want to format. • On the Ink Drawing and Writing or Ink Annotations toolbar, tap Select Objects. • Tap the ink. Sizing handles and an outline of the ink shapes indicate that the ink is selected. • On the Ink Drawing and Writing or Ink Annotations toolbar, tap the arrow next to Line Color. • Tap the color you want to use. • Tip • After you select a color, the Line Color button displays that color. You can apply the same color again to any ink selection by clicking or tapping Line Color again. By Dr. Xinwen Fu

  26. Outline • Installing and configuring Visual Studio 2010 to run an OpenCV example • Visual studio concepts • Tips of using Visual C++ • Example code By Dr. Xinwen Fu

  27. OpenCV 2 Example DisplayImage.cpp By Dr. Xinwen Fu

  28. Video Capture Example • #include <opencv\cv.h> • #include <opencv\highgui.h> • #include <iostream> • using namespace std; • using namespace cv; • int main(){ • Mat m; • VideoCapture cap; • cap.open(0); • cout<<cap.isOpened()<<endl; • namedWindow("window",1); • while(1){ • cap>>m; • imshow("window",m); • waitKey(33); • } • return 0; • } By Dr. Xinwen Fu

  29. OpenCV 1 Example By Dr. Xinwen Fu

  30. cv Namespace • All OpenCV classes and functions are in the cv namespace. • Therefore, to access this functionality from your code, use the cv:: specifier or using namespace cv; directive: • #include "opencv2/core/core.hpp" • ... • cv::Mat H = cv::findHomography(points1, points2, CV_RANSAC, 5); • ... • or • #include "opencv2/core/core.hpp" • using namespace cv; • ... • Mat H = findHomography(points1, points2, CV_RANSAC, 5 ); • ... By Dr. Xinwen Fu

  31. References • Application Development in Visual Studio By Dr. Xinwen Fu

More Related