EyeQ Docs

iOS API Reference

Complete class and method reference for the Perfectly Clear iOS SDK

This page documents all public classes and methods in PFC_iOS_Framework.xcframework. The API is written in Objective-C and is fully accessible from Swift.


PCSEngine

The core image processing engine. Wraps the Perfectly Clear C++ engine and exposes scene detection, correction, and creative look operations.

class PCSEngine: NSObject

PCSEngine is not thread-safe. Serialize all calls using an NSLock or similar mechanism. Create one engine instance per workflow; switching workflows requires constructing a new instance.

Constructor

init(
    apiKey: String,
    certificate: String,
    sceneDetectionModelUrL: URL,
    skintoneModelUrl: URL,
    aiColorModelUrl: URL,
    aiFDFrontModel: URL,
    aiFDBackModel: URL,
    aiFacemeshModel: URL,
    aiBlendshapeModel: URL,
    scenePresetsUrl: URL?,
    addonLooksUrl: URL
)

Parameters:

ParameterDescription
apiKeyAPI key string provided by EyeQ
certificateCertificate string provided by EyeQ
sceneDetectionModelUrLPath to the scene detection .pnn model file
skintoneModelUrlPath to the skin tone .pnn model file
aiColorModelUrlPath to the AI color correction .pnn model file
aiFDFrontModelPath to the front face detection .pnn model file
aiFDBackModelPath to the back face detection .pnn model file
aiFacemeshModelPath to the face mesh .pnn model file
aiBlendshapeModelPath to the face blend-shape .pnn model file
scenePresetsUrlPath to the scene preset file (.preset); nil for School & Sports workflow
addonLooksUrlPath to the creative looks bundle (.looks)

Properties

PropertyTypeDescription
pfcEngineUnsafeMutableRawPointerInternal C++ engine pointer; do not access directly
automapSceneLabelsBoolWhen true, the engine maps raw model labels to canonical scene IDs
sceneMappings[Any]Read-only array of scene label mapping entries

Methods

detectSceneForImage

Classifies the image using on-device AI models and returns the detected scene and a color profile.

func detectSceneForImage(_ image: PCSImage) -> PCSSceneDetectionResult?

Returns nil if detection fails (missing models, incompatible image format, or engine error). Run on a background thread — blocks for the full classification pass.

applyParam

Applies correction parameters to an image using a previously computed color profile.

func applyParam(
    _ param: PCSParam,
    toImage image: PCSImage,
    profile: PCSProfile?,
    errorCode: UnsafeMutablePointer<Int32>
) -> PCSParam

Parameters:

ParameterDescription
paramCorrection parameters — pass a copy (param.copy() as! PCSParam)
imageThe PCSImage to correct, must be on the same thread it was created
profileColor profile from detectSceneForImage; pass nil to skip profile-based correction
errorCodeOn return, 0 indicates success

Returns the param that was actually applied (may differ from the input if the SDK computed auto values).

calcFromImage

Computes the image profile without applying corrections. Use when you want to call applyParam multiple times with different parameters on the same image.

func calcFromImage(_ pcsImage: PCSImage) -> PCSProfile

getSceneDescriptions

Returns the list of scenes available in the loaded preset model.

func getSceneDescriptions() -> [PCSSceneDescription]

getLooks3DLutWithGuid

Returns the LUT data for a creative look identified by its GUID.

func getLooks3DLutWithGuid(
    _ guid: String,
    strength: Int32,
    contrast: Int32,
    saturation: Int32
) -> UnsafeMutablePointer<Float>?

PCSImage

An image wrapper that holds pixel data in the format required by PCSEngine. Created from a UIImage and used as both input and output for the engine.

class PCSImage: NSObject

PCSImage is thread-affine. Create it and consume it on the same thread. Do not create a PCSImage on the main thread and then pass it to a background queue.

Constructor

init?(image: UIImage)

Returns nil if the UIImage does not meet the SDK's format requirements. The image must be:

  • 8 bits per component
  • 32 bits per pixel
  • sRGB color space
  • bitmapInfo raw value 16385 (alphaFirst | byteOrder32Big)

Always re-render through UIGraphicsImageRenderer(preferredRange: .standard) before passing to this constructor.

Properties

PropertyTypeDescription
widthInt32Image width in pixels
heightInt32Image height in pixels
strideInt32Bytes per row (should equal width × 4)
bitsPerComponentInt32Must be 8
bitsPerPixelInt32Must be 32
bytesPerPixelInt32Must be 4
bitmapInfoCGBitmapInfoRaw value must be 16385
colorSpaceCGColorSpaceMust be sRGB
dataUnsafeMutablePointer<UInt8>Raw pixel bytes
pfcImageUnsafeMutableRawPointerInternal image pointer; do not access directly

Methods

generateImage

Extracts the processed image after applyParam has been called. Returns a new UIImage with corrections applied.

func generateImage(withColorSpace colorSpace: CGColorSpace) -> UIImage

Call this on the same thread where the PCSImage was created, immediately after applyParam.


PCSParam

Holds all correction parameters. Passed to applyParam to control the correction result.

class PCSParam: NSObject, NSCopying

The default initializer PCSParam() represents the identity state — no corrections applied. Use this to reset all parameters.

Initializers

// Identity (no correction)
init()

// Scene-optimized parameters from a detected scene
init(sceneLabel: Int, usingEngine engine: PCSEngine)

Instance methods

// Returns a new param with all values scaled by the given strength (0–100+)
func withStrength(_ strength: Int) -> PCSParam

// NSCopying — always copy before passing to applyParam
func copy(with zone: NSZone? = nil) -> Any

Correction parameters

Overall strength

PropertyTypeDescription
iStrengthIntOverall correction strength (0–100+)
bUseAutomaticStrengthSelectionBoolLet the SDK select optimal strength
iSkintoneTypeIntSkin tone category (1–10)

Dynamic and white balance

PropertyTypeDescription
iDynamicIntDynamic range correction amount
iDynamicWBIntDynamic white balance amount

Skin tools

PropertyTypeDescription
bSmoothBoolEnable skin smoothing
iSmoothLevelIntSkin smoothing amount
bSkinToningBoolEnable skin tone normalization
iSkinToningIntSkin toning amount
bBlushBoolEnable blush enhancement
iBlushIntBlush amount

Eye tools

PropertyTypeDescription
bEyeCircBoolEnable eye circle reduction
iEyeCircIntEye circle reduction amount
bCatchLightBoolEnable catchlight enhancement
iCatchLightIntCatchlight enhancement amount

Face tools

PropertyTypeDescription
bTeethBoolEnable teeth whitening
iTeethLevelIntTeeth whitening amount
bLipSharpenBoolEnable lip sharpening
iLipSharpenIntLip sharpening amount
bSlimBoolEnable face slimming
iSlimIntFace slimming amount

Portrait light

PropertyTypeDescription
bPortraitLightBoolEnable portrait light effect
iPortraitLightIntPortrait light amount
iPortraitLightDepthIntPortrait light depth
iPortraitLightFeatherIntPortrait light feather

Color

PropertyTypeDescription
iColorVibrancyIntColor vibrancy
iContrastIntContrast
iLocalContrastIntLocal contrast
iVibrancyIntVibrancy

Finishing tools

PropertyTypeDescription
iFinishTempIntFinishing temperature
iFinishTintIntFinishing tint
iFinishExposureIntFinishing exposure

Creative looks (LUT)

PropertyTypeDescription
lutOutputGuidString?GUID of the creative look to apply; nil for no look
lutOutputStrengthIntLook strength (0–100)
iOutLUTcontrastIntLook contrast adjustment
iOutLUTsaturationIntLook saturation adjustment

PCSProfile

An opaque color profile returned by detectSceneForImage. Encodes the scene-specific color characteristics needed during applyParam.

class PCSProfile: NSObject

Properties

PropertyTypeDescription
pfcProfileUnsafeMutableRawPointerInternal profile pointer; do not access directly

A PCSProfile is tied to the PCSEngine that created it. Do not cache profiles across engine replacements (workflow switches). After switching workflows, run detectSceneForImage again to obtain a fresh profile from the new engine.


PCSSceneDetectionResult

Return value of PCSEngine.detectSceneForImage. Carries both the scene classification result and the color profile needed for applying corrections.

class PCSSceneDetectionResult: NSObject

Properties

PropertyTypeDescription
sceneLabelIntCanonical scene identifier (see scene catalogue in Using the SDK)
unmappedSceneLabelIntRaw label from the model before canonical mapping
profilePCSProfileColor profile — pass directly to applyParam for the same image

PCSSceneDescription

Describes a single scene available in the loaded preset model. Returned by PCSEngine.getSceneDescriptions().

class PCSSceneDescription: NSObject

Properties

PropertyTypeDescription
sceneLabelIntScene identifier
localizationKeyStringLocalization key for the scene name
imageNameStringAsset name for the scene thumbnail

On this page