"atomic bomb" commit. Reorganized OpenCV directory structure
This commit is contained in:
20
samples/MacOSX/FaceTracker/FaceTracker-Info.plist
Normal file
20
samples/MacOSX/FaceTracker/FaceTracker-Info.plist
Normal file
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>de.rwth-aachen.ient.FaceTracker</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>1.0</string>
|
||||
</dict>
|
||||
</plist>
|
||||
86
samples/MacOSX/FaceTracker/FaceTracker.cpp
Normal file
86
samples/MacOSX/FaceTracker/FaceTracker.cpp
Normal file
@@ -0,0 +1,86 @@
|
||||
|
||||
#include <OpenCV/OpenCV.h>
|
||||
#include <cassert>
|
||||
#include <iostream>
|
||||
|
||||
|
||||
const char * WINDOW_NAME = "Face Tracker";
|
||||
const CFIndex CASCADE_NAME_LEN = 2048;
|
||||
char CASCADE_NAME[CASCADE_NAME_LEN] = "~/opencv/data/haarcascades/haarcascade_frontalface_alt2.xml";
|
||||
|
||||
using namespace std;
|
||||
|
||||
int main (int argc, char * const argv[])
|
||||
{
|
||||
const int scale = 2;
|
||||
|
||||
// locate haar cascade from inside application bundle
|
||||
// (this is the mac way to package application resources)
|
||||
CFBundleRef mainBundle = CFBundleGetMainBundle ();
|
||||
assert (mainBundle);
|
||||
CFURLRef cascade_url = CFBundleCopyResourceURL (mainBundle, CFSTR("haarcascade_frontalface_alt2"), CFSTR("xml"), NULL);
|
||||
assert (cascade_url);
|
||||
Boolean got_it = CFURLGetFileSystemRepresentation (cascade_url, true,
|
||||
reinterpret_cast<UInt8 *>(CASCADE_NAME), CASCADE_NAME_LEN);
|
||||
if (! got_it)
|
||||
abort ();
|
||||
|
||||
// create all necessary instances
|
||||
cvNamedWindow (WINDOW_NAME, CV_WINDOW_AUTOSIZE);
|
||||
CvCapture * camera = cvCreateCameraCapture (CV_CAP_ANY);
|
||||
CvHaarClassifierCascade* cascade = (CvHaarClassifierCascade*) cvLoad (CASCADE_NAME, 0, 0, 0);
|
||||
CvMemStorage* storage = cvCreateMemStorage(0);
|
||||
assert (storage);
|
||||
|
||||
// you do own an iSight, don't you ?!?
|
||||
if (! camera)
|
||||
abort ();
|
||||
|
||||
// did we load the cascade?!?
|
||||
if (! cascade)
|
||||
abort ();
|
||||
|
||||
// get an initial frame and duplicate it for later work
|
||||
IplImage * current_frame = cvQueryFrame (camera);
|
||||
IplImage * draw_image = cvCreateImage(cvSize (current_frame->width, current_frame->height), IPL_DEPTH_8U, 3);
|
||||
IplImage * gray_image = cvCreateImage(cvSize (current_frame->width, current_frame->height), IPL_DEPTH_8U, 1);
|
||||
IplImage * small_image = cvCreateImage(cvSize (current_frame->width / scale, current_frame->height / scale), IPL_DEPTH_8U, 1);
|
||||
assert (current_frame && gray_image && draw_image);
|
||||
|
||||
// as long as there are images ...
|
||||
while (current_frame = cvQueryFrame (camera))
|
||||
{
|
||||
// convert to gray and downsize
|
||||
cvCvtColor (current_frame, gray_image, CV_BGR2GRAY);
|
||||
cvResize (gray_image, small_image, CV_INTER_LINEAR);
|
||||
|
||||
// detect faces
|
||||
CvSeq* faces = cvHaarDetectObjects (small_image, cascade, storage,
|
||||
1.1, 2, CV_HAAR_DO_CANNY_PRUNING,
|
||||
cvSize (30, 30));
|
||||
|
||||
// draw faces
|
||||
cvFlip (current_frame, draw_image, 1);
|
||||
for (int i = 0; i < (faces ? faces->total : 0); i++)
|
||||
{
|
||||
CvRect* r = (CvRect*) cvGetSeqElem (faces, i);
|
||||
CvPoint center;
|
||||
int radius;
|
||||
center.x = cvRound((small_image->width - r->width*0.5 - r->x) *scale);
|
||||
center.y = cvRound((r->y + r->height*0.5)*scale);
|
||||
radius = cvRound((r->width + r->height)*0.25*scale);
|
||||
cvCircle (draw_image, center, radius, CV_RGB(0,255,0), 3, 8, 0 );
|
||||
}
|
||||
|
||||
// just show the image
|
||||
cvShowImage (WINDOW_NAME, draw_image);
|
||||
|
||||
// wait a tenth of a second for keypress and window drawing
|
||||
int key = cvWaitKey (100);
|
||||
if (key == 'q' || key == 'Q')
|
||||
break;
|
||||
}
|
||||
|
||||
// be nice and return no error
|
||||
return 0;
|
||||
}
|
||||
262
samples/MacOSX/FaceTracker/FaceTracker.xcodeproj/project.pbxproj
Normal file
262
samples/MacOSX/FaceTracker/FaceTracker.xcodeproj/project.pbxproj
Normal file
@@ -0,0 +1,262 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 42;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
4D7DBE8E0C04A90C00D8835D /* FaceTracker.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 08FB7796FE84155DC02AAC07 /* FaceTracker.cpp */; };
|
||||
4D95C9BE0C0577B200983E4D /* OpenCV.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 4D06E1E00C039982004AF23F /* OpenCV.framework */; };
|
||||
4D95C9D80C0577BD00983E4D /* OpenCV.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4D06E1E00C039982004AF23F /* OpenCV.framework */; };
|
||||
4DBF87310C05731500880673 /* haarcascade_frontalface_alt2.xml in Resources */ = {isa = PBXBuildFile; fileRef = 4DBF87300C05731500880673 /* haarcascade_frontalface_alt2.xml */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
/* Begin PBXCopyFilesBuildPhase section */
|
||||
4D7DBE8F0C04A93300D8835D /* CopyFiles */ = {
|
||||
isa = PBXCopyFilesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
dstPath = "";
|
||||
dstSubfolderSpec = 10;
|
||||
files = (
|
||||
4D95C9D80C0577BD00983E4D /* OpenCV.framework in CopyFiles */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
08FB7796FE84155DC02AAC07 /* FaceTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FaceTracker.cpp; sourceTree = "<group>"; };
|
||||
4D06E1E00C039982004AF23F /* OpenCV.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenCV.framework; path = ../../../OpenCV.framework; sourceTree = SOURCE_ROOT; };
|
||||
4D4CDBCC0C0630060001A8A2 /* README.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = README.txt; sourceTree = "<group>"; };
|
||||
4D7DBE570C04A8FF00D8835D /* FaceTracker.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = FaceTracker.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
4D7DBE590C04A8FF00D8835D /* FaceTracker-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.xml; path = "FaceTracker-Info.plist"; sourceTree = "<group>"; };
|
||||
4DBF87300C05731500880673 /* haarcascade_frontalface_alt2.xml */ = {isa = PBXFileReference; fileEncoding = 5; lastKnownFileType = text.xml; name = haarcascade_frontalface_alt2.xml; path = ../../../data/haarcascades/haarcascade_frontalface_alt2.xml; sourceTree = SOURCE_ROOT; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXFrameworksBuildPhase section */
|
||||
4D7DBE550C04A8FF00D8835D /* Frameworks */ = {
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4D95C9BE0C0577B200983E4D /* OpenCV.framework in Frameworks */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXFrameworksBuildPhase section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
08FB7794FE84155DC02AAC07 /* FrameworkTest */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4D4CDBCC0C0630060001A8A2 /* README.txt */,
|
||||
08FB7795FE84155DC02AAC07 /* Source */,
|
||||
4DBF872C0C0572BC00880673 /* Resources */,
|
||||
4D9D40B00C04AC1600EEFFD0 /* Frameworks */,
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */,
|
||||
);
|
||||
name = FrameworkTest;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
08FB7795FE84155DC02AAC07 /* Source */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
08FB7796FE84155DC02AAC07 /* FaceTracker.cpp */,
|
||||
);
|
||||
name = Source;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
1AB674ADFE9D54B511CA2CBB /* Products */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4D7DBE570C04A8FF00D8835D /* FaceTracker.app */,
|
||||
);
|
||||
name = Products;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4D9D40B00C04AC1600EEFFD0 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4D06E1E00C039982004AF23F /* OpenCV.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
4DBF872C0C0572BC00880673 /* Resources */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
4DBF87300C05731500880673 /* haarcascade_frontalface_alt2.xml */,
|
||||
4D7DBE590C04A8FF00D8835D /* FaceTracker-Info.plist */,
|
||||
);
|
||||
name = Resources;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXNativeTarget section */
|
||||
4D7DBE560C04A8FF00D8835D /* FaceTracker */ = {
|
||||
isa = PBXNativeTarget;
|
||||
buildConfigurationList = 4D7DBE5A0C04A8FF00D8835D /* Build configuration list for PBXNativeTarget "FaceTracker" */;
|
||||
buildPhases = (
|
||||
4D7DBE530C04A8FF00D8835D /* Resources */,
|
||||
4D7DBE540C04A8FF00D8835D /* Sources */,
|
||||
4D7DBE550C04A8FF00D8835D /* Frameworks */,
|
||||
4D7DBE8F0C04A93300D8835D /* CopyFiles */,
|
||||
);
|
||||
buildRules = (
|
||||
);
|
||||
dependencies = (
|
||||
);
|
||||
name = FaceTracker;
|
||||
productName = FaceTracker;
|
||||
productReference = 4D7DBE570C04A8FF00D8835D /* FaceTracker.app */;
|
||||
productType = "com.apple.product-type.application";
|
||||
};
|
||||
/* End PBXNativeTarget section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
08FB7793FE84155DC02AAC07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "FaceTracker" */;
|
||||
hasScannedForEncodings = 1;
|
||||
mainGroup = 08FB7794FE84155DC02AAC07 /* FrameworkTest */;
|
||||
projectDirPath = "";
|
||||
targets = (
|
||||
4D7DBE560C04A8FF00D8835D /* FaceTracker */,
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin PBXResourcesBuildPhase section */
|
||||
4D7DBE530C04A8FF00D8835D /* Resources */ = {
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4DBF87310C05731500880673 /* haarcascade_frontalface_alt2.xml in Resources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXResourcesBuildPhase section */
|
||||
|
||||
/* Begin PBXSourcesBuildPhase section */
|
||||
4D7DBE540C04A8FF00D8835D /* Sources */ = {
|
||||
isa = PBXSourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
4D7DBE8E0C04A90C00D8835D /* FaceTracker.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
/* End PBXSourcesBuildPhase section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
1DEB923608733DC60010E9CD /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
1DEB923708733DC60010E9CD /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = (
|
||||
ppc,
|
||||
i386,
|
||||
);
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
PREBINDING = NO;
|
||||
SDKROOT = /Developer/SDKs/MacOSX10.4u.sdk;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
4D7DBE5B0C04A8FF00D8835D /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = NO;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_2)",
|
||||
);
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../opencv\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/../../..\"";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
|
||||
INFOPLIST_FILE = "FaceTracker-Info.plist";
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
Carbon,
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = FaceTracker;
|
||||
WRAPPER_EXTENSION = app;
|
||||
ZERO_LINK = YES;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
4D7DBE5C0C04A8FF00D8835D /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
COPY_PHASE_STRIP = YES;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_1)",
|
||||
"$(FRAMEWORK_SEARCH_PATHS_QUOTED_2)",
|
||||
);
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_1 = "\"$(SRCROOT)/../opencv\"";
|
||||
FRAMEWORK_SEARCH_PATHS_QUOTED_2 = "\"$(SRCROOT)/../../..\"";
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = NO;
|
||||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
GCC_PRECOMPILE_PREFIX_HEADER = YES;
|
||||
GCC_PREFIX_HEADER = "$(SYSTEM_LIBRARY_DIR)/Frameworks/Carbon.framework/Headers/Carbon.h";
|
||||
INFOPLIST_FILE = "FaceTracker-Info.plist";
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
OTHER_LDFLAGS = (
|
||||
"-framework",
|
||||
Carbon,
|
||||
);
|
||||
PREBINDING = NO;
|
||||
PRODUCT_NAME = FaceTracker;
|
||||
WRAPPER_EXTENSION = app;
|
||||
ZERO_LINK = NO;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "FaceTracker" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
1DEB923608733DC60010E9CD /* Debug */,
|
||||
1DEB923708733DC60010E9CD /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
4D7DBE5A0C04A8FF00D8835D /* Build configuration list for PBXNativeTarget "FaceTracker" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
4D7DBE5B0C04A8FF00D8835D /* Debug */,
|
||||
4D7DBE5C0C04A8FF00D8835D /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
|
||||
}
|
||||
35
samples/MacOSX/FaceTracker/README.txt
Normal file
35
samples/MacOSX/FaceTracker/README.txt
Normal file
@@ -0,0 +1,35 @@
|
||||
FaceTracker/REAME.txt
|
||||
2007-05-24, Mark Asbach <asbach@ient.rwth-aachen.de>
|
||||
|
||||
Objective:
|
||||
This document is intended to get you up and running with an OpenCV Framework on Mac OS X
|
||||
|
||||
Building the OpenCV.framework:
|
||||
In the main directory of the opencv distribution, you will find a shell script called
|
||||
'make_frameworks.sh' that does all of the typical unixy './configure && make' stuff required
|
||||
to build a universal binary framework. Invoke this script from Terminal.app, wait some minutes
|
||||
and you are done.
|
||||
|
||||
OpenCV is a Private Framework:
|
||||
On Mac OS X the concept of Framework bundles is meant to simplify distribution of shared libraries,
|
||||
accompanying headers and documentation. There are however to subtly different 'flavours' of
|
||||
Frameworks: public and private ones. The public frameworks get installed into the Frameworks
|
||||
diretories in /Library, /System/Library or ~/Library and are meant to be shared amongst
|
||||
applications. The private frameworks are only distributed as parts of an Application Bundle.
|
||||
This makes it easier to deploy applications because they bring their own framework invisibly to
|
||||
the user. No installation of the framework is necessary and different applications can bring
|
||||
different versions of the same framework without any conflict.
|
||||
Since OpenCV is still a moving target, it seems best to avoid any installation and versioning issues
|
||||
for an end user. The OpenCV framework that currently comes with this demo application therefore
|
||||
is a Private Framework.
|
||||
|
||||
Use it for targets that result in an Application Bundle:
|
||||
Since it is a Private Framework, it must be copied to the Frameworks/ directory of an Application
|
||||
Bundle, which means, it is useless for plain unix console applications. You should create a Carbon
|
||||
or a Cocoa application target in XCode for your projects. Then add the OpenCV.framework just like
|
||||
in this demo and add a Copy Files build phase to your target. Let that phase copy to the Framework
|
||||
directory and drop the OpenCV.framework on the build phase (again just like in this demo code).
|
||||
|
||||
The resulting application bundle will be self contained and if you set compiler option correctly
|
||||
(in the "Build" tab of the "Project Info" window you should find 'i386 ppc' for the architectures),
|
||||
your application can just be copied to any OS 10.4 Mac and used without further installation.
|
||||
Reference in New Issue
Block a user