懒得翻译了,看不懂的发邮件问我。
Installing OpenCV
Project Proposal and Update 1
1. For the first project, and possibly the second project as well, the team will get familiar with the OpenCV library, becoming familiar with OpenCV tools, and implementing OpenCV API’s in order to accomplish a few, small, tasks. Some of our ideas for implementation include:
-Ball tracking -Eye tracking - locating eye position on screen, blink to click -Facial recognition - expression recognition - happy, sad, wink, smile, brow raise -individual face recognition/distinction -Sign language alphabet -Library of objects that can be recognized - iPhone, pen, flower... -Flower recognition - different kinds of flowers. -Animal recognition -Sports - track player / puck, etc. -Puzzle solver (this would be so cool!) -iPhone integration We will likely start from the top, some of the implementations above will clearly be beyond the scope of this project, but would nonetheless be cool in the long run.2. The team has successfully installed OpenCV! This turned out to be much more challenging than either of us anticipated, as we found the instructions to be cryptic, and difficult to understand. All-in-all, it took about 5 hours to get the software installed. Because of this difficulty, the team decided to create a more straightforward tutorial, compiling information that we had found from multiple places online. This tutorial will be posted on stackoverflow.com so that people can see it if they google search. It is also included at the end of this write-up. Now that we have the software installed, and the program working (we were successfully able to build and run a project in XCode that simply opened a new window), it is a matter of becoming more familiar with the OpenCV libraries. This will be accomplished by examining examples of code online, and become more familiar with the OpenCV API’s that will be most useful for our applications. 3. In addition to the 5-6 spent downloading the software, an additional hour was spent writing the tutorial, and an additional few hours spent becoming familiar with the basic commands of OpenCV. If time permits, we would be willing to spend more than 3-4 hours per week, as we have some extensive projects that would be cool to tackle. 4. In the next two weeks we would like to become familiar with the OpenCV library. We would like to implement at least one of the ideas described question 1, particularly the ball tracking (maybe narrow it to ball detection) or facial recognition (recognizing an image captured from a webcam, or recognizing faces in image files). We will focus on applications that do not involve many new API’s, and will focus on mastering a few at a time. 5. For the third report we would like to have an additional objective functioning, or perhaps we could go more in depth into the ball tracking or facial recognition. Recognizing facial gestures, such as a smile, a raised eyebrow, or a wink, are potential ideas that we would like to implement, although depending on the speed of our progression, this may wait until the final deliverable. _________________________________________________________________________ Using OS X Lion, Xcode 4, and OpenCV 2.3.1 I found the website difficult to navigate through and the installation instructions cryptic, so when I finally go this thing working, I thought it would be nice to write some straightforward instructions for installing OpenCV and getting started with developing through Xcode. I got most of this information from http://opencv.willowgarage.com/wiki/UsingOpenCVUnderOSX and http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port (look for this heading: “2. Build from source using the CMake build system (new)”) Installation Instructions: Install Xcode 4.3 Xcode 4.3 usually comes with OS X Lion. But if it is not installed, you need to go to the App Store and download it. Once it has installed open Xcode (its in your Applications folder) and go through the installer. Next, we need to install the Command Line Tools. In the menu bar, click Xcode > Preferences and in the Downloads toolbar menu, install the command line tools. This is documented here: http://guide.macports.org/chunked/installing.xcode.html Download MacPorts
Download OpenCV
OpenCV is now installed. Lets get an Xcode Project working with OpenCV. Open Xcode.
#include <opencv2/opencv.hpp>. TEST CODE Copy this code into your main.cpp file. It should open up a small window that is half shaded. (There may be some formatting errors in copy pasting this code into Xcode, but it should be easy to clean up.) #include <iostream> #include <opencv2/opencv.hpp> int main( int argc, char *argv[]) { // Open the file. IplImage *img = cvCreateImage ( cvSize ( 100 , 200 ), IPL_DEPTH_8U , 3 ); //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 ; } |