I am working on an iOS application in which I detect a face from an image and face blur, I have already achieved a face blur in a rectangular shape, but for me it requires a face blur in a rounded shape. what i tried is
-(void)markAfterFaceDetect:(NSArray *)features
{
for (CIFaceFeature *f in features)
{
CGRect aRect = f.bounds;
NSLog(@"here is the height of h %f",aRect.size.height);
aRect.origin.y = self.viewShow.bounds.size.height - aRect.size.height - aRect.origin.y;
NSLog(@"Height Of the Image Is : == %f",_imageView.image.size.height);
rectFaceDetect = aRect;
UIVisualEffect *blurEffect;
blurEffect = [UIBlurEffect effectWithStyle:UIBlurEffectStyleLight];
UIVisualEffectView *visualEffectView;
visualEffectView = [[UIVisualEffectView alloc] initWithEffect:blurEffect];
visualEffectView.frame = vv.frame;
visualEffectView.alpha =0.96;
visualEffectView.tag = markViewTag;
CAShapeLayer *mask = [CAShapeLayer layer];
mask.path = [UIBezierPath bezierPathWithOvalInRect:visualEffectView.bounds].CGPath;
visualEffectView.layer.mask = mask;
}
}
Using this method, I managed to blur the face with a rounded shape or a circular shape, but when I take a screenshot to save a blurry image in the application database, its Alpha will become 0, and the blur area will become visible, the code that I use to take screenshots
CGRect rect = viewShow.frame;
UIGraphicsBeginImageContext(rect.size);
CGContextRef context = UIGraphicsGetCurrentContext();
[viewShow.layer renderInContext:context];
UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
here is the image before and after the screenshots


Now I have used this category and achieved this blur in a rectangular shape. Attached Image

.
1- ?
2- Alpha 0, .
: 
.