Detects spoof devices like screens 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-Device-Detection-Ver-ID-3-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 face recognition 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.
Detect all spoof devices in an image.
import SpoofDeviceDetection
let uiImage: UIImage // The image in which to detect spoof devices
let apiKey: String // Your API key
let url: URL // Service URL
let spoofDeviceDetection = SpoofDeviceDetection(apiKey: apiKey, url: url)
guard let cgImage = uiImage.cgImage, let image = Image(cgImage: cgImage) else {
fatalError("Image conversion failed")
}
Task {
let spoofDevices = try await spoofDeviceDetection.detectSpoofDevicesInImage(image)
}Find out whether a face in an image is a spoof.
import SpoofDeviceDetection
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 spoofDeviceDetection = SpoofDeviceDetection(apiKey: apiKey, url: url)
guard let cgImage = uiImage.cgImage, let image = Image(cgImage: cgImage) else {
fatalError("Image conversion failed")
}
Task {
let isSpoof = try await spoofDeviceDetection.isSpoofInImage(image, regionOfInterest: face.bounds)
}