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

Mockup & CodeGen, iPhone & iPad
($9.99)

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

Manu
($0.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 09-18-2009, 10:17 AM   #1 (permalink)
Registered Member
 
Join Date: Sep 2009
Location: india
Posts: 65
Question taking images from camera without user interaction

i am creating an app in which as soon as the uiimagepickercontroller loads i.e. the camera view , it should start taking pictures without any click and should be storing images in some array. how can i do this without clicking on shoot button.

in refernce library , uiimagepickercontroller contains an instance method, takepicture. can somebody tell me that this function will do the trick if i call it through timer.

thanks in advance...
sharhelia is offline   Reply With Quote
Old 02-13-2010, 10:38 PM   #2 (permalink)
Registered Member
 
Join Date: Jan 2009
Posts: 8
Default Re: Taking images from camera w/o user interaction

Hi,

Have you been able to resolve this issue? I'm trying to do a similar thing by automating the capture of pictures from an iPhone application.

Thanks,
Al


Quote:
Originally Posted by sharhelia View Post
i am creating an app in which as soon as the uiimagepickercontroller loads i.e. the camera view , it should start taking pictures without any click and should be storing images in some array. how can i do this without clicking on shoot button.

in refernce library , uiimagepickercontroller contains an instance method, takepicture. can somebody tell me that this function will do the trick if i call it through timer.

thanks in advance...
alankernel is offline   Reply With Quote
Old 02-14-2010, 02:00 AM   #3 (permalink)
Dr. Touch Cocoa Helpdesk
iPhone Dev SDK Supporter
 
Join Date: Sep 2008
Location: Vienna, Austria
Posts: 537
Send a message via AIM to Oliver Drobnik Send a message via MSN to Oliver Drobnik Send a message via Skype™ to Oliver Drobnik
Default

Quote:
Originally Posted by alankernel View Post
Hi,

Have you been able to resolve this issue? I'm trying to do a similar thing by automating the capture of pictures from an iPhone application.

Thanks,
Al
you have two options:

- takePicture does the same as pushing the button would do.
- UIGetScreenImage private API has been un-banned in December so you can use this as well

Bear in mind though that one uncompressed UIImage of the screen weights about 450 kByte and keeping lots of these in an Array will run your memory full in no time.
__________________
regards

Oliver Drobnik
Cocoanetics - Our DNA is programmed in Objective-C.

Linguan – makes localizing strings file fun!

Cocoanetics Parts Store – easy to use yet professionally looking components that you can use to spruce up your own apps. Augmented Reality, Calendar Control, Pin Lock or Purchase Button are only some examples. You get full source code, no static library crap, and lifetime support. Check it out today!
Oliver Drobnik is offline   Reply With Quote
Old 02-19-2010, 07:22 AM   #4 (permalink)
Registered Member
 
Join Date: Sep 2009
Location: india
Posts: 65
Default

Quote:
Originally Posted by Oliver Drobnik View Post
you have two options:

- takePicture does the same as pushing the button would do.
- UIGetScreenImage private API has been un-banned in December so you can use this as well

Bear in mind though that one uncompressed UIImage of the screen weights about 450 kByte and keeping lots of these in an Array will run your memory full in no time.
Thank you so much for reply, it was a great help
sharhelia is offline   Reply With Quote
Old 02-19-2010, 03:48 PM   #5 (permalink)
Registered Member
 
Join Date: Feb 2010
Location: Rochester, NY
Posts: 11
Default

Quote:
Originally Posted by sharhelia View Post
Thank you so much for reply, it was a great help
I am trying to do something similar, but still can't get the takePicture method to work correctly.

Have you had any luck?

I'm trying to capture an image automatically without pushing the capture button. To do this, I create an overlay and then call takePicture:

Code:
	imgPicker = [[UIImagePickerController alloc] init]; 
	imgPicker.delegate = self; 
	imgPicker.sourceType = UIImagePickerControllerSourceTypeCamera; 
	imgPicker.allowsEditing = NO; 
	imgPicker.showsCameraControls = NO;
	imgPicker.wantsFullScreenLayout = NO;
	
	imgPicker.view = cameraOverlayView;
	

	[self presentModalViewController:imgPicker animated:YES]; 
	
	[imgPicker takePicture];
	printf("should have taken picture");
	[[imgPicker parentViewController] dismissModalViewControllerAnimated:YES];
The problem is that for some reason I can't get access to the picture that should be captured. I have the following method in my code but it never seems to get called:

Code:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
	printf("Did finish picking with info");
	
	[picker release];
}
Any suggestions?
dr_carmster is offline   Reply With Quote
Old 03-01-2010, 10:04 AM   #6 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 2
Default

I am using UIGetScreenImage but I don't have a very large image.
Is there a way to get access to 1600*1200 pixels image?

Thanks!
SuperCed is offline   Reply With Quote
Old 03-30-2010, 02:50 PM   #7 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 20
Default

dr_carmster, when you call the takePicture method, the camera does indeed take a picture, but then it displays it to the user giving them the options of "retake" or "use". Since you're quickly dismissing the picker controller, you'll never see that screen.

I'm wondering if anyone has anything else to add to this... I'm trying to do the following:

I want to take a picture and then gain access to it in the code to do some processing, but I don't want the picker to ever be shown on the screen (not before takePicture, and not after). I'm using the iPhone to control an autonomous vehicle in a school project, and I'm communicating with the vehicle in a pretty obscure way... The screen displays white and black squares to indicate different messages... so, having images pop up and go away while processing might cause the vehicle to do undesirable things. Weird, I know, but that's the way we're doing it.

Thanks
Avocado is offline   Reply With Quote
Old 03-30-2010, 03:37 PM   #8 (permalink)
Registered Member
 
Join Date: Feb 2010
Location: Rochester, NY
Posts: 11
Default

Quote:
Originally Posted by Avocado View Post
dr_carmster, when you call the takePicture method, the camera does indeed take a picture, but then it displays it to the user giving them the options of "retake" or "use". Since you're quickly dismissing the picker controller, you'll never see that screen.

I'm wondering if anyone has anything else to add to this... I'm trying to do the following:

I want to take a picture and then gain access to it in the code to do some processing, but I don't want the picker to ever be shown on the screen (not before takePicture, and not after). I'm using the iPhone to control an autonomous vehicle in a school project, and I'm communicating with the vehicle in a pretty obscure way... The screen displays white and black squares to indicate different messages... so, having images pop up and go away while processing might cause the vehicle to do undesirable things. Weird, I know, but that's the way we're doing it.

Thanks
I eventually got my code to work by creating an overlay. Using an overlay, I believe you could do what you are after, Avocado. In the overlay, just don't show the image you are capturing.
dr_carmster is offline   Reply With Quote
Old 03-30-2010, 03:53 PM   #9 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 20
Default

Quote:
Originally Posted by dr_carmster View Post
I eventually got my code to work by creating an overlay. Using an overlay, I believe you could do what you are after, Avocado. In the overlay, just don't show the image you are capturing.
Thanks, I'll give that a try. I'm still not sure how I'll gain access to the image that was captured by the camera... do you know how I could do that?
Avocado is offline   Reply With Quote
Old 03-30-2010, 04:13 PM   #10 (permalink)
Registered Member
 
Join Date: Feb 2010
Location: Rochester, NY
Posts: 11
Default

Quote:
Originally Posted by Avocado View Post
Thanks, I'll give that a try. I'm still not sure how I'll gain access to the image that was captured by the camera... do you know how I could do that?
Basically what you want to do is this:


- (void)changeImage {
// call the takePicture method, after it takes the picture, it should automatically call the method below
[imgPicker takePicture];
}


- (void)imagePickerControllerUIImagePickerControll er *)picker didFinishPickingMediaWithInfoNSDictionary *)info{

// the captured image should be in the variable img, and then you can go and manipulate it as you see fit
UIImage * img = [info objectForKey:UIImagePickerControllerOriginalImage];
}
dr_carmster is offline   Reply With Quote
Old 03-30-2010, 06:52 PM   #11 (permalink)
Registered Member
 
Join Date: Apr 2009
Location: michigan
Posts: 185
Default

Quote:
Originally Posted by dr_carmster View Post
Basically what you want to do is this:


- (void)changeImage {
// call the takePicture method, after it takes the picture, it should automatically call the method below
[imgPicker takePicture];
}


- (void)imagePickerControllerUIImagePickerControll er *)picker didFinishPickingMediaWithInfoNSDictionary *)info{

// the captured image should be in the variable img, and then you can go and manipulate it as you see fit
UIImage * img = [info objectForKey:UIImagePickerControllerOriginalImage];
}
if I understand what you are doing then you don't want to use takepicture at all. Why would you , you don't need a really photo quality picture.

Also I don't understand the ui, what are the white and black squares doing. can you just display them on the overlayed video . I don't understand.

Secondly, you say the vehicle is controlled by the phone , do you mean that the vehicle has a video camera and that info is being relayed back to the phone or the vehicle is blind and is using the iphone as the video source.

You mention gaining access to the images which would seem consistent with the second usecase.

So assuming the iphone is communicating to the vehicle via wifi.

The normal way to process video is:

In a nstimer loop call a process that calls uigetscreen image to create a cgimage, 32 bit bitmap seems to work best, convert this to grey scale than run a fourier algorithm or some other descrete image processing algorithm to extract the information from the video. There a quite a few open source libraries that can be used for recognizing simple shapes or colors.

I would very much like to hear more about this project, and since this is for a school project would be willing to offer help or assistant if you email me, we have done a lot with video processing.
michelle is offline   Reply With Quote
Old 03-30-2010, 07:05 PM   #12 (permalink)
Registered Member
 
Join Date: Jun 2009
Posts: 20
Default

Michelle,

On the vehicle, I have 4 photo-transistors that detect when sections of the screen are white or black, allowing us to send 16 different control messages to the vehicle. This is all done over WiFi, yes, and it all works great, and I do plan on using this view as the overlay view.

Here's some more detail about the camera:

We are required to detect when the vehicle has traveled 1m, 2m, 3m, etc. We plan to hang markers from the ceiling and have the phone take pictures of the ceiling, locating the marker, and based on its location within the image, we will know how far we have traveled. The problem is that when taking the picture, it seems like I need some kind of user interaction get at the image, and, if the actual image of the ceiling is displayed on the screen, the vehicle is likely to misinterpret it as a control signal that wasn't intended.

Thanks for the help
Avocado is offline   Reply With Quote
Reply

Bookmarks

Tags
camera, iphone, uiimagepickercontroller, zoom

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: 264
20 members and 244 guests
ADY, AragornSG, Bertrand21, Dani77, Dattee, Duncan C, fkmtc, HDshot, HemiMG, iDifferent, JasonR, macquitzon216, mer10, prchn4christ, Promo Dispenser, Rudy, sacha1996, sneaky, spiderguy84, theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,231
Posts: 380,768
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

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