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.
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
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.
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.
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!
- 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.
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:
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.
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.
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?
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];
}
- (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.
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.