PDA

View Full Version : reloading/refreshing/updating cameraViewTransform?




Jakintosh™
Jul 11, 2010, 11:32 AM
Basically for camera zoom purposes. I just can't figure out how to update the cameraViewTransform property of my UIImagePickerController called camView. I'm trying to change this from the camView instance's cameraOverlayView. I've got a lone "global" variable "trans" that holds the transformation magnitude, and I can change it and everything, I even ended up making camView "global" so that I can access that instance from two separate classes (the ViewController and the overlayView called "Button") and I have this under my "controlPressed:" method

camView.cameraViewTrasform = CGAffineTransformMakeScale(trans, trans);

I'm thinking I will need to run "presentModalViewController: camView" again to display the changes like I did when I initialized camView in the ViewController, but I can't figure out how to run that "presentModalViewController: camView" again without being in viewDidAppear in my ViewController... how can display the changes to camView.cameraViewTransform?

I'm new to programming, I've only had a year of more introductory college courses, so I may have missed something really obvious...

Also, if I'm going about this completely the wrong way, please tell me, I'd like to learn from this. I've been working at this for three days now, and I decided I'd ask you guys now because I'm not getting anywhere...

Thanks!



PhoneyDeveloper
Jul 11, 2010, 01:29 PM
You do it in your view controller. The view controller creates the camera view controller and should maintain a pointer to it. Then you set the transform from the view controller whenever you like.

Jakintosh™
Jul 11, 2010, 01:40 PM
So, once it is initialized, just saying camView.cameraTransformView = blahblah will then automatically change the zoom? As long as I'm in the view controller? Thanks, I'm going to try that right now...

EDIT: so, how would I access that instance of the view controller from another class? I made this in the view controler:

-(void)refresh
{
camView.cameraViewTransform = CGAffineTransformScale (camView.cameraViewTransform, transX, transY);
}

but how do I call it from a different class? (where my buttons to change it reside)


EDIT: Ok, I got it.

DARSHANSHAH1302
Apr 29, 2011, 11:15 AM
Hi ...
I am kind of similar to what are you doing !!

I created a custom Camera Control with overlay ...

Now i am zooming image by using Slider by ..
imagePickerController.cameraViewTransform = CGAffineTransformScale(initialTransform, MainSlider.value, MainSlider.value);


where initialTransform is the initial image transformation ...
MainSlider is slider , which i use to get zoom level from 1 to 4
So each time when i increase image using Slider ... I refer initialTransform and zoom accordingly Slider value ...

I am able to zoom by doing this .. But when i capture photo using



[imagePickerController takePicture];



It gives me Original Picture only .. does not give me any EditedImage ...

This original image is same as without zoom ...
I want to get Image which was zoomed ...
Means whatever showing in screen ...

I try to find a lot for this,,,, I know we can use GetScreenCapture()
but it can be cause of rejection of app and also it lower down the image quality ...

PhoneyDeveloper
Apr 29, 2011, 12:41 PM
It gives me Original Picture only .. does not give me any EditedImage ...

That's right. The transform applies to the view on the screen, not the image.

This original image is same as without zoom ...
I want to get Image which was zoomed ...

There is no such thing. You should take the image that you get and then use the slider's value to generate a new image that matches your zoom level.

DARSHANSHAH1302
Apr 29, 2011, 12:58 PM
Can you tell me how to scale image before i get to another view

I know there is none property of like Transform in UIImage (if i am not wrong)

Can you suggest me alternate way for that !!!