I'm currently developing an iOS app that is using OCR.
Currently I'm using AVFoundation to preview the video from the camera (using Apples sample AVCam).
For a good user experience I want to lay out a rectangle in the preview layer. The image inside this rectangle will be the image parsed by the OCR engine. My problem is that I also would like to "dim" everything outside this rectangle and I'm currently out of ideas how to solve this. Does anybody know how to do this?
Edit
This is what I would like to accomplish (image taken from the app Horizon):
http://i.imgur.com/MuuJNS9.png
You can use two black images covering the top and bottom areas that you want to "dim", set the alpha of those images to a certain value, like 0.5.
Why not add a subview that covers the entire screen and set the background color to a semi transparent gray - your gray overlay?
And then add the image parsed by the OCR engine add a subview of this grayoverlay int the center of it
Related
I've seen many solutions out here but they're not exactly what I'm looking for. What I'm attempting to do is have the view's background to move an image multiple times-- slowly and diagonally rather than horizontally or vertically.
From a web designing perspective, this can be achieved with a tiled bg.gif where the image gives the effect of an image moving without additional programming.
Example:
However, I'm not sure whether this is achievable within Swift programming. I'm sure alternative solutions are out there like having a single image (a smiley face) tiled to fill the view frame and have it move diagonally by incrementing it's x & y coordinates.
I'm new to iOS development and Swift yet I am learning a lot! Much help will be appreciated.
refer this two links. it will help to achieve what you want. click here and click here
Update as advised in comment : download SwiftGif and Import the Gif.swift in your project and do the following:
// Returns an animated UIImage
let myGif = UIImage.gifWithName("imggif")
// Use the UIImage in your UIImageView
let imageView = UIImageView(image: myGif)
here imggif is your gif image which shown in question. put it in your project
hope this will help :)
I would like to create the same effect that you can see on the picture attached.
I would like to have that kind of effect over my barcode scanner, which scan barcode with phone camera.
Any idea how can I do this?
I already tried with shadows but that was not the effect I want.
Thank you.
It looks like the
CILenticularHaloGenerator core image filter simulates lens flare, although the appearance is different than what you show.
Your image looks more like a radial gradient in red drawn over your image. You could use the Core Image CIRadialGradient filter, or overlay a partly transparent gradient on top of your image using CGGradient and CGContextDrawRadialGradient.
I am trying to make Apple kind of shape for progressHUD. I have option to use .png Image but I cant because I have to fill the apple Shape with different colour depends of percentage status.. I am using UIView to draw this shape...
I want suggestion how to draw apple kind of shape easily?
And How we can fill half colour with different colour?
I have option to use .png Image but I cant
Yes, you can. — Get hold of some apple-shaped artwork. Use it as a mask - it punches a hole in a view. Now put another view behind it, with a color. Now the apple appears to be that color, because that color is being seen through the apple-shaped hole. Now put another view behind it, with a different color, and move it up or across the right amount so as to divide what's seen through the apple into two colors.
Using that approach, it took me about 30 seconds to create this result (using your apple-shaped artwork as a .png image!):
I am working on an application which is used to change the orientation of the Image view and also provide a shadow to it. I have succeeded in that and the only obstacle remaining here is the fact that I have not been able to provide a 3D border to it as shown in this Image.
Look at the 3D border on the left and Bottom edge of this image view.
Please guide me to create this effect.
Thanks in advance.
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.