Objective-c how to create lens flare effect in iOS - ios

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.

Related

Is anyone has idea about Palm line detection in iOS Swift?

Currently, I am doing Image COLOUR filtering operation second MEDIAN filtering then CANNY EDGE DETECTION ALGORITHM.
Then, I read pixels using for loop and I draw lines using pixel, but I do not getting proper result for palm scanning and showing lines on human Palm.
So if anybody has any types of idea regarding this then please let me know.
Currently i am getting this type of result:
but I need this type of output:
Oh I got your problem, You can do this by following steps.
1.process your hand image with canny edge detection algo lets name that cannyImage.
2.now create the bitmap of cannyImage and remove black pixels from the image and replace them with transparent pixels, black only because canny image will be filled with black color and objects lines in white when you process the image through the algo, now you have extracted the image with palm lines white in color, lets name that palmLineImage.
3.now the main part is MASKING you need to mask the palmLineImage on the original image.
These three steps will give you your desire O/P.
Tools you can use GPUImage awsesome library by BradLarson for this https://github.com/BradLarson/GPUImage2
For refining the palm image from background which I'm sure you have to use in future you can use GrabCut algo
LINK - https://github.com/naver/grabcutios
and now the apple has launched Photos captured in Portrait Mode on iOS 12 contain an embedded person segmentation matte that made it easy to create creative visual effects like background replacement.
Links - https://developer.apple.com/videos/play/wwdc2019/260/ , https://developer.apple.com/videos/play/wwdc2019/225/
Looks like you need to use something like the douglas peucker algorithm - to simplify the number of data points and smooth the lines. link - https://en.wikipedia.org/wiki/Ramer%E2%80%93Douglas%E2%80%93Peucker_algorithm

IOS Crosshatched image: Animate the lines being drawn

I am using the GPUImage2 library on IOS to create filters for my images.
I filter my image with a crosshatch filter, and get something like this:
I want to animate these black lines falling onto the page, one after the other (kind of like how snapchat animates a mesh onto your face before putting filters on)
I'm not sure if this is possible... Maybe there is a library that can do what I want?
Thanks for the help.

How do you create a 'blurred text' image effect in iOS?

I want to create a text shaped blur effect to an image as shown below:
Another example:
I have found an answer on blurring a UILabel answer: How to blur UILabel text.
But the effect is not correct.
So, How can I create a blurred text image effect that I can render into an image as a watermark in Swift?
Somebody help me! Thanks very much!
By the way, the answers about UIVisualEffectView is not correct.
The effect using UIVisualEffectView is like:
Besides, I also want to apply this kind of blur effect into photo's watermark.
So, any help?
You're going to need a two stage approach to get the desired effect:
Generate a black and white image of the text (black background, white text). The standard string in Swift has a Draw method. There's another Answer that has more detail on this.
Pass this 'text' image and your source image into the CIMaskedVariableBlur filter from CoreImage.
Basically, your 'text' image will act as the mask for the blur filter. Where the mask is lighter, the blur is stronger, and where the mask is black, no blur is applied.

Mask/crop an image

What is the best approach to display a cropped/masked image in Flutter?
Lets say I have one image with a mask (eg. an irregular star shape with transparent background) and the other image which I want to mask with this star, so that only the part inside the star of original image would be rendered.
I'm aiming for something like PorterDuffXfermode on Android (similar question here - Android how to apply mask on ImageView?).
In case of simple mask shapes is going the RenderClipOval way a good approach?
I would just paint it using a CustomPainter, setting the Paint.BlendMode on the Paint you pass to the method when you paint the image.
See https://docs.flutter.io/flutter/dart-ui/Canvas/drawImageRect.html and https://docs.flutter.io/flutter/dart-ui/Paint/blendMode.html and https://docs.flutter.io/flutter/widgets/CustomPaint-class.html.

How to dim/blur everything outside given rect in iOS?

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

Resources