How to get the color of the tapped point on the iPhone's camera input in real time?
I want to get the color of the point that the user is panning on the image from the camera. And this needs to happen in real time.
I'm using UIImagePickerController
class with sourceType
property set to UIImagePickerControllerSourceTypeCamera
.
So the user opens the video camera and after the iris opens he has the possibility to tap over it.
While he is panning on the video camera view I want the application to show the color of the point under his finger. Real time.
If there is someone who could please tell me if this is possible and how to do it.
I tried to use the code from here:
http://developer.apple.com/library/ios/#qa/qa1702/_index.html
Firs开发者_JAVA百科t I have a warning:
warning: 'CameraViewController' may not respond to '-setSession:'
I get a lot of errors when trying to compile. I included inside the .h
file this:
#import <AVFoundation/AVFoundation.h>
Do I have to include more then this?
Also do I still need to use the UIImagePickerController to show the camera?
I'm new to iOS and very confused with this.
OK I did it using the example from http://developer.apple.com/library/ios/#qa/qa1702/_index.html
The problem that I have is that is working only on the iPhone. On the simulator I still get those errors regarding not recognizing the frameworks.
You will have to use AVFoundation for this. An AVCaptureSession
can deliver live video frames to AVCaptureVideoDataOutput
's delegate method captureOutput:didOutputSampleBuffer:fromConnection:
where you then have to analyze each frame to determine the color at a particular position.
精彩评论