Var imageOrientation = CGImagePropertyOrientation(. Let bgImage = (to: frame.extent)Ĭlass ViewController: UIViewController weak var imageView: UIImageView! To create clear background CIImage just do this: Render the contents of the CAShapeLayer to CGImageīitmapInfo: )! Set background and fill color and set the path ame = frame.extent // Assuming frame is the input CIImage with the face Create CAShapeLayer matching the dimensions of the input frame Create the closed contour path from points One way to do that is to create a CGImage from CAShapeLayer containing the mask and then create CIImage out of it. So the mask image has to be a CIImage as well. And now you can use the CIKMeans filter with it as described at the beginning.īTW, if you want to play with every single of the 230 filters out there check this app out: UPDATE:ĬIFilters can only work with CIImages. The output of that filter will give you the image with all pixels outside the contour fully transparent.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |