 |
Perfectly Clear SDK Documentation
10.7.1.1191
|
Using Perfectly Clear in iOS is very similar to using it on OSX. See example usage in your SDK package in Demo/ImageEngine.
Simple AI Sample - Using Scene Detection
- Create AI-enabled engine - this should be done once when the app loads
- Enable AI features (Dynamic and Scene Detection) in PFCENGINE. This requires passing your PFC SDK apikey, certificate, and paths to PFC AI models (PFCDynamicModel.pnnc and pfcsdcoreml.pnn) in the app bundle
int featuresLoaded =
PFC_LoadAIEngineNative(m_PFCEngine, features, pathDynamic, 0, pathSD, 0, 0, apiKey.UTF8String,certificate.UTF8String, &statusCertificate);
- OPTIONALLY: load custom AI presets (presets to be selected based on scene detection). If custom presets are not loaded, default AI presets from the SD model will be used. Export these .preset files from Pefectly Clear Workbench.
- Detect scene. This is needs to be done once per loaded image
- Read correction params from scene preset
if (detectedScene > 0) {
}
- Or optionally read correction params from preset, ignoring scene detection
- Apply Perfectly Clear:
- Cleanup: Run this as the app is closing.
The calling patterns are very similar to OSX or Linux, so you can also review those samples for more use-cases.
int PFC_LoadAIEngineNative(PFCENGINE *pEngineAI, unsigned int aifeatures, const char *modelDynamic, int lenDynamic, const char *modelSD, int lenSD, const char *modelSkintone, int lenSkintone, const char *modelAicolor, int lenAicolor, const char *modelFDFront, int lenFDFront, const char *modelFDBack, int lenFDBack, const char *modelFaceMesh, int lenFaceMesh, const char *modelBlendShape, int lenBlendShape, int bUseAngroidGPU, const char *apikey, const char *certificate, int *statusCertificate)
Loads/reloads platform-native (CoreML or TFLite) version of AI models into engine....
int PFC_GetScene(PFCPROFILE precalc, int *version)
Get scene detection label from profile obtained with PFC_Calc For this to work you need to pass AI_SC...
Struct PFCPARAM the master structure of all processing parameters.
@ AI_CORRECTIONS
Loads AI-based corrections model, requiring the file dynamic.pnn
@ CALC_ALL
Calculates for all classic features, all of the above.
#define PFCPROFILE
Define.
Struct defining an PFC engine instance.
int PFC_LoadScenePresets(PFCENGINE *pEngine, const char *filePath, int modelUuid=0, int *presetUuid=NULL, int arrProfileUUIDLen=0)
Loads AI Scene Detection group presets from presets file, and optionally re-loading different Scene D...
void PFC_DestroyEngine(PFCENGINE *p)
Destroy PFCENGINE instance and release associated resources.
int PFC_ReadScenePreset(PFCPARAM ¶m, PFCENGINE *pEngineAI, int scene)
Fill param for the scene from the engine with previously loaded scene presets with PFC_LoadScenePrese...
int PFC_AutoCorrect(PFCIMAGE *pImage, PFCIMAGE *pImageds, PFCPARAM ¶m, int iISO=-1, char *pCameraModel=NULL, BOOL bFastFAE=FALSE, PFC_PROGRESS progfn=NULL, PFCENGINE *pEngineAI=NULL, BOOL bUseAutoSDPreset=FALSE)
Single function to perform Perfectly Clear correction.
@ PFC_REJECT_CLIPART
Reject images classified as clipart, used by default.
@ AI_SCENE_DETECTION
Loads scene detection model, requiring one or two pnn files with filenames like pro_and_universal_202...
PFCENGINE * PFC_CreateEngine()
Create PFCENGINE instance.
int PFC_ReadPresetsFromStream(PFCPARAM ¶m, const char *s)
Load image processing settings from a char buffer.
@ CALC_SCENE_DETECTION
Calculate Scene Detection.
PFCPROFILE PFC_Calc(PFCIMAGE *pImage, PFCIMAGE *pImageds, PFCENGINE *pEngine, unsigned int feature=CALC_ALL, int iISO=-1, char *pCameraModel=NULL, PFCPROFILE pImageProfile=NULL, PFC_PROGRESS progfn=NULL, int iRejectOption=PFC_REJECT_CLIPART, PFCENGINE *pEngineAI=NULL)
Perform initial analysis on images.