Take a picture, choose between Full or Square Mode in camera - ios

Is there a way to use the overlays in the UIImagePickerController to show the square picture a user might use, while having a toggle button in there somewhere to switch on the fly?
Currently the iOS 7 camera has this capability, but UIImagePickerController does not (thanks Apple), so is there a way to add this functionality?
Would using AVCaptureSession be necessary? It seems like serious overkill, and I'd have to program flash/focus/etc all over again, I think.
Failing that, is there a customizable class that already exists that I could just implement?
I'm banging my head against the wall trying to figure out the best course of action here, so any help would be appreciated.

You can adjust the camera view by transforming the scale
CGAffineTransform transform = CGAffineTransformMakeScale(1.0, 0.5);
imagePickerController.cameraViewTransform = transform;
with the arguments being the scale to change the x and y axis of the camera screen by. You could add a button that re-presents the camera view within the view controller at the top of your hierarchy. It may not perfectly recapitulate the native phone app, but it will be a pretty good approximation.

I would probably do this with a custom cameraOverlayView that letterboxes the viewfinder. Once the picture has been taken you'll have to crop the resulting image.

Related

How can I add a 3d object as a marker on Google Maps like Uber does

I want to add a 3d marker for showing cars on map with rotation like Uber does but I can't find any information on adding 3d objects on Google Maps SDK for iOS.
Would appreciate any help.
Apparently no one is seeing what OP and I are seeing so here's a video of a Uber car turning 90 degrees. Play it frame by frame and you'll notice that it's not a simple image rotation. Either Uber went through the trouble of doing ~360 angles of each vehicles, or it really is a 3D model. Doing 360 images of every car seems foolish to me.
From what I can tell, they are not using 3D objects. They are also not animating between 400 images of a car at a different angle. They're doing a mix of rotating image assets and animating between ~50-70 images of a car at different angles. The illusion is perfect because it really does look like they used 3D car models !
Look at this GIF of a Uber car turning a corner (Dropbox link):
We can clearly see that that the shadow and the car's view angle doesn't update as often as the car's rotation.
Here I overlaid 2 images of the car at different angles, but using the same car image:
We can see that the map is rotated ~5 degrees but the car image is perfectly clear because it hasn't changed, it was simply rotated.
Uber just released a blog post documenting this.
It looks like the vehicles were modeled in 3D software and then image assets depicting different angles were exported for the app. Depending on where the vehicle is on the map and its heading then a different asset is used.
First, they are NOT 3D Objects if that's what you referring to (It's possible to create one though, but waste of time) They are simply 3D image created in Photoshop or Illustrator (Mostly) that have 3D perspective (It's also retina optimized, that's why it looks very clear).
The reason you see that the car is rotated its because the UIImageView that the image is being held into is rotated (using CABasicAnimation mostly) using calculation base off of 3D device position (Same technology use for running apps to track your location etc), which you can use Core Location to retrieve that data.
It's a proccess, but very doable. Good Luck!
Thanks All answers are valid.
if you want you can see the video running, how it works
You can generate sprite sheet ( around 60 ) tiles
How i implement it and tools you need
3d source car model.
blender, animate camera using path animation elipse.
camera rotate around of car from top to bottom view
render 3d marker using sprite generated with blender, for angles use bearing change on location updates.
Your vehicle needs to be rendered to support most screens, so the base size for each tile was 64 px and I was scaling according to the dpi of the screens
Result implementation:
https://twitter.com/ronfravi/status/1133226618024022016?s=09
I believe a pair of marker images, one is the real marker, and another one is a darker blurry shadow can do the trick in a cheaper way. Putting the shadow marker beneath the marker, shifting X & Y axis to an amount where you feel the shadow would be put appropriately, and finally moving them as well as rotating them (on web version, you may need separate rotated images) at the same time should be able to [re]create the illusion.
As #Felix Lapalme already explained it beyond any easier, am not diving any deeper into explaning it.
check out my repo
I used a dea model and turned it according to the heading variable
https://github.com/hilalalhakani/HHMarker
I achieved this in Xamarin by rendering three.js in a webview then sending the image buffer directly to the marker instead of drawing it to the screen. It only took a couple of days, and for my use case it was needed because I want the drivers to be able to change the color and kind of car, but if this is not the functionality you need you're better of just using a sequence of rendered images.
If you want to Rotated your image as the marker. Want to show a moving object you can use .git image. It would be help full for you.
Swift 3
let position = CLLocationCoordinate2D(latitude: 51.5, longitude: -0.127)
//Rotate a marker
let degrees = 90.0
let london = GMSMarker(position: position)
london.title = "London"
//Customize the marker image
london.icon = UIImage(named: "YourGifImageName")
london.groundAnchor = CGPoint(x: 0.5, y: 0.5)
london.rotation = degrees
london.map = mapView
For more info Please check here

How to implement Slide-out menu for iOS Apps

I just wanted to implement slide-out menu like implemented in this snapshot below:
Could anybody guide me how to go for it.
Thanks
V#run
Looks like Patrick's link will give you most of what you want. If you really want the 3D look where the menu appears to be tilted away you'll have to learn how to use Core Animation with transformation matrixes that create perspective. Do a search on "Adding Perspective to Your Animations" in the Xcode help system for info on how to get perspective.
In short, it involves setting the M34 field of a CATransform3D to a small negative value after rotating the layer around the desired axis. (In this case you'd want to rotate around the y axis.)
RESideMenu is a great library that I've used more than once. You can find it on Github here: https://github.com/romaonthego/RESideMenu

iOS 7 Camera.app horizontal 3d transform

I'm really interested in this effect introduced in iOS 7 Camera app:
http://i41.tinypic.com/2a0hwk8.jpg
Notice, how "Pano" option is transformed - as if it is goes on a circular path to the right and dissappears. What kind of transformation can achieve this effect? Any help would be appreciated.
Thanks
It is probably a transform that is applied and adjusted when the view in question (the label) reaches a certain position (which would normally be done with KVO or similar).
However, a good place to start would be the iOS 7 picker view, which has a similar 3D effect, but in the vertical rather than the horizontal. They are probably achieved the same way, and the advantage with the picker is you can inspect its view hierarchy in your own apps.

xcode custom overlay capture

I am working on OCR recognition App and I want to give the user the option to manually select the area (during the camera selection) on which to perform the OCR. Now, the issue I face is that I provide a rectangle on the camera screen by simply overriding the - (void)drawRect:(CGRect)rect method, However, despite there being a rectangle ,the camera tries to focus on the entire captured area rather than just within rectangle specified.
In other word, I do not want the entire picture to be send for processing but rather only the part of the captured image inside the rectangle. I have managed to provide a rectangle, However with no functionality. I do not want the entire screen area to be focused, but only the area under the rectangle.
I hope this makes sense since i have tried my best to explain it.
Thanks and let me know
Stream the camera's image to a UIScrollView using an AVCaptureOutput then allow the user to pinch/pull/pan the camera into the proper place... now use UIGraphics Image Context to take a "screen-shot" of this area and send that UIImage.CGImage in for processing.

Correcting an image orientation

I have an image that can be photographed on different orientations. My problem is after that the image was photographed I have to rotate it in an upright position. My initial plan was to put a marker on the upper left hand of the image, find its location, and rotate it. However if I take this approach, I have to study object/feature extraction. Is there any other simple solution to this problem? By the way, I need to make an iOS app out of it
Thanks in avance!

Resources