Photos that are not geometric - How can I focus photos in my iPhone app?
When you take photos with your iPhone camera, they automatically snap to geometry.
I wrote down the following code to take photos in GPS Recorder app, but the photos are not geometrically bound.
What am I doing wrong? Should I use a completely different method or can I somehow modify my code to add geotag and other data to the EXIF information?
Note that self.photoInfo is the dictionary of information returned by this delegate method:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
Here's the code:
UIImage *oImage = [self.photoInfo objectForKey:UIImagePickerControllerOriginalImage];
CGSize size = oImage.size;
oImage = [CameraController imageWithImage:oImage
scaledToSize:CGSizeMake(size.width/2.56,size.height/2.56)];
NSDictionary *info = [[NSDictionary alloc] initWithObjectsAndKeys:
oImage, @"image", titleString, @"title", nil];
TrailTrackerAppDelegate *t = (TrailTrackerAppDelegate *)[[UIApplication sharedApplication] delegate];
[NSThread detachNewThreadSelector:@selector(saveImage:) toTarget:t withObject:info];
+ (UIImage*)imageWithImage:(UIImage*)image scaledToSize:(CGSize)newSize {
UIGraphicsBeginImageContext( newSize );
[image drawInRect:CGRectMake(0,0,newSize.width,newSize.height)];
UIImage* newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return newImage;
}
Here is a photo taken with a camera that has all the good EXIF data: http://www.flickr.com/photos/ 33766454 @ N02 / 3978868900 /
And here we took with my code, which has no EXIF data: http://www.flickr.com/photos/ 33766454 @ N02 / 3978860380 /
+2
source to share