Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 12-13-2011, 09:22 PM   #1 (permalink)
Registered Member
 
Join Date: Sep 2011
Location: texas
Posts: 49
raptor85 is on a distinguished road
Default how to paste a photo on top a video in objective c

i have a photo where it should appear on top of a video (ex: face) so
when the face moves the photo also moves along with face , is there a
way where we can program it ,any help would be appreciated
raptor85 is offline   Reply With Quote
Old 12-13-2011, 10:02 PM   #2 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,005
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by raptor85 View Post
i have a photo where it should appear on top of a video (ex: face) so
when the face moves the photo also moves along with face , is there a
way where we can program it ,any help would be appreciated
So you want to track the face in the picture, and have the image move along with the face?

There is a face recognition system built into Core Image in iOS 5. It's an object of class CIDetector.

You create a face detector with the CIDetector class method detectorOfType:contextptions, passing in a type of CIDetectorTypeFace.

You then pass the detector a CIImage that contains one or more faces, and it hands you back an array of CIFaceFeature objects, which gives you a bounding rectangle for the face, plus point coordinates for each eye and the mouth.

We've only used it so far in high accuracy mode, which is intended for still images. Supposedly the low accuracy mode can be used to find faces in a video feed.

Once you find a face i an an image, you could use it's location to move a party transparent image view over the face.
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is online now   Reply With Quote
Old 12-13-2011, 11:37 PM   #3 (permalink)
Registered Member
 
Join Date: Sep 2011
Location: texas
Posts: 49
raptor85 is on a distinguished road
Default

Quote:
Originally Posted by Duncan C View Post
So you want to track the face in the picture, and have the image move along with the face?

There is a face recognition system built into Core Image in iOS 5. It's an object of class CIDetector.

You create a face detector with the CIDetector class method detectorOfType:contextptions, passing in a type of CIDetectorTypeFace.

You then pass the detector a CIImage that contains one or more faces, and it hands you back an array of CIFaceFeature objects, which gives you a bounding rectangle for the face, plus point coordinates for each eye and the mouth.

We've only used it so far in high accuracy mode, which is intended for still images. Supposedly the low accuracy mode can be used to find faces in a video feed.

Once you find a face i an an image, you could use it's location to move a party transparent image view over the face.
Code:
exampleVideoController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:[resourcePath stringByAppendingPathComponent:@"pathOftheVideoFile"]]];
    exampleVideoController.shouldAutoplay = YES;
    exampleVideoController.repeatMode = MPMovieRepeatModeOne;
    exampleVideoController.view.contentMode = UIViewContentModeScaleToFill;
    exampleVideoController.controlStyle = MPMovieControlModeDefault;
    exampleVideoController.view.frame = CGRectMake(0.0, 0.0, videoAnimationView.frame.size.width, videoAnimationView.frame.size.height);
    [videoAnimationView addSubview:exampleVideoController.view];
    exampleVideoController.view.backgroundColor = [UIColor clearColor];
    videoAnimationView.backgroundColor = [UIColor clearColor];

Is this correct
Code:
CIImage *ciImage = [[CIImage alloc] initWithImage:[UIImage imageNamed:@"Photo.JPG"]];
if (ciImage == nil)

[imageView setImage:[UIImage imageNamed:@"Photo.JPG"]];

NSDictionary *options = [[NSDictionary alloc] initWithObjectsAndKeys:
                         @"CIDetectorAccuracy", @"CIDetectorAccuracyHigh",nil];

CIDetector *ciDetector = [CIDetector detectorOfType:CIDetectorTypeFace 
                                            context:nil
                                            options:options];
NSArray *features = [ciDetector featuresInImage:ciImage];
NSLog(@"no of face detected: %d", [features count]);
should i use this code while declaring NSDictionary object
NSDictionary *options = [NSDictionary dictionaryWithObject: CIDetectorAccuracyLow forKey: CIDetectorAccuracy];

Last edited by raptor85; 12-13-2011 at 11:52 PM.
raptor85 is offline   Reply With Quote
Old 12-14-2011, 08:41 AM   #4 (permalink)
Cocoa Junkie
 
Duncan C's Avatar
 
Join Date: Dec 2008
Location: Northern Virginia
Posts: 6,005
Duncan C has a spectacular aura about
Default

Quote:
Originally Posted by raptor85 View Post
Code:
exampleVideoController = [[MPMoviePlayerController alloc] initWithContentURL:[NSURL fileURLWithPath:[resourcePath stringByAppendingPathComponent:@"pathOftheVideoFile"]]];
    exampleVideoController.shouldAutoplay = YES;
    exampleVideoController.repeatMode = MPMovieRepeatModeOne;
    exampleVideoController.view.contentMode = UIViewContentModeScaleToFill;
    exampleVideoController.controlStyle = MPMovieControlModeDefault;
    exampleVideoController.view.frame = CGRectMake(0.0, 0.0, videoAnimationView.frame.size.width, videoAnimationView.frame.size.height);
    [videoAnimationView addSubview:exampleVideoController.view];
    exampleVideoController.view.backgroundColor = [UIColor clearColor];
    videoAnimationView.backgroundColor = [UIColor clearColor];

Is this correct
Code:
CIImage *ciImage = [[CIImage alloc] initWithImage:[UIImage imageNamed:@"Photo.JPG"]];
if (ciImage == nil)

[imageView setImage:[UIImage imageNamed:@"Photo.JPG"]];

NSDictionary *options = [[NSDictionary alloc] initWithObjectsAndKeys:
                         @"CIDetectorAccuracy", @"CIDetectorAccuracyHigh",nil];

CIDetector *ciDetector = [CIDetector detectorOfType:CIDetectorTypeFace 
                                            context:nil
                                            options:options];
NSArray *features = [ciDetector featuresInImage:ciImage];
NSLog(@"no of face detected: %d", [features count]);
should i use this code while declaring NSDictionary object
NSDictionary *options = [NSDictionary dictionaryWithObject: CIDetectorAccuracyLow forKey: CIDetectorAccuracy];

Looks reasonable, but I am a lousy proofreader. The compiler will certainly complain if you have any syntax errors, and the real test will be what happens if you run it. Why not try it?
__________________
Regards,

Duncan C
WareTo

Check out our apps in the Apple App store


Check out this password generator app that shows various techniques including using a data container singleton object to share data between objects in your project.

See this tutorial on using UIView animations and layer animations:

See this thread on generating random, non-repeating text

Check out a very cool Macintosh Kaleidoscopes app called ScopeWorks that we released to the Mac App store.
Duncan C is online now   Reply With Quote
Reply

Bookmarks

Tags
iphone, objective - c, xcode

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 397
13 members and 384 guests
7twenty7, AppsBlogger, Creativ, David-T, Duncan C, HemiMG, heshiming, LunarMoon, Murphy, pbart, Sami Gh, teebee74, Tomsky
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,676
Threads: 94,127
Posts: 402,915
Top Poster: BrianSlick (7,990)
Welcome to our newest member, jleannex55
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 06:49 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0