Detects spoof in images
- Open your project in Xcode.
- Select your project in the Project Navigator.
- Click on the Package Dependencies tab.
- Click the + icon and enter
https://github.com/AppliedRecognition/Spoof-Detection-Fasnet-Apple.gitin the search box labelled "Search or Enter Package URL". - In the Dependency Rule drop-down select Up to Next Major Version and enter 1.0.0 in the adjacent text box.
- Press the "Add Package" button.
You will need an API key to use the spoof detection in your project. The API key in tests is rate-limited and not suitable for production applications. Please contact Applied Recognition to obtain an API key.
Find out whether a face in an image is a spoof.
import FASnetSpoofDetection
import VerIDCommonTypes
let uiImage: UIImage // The image in which to detect spoof devices
let face: Face // Face detected in the image
let apiKey: String // Your API key
let url: URL // Service URL
let spoofDetection = FASnetSpoofDetection(apiKey: apiKey, url: url)
guard let cgImage = uiImage.cgImage, let image = Image(cgImage: cgImage) else {
fatalError("Image conversion failed")
}
Task {
let isSpoof = try await spoofDetection.isSpoofInImage(image, regionOfInterest: face.bounds)
}