Scenario #1 - Using PCF_AutoCorrect
The simplest way to use Perfectly Clear library suite.
- Populate image data into PFCIMAGE structure:
im.
width = originalImageFile.width;
im.
height = originalImageFile.height;
im.
stride = originalImageFile.stride;
im.
data = originalImageFile.raw_image;
- Initialize the parameter structure:
- Perform full correction using the auto function:
int status =
PFC_AutoCorrect(&im, NULL, param, -1, NULL, FALSE, bVerbose? myStatus : NULL);
if (bVerbose)
{
if (status == 0)
{
printf("Image processed successfully\n");
}
else if (status > 0)
{
printf(
" Pre-calculation on noise returns %d\n",
PFCNR_STATUS(status));
printf(
" Pre-calculation on face details returns %d\n",
PFCFB_STATUS(status));
printf(
" Pre-calculation on red eye returns %d\n",
PFCRE_STATUS(status));
}
else if (status < 0)
{
printf("Image processed failed with return code: %d\n", status);
}
}
Scenario #2 - Separate PFC_Calc and PFC_Apply
More advanced way to use Perfectly Clear library suite.
- Create a single engine that can be re-used on many images:
if (bVerbose)
{
{
printf("Engine created successfully.\n");
}
else
{
{
printf("Face Beautification library not available.");
}
}
}
- Initialize the parameter structure (using default parameter values): The parameters can be imported from a preset file.
if (bVerbose)
printf("PFC_ReadPresets returns %d\n", ret);
Alternatively the parameters can be initialized using PFC_SetParam() function. Example: if (profilename != NULL)
{
if (bVerbose)
printf("PFC_ReadPresets returns %d\n", ret);
if (ret != 0)
{
if (ret == -2)
{
printf("Unable to open preset file %s. Using default settings.\n", argv[3]);
}
else
{
printf("Unable to read preset file.\n");
exit(1);
}
}
}
else
{
}
- Populate image data into PFCIMAGE structure:
im.
width = originalImageFile.width;
im.
height = originalImageFile.height;
im.
stride = originalImageFile.stride;
im.
data = originalImageFile.raw_image;
- Perform pre-calculation of image specific profile. pEngine is created from step 1 and used here in the PFC_Calc function
if (bVerbose)
{
if (pProfile->Status != 0)
{
{
printf(" Pre-calculation on noise returns %d\n", pProfile->NR_Status);
}
{
printf(" Core pre-calculation returns %d\n", pProfile->CORE_Status);
}
{
printf(" Pre-calculation on face details returns %d\n", pProfile->FB_Status);
}
{
printf(" Pre-calculation on red eye returns %d\n", pProfile->RE_Status);
}
}
printf("Calc returns %d\n", pProfile->Status);
}
- Apply the calculated profile and parameters to the image.
{
printf("Image processed successfully.\n");
}
{
printf(
"Noise removal status %d\n",
NRRETCODE(status));
printf(
"Perfectly Clear correction status %d\n",
CORERETCODE(status));
printf(
"Face beautification status %d\n",
FBRETCODE(status));
printf(
"Red eye removal status %d\n",
RERETCODE(status));
}
{
printf("Image processing failed with return code: %d\n", status);
}
- Release resources used by PFCPROFILE:
- Release the engine to release resource. Or, keep the engine around for use on another image.
- Copyright
- Copyright (C) 2019 Athentech Imaging Inc