Skip to content

Commit

Permalink
Sephia Demo
Browse files Browse the repository at this point in the history
  • Loading branch information
mshopsin committed Jul 21, 2012
1 parent 42cd59e commit 05426f5
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CVFunhouse.xcodeproj/project.pbxproj
Expand Up @@ -29,6 +29,7 @@
42B3377615BA949400CBD888 /* CVFunhouse114.png in Resources */ = {isa = PBXBuildFile; fileRef = 42B3377515BA949400CBD888 /* CVFunhouse114.png */; };
42B3377915BA94A000CBD888 /* CVFunhouse57.png in Resources */ = {isa = PBXBuildFile; fileRef = 42B3377815BA94A000CBD888 /* CVFunhouse57.png */; };
42B3377C15BB2F5200CBD888 /* CVFCannyDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = 42B3377B15BB2F5200CBD888 /* CVFCannyDemo.m */; };
CD7E937715BB5354004D709A /* CVFSephiaDemo.m in Sources */ = {isa = PBXBuildFile; fileRef = CD7E937615BB5354004D709A /* CVFSephiaDemo.m */; };
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
Expand Down Expand Up @@ -63,6 +64,8 @@
42B3377815BA94A000CBD888 /* CVFunhouse57.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = CVFunhouse57.png; sourceTree = "<group>"; };
42B3377A15BB2F5200CBD888 /* CVFCannyDemo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CVFCannyDemo.h; sourceTree = "<group>"; };
42B3377B15BB2F5200CBD888 /* CVFCannyDemo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CVFCannyDemo.m; sourceTree = "<group>"; };
CD7E937515BB5354004D709A /* CVFSephiaDemo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CVFSephiaDemo.h; sourceTree = "<group>"; };
CD7E937615BB5354004D709A /* CVFSephiaDemo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CVFSephiaDemo.m; sourceTree = "<group>"; };
/* End PBXFileReference section */

/* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -137,6 +140,8 @@
42537093150839FF00BFE3C0 /* CVFImageProcessor.m */,
42B3377A15BB2F5200CBD888 /* CVFCannyDemo.h */,
42B3377B15BB2F5200CBD888 /* CVFCannyDemo.m */,
CD7E937515BB5354004D709A /* CVFSephiaDemo.h */,
CD7E937615BB5354004D709A /* CVFSephiaDemo.m */,
4253709515083BA800BFE3C0 /* CVFImageProcessorDelegate.h */,
42AA085E1508314600B379F4 /* Supporting Files */,
);
Expand Down Expand Up @@ -229,6 +234,7 @@
42AA08741508314600B379F4 /* CVFFlipsideViewController.m in Sources */,
42537094150839FF00BFE3C0 /* CVFImageProcessor.m in Sources */,
42B3377C15BB2F5200CBD888 /* CVFCannyDemo.m in Sources */,
CD7E937715BB5354004D709A /* CVFSephiaDemo.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
3 changes: 2 additions & 1 deletion CVFunhouse/CVFMainViewController.m
Expand Up @@ -9,6 +9,7 @@
#import "CVFMainViewController.h"
#import <AVFoundation/AVFoundation.h>
#import "CVFCannyDemo.h"
#import "CVFSephiaDemo.h"

@interface CVFMainViewController ()

Expand All @@ -32,7 +33,7 @@ @implementation CVFMainViewController {
- (void)viewDidLoad
{
[super viewDidLoad];
_imageProcessor = [[CVFCannyDemo alloc] init];
_imageProcessor = [[CVFSephiaDemo alloc] init];
_imageProcessor.delegate = self;
[self setupCamera];
[self turnCameraOn];
Expand Down
13 changes: 13 additions & 0 deletions CVFunhouse/CVFSephiaDemo.h
@@ -0,0 +1,13 @@
//
// CVFSephiaDemo.h
// CVFunhouse
//
// Created by Matthew Shopsin on 7/21/12.
// Copyright (c) 2012 Jera Design LLC. All rights reserved.
//

#import "CVFImageProcessor.h"

@interface CVFSephiaDemo : CVFImageProcessor

@end
37 changes: 37 additions & 0 deletions CVFunhouse/CVFSephiaDemo.m
@@ -0,0 +1,37 @@
//
// CVFSephiaDemo.m
// CVFunhouse
//
// Created by Matthew Shopsin on 7/21/12.
// Copyright (c) 2012 Jera Design LLC. All rights reserved.
//

#import "CVFSephiaDemo.h"
#include "opencv2/core/core_c.h"
#include "opencv2/imgproc/imgproc_c.h"

@implementation CVFSephiaDemo



-(void)processIplImage:(IplImage*)iplImage
{
IplImage *output = cvCreateImage(cvGetSize(iplImage), IPL_DEPTH_8U, 3);
IplImage *sepiaImage = cvCreateImage(cvGetSize(iplImage), IPL_DEPTH_8U, 4);
//cvCvtColor(iplImage, output, CV_RGB2BGR);
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};
CvMat m_Sepia = cvMat(3, 3, CV_32F, sepia_Array);

cvFilter2D(iplImage, sepiaImage, &m_Sepia, cvPoint(1, -1));//(iplImage, sepiaImage, &m_Sepia, NULL);
cvCvtColor(sepiaImage, output, CV_BGRA2RGB);
//cvCvtColor(output, output2, CV_RGB2BGR);
//cvReleaseImage(&sepiaImage);
cvReleaseImage(&sepiaImage);
cvReleaseImage(&iplImage);



[self imageReady:output];
}

@end

0 comments on commit 05426f5

Please sign in to comment.