ios - Face filter implementation like MSQRD/SnapChat -
i want develop live face filters msqrd/snapchat live filters did not able find out how should proceed should use augmented reality framework , detect face or use core image detect face , process accordingly. please let me know if has idea how implement same?
i recommend going core image
, cidetector. https://developer.apple.com/library/ios/documentation/graphicsimaging/conceptual/coreimaging/ci_detect_faces/ci_detect_faces.html has been available since ios 5 , has great documentation.
creating face detector example:
cicontext *context = [cicontext contextwithoptions:nil]; // 1 nsdictionary *opts = @{ cidetectoraccuracy : cidetectoraccuracyhigh }; // 2 cidetector *detector = [cidetector detectoroftype:cidetectortypeface context:context options:opts]; // 3 opts = @{ cidetectorimageorientation : [[myimage properties] valueforkey:kcgimagepropertyorientation] }; // 4 nsarray *features = [detector featuresinimage:myimage options:opts]; // 5
here’s code does:
1.- creates context; in example, context ios. can use of context-creation functions described in processing images.) have option of supplying nil instead of context when create detector.)
2.- creates options dictionary specify accuracy detector. can specify low or high accuracy. low accuracy (cidetectoraccuracylow) fast; high accuracy, shown in example, thorough slower.
3.- creates detector faces. type of detector can create 1 human faces.
4.- sets options dictionary finding faces. it’s important let core image know image orientation detector knows can find upright faces. of time you’ll read image orientation image itself, , provide value options dictionary.
5.- uses detector find features in image. image provide must ciimage object. core image returns array of cifeature objects, each of represents face in image.
here open projects out start coreimage
or other technologies gpuimage
or opencv
1 https://github.com/aaronabentheuer/aafacedetection (cidetector - swift)
2 https://github.com/bradlarson/gpuimage (objective-c)
3 https://github.com/jeroentrappers/facedetectionpoc (objective-c: has deprecated code ios9)
4 https://github.com/kairosinc/kairos-sdk-ios (objective-c)
5 https://github.com/macmade/facedetect (opencv)
Comments
Post a Comment