How to Add Face Filter Beauty With Twilio Video Call SDK Like Snap Chat

122 Views Asked by At

I am working in a project who has feature to start One - one Video call. So, Now requirement is list out few face beauty filters to apply on video call Just like Snap Chat Video call or Instagram Video call.

Last 1 weeks I have a lot of R & D this in Swift with Twilio Video call SDK and other way to do this. But I am unable to do it.

There is some Article I got from Twilio which describes VideoProcessor for Face filter which is currently available in Web not for iOS and Android. Reference -

  1. https://www.twilio.com/blog/add-filters-twilio-video-application-faceapi-react-hooks-typescript
  2. https://www.twilio.com/blog/custom-effect-filters-twilio-programmable-video
  3. https://www.twilio.com/blog/change-background-video-calls-twilio-video-processors-library
  4. https://www.twilio.com/blog/integrating-opencv-object-detection-programmable-video

I tried some custom code in iOS

import TwilioVideo
import AVFoundation
import Vision
import CoreImage

private func applyBeautyFilter(to faceImage: CIImage, originalImage: CIImage) -> CIImage? {
       
        let filteredImage = faceImage.applyingFilter("CIColorControls", parameters: [
            kCIInputSaturationKey: 1.2, // Example saturation adjustment
            kCIInputBrightnessKey: 0.1 // Example brightness adjustment
        ])
        
        
        let blendFilter = CIFilter(name: "CISourceOverCompositing")
        blendFilter?.setValue(filteredImage, forKey: kCIInputImageKey)
        blendFilter?.setValue(originalImage, forKey: kCIInputBackgroundImageKey)
        
        return blendFilter?.outputImage
    }
    

I am not getting where to put this code and how to apply this filter with Twilio?

Thank you if any one can help to find solution.

0

There are 0 best solutions below