What You’re Seeing:
11 | The edge detector searches for edges between regions of different brightness in the image. It draws a black line for each edge it finds.
12 |
How It Works:
13 | Edge detectors treat changes in brightness between adjacent pixels in an image beyond a certain threshold as edges. The Canny Edge Detector is more sophisticated in that it uses two thresholds. If a pixel is not adjacent to an existing edge, it uses a higher threshold; if a pixel is adjacent to an existing edge, it uses a lower threshold. The high threshold keeps down the number of excess edges to a minimum, while the lower threshold continues existing edges, even if they get slightly fuzzy.
14 |
What It’s Used For:
15 | Edge detection is often the first step in object segmentation, that is, breaking up an image into segments that represent different objects in the image.
16 |
Try and Notice:
17 | Experiment with objects different levels of contrast. What’s the minimum difference in brightness needed between to areas to find an edge?
18 | Just for for fun, Play A-Ha’s song “Take on Me” in the background while this demo runs, and pretend you’re in the music video for the song.
What You’re Seeing:
11 | This face detector draws a red circle around any faces it detects. (There’s a size threshold, so distant faces won’t be recognized.)
12 |
How It Works:
13 | This face detector uses a technique called a cascade classifier to detect faces. The classifier scans across then entire image looking for haar-like features that match those of faces in its training database. It’s called a ‘cascade’ because each candidate region is run through a cascade of different detectors, any of which can reject it. A region is only marked as a facepasses if it passes all of the detectors.
14 |
What It’s Used For:
15 | Face detection is widely used in from everything to digital cameras to security applications to digital photo albums.
16 |
Try and Notice:
17 | Turn your head to either side, or tilt it slightly. Note that the face detector no longer recognizes your face. That’s because this face detector was only trained on full-face images. Other, more sophisticated face recognizers can recognize faces from a wider range of angles.
What You’re Seeing:
11 | This demo shows an example of a dense optical flow. It uses the Farnebäck’s algorithm to estimate the motion of every pixel in the image from frame to frame. Although motion is computed for every pixel, it’s only displayed every 16 pixels, both horizontally and vertically.
12 |
How It Works:
13 | Farnebäck’s algorithm estimates the motion for subregions on several different scales. Then on a pixel level, it estimates the pixel’s motion within the region by attempting to minimize the value of a set of simultaneous equations.
14 |
What It’s Used For:
15 | Optical flow is an important part of digital video compression. Video compressors can store much less data by indicating that subsequent frames of video can be produced by simply moving around regions from the preceding frame.
16 |
Try and Notice:
17 | Move your hand or head around and watch the image the lines track the motion. Also notice how slowly the screen updates. Computing motion for every pixel on the screen is lots of work! See the Lucas-Kanade demo for another, faster approach to tracking the flow of motion.
What You’re Seeing:
11 | This demo takes the Laplace operator (also known as the Laplacian) on each point for the primary colors red, green and blue. The Laplacian is defined as the sum of the second derivative in the x and y directions.
12 |
How It Works:
13 | In OpenCV, the Laplacian function uses the Sobel operator to produce the second derivatives with respect to x and y, and then adds them together.
14 |
What It’s Used For:
15 | The Laplace operator performs a simple form of edge detection. Edges appear as black lines surrounded by white areas.
16 |
Try and Notice:
17 | Point the camera at an object of a solid color. Note how the center of the object appears black, while the edges are the color of the the object.
Note:
11 | If you move too rapidly, or point the camera at a different scene, the green dots may get lost. If this happens, you can restart the demo by tapping the button and choosing “Lucas-Kanade” from the demo list again.
12 |
What You’re Seeing:
13 | This is an example of sparse optical flow. Unlike the Farnebäck flow, which tries to estimate flow for every pixel in the image, Lucas-Kanade looks at the initial frame of video for features -- locations that it can track easily. Then for each subsequent frame, it tracks those same features as they move around. Each feature is marked by a green dot.
14 |
How it Works:
15 | The Lucas-Kanade starts by looking for “corners” — places where an image changes both vertically and horizontally. Then it tracks those corners from frame to frame by searching nearby regions of the image. (It assumes that objects don’t move too much between frames.)
16 |
Try and Notice:
17 | With the camera pointing at yourself, reset the Lucas-Kanade demo and then move your arm across your face. You should be able to “wipe” most of the green dots off your face. This is because Lucas-Kanade always updates point positions to the closest matching nearby location it can find. Usually this will be the same point on the same object. When you cover up part of the image with your arm, the closest matching nearby point is usually somewhere along your arm, so the points start following your arm. Even when you face is visible again, the points have moved, and so don’t find their original location because it’s too far from their new location.
What You’re Seeing:
11 | Things that have moved lately appear in red, and gradually fade to black once they stop moving. (Moving the camera will also produce this effect for everything in the scene. Try to hold the device steady, or better yet, put it in a stand.) Regions of the image that moved have a blue circle with a line that shows the direction of motion.
12 |
How It Works:
13 | Each time the camera generates a new frame, that image is subtracted from the image of the previous frame. Any place the two images differ is treated as motion. The motion is then stored in a motion history image, which tracks recent areas where motion occurred. The motion template code looks a the motion history image, and uses it to compute gradients of motion for each area of motion. Those are then visualized as blue circles. The motion template image itself is visualized in red.
14 |
What it’s Used For:
15 | Motion templates are used in security applications. For example, a security camera might be set up to motion detect motion and flag anything the camera saw that moved for a person to examine.
16 |
Try and Notice:
17 | Hold very still and eventually you’ll disappear from the image. Just like the T. Rex in Jurassic Park, this demo only senses motion. You can also try moving one hand down and the other hand up, and see that each one is tracked by a blue circle with a line indicating the direction of motion.
What You’re Seeing:
11 | You’re seeing exactly what the camera does. This demo simply takes what the camera sees and displays it on the screen. It’s not a very impressive demo visually. But you can modify the code for it to create computer vision demos of your own.
12 |
How it Works:
13 | Every demo in this app was written using the OpenCV computer vision library and the CVFunhouse framework. The framework takes images from the camera, passes them to an object that transforms the image using the OpenCV library, and then returns the transformed image to display.
14 | Note that
15 | even doing “nothing” requires some work. The camera produces an image in BGRA (storing the blue, green, red, and alpha components of each pixel in that order). The screen wants the pixels in RGB (red, green, blue) order, so the code has to convert the image in order to do nothing.
16 |
What it’s Used For:
17 | It’s used by people just like you to create their own computer vision demonstrations.
18 |
Try and Notice:
19 | Check out the code from http://github.com/jeradesign/CVFunhouse and start building computer vision demos of your own. As a simple starter, in file CVPassThru.m, change the body of method processIplImage: with the single line:
20 |
[self imageReady:iplImage];
21 |
Note that red and blue are reversed in the image. Everywhere in the image that was red shows up as blue, and vice-versa.
22 |
Learn More:
23 | The OpenCV project website. Complete documentation and tutorials for the OpenCV library.
24 |
25 |
26 |
--------------------------------------------------------------------------------
/CVFunhouse.xcodeproj/project.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
8 |
--------------------------------------------------------------------------------
/CVFunhouse.xcodeproj/project.xcworkspace/xcshareddata/CVFunhouse.xccheckout:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDESourceControlProjectFavoriteDictionaryKey
6 |
7 | IDESourceControlProjectIdentifier
8 | 2696B4BA-739B-40BD-AF7E-C4BD66930223
9 | IDESourceControlProjectName
10 | CVFunhouse
11 | IDESourceControlProjectOriginsDictionary
12 |
13 | 158EF702276F66A9237FA7AD7161917397DDDAD8
14 | github.com:jeradesign/CVFunhouse.git
15 |
16 | IDESourceControlProjectPath
17 | CVFunhouse.xcodeproj
18 | IDESourceControlProjectRelativeInstallPathDictionary
19 |
20 | 158EF702276F66A9237FA7AD7161917397DDDAD8
21 | ../..
22 |
23 | IDESourceControlProjectURL
24 | github.com:jeradesign/CVFunhouse.git
25 | IDESourceControlProjectVersion
26 | 111
27 | IDESourceControlProjectWCCIdentifier
28 | 158EF702276F66A9237FA7AD7161917397DDDAD8
29 | IDESourceControlProjectWCConfigurations
30 |
31 |
32 | IDESourceControlRepositoryExtensionIdentifierKey
33 | public.vcs.git
34 | IDESourceControlWCCIdentifierKey
35 | 158EF702276F66A9237FA7AD7161917397DDDAD8
36 | IDESourceControlWCCName
37 | CVFunhouse
38 |
39 |
40 |
41 |
42 |
--------------------------------------------------------------------------------
/CVFunhouse.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | IDEDidComputeMac32BitWarning
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFAppDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // CVFAppDelegate.h
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 3/7/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @interface CVFAppDelegate : UIResponder
12 |
13 | @property (strong, nonatomic) UIWindow *window;
14 |
15 | @end
16 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFAppDelegate.m:
--------------------------------------------------------------------------------
1 | //
2 | // CVFAppDelegate.m
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 3/7/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import "CVFAppDelegate.h"
10 |
11 | @implementation CVFAppDelegate
12 |
13 | @synthesize window = _window;
14 |
15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
16 | {
17 | #pragma unused(application)
18 | #pragma unused(launchOptions)
19 | // Override point for customization after application launch.
20 | return YES;
21 | }
22 |
23 | - (void)applicationWillResignActive:(UIApplication *)application
24 | {
25 | #pragma unused(application)
26 | // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
27 | // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
28 | }
29 |
30 | - (void)applicationDidEnterBackground:(UIApplication *)application
31 | {
32 | #pragma unused(application)
33 | // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
34 | // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
35 | }
36 |
37 | - (void)applicationWillEnterForeground:(UIApplication *)application
38 | {
39 | #pragma unused(application)
40 | // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
41 | }
42 |
43 | - (void)applicationDidBecomeActive:(UIApplication *)application
44 | {
45 | #pragma unused(application)
46 | // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
47 | }
48 |
49 | - (void)applicationWillTerminate:(UIApplication *)application
50 | {
51 | #pragma unused(application)
52 | // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
53 | }
54 |
55 | @end
56 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFCannyDemo.h:
--------------------------------------------------------------------------------
1 | //
2 | // CVFCannyDemo.h
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 7/21/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import "CVFImageProcessor.h"
10 |
11 | @interface CVFCannyDemo : CVFImageProcessor
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFCannyDemo.m:
--------------------------------------------------------------------------------
1 | //
2 | // CVFCannyDemo.m
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 7/21/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import "CVFCannyDemo.h"
10 | #include "opencv2/core/core_c.h"
11 | #include "opencv2/imgproc/imgproc_c.h"
12 |
13 | @implementation CVFCannyDemo
14 | /* Override this method do your image processing. */
15 | /* You are responsible for releasing ipImage. */
16 | /* Return your IplImage by calling imageReady: */
17 | /* The IplImage you pass back will be disposed of for you. */
18 | -(void)processIplImage:(IplImage*)iplImage
19 | {
20 | IplImage *grayImage = cvCreateImage(cvGetSize(iplImage), IPL_DEPTH_8U, 1);
21 | cvCvtColor(iplImage, grayImage, CV_BGRA2GRAY);
22 | cvReleaseImage(&iplImage);
23 |
24 | IplImage* img_blur = cvCreateImage( cvGetSize( grayImage ), grayImage->depth, 1);
25 | cvSmooth(grayImage, img_blur, CV_BLUR, 3, 0, 0, 0);
26 | cvReleaseImage(&grayImage);
27 |
28 | IplImage* img_canny = cvCreateImage( cvGetSize( img_blur ), img_blur->depth, 1);
29 | cvCanny( img_blur, img_canny, 10, 100, 3 );
30 | cvReleaseImage(&img_blur);
31 |
32 | cvNot(img_canny, img_canny);
33 |
34 | [self imageReady:img_canny];
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFFaceDetect.h:
--------------------------------------------------------------------------------
1 | //
2 | // CVFFaceDetect.h
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 7/24/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import "CVFImageProcessor.h"
10 |
11 | @interface CVFFaceDetect : CVFImageProcessor
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFFaceDetect.mm:
--------------------------------------------------------------------------------
1 | //
2 | // CVFFaceDetect.m
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 7/22/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | // Based on the OpenCV example: /samples/c/facedetect.cpp
10 |
11 | #import "CVFFaceDetect.h"
12 |
13 | #include "opencv2/objdetect/objdetect.hpp"
14 | #include "opencv2/imgproc/imgproc.hpp"
15 |
16 | using namespace std;
17 | using namespace cv;
18 |
19 | CascadeClassifier cascade;
20 | double scale = 1;
21 |
22 | @interface CVFFaceDetect() {
23 | bool _inited;
24 | }
25 |
26 | @end
27 |
28 | @implementation CVFFaceDetect
29 |
30 | -(void)processMat:(cv::Mat)mat
31 | {
32 | if (!_inited) {
33 | NSString* haarDataPath =
34 | [[NSBundle mainBundle] pathForResource:@"haarcascade_frontalface_alt.xml" ofType:nil];
35 |
36 | cascade.load([haarDataPath UTF8String]);
37 | _inited = true;
38 | }
39 |
40 | cvtColor(mat, mat, CV_BGR2RGB);
41 |
42 | int i = 0;
43 | vector faces;
44 | const static Scalar colors[] = { CV_RGB(0,0,255),
45 | CV_RGB(0,128,255),
46 | CV_RGB(0,255,255),
47 | CV_RGB(0,255,0),
48 | CV_RGB(255,128,0),
49 | CV_RGB(255,255,0),
50 | CV_RGB(255,0,0),
51 | CV_RGB(255,0,255)} ;
52 | Mat gray, smallImg( cvRound (mat.rows/scale), cvRound(mat.cols/scale), CV_8UC1 );
53 |
54 | cvtColor( mat, gray, CV_RGB2GRAY );
55 | resize( gray, smallImg, smallImg.size(), 0, 0, INTER_LINEAR );
56 | equalizeHist( smallImg, smallImg );
57 |
58 | cascade.detectMultiScale( smallImg, faces,
59 | 1.2, 2, 0
60 | //|CV_HAAR_FIND_BIGGEST_OBJECT
61 | //|CV_HAAR_DO_ROUGH_SEARCH
62 | |CV_HAAR_SCALE_IMAGE
63 | ,
64 | cv::Size(75, 75) );
65 | for( vector::const_iterator r = faces.begin(); r != faces.end(); r++, i++ )
66 | {
67 | Mat smallImgROI;
68 | vector nestedObjects;
69 | cv::Point center;
70 | Scalar color = colors[i%8];
71 | int radius;
72 | center.x = cvRound((r->x + r->width*0.5)*scale);
73 | center.y = cvRound((r->y + r->height*0.5)*scale);
74 | radius = cvRound((r->width + r->height)*0.25*scale);
75 | circle( mat, center, radius, color, 3, 8, 0 );
76 | }
77 |
78 | [self matReady:mat];
79 | }
80 |
81 | @end
82 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFFarneback.h:
--------------------------------------------------------------------------------
1 | //
2 | // CVFFarneback.h
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 7/24/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import "CVFImageProcessor.h"
10 |
11 | @interface CVFFarneback : CVFImageProcessor
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFFarneback.m:
--------------------------------------------------------------------------------
1 | //
2 | // CVFFarneback.m
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 7/22/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | // Based on the OpenCV example: /samples/c/fback_c.c
10 |
11 | #import "CVFFarneback.h"
12 |
13 | #include "opencv2/video/tracking.hpp"
14 | #include "opencv2/imgproc/imgproc_c.h"
15 |
16 | static void drawOptFlowMap(const CvMat* flow, CvMat* cflowmap, int step,
17 | double scale, CvScalar color)
18 | {
19 | int x, y;
20 | (void)scale;
21 | for( y = 0; y < cflowmap->rows; y += step)
22 | for( x = 0; x < cflowmap->cols; x += step)
23 | {
24 | CvPoint2D32f fxy = CV_MAT_ELEM(*flow, CvPoint2D32f, y, x);
25 | cvLine(cflowmap, cvPoint(x,y), cvPoint(cvRound(x+fxy.x), cvRound(y+fxy.y)),
26 | color, 1, 8, 0);
27 | cvCircle(cflowmap, cvPoint(x,y), 2, color, -1, 8, 0);
28 | }
29 | }
30 |
31 | @interface CVFFarneback () {
32 | CvMat *prevgray;
33 | CvMat *gray;
34 | CvMat *flow;
35 | CvMat *cflow;
36 | }
37 |
38 | @end
39 |
40 | @implementation CVFFarneback
41 |
42 | /*
43 | * processIplImage
44 | *
45 | * Inputs:
46 | * iplImage: an IplImage in BGRA format, 8 bits per pixel.
47 | * YOU ARE RESPONSIBLE FOR CALLING cvReleaseImage on this image.
48 | *
49 | * Outputs:
50 | * When you are done, call imageReady: with an RGB, RGBA, or grayscale
51 | * IplImage with 8-bits per pixel.
52 | *
53 | * You can call imageReady: from any thread and it will do the right thing.
54 | * You can fork as many threads to process the image as you like; just call
55 | * imageReady when you are done.
56 | *
57 | * imageReady: will dispose of the IplImage you pass it once the system is
58 | * done with it.
59 | */
60 | -(void)processIplImage:(IplImage*)frame
61 | {
62 | int firstFrame = (gray == 0);
63 | if(!gray)
64 | {
65 | gray = cvCreateMat(frame->height, frame->width, CV_8UC1);
66 | prevgray = cvCreateMat(gray->rows, gray->cols, gray->type);
67 | flow = cvCreateMat(gray->rows, gray->cols, CV_32FC2);
68 | cflow = cvCreateMat(gray->rows, gray->cols, CV_8UC3);
69 | }
70 | cvCvtColor(frame, gray, CV_BGR2GRAY);
71 | cvReleaseImage(&frame);
72 |
73 | cvCvtColor(gray, cflow, CV_GRAY2BGR);
74 |
75 | if( !firstFrame )
76 | {
77 | cvCalcOpticalFlowFarneback(prevgray, gray, flow, 0.5, 3, 15, 3, 5, 1.2, 0);
78 | drawOptFlowMap(flow, cflow, 16, 1.5, CV_RGB(0, 255, 0));
79 | }
80 |
81 | cvCopy(gray, prevgray, nil);
82 |
83 | // Call imageReady with your new image.
84 | IplImage *tempImage = cvAlloc(sizeof(IplImage));
85 | IplImage *outImage = cvGetImage(cflow, tempImage);
86 | [self imageReady: outImage];
87 | }
88 |
89 | @end
90 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFFlipsideViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // CVFFlipsideViewController.h
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 3/7/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class CVFFlipsideViewController;
12 |
13 | @protocol CVFFlipsideViewControllerDelegate
14 | - (void)flipsideViewControllerDidFinish:(CVFFlipsideViewController *)controller;
15 | @end
16 |
17 | @interface CVFFlipsideViewController : UIViewController
18 | {
19 | bool shouldShowFPS;
20 | bool shouldShowDescription;
21 | }
22 | @property (retain, nonatomic) IBOutlet UITableView *menuTable;
23 | @property (weak, nonatomic) id delegate;
24 | @property (weak, nonatomic) IBOutlet UINavigationBar *navBar;
25 | @property (weak, nonatomic) UISwitch *switchCtl;
26 | @property (retain, nonatomic) NSArray *demoList;
27 |
28 | - (IBAction)done:(id)sender;
29 |
30 | @end
31 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFHough.h:
--------------------------------------------------------------------------------
1 | //
2 | // CVFHough.h
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 8/1/13.
6 | // Copyright (c) 2013 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import "CVFImageProcessor.h"
10 |
11 | @interface CVFHough : CVFImageProcessor
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFHough.mm:
--------------------------------------------------------------------------------
1 | //
2 | // CVFHough.m
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 8/1/13.
6 | // Copyright (c) 2013 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import "CVFHough.h"
10 |
11 | #include "opencv2/imgproc/imgproc.hpp"
12 |
13 | using namespace std;
14 | using namespace cv;
15 |
16 | @implementation CVFHough
17 |
18 | -(void)processMat:(Mat)mat
19 | {
20 | cvtColor(mat, mat, CV_BGR2RGB);
21 | Mat grayImage;
22 | cvtColor(mat, grayImage, CV_RGB2GRAY);
23 | vector lines;
24 | Mat canny;
25 | Canny(grayImage, canny, 50, 100);
26 | HoughLinesP(canny, lines, 1, CV_PI/180, 80, 30, 10 );
27 | for( size_t i = 0; i < lines.size(); i++ )
28 | {
29 | line( mat, cv::Point(lines[i][0], lines[i][1]),
30 | cv::Point(lines[i][2], lines[i][3]), Scalar(0,0,255), 3, 8 );
31 | }
32 | [self matReady:mat];
33 | }
34 |
35 | @end
36 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFImageProcessor.h:
--------------------------------------------------------------------------------
1 | //
2 | // CVFImageProcessor.h
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 3/7/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #include "opencv2/core/core_c.h"
12 | #include "opencv2/imgproc/imgproc_c.h"
13 |
14 | @protocol CVFImageProcessorDelegate;
15 |
16 | @interface CVFImageProcessor : NSObject
17 |
18 | @property (nonatomic, weak) id delegate;
19 | @property (nonatomic, readonly) NSString *demoDescription;
20 |
21 | -(void)processImageBuffer:(CVImageBufferRef)imageBuffer withMirroring:(BOOL)shouldMirror;
22 | -(void)processIplImage:(IplImage*)iplImage;
23 | -(void)imageReady:(IplImage*)image;
24 | #ifdef __cplusplus
25 | -(void)processMat:(cv::Mat)mat;
26 | -(void)matReady:(cv::Mat)mat;
27 | #endif
28 |
29 | @end
30 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFImageProcessorDelegate.h:
--------------------------------------------------------------------------------
1 | //
2 | // CVFImageProcessorDelegate.h
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 3/7/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | @class CVFImageProcessor;
12 |
13 | @protocol CVFImageProcessorDelegate
14 |
15 | -(void)imageProcessor:(CVFImageProcessor*)imageProcessor didCreateImage:(UIImage*)image;
16 |
17 | @end
18 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFLaplace.h:
--------------------------------------------------------------------------------
1 | //
2 | // CVFLaplace.h
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 7/24/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import "CVFImageProcessor.h"
10 |
11 | @interface CVFLaplace : CVFImageProcessor
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFLaplace.mm:
--------------------------------------------------------------------------------
1 | //
2 | // CVFLaplace.m
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 7/24/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | // Based on the OpenCV example: /samples/cpp/laplace.cpp
10 |
11 | #import "CVFLaplace.h"
12 |
13 | #include "opencv2/core/core.hpp"
14 | #include "opencv2/imgproc/imgproc.hpp"
15 |
16 | using namespace cv;
17 | using namespace std;
18 |
19 | int sigma = 3;
20 | int smoothType = CV_GAUSSIAN;
21 |
22 | @implementation CVFLaplace
23 |
24 | -(void)processMat:(cv::Mat)mat
25 | {
26 | Mat smoothed, laplace, result;
27 |
28 | cvtColor(mat, mat, CV_BGR2RGB);
29 |
30 | int ksize = (sigma*5)|1;
31 | if(smoothType == CV_GAUSSIAN)
32 | GaussianBlur(mat, smoothed, cv::Size(ksize, ksize), sigma, sigma);
33 | else if(smoothType == CV_BLUR)
34 | blur(mat, smoothed, cv::Size(ksize, ksize));
35 | else
36 | medianBlur(mat, smoothed, ksize);
37 |
38 | Laplacian(smoothed, laplace, CV_16S, 5);
39 | convertScaleAbs(laplace, result, (sigma+1)*0.25);
40 |
41 | [self matReady:result];
42 | }
43 |
44 | @end
45 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFLucasKanade.h:
--------------------------------------------------------------------------------
1 | //
2 | // CVFLucasKanade.h
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 7/25/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import "CVFImageProcessor.h"
10 |
11 | @interface CVFLucasKanade : CVFImageProcessor
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFLucasKanade.mm:
--------------------------------------------------------------------------------
1 | //
2 | // CVFLukasKanade.m
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 7/25/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | // Based on the OpenCV example: /samples/cpp/lkdemo.cpp
10 |
11 | #import "CVFLucasKanade.h"
12 |
13 | #include "opencv2/video/tracking.hpp"
14 | #include "opencv2/imgproc/imgproc.hpp"
15 |
16 | using namespace cv;
17 | using namespace std;
18 |
19 | TermCriteria termcrit(CV_TERMCRIT_ITER|CV_TERMCRIT_EPS,20,0.03);
20 | cv::Size subPixWinSize(10,10), winSize(31,31);
21 | const int MAX_COUNT = 500;
22 |
23 | @interface CVFLucasKanade () {
24 | bool hasBeenInited;
25 | Mat gray, prevGray/*, image */;
26 | vector points[2];
27 | }
28 |
29 | @end
30 |
31 |
32 | @implementation CVFLucasKanade
33 |
34 | -(void)processMat:(cv::Mat)image
35 | {
36 | // mat.copyTo(image);
37 | cvtColor(image, image, CV_BGR2RGB);
38 | cvtColor(image, gray, CV_BGR2GRAY);
39 |
40 | if( !hasBeenInited )
41 | {
42 | // automatic initialization
43 | goodFeaturesToTrack(gray, points[1], MAX_COUNT, 0.01, 10, Mat(), 3, 0, 0.04);
44 | cornerSubPix(gray, points[1], subPixWinSize, cv::Size(-1,-1), termcrit);
45 | }
46 | else if( !points[0].empty() )
47 | {
48 | vector status;
49 | vector err;
50 | if(prevGray.empty())
51 | gray.copyTo(prevGray);
52 | calcOpticalFlowPyrLK(prevGray, gray, points[0], points[1], status, err, winSize,
53 | 3, termcrit, 0, 0.001);
54 | size_t i, k;
55 | for( i = k = 0; i < points[1].size(); i++ )
56 | {
57 | if( !status[i] )
58 | continue;
59 |
60 | points[1][k++] = points[1][i];
61 | circle( image, points[1][i], 3, Scalar(0,255,0), -1, 8);
62 | }
63 | points[1].resize(k);
64 | }
65 |
66 | hasBeenInited = true;
67 |
68 | std::swap(points[1], points[0]);
69 | swap(prevGray, gray);
70 |
71 | [self matReady:image];
72 | }
73 |
74 | @end
75 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFMainViewController.h:
--------------------------------------------------------------------------------
1 | //
2 | // CVFMainViewController.h
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 3/7/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import
10 | #import
11 | #import "CVFImageProcessorDelegate.h"
12 | #import "CVFFlipsideViewController.h"
13 |
14 | @class CVFImageProcessor;
15 |
16 | @interface CVFMainViewController : UIViewController <
17 | CVFFlipsideViewControllerDelegate,
18 | UIPopoverControllerDelegate,
19 | AVCaptureVideoDataOutputSampleBufferDelegate,
20 | CVFImageProcessorDelegate,
21 | UIWebViewDelegate
22 | >
23 | @property (weak, nonatomic) IBOutlet UIImageView *imageView;
24 | @property (weak, nonatomic) IBOutlet UILabel *fpsLabel;
25 | @property (weak, nonatomic) IBOutlet UIButton *flipCameraButton;
26 | @property (weak, nonatomic) IBOutlet UIWebView *descriptionView;
27 | @property (weak, nonatomic) IBOutlet UIView *descriptionContainer;
28 | @property (weak, nonatomic) IBOutlet GLKView *arView;
29 |
30 | @property (strong, nonatomic) UIPopoverController *flipsidePopoverController;
31 | @property (strong, atomic) CVFImageProcessor *imageProcessor;
32 |
33 | - (IBAction)flipAction:(id)sender;
34 | - (IBAction)swipeUpAction:(id)sender;
35 | - (IBAction)swipeDownAction:(id)sender;
36 | - (IBAction)closeDescription:(id)sender;
37 |
38 | @end
39 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFMotionTemplates.h:
--------------------------------------------------------------------------------
1 | //
2 | // CVFMotionTemplates.h
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 7/25/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import "CVFImageProcessor.h"
10 |
11 | @interface CVFMotionTemplates : CVFImageProcessor
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFPassThru.h:
--------------------------------------------------------------------------------
1 | //
2 | // CVFPassThru.h
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 7/22/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import "CVFImageProcessor.h"
10 |
11 | @interface CVFPassThru : CVFImageProcessor
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFPassThru.m:
--------------------------------------------------------------------------------
1 | //
2 | // CVFPassThru.m
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 7/22/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import "CVFPassThru.h"
10 |
11 | @implementation CVFPassThru
12 |
13 | /*
14 | * processIplImage
15 | *
16 | * Inputs:
17 | * iplImage: an IplImage in BGRA format, 8 bits per pixel.
18 | * YOU ARE RESPONSIBLE FOR CALLING cvReleaseImage on this image.
19 | *
20 | * Outputs:
21 | * When you are done, call imageReady: with an RGB, RGBA, or grayscale
22 | * IplImage with 8-bits per pixel.
23 | *
24 | * You can call imageReady: from any thread and it will do the right thing.
25 | * You can fork as many threads to process the image as you like; just call
26 | * imageReady when you are done.
27 | *
28 | * imageReady: will dispose of the IplImage you pass it once the system is
29 | * done with it.
30 | */
31 | -(void)processIplImage:(IplImage*)iplImage
32 | {
33 | // We get an BGRA image at 8-bits per pixel, but we need an RGB image
34 | // to pass to imageReady:, so we need to do a brief conversion.
35 |
36 | // To do the conversion, first create an IplImage the same size...
37 | IplImage *rgbImage = cvCreateImage(cvGetSize(iplImage), IPL_DEPTH_8U, 3);
38 |
39 | // Call cvCvtColor to do the conversion
40 | cvCvtColor(iplImage, rgbImage, CV_BGR2RGB);
41 |
42 | // Release the original image or you will run out of memory very fast!
43 | cvReleaseImage(&iplImage);
44 |
45 | // Call imageReady with your new image.
46 | [self imageReady:rgbImage];
47 | }
48 |
49 | @end
50 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFSephiaDemo.h:
--------------------------------------------------------------------------------
1 | //
2 | // CVFSephiaDemo.h
3 | // CVFunhouse
4 | //
5 | // Created by Matthew Shopsin on 7/21/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import "CVFImageProcessor.h"
10 |
11 | @interface CVFSephiaDemo : CVFImageProcessor
12 |
13 | @end
14 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFSephiaDemo.m:
--------------------------------------------------------------------------------
1 | //
2 | // CVFSephiaDemo.m
3 | // CVFunhouse
4 | //
5 | // Created by Matthew Shopsin on 7/21/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import "CVFSephiaDemo.h"
10 | #include "opencv2/core/core_c.h"
11 | #include "opencv2/imgproc/imgproc_c.h"
12 |
13 | @implementation CVFSephiaDemo
14 |
15 |
16 |
17 | -(void)processIplImage:(IplImage*)iplImage
18 | {
19 | IplImage *output = cvCreateImage(cvGetSize(iplImage), IPL_DEPTH_8U, 3);
20 | IplImage *sepiaImage = cvCreateImage(cvGetSize(iplImage), IPL_DEPTH_8U, 4);
21 | //cvCvtColor(iplImage, output, CV_RGB2BGR);
22 | float sepia_Array[] = {0.393, 0.769, 0.189,0.0, 0.349, 0.686, 0.168,0.0, 0.272, 0.534, 0.131,0.0, 0.0, 0.0, 0.0, 1.0};
23 | CvMat m_Sepia = cvMat(3, 3, CV_32F, sepia_Array);
24 |
25 | cvFilter2D(iplImage, sepiaImage, &m_Sepia, cvPoint(1, -1));//(iplImage, sepiaImage, &m_Sepia, NULL);
26 | cvCvtColor(sepiaImage, output, CV_BGRA2RGB);
27 | //cvCvtColor(output, output2, CV_RGB2BGR);
28 | //cvReleaseImage(&sepiaImage);
29 | cvReleaseImage(&sepiaImage);
30 | cvReleaseImage(&iplImage);
31 |
32 |
33 |
34 | [self imageReady:output];
35 | }
36 |
37 | @end
38 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFunhouse-Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | ${PRODUCT_NAME}
9 | CFBundleExecutable
10 | ${EXECUTABLE_NAME}
11 | CFBundleIcons
12 |
13 | CFBundlePrimaryIcon
14 |
15 | CFBundleIconFiles
16 |
17 | CVFunhouse57.png
18 | CVFunhouse114.png
19 | CVFunhouse144.png
20 | CVFunhouse72.png
21 |
22 | UIPrerenderedIcon
23 |
24 |
25 |
26 | CFBundleIdentifier
27 | $(PRODUCT_BUNDLE_IDENTIFIER)
28 | CFBundleInfoDictionaryVersion
29 | 6.0
30 | CFBundleName
31 | ${PRODUCT_NAME}
32 | CFBundlePackageType
33 | APPL
34 | CFBundleShortVersionString
35 | 1.0
36 | CFBundleSignature
37 | ????
38 | CFBundleVersion
39 | $(CURRENT_PROJECT_VERSION)
40 | LSRequiresIPhoneOS
41 |
42 | NSCameraUsageDescription
43 | To transform camera image via OpenCV.
44 | UILaunchStoryboardName
45 | Launch Screen
46 | UIMainStoryboardFile
47 | MainStoryboard_iPhone
48 | UIMainStoryboardFile~ipad
49 | MainStoryboard_iPad
50 | UIPrerenderedIcon
51 |
52 | UIRequiredDeviceCapabilities
53 |
54 | armv7
55 | video-camera
56 |
57 | UIRequiresFullScreen
58 |
59 | UIStatusBarHidden
60 |
61 | UISupportedInterfaceOrientations
62 |
63 | UIInterfaceOrientationPortrait
64 |
65 | UISupportedInterfaceOrientations~ipad
66 |
67 | UIInterfaceOrientationPortrait
68 |
69 | UIViewControllerBasedStatusBarAppearance
70 |
71 |
72 |
73 |
--------------------------------------------------------------------------------
/CVFunhouse/CVFunhouse-Prefix.pch:
--------------------------------------------------------------------------------
1 | //
2 | // Prefix header for all source files of the 'CVFunhouse' target in the 'CVFunhouse' project
3 | //
4 |
5 | #import
6 |
7 | #ifndef __IPHONE_5_0
8 | #warning "This project uses features only available in iOS SDK 5.0 and later."
9 | #endif
10 |
11 | #ifdef __cplusplus
12 | #pragma clang diagnostic push
13 | #pragma clang diagnostic ignored "-Wall"
14 | #pragma clang diagnostic ignored "-Wnested-anon-types"
15 | #import "opencv2/opencv.hpp"
16 | #pragma clang diagnostic pop
17 | #endif
18 |
19 | #ifdef __OBJC__
20 | #import
21 | #import
22 | #endif
23 |
--------------------------------------------------------------------------------
/CVFunhouse/en.lproj/InfoPlist.strings:
--------------------------------------------------------------------------------
1 | /* Localized versions of Info.plist keys */
2 |
3 |
--------------------------------------------------------------------------------
/CVFunhouse/main.m:
--------------------------------------------------------------------------------
1 | //
2 | // main.m
3 | // CVFunhouse
4 | //
5 | // Created by John Brewer on 3/7/12.
6 | // Copyright (c) 2012 Jera Design LLC. All rights reserved.
7 | //
8 |
9 | #import
10 |
11 | #import "CVFAppDelegate.h"
12 |
13 | int main(int argc, char *argv[])
14 | {
15 | @autoreleasepool {
16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([CVFAppDelegate class]));
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/CVFunhouse114.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeradesign/CVFunhouse/9b676ea969c255782386eedbe5c307c8d14bd14b/CVFunhouse114.png
--------------------------------------------------------------------------------
/CVFunhouse144.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeradesign/CVFunhouse/9b676ea969c255782386eedbe5c307c8d14bd14b/CVFunhouse144.png
--------------------------------------------------------------------------------
/CVFunhouse57.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeradesign/CVFunhouse/9b676ea969c255782386eedbe5c307c8d14bd14b/CVFunhouse57.png
--------------------------------------------------------------------------------
/CVFunhouse72.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeradesign/CVFunhouse/9b676ea969c255782386eedbe5c307c8d14bd14b/CVFunhouse72.png
--------------------------------------------------------------------------------
/CloseButton.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeradesign/CVFunhouse/9b676ea969c255782386eedbe5c307c8d14bd14b/CloseButton.png
--------------------------------------------------------------------------------
/Default-568h@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeradesign/CVFunhouse/9b676ea969c255782386eedbe5c307c8d14bd14b/Default-568h@2x.png
--------------------------------------------------------------------------------
/Demos.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | Canny Edge Detector
7 | CVFCannyDemo
8 |
9 |
10 | Face Detector
11 | CVFFaceDetect
12 |
13 |
14 | Laplace
15 | CVFLaplace
16 |
17 |
18 | Farneback
19 | CVFFarneback
20 |
21 |
22 | Lucas-Kanade
23 | CVFLucasKanade
24 |
25 |
26 | Motion Templates
27 | CVFMotionTemplates
28 |
29 |
30 | Hough Transform
31 | CVFHough
32 |
33 |
34 | Pass Thru
35 | CVFPassThru
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Copyright (c) 2012, Jera Design LLC
2 | All rights reserved.
3 |
4 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5 |
6 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7 |
8 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9 |
10 | * Neither the name of Jera Design LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11 |
12 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
13 |
14 | NOTE: CVFunhouse includes a copy of the OpenCV library in built as an iOS framework. OpenCV is licensed separately under similar terms. See the file "OpenCV license.txt" for details. For more information on OpenCV (including full source code to the library), see http://opencv.org/
--------------------------------------------------------------------------------
/Launch Screen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/NoDescription.html:
--------------------------------------------------------------------------------
1 |
No Description Provided
--------------------------------------------------------------------------------
/OpenCV license.txt:
--------------------------------------------------------------------------------
1 | IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
2 |
3 | By downloading, copying, installing or using the software you agree to this license.
4 | If you do not agree to this license, do not download, install,
5 | copy or use the software.
6 |
7 |
8 | License Agreement
9 | For Open Source Computer Vision Library
10 |
11 | Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
12 | Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved.
13 | Third party copyrights are property of their respective owners.
14 |
15 | Redistribution and use in source and binary forms, with or without modification,
16 | are permitted provided that the following conditions are met:
17 |
18 | * Redistributions of source code must retain the above copyright notice,
19 | this list of conditions and the following disclaimer.
20 |
21 | * Redistributions in binary form must reproduce the above copyright notice,
22 | this list of conditions and the following disclaimer in the documentation
23 | and/or other materials provided with the distribution.
24 |
25 | * The name of the copyright holders may not be used to endorse or promote products
26 | derived from this software without specific prior written permission.
27 |
28 | This software is provided by the copyright holders and contributors "as is" and
29 | any express or implied warranties, including, but not limited to, the implied
30 | warranties of merchantability and fitness for a particular purpose are disclaimed.
31 | In no event shall the Intel Corporation or contributors be liable for any direct,
32 | indirect, incidental, special, exemplary, or consequential damages
33 | (including, but not limited to, procurement of substitute goods or services;
34 | loss of use, data, or profits; or business interruption) however caused
35 | and on any theory of liability, whether in contract, strict liability,
36 | or tort (including negligence or otherwise) arising in any way out of
37 | the use of this software, even if advised of the possibility of such damage.
38 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This project should contain everything you need to build and run CVFunhouse
2 | under Xcode 4.5.2. If you run into any problems building or running, please file
3 | a bug.
4 |
5 | To get started writing your own OpenCV code, try modifying the CVFPassThru
6 | example. It contains thorough comments explaining exactly what you need to do.
7 | Plus it starts out working, so you can easily tell if you break anything as you
8 | hack.
9 |
10 | NOTE: CVFunhouse includes a copy of the OpenCV library built as an iOS
11 | framework. OpenCV is licensed separately under similar terms. See the file
12 | "OpenCV license.txt" for details. For more information on OpenCV (including full
13 | source code to the library), see the [OpenCV website](http://opencv.org/).
14 |
15 | Augmented Reality
16 | -----------------
17 |
18 | The augmented reality demo is currently checked into a separate branch. To use
19 | it, enter `git checkout augmented-reality` on the command line.
20 |
21 | Rebasing
22 | --------
23 |
24 | If you forked or cloned before 12-Jan-2013, you'll need to rebase your code to
25 | have your changes fit into the history properly. To do this:
26 |
27 | * Enter `git fetch` (**Do not use** `git pull`)
28 | * Enter `git rebase -i`
29 | * An editor window will appear.
30 | * Delete the line that starts: `pick 2a02f2a`
31 | * Delete the line that starts: `pick 429b656`
32 | * Save the file and close the editor.
33 | * That's it! You should be good to go from now on.
34 |
35 | Sorry for the inconvenience. This should be a one-time occurrence.
--------------------------------------------------------------------------------
/Settings.bundle/Root.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | PreferenceSpecifiers
6 |
7 |
8 | Type
9 | PSGroupSpecifier
10 | FooterText
11 | CVFunhouse
12 | Copyright (c) 2012, 2013, Jera Design LLC
13 | All rights reserved.
14 |
15 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
16 |
17 | * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
18 |
19 | * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
20 |
21 | * Neither the name of Jera Design LLC nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
22 |
23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 |
25 | NOTE: CVFunhouse includes a copy of the OpenCV library in built as an iOS framework. OpenCV is licensed separately under similar terms. See the file "OpenCV license.txt" for details. For more information on OpenCV (including full source code to the library), see http://opencv.org/
26 |
27 |
28 |
29 |
30 | Type
31 | PSGroupSpecifier
32 | FooterText
33 | OpenCV
34 | IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
35 |
36 | By downloading, copying, installing or using the software you agree to this license.
37 | If you do not agree to this license, do not download, install,
38 | copy or use the software.
39 |
40 |
41 | License Agreement
42 | For Open Source Computer Vision Library
43 |
44 | Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
45 | Copyright (C) 2008-2011, Willow Garage Inc., all rights reserved.
46 | Third party copyrights are property of their respective owners.
47 |
48 | Redistribution and use in source and binary forms, with or without modification,
49 | are permitted provided that the following conditions are met:
50 |
51 | * Redistributions of source code must retain the above copyright notice,
52 | this list of conditions and the following disclaimer.
53 |
54 | * Redistributions in binary form must reproduce the above copyright notice,
55 | this list of conditions and the following disclaimer in the documentation
56 | and/or other materials provided with the distribution.
57 |
58 | * The name of the copyright holders may not be used to endorse or promote products
59 | derived from this software without specific prior written permission.
60 |
61 | This software is provided by the copyright holders and contributors "as is" and
62 | any express or implied warranties, including, but not limited to, the implied
63 | warranties of merchantability and fitness for a particular purpose are disclaimed.
64 | In no event shall the Intel Corporation or contributors be liable for any direct,
65 | indirect, incidental, special, exemplary, or consequential damages
66 | (including, but not limited to, procurement of substitute goods or services;
67 | loss of use, data, or profits; or business interruption) however caused
68 | and on any theory of liability, whether in contract, strict liability,
69 | or tort (including negligence or otherwise) arising in any way out of
70 | the use of this software, even if advised of the possibility of such damage.
71 |
72 |
73 |
74 |
75 | Type
76 | PSGroupSpecifier
77 | FooterText
78 | Icon: Switch Camera Front/Rear by Simon Strandgaard
79 | http://www.flickr.com/photos/12739382@N04/5463151636/
80 |
81 |
82 | StringsTable
83 | Root
84 |
85 |
86 |
--------------------------------------------------------------------------------
/Settings.bundle/en.lproj/Root.strings:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeradesign/CVFunhouse/9b676ea969c255782386eedbe5c307c8d14bd14b/Settings.bundle/en.lproj/Root.strings
--------------------------------------------------------------------------------
/SwitchCameraIcon44.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeradesign/CVFunhouse/9b676ea969c255782386eedbe5c307c8d14bd14b/SwitchCameraIcon44.png
--------------------------------------------------------------------------------
/SwitchCameraIcon44@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeradesign/CVFunhouse/9b676ea969c255782386eedbe5c307c8d14bd14b/SwitchCameraIcon44@2x.png
--------------------------------------------------------------------------------
/iButton30.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeradesign/CVFunhouse/9b676ea969c255782386eedbe5c307c8d14bd14b/iButton30.png
--------------------------------------------------------------------------------
/iButton30@2x.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jeradesign/CVFunhouse/9b676ea969c255782386eedbe5c307c8d14bd14b/iButton30@2x.png
--------------------------------------------------------------------------------
/opencv2.framework/Headers:
--------------------------------------------------------------------------------
1 | Versions/Current/Headers
--------------------------------------------------------------------------------
/opencv2.framework/Resources:
--------------------------------------------------------------------------------
1 | Versions/Current/Resources
--------------------------------------------------------------------------------
/opencv2.framework/Versions/A/Headers/contrib/detection_based_tracker.hpp:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #if defined(__linux__) || defined(LINUX) || defined(__APPLE__) || defined(ANDROID)
4 |
5 | #include
6 | #include
7 |
8 | #include
9 |
10 | class DetectionBasedTracker
11 | {
12 | public:
13 | struct Parameters
14 | {
15 | int minObjectSize;
16 | int maxObjectSize;
17 | double scaleFactor;
18 | int maxTrackLifetime;
19 | int minNeighbors;
20 | int minDetectionPeriod; //the minimal time between run of the big object detector (on the whole frame) in ms (1000 mean 1 sec), default=0
21 |
22 | Parameters();
23 | };
24 |
25 | DetectionBasedTracker(const std::string& cascadeFilename, const Parameters& params);
26 | virtual ~DetectionBasedTracker();
27 |
28 | virtual bool run();
29 | virtual void stop();
30 | virtual void resetTracking();
31 |
32 | virtual void process(const cv::Mat& imageGray);
33 |
34 | bool setParameters(const Parameters& params);
35 | const Parameters& getParameters();
36 |
37 |
38 | typedef std::pair Object;
39 | virtual void getObjects(std::vector& result) const;
40 | virtual void getObjects(std::vector