8 using System.Drawing.Drawing2D;
10 using System.Drawing.Imaging;
12 using System.Runtime.InteropServices;
448 public enum PFCCORE_MASK_TYPE
455 PFCCORE_MASK_ROUNDRECT
476 [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
480 [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 33)]
483 public byte strength;
514 [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
616 #if PROTECTION_ENABLED 619 byte* pLicpath = null;
622 pLicpath = GetCharBuffer(path);
625 int status = PFC_SetProtectionPath(pLicpath);
630 Trace.WriteLine(ex.Message);
635 m_pEngine = PFC_CreateEngine();
636 if (m_pEngine != null)
638 LastStatus.Status = (int)(*m_pEngine).status;
643 Trace.WriteLine(ex.Message);
646 PFC_SetParam(ref m_Param,
PFCPRESETID.PRESET_INTELLIGENTAUTO);
651 #if PROTECTION_ENABLED 652 PFC_ReleaseProtectionPath();
683 return Calc(ref bm, feature, -1, null);
694 return Calc(ref bm, ref bmds, feature, -1, null);
706 BitmapData bd = null;
708 bd = LockBitmapData(ref bm);
709 if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
710 bd.PixelFormat != PixelFormat.Format32bppArgb &&
711 bd.PixelFormat != PixelFormat.Format48bppRgb &&
712 bd.PixelFormat != PixelFormat.Format64bppArgb)
714 ReleaseBitmapData(ref bm, ref bd);
717 pBase = (Byte*)bd.Scan0.ToPointer();
723 switch (bd.PixelFormat)
731 im.
data = (
void*)pBase;
733 if (m_pProfile != null)
734 PFC_ReleaseProfile(m_pProfile);
737 if (CameraModel != null)
739 pModel = GetCharBuffer(CameraModel);
741 m_pProfile = PFC_Calc(&im, null, m_pEngine, feature, ISO, pModel, null, null, 1);
743 FreeCharBuffer(pModel);
745 ReleaseBitmapData(ref bm, ref bd);
747 LastStatus.NR_Status = (*m_pProfile).NR_Status;
748 LastStatus.CORE_Status = (*m_pProfile).CORE_Status;
749 LastStatus.FB_Status = (*m_pProfile).FB_Status;
750 LastStatus.RE_Status = (*m_pProfile).RE_Status;
751 LastStatus.Status = (*m_pProfile).Status;
766 BitmapData bd = null;
768 bd = LockBitmapData(ref bm);
769 if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
770 bd.PixelFormat != PixelFormat.Format32bppArgb &&
771 bd.PixelFormat != PixelFormat.Format48bppRgb &&
772 bd.PixelFormat != PixelFormat.Format64bppArgb)
774 ReleaseBitmapData(ref bm, ref bd);
777 pBase = (Byte*)bd.Scan0.ToPointer();
783 switch (bd.PixelFormat)
791 im.
data = (
void*)pBase;
793 BitmapData bdds = null;
794 bdds = LockBitmapData(ref bmds);
795 if (bdds.PixelFormat != PixelFormat.Format24bppRgb &&
796 bdds.PixelFormat != PixelFormat.Format32bppArgb &&
797 bdds.PixelFormat != PixelFormat.Format48bppRgb &&
798 bdds.PixelFormat != PixelFormat.Format64bppArgb)
800 ReleaseBitmapData(ref bmds, ref bdds);
803 pBase = (Byte*)bdds.Scan0.ToPointer();
806 imds.
width = bdds.Width;
807 imds.
height = bdds.Height;
808 imds.
stride = bdds.Stride;
809 switch (bdds.PixelFormat)
817 imds.
data = (
void*)pBase;
819 if (m_pProfile != null)
820 PFC_ReleaseProfile(m_pProfile);
823 if (CameraModel != null)
825 pModel = GetCharBuffer(CameraModel);
827 m_pProfile = PFC_Calc(&im, &imds, m_pEngine, feature, ISO, pModel, null, null, 1);
829 FreeCharBuffer(pModel);
831 ReleaseBitmapData(ref bm, ref bd);
832 ReleaseBitmapData(ref bmds, ref bdds);
834 LastStatus.NR_Status = (*m_pProfile).NR_Status;
835 LastStatus.CORE_Status = (*m_pProfile).CORE_Status;
836 LastStatus.FB_Status = (*m_pProfile).FB_Status;
837 LastStatus.RE_Status = (*m_pProfile).RE_Status;
838 LastStatus.Status = (*m_pProfile).Status;
849 return Apply(ref bm, 100);
859 if (m_pProfile == null)
864 BitmapData bd = null;
866 bd = LockBitmapData(ref bm);
867 if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
868 bd.PixelFormat != PixelFormat.Format32bppArgb &&
869 bd.PixelFormat != PixelFormat.Format48bppRgb &&
870 bd.PixelFormat != PixelFormat.Format64bppArgb)
872 ReleaseBitmapData(ref bm, ref bd);
875 pBase = (Byte*)bd.Scan0.ToPointer();
881 switch (bd.PixelFormat)
889 im.
data = (
void*)pBase;
891 PFCAPPLYSTATUS ret = PFC_Apply(&im, m_pEngine, m_pProfile, ref m_Param, null, iOpacity);
897 LastStatus.NR_Status = (
PFCNR_STATUS)(code & 0x000000FF);
898 LastStatus.CORE_Status = (
PFCCORE_STATUS)((code >> 8) & 0x000000FF);
899 LastStatus.FB_Status = (
PFCFB_STATUS)((code >> 16) & 0x000000FF);
900 LastStatus.RE_Status = (
PFCRE_STATUS)((code >> 24) & 0x000000FF);
901 LastStatus.Status = code;
904 ReleaseBitmapData(ref bm, ref bd);
908 public unsafe
PFCAPPLYSTATUS ApplyLocal(ref Bitmap bm,
int xOffset,
int yOffset,
int widthOrig,
int heightOrig)
910 return ApplyLocal(ref bm, xOffset, yOffset, widthOrig, heightOrig, 100);
913 public unsafe
PFCAPPLYSTATUS ApplyLocal(ref Bitmap bm,
int xOffset,
int yOffset,
int widthOrig,
int heightOrig,
int iOpacity)
915 BitmapData bd = null;
917 bd = LockBitmapData(ref bm);
918 if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
919 bd.PixelFormat != PixelFormat.Format32bppArgb &&
920 bd.PixelFormat != PixelFormat.Format48bppRgb &&
921 bd.PixelFormat != PixelFormat.Format64bppArgb)
923 ReleaseBitmapData(ref bm, ref bd);
926 pBase = (Byte*)bd.Scan0.ToPointer();
932 switch (bd.PixelFormat)
940 im.
data = (
void*)pBase;
942 PFCAPPLYSTATUS ret = PFC_ApplyLocal(&im, xOffset, yOffset, widthOrig, heightOrig, m_pEngine, m_pProfile, ref m_Param, iOpacity);
944 ReleaseBitmapData(ref bm, ref bd);
993 return AutoCorrect(ref bm, ref bmds, -1, null,
false);
1017 public int AutoCorrect(ref Bitmap bm,
int ISO,
string CameraModel,
bool bFastFAE)
1063 int retInt = (((((((int)retRE << 8) | (int)retFB) << 8) | (
int)retCORE) << 8) | (int)retNR);
1095 public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds,
int ISO,
string CameraModel,
bool bFastFAE)
1141 int retInt = (((((((int)retRE << 8) | (int)retFB) << 8) | (
int)retCORE) << 8) | (int)retNR);
1189 return retCode-1000;
1224 public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds,
string pathPreset)
1229 return AutoCorrect(ref bm, ref bmds, -1, null,
false);
1231 return retCode - 1000;
1268 public int AutoCorrect(ref Bitmap bm,
string pathPreset,
int ISO,
string CameraModel,
bool bFastFAE)
1273 return AutoCorrect(ref bm, ISO, CameraModel, bFastFAE);
1275 return retCode - 1000;
1313 public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds,
string pathPreset,
int ISO,
string CameraModel,
bool bFastFAE)
1318 return AutoCorrect(ref bm, ref bmds, ISO, CameraModel, bFastFAE);
1320 return retCode - 1000;
1329 PFC_SetParam(ref m_Param,
id);
1352 byte* presetpath = null;
1355 presetpath = GetCharBuffer(path);
1367 int status = PFC_ReadPresets(ref m_Param, presetpath);
1371 catch (Exception ex)
1373 Trace.WriteLine(ex.Message);
1393 long len = fs.Length;
1394 byte[] buffer =
new byte[len + 1];
1395 int size = (int)len;
1396 fs.Read(buffer, 0, size);
1398 byte* b = GetCharBuffer(buffer);
1403 int status = PFC_ReadPresetsFromStream(ref m_Param, b);
1407 catch (Exception ex)
1409 Trace.WriteLine(ex.Message);
1420 return PFC_HasFaceBeautification(m_pEngine);
1429 return PFC_FBFaceCount(m_pProfile);
1442 bool ret = PFC_GetFaceInfo(m_pProfile, &fi, index);
1460 return PFC_AbnormalTintDetected(m_pProfile, eTintMethod);
1463 protected BitmapData LockBitmapData(ref Bitmap bm)
1465 GraphicsUnit unit = GraphicsUnit.Pixel;
1466 RectangleF boundsF = bm.GetBounds(ref unit);
1467 Rectangle bounds =
new Rectangle((
int)boundsF.X,
1470 (
int)boundsF.Height);
1472 BitmapData bitmapData =
1473 bm.LockBits(bounds, ImageLockMode.ReadWrite, bm.PixelFormat);
1477 protected void ReleaseBitmapData(ref Bitmap bm, ref BitmapData bitmapData)
1479 bm.UnlockBits(bitmapData);
1482 protected Bitmap DupBitmap(ref Bitmap bm)
1484 PerfectlyClearImageTransfer tr, tr1;
1486 GraphicsUnit unit = GraphicsUnit.Pixel;
1487 RectangleF boundsF = bm.GetBounds(ref unit);
1488 Rectangle bounds =
new Rectangle((
int)boundsF.X,
1491 (
int)boundsF.Height);
1492 BitmapData bd = bm.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
1493 Bitmap bm1 =
new Bitmap(bd.Width, bd.Height, PixelFormat.Format24bppRgb);
1494 BitmapData bd1 = LockBitmapData(ref bm1);
1495 pBase = (Byte*)bd.Scan0.ToPointer();
1496 tr.columnBytes = (bd.PixelFormat == PixelFormat.Format24bppRgb) ? 3 : 4;
1497 tr.rowBytes = bd.Stride;
1498 tr.height = bd.Height;
1499 tr.width = bd.Width;
1500 tr.data1 = (int)(pBase + 2);
1501 tr.data2 = (int)(pBase + 1);
1502 tr.data3 = (int)pBase;
1503 pBase = (Byte*)bd1.Scan0.ToPointer();
1504 tr1.columnBytes = (bd1.PixelFormat == PixelFormat.Format24bppRgb) ? 3 : 4;
1505 tr1.rowBytes = bd1.Stride;
1506 tr1.height = bd1.Height;
1507 tr1.width = bd1.Width;
1508 tr1.data1 = (int)(pBase + 2);
1509 tr1.data2 = (int)(pBase + 1);
1510 tr1.data3 = (int)pBase;
1511 for (
int i = 0; i < tr.height; i++)
1513 for (
int j = 0; j < tr.width; j++)
1515 ((Byte*)tr1.data1)[j * tr1.columnBytes] = ((Byte*)tr.data1)[j * tr.columnBytes];
1516 ((Byte*)tr1.data2)[j * tr1.columnBytes] = ((Byte*)tr.data2)[j * tr.columnBytes];
1517 ((Byte*)tr1.data3)[j * tr1.columnBytes] = ((Byte*)tr.data3)[j * tr.columnBytes];
1519 tr.data1 += (int)tr.rowBytes;
1520 tr.data2 += (
int)tr.rowBytes;
1521 tr.data3 += (int)tr.rowBytes;
1522 tr1.data1 += (
int)tr1.rowBytes;
1523 tr1.data2 += (int)tr1.rowBytes;
1524 tr1.data3 += (
int)tr1.rowBytes;
1526 ReleaseBitmapData(ref bm1, ref bd1);
1527 ReleaseBitmapData(ref bm, ref bd);
1531 protected Bitmap BW2RGB(ref Bitmap bm)
1534 Byte* pBase1 = null;
1535 GraphicsUnit unit = GraphicsUnit.Pixel;
1536 RectangleF boundsF = bm.GetBounds(ref unit);
1537 Rectangle bounds =
new Rectangle((
int)boundsF.X,
1540 (
int)boundsF.Height);
1541 BitmapData bd = bm.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed);
1542 Bitmap bm1 =
new Bitmap(bd.Width, bd.Height, PixelFormat.Format24bppRgb);
1543 BitmapData bd1 = LockBitmapData(ref bm1);
1544 pBase = (Byte*)bd.Scan0.ToPointer();
1545 pBase1 = (Byte*)bd1.Scan0.ToPointer();
1546 for (
int i = 0; i < bd.Height; i++)
1548 for (
int j = 0; j < bd.Width; j++)
1550 pBase1[j * 3] = pBase[j];
1551 pBase1[j * 3 + 1] = pBase[j];
1552 pBase1[j * 3 + 2] = pBase[j];
1555 pBase1 += bd1.Stride;
1557 ReleaseBitmapData(ref bm1, ref bd1);
1558 ReleaseBitmapData(ref bm, ref bd);
1571 Bitmap myBitmap =
new Bitmap(filename);
1572 if ((myBitmap.Flags & (
int)ImageFlags.ColorSpaceYcck) != 0)
1574 bm = DupBitmap(ref myBitmap);
1579 if (myBitmap.PixelFormat == PixelFormat.Format8bppIndexed)
1581 bm = BW2RGB(ref myBitmap);
1592 protected Bitmap GetStatImage(ref Bitmap bm,
int iMaxDimension)
1595 bool bNeedResize =
true;
1602 if (w <= iMaxDimension)
1603 bNeedResize =
false;
1609 if (h <= iMaxDimension)
1610 bNeedResize =
false;
1621 Bitmap bmds =
new Bitmap(w1, h1, bm.PixelFormat);
1623 using (Graphics gr = Graphics.FromImage(bmds))
1625 gr.SmoothingMode = SmoothingMode.HighQuality;
1626 gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
1627 gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
1628 gr.DrawImage(bm,
new Rectangle(0, 0, w1, h1));
1636 Bitmap bmds = (Bitmap)bm.Clone();
1641 public void Dispose()
1644 GC.SuppressFinalize(
this);
1647 protected virtual void Dispose(
bool disposing)
1653 if (m_pProfile != null)
1655 PFC_ReleaseProfile(m_pProfile);
1659 if (m_pEngine != null)
1661 PFC_DestroyEngine(m_pEngine);
1666 protected byte* GetCharBuffer(byte[] s)
1668 int i, iCount = s.Length;
1669 IntPtr _memory = IntPtr.Zero;
1670 _memory = Marshal.AllocHGlobal(iCount + 1);
1671 byte* p = (byte*)_memory;
1672 for (i = 0; i < iCount; i++)
1681 protected byte* GetCharBuffer(
string s)
1683 int i, iCount = s.Length;
1684 IntPtr _memory = IntPtr.Zero;
1685 _memory = Marshal.AllocHGlobal(iCount + 1);
1686 byte* p = (byte*)_memory;
1687 for (i = 0; i < iCount; i++)
1696 protected void FreeCharBuffer(byte* p)
1698 IntPtr _memory = (IntPtr)p;
1699 Marshal.FreeHGlobal(_memory);
1703 [DllImport(
"PerfectlyClearPro.dll")]
1704 static extern int PFC_SetProtectionPath(byte* path);
1706 [DllImport(
"PerfectlyClearPro.dll")]
1707 static extern void PFC_ReleaseProtectionPath();
1709 [DllImport(
"PerfectlyClearPro.dll")]
1710 static extern PFCENGINE* PFC_CreateEngine();
1712 [DllImport(
"PerfectlyClearPro.dll")]
1713 static extern void PFC_DestroyEngine(
PFCENGINE* p);
1715 [DllImport(
"PerfectlyClearPro.dll")]
1718 [DllImport(
"PerfectlyClearPro.dll")]
1719 static extern int PFC_ReadPresets(ref
PFCPARAM param, byte* filename);
1721 [DllImport(
"PerfectlyClearPro.dll")]
1722 static extern int PFC_ReadPresetsFromStream(ref
PFCPARAM param, byte* s);
1724 [DllImport(
"PerfectlyClearPro.dll")]
1727 [DllImport(
"PerfectlyClearPro.dll")]
1728 static extern void PFC_ReleaseProfile(
void* pProfile);
1730 [DllImport(
"PerfectlyClearPro.dll")]
1733 [DllImport(
"PerfectlyClearPro.dll")]
1736 [DllImport(
"PerfectlyClearPro.dll")]
1737 static extern bool PFC_HasFaceBeautification(
PFCENGINE* pEngine);
1739 [DllImport(
"PerfectlyClearPro.dll")]
1740 static extern int PFC_FBFaceCount(
void* pImageProfile);
1742 [DllImport(
"PerfectlyClearPro.dll")]
1743 static extern bool PFC_GetFaceInfo(
void* pImageProfile, PFCFBFACEINFO1* pFace,
int index);
1745 [DllImport(
"PerfectlyClearPro.dll")]
1746 static extern bool PFC_AbnormalTintDetected(
void* pImageProfile,
TINTCORRECTION eTintMethod);
1750 [DllImport(
"PerfectlyClearPro.dll", CallingConvention = CallingConvention.Cdecl)]
1751 static extern int PFC_SetProtectionPath(byte* path);
1753 [DllImport(
"PerfectlyClearPro.dll", CallingConvention = CallingConvention.Cdecl)]
1754 static extern void PFC_ReleaseProtectionPath();
1756 [DllImport(
"PerfectlyClearPro.dll", CallingConvention = CallingConvention.Cdecl)]
1757 static extern PFCENGINE* PFC_CreateEngine();
1759 [DllImport(
"PerfectlyClearPro.dll", CallingConvention = CallingConvention.Cdecl)]
1760 static extern void PFC_DestroyEngine(
PFCENGINE* p);
1762 [DllImport(
"PerfectlyClearPro.dll", CallingConvention = CallingConvention.Cdecl)]
1765 [DllImport(
"PerfectlyClearPro.dll", CallingConvention = CallingConvention.Cdecl)]
1766 static extern int PFC_ReadPresets(ref
PFCPARAM param, byte* filename);
1768 [DllImport(
"PerfectlyClearPro.dll", CallingConvention = CallingConvention.Cdecl)]
1769 static extern int PFC_ReadPresetsFromStream(ref
PFCPARAM param, byte* s);
1771 [DllImport(
"PerfectlyClearPro.dll", CallingConvention = CallingConvention.Cdecl)]
1774 [DllImport(
"PerfectlyClearPro.dll", CallingConvention = CallingConvention.Cdecl)]
1775 static extern void PFC_ReleaseProfile(
void* pProfile);
1777 [DllImport(
"PerfectlyClearPro.dll", CallingConvention = CallingConvention.Cdecl)]
1780 [DllImport(
"PerfectlyClearPro.dll", CallingConvention = CallingConvention.Cdecl)]
1783 [DllImport(
"PerfectlyClearPro.dll", CallingConvention = CallingConvention.Cdecl)]
1784 static extern bool PFC_HasFaceBeautification(
PFCENGINE* pEngine);
1786 [DllImport(
"PerfectlyClearPro.dll", CallingConvention = CallingConvention.Cdecl)]
1787 static extern int PFC_FBFaceCount(
void* pImageProfile);
1789 [DllImport(
"PerfectlyClearPro.dll", CallingConvention = CallingConvention.Cdecl)]
1790 static extern bool PFC_GetFaceInfo(
void* pImageProfile, PFCFBFACEINFO1* pFace,
int index);
1792 [DllImport(
"PerfectlyClearPro.dll", CallingConvention = CallingConvention.Cdecl)]
1793 static extern bool PFC_AbnormalTintDetected(
void* pImageProfile,
TINTCORRECTION eTintMethod);
PFCPIXELFORMAT
defines the format of the image data
Legacy structure defining face area detected from the SFB library.
Adjust skin to user defined foundation color.
void * pNoiseParam
Internal use only.
PFCRE_STATUS
Enumeration defining status of Red Eye pre-calculation.
int data1
Location of Red channel.
bool bDCF
Set to TRUE to enable Digital Color Fidelity. Recommended value is FALSE.
Error reading image data.
Skip pre-calculations on Abnormal Tint Correction during Core pre-calculations.
int iTeethLevel
Teeth whitening level. Range 0 to 100.
Process aborted because of insufficient memory.
PFCPIXELFORMAT format
Defines byte order of input buffer.
int iFinishExposure
Exposure correction amount.
Invalid License or validation failed.
int width
width of this rect.
int iEnhanceLevel
Eye enhancement level. Range 0 to 100.
PFCAPPLYSTATUS
Enumeration defining return code from the Apply() function.
PFCV3PARAM v3
V3 Corrections.
void * pRedEyeParam
Internal use only.
Full res image (pImage) is missing.
void * pEngine
Pointer to binary definition of the processing engine.
PFCCORE_STATUS CORE_Status
Status code for CORE pre-calc analysis.
Structure encapsulating Noise Removal parameters.
AGGRESSIVENESS eAggressiveness
The desired level of lighting for Automatic Strength Selection to target at the Exposure Correction...
void * pInternal
Internal use only.
int AutoCorrect(ref Bitmap bm, ref Bitmap bmds)
Overload method for auto correction.
PFCRECT face
Bounding rectangle of detected face.
This type of correction provides a more uniform appearance to the complexion. It combines the natural...
PFCREPARAM re
Red Eye Removal.
TINTCORRECTION
Enumeration defining different abnormal tint analysis mode.
TINTCORRECTION eTintMode
ENUM value defined in TINTCORRECTION. It sets the aggressiveness of Tint Removal. ...
Struct describing 3D Lut information.
int iSkinToning
Skin Toning level. Range 0 to 100.
PFCPOINT leftEye
Point of left eye in detected face.
No correction occur during process.
Less aggressive in exposure correction.
int stride
Byte width of each scanline.
int iFinishTint
Tint correction amount.
PFCV3PARAM layer2
params on layers 2 - fiinishing
PFCCOREMask mask0
masks for layer 0
int stride
Byte width of each scanline.
Struct defining an image.
int iBlemish
Blemish removal level. Range 0 to 100.
int iBlush
Blush level. Range 0 to 100.
Pixel format not supported.
bool bEyeCirc
Set to TRUE to enable eye circle removal.
float fTintScale
Scalar value of how much tint correction should be applied. Range 0.0 to 1.0.
int iFinishHighlights
Highlights correction amount.
bool bUseFAE
Set to TRUE (recommended) to enable Face Aware Exposure selection. Recommended exposure will be calcu...
bool bEnabled
Set to TRUE to enable noise removal.
bool GetFaceInfo(ref PFCFBFACEINFO info, int index)
Get face information.
Structure encapsulating Face Beautification parameters.
int ReadPresetsFromStream(FileStream fs)
Read a preset from a file stream.
Warning. e.g. face not detected.
bool bLightDiffusion
Set to TRUE to enable light diffusion during DCF correction.
Struct PFCSTATUS Process status of all sub sectors.
int AutoCorrect(ref Bitmap bm)
Overload method for auto correction.
This is a more aggressive and effective correction where the appearance of the entire skin (including...
int height
Pixel height of image.
Struct PFCPARAM the master structure of all processing parameters.
int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
Overload method for auto correction.
float height
radial/rounded: h of bounding rect, linear: dist from centerY where grad becomes 1.0.
SKINMODE
Enumeration defining modes in Perfect Smooth analysis.
int ReadPresets(string path)
Read a preset from .preset file.
PFCPIXELFORMAT
defines the format of the image data
Highest sensitivity level of tint detection.
Apply correction ONLY on skin regions included in faces.
int iNeutralDensity
Neutral density filter amout.
Struct defining an PFC engine instance.
Moderate level of tint detection.
PFCPOINT rightEye
Point of right eye in detected face.
Structure encapsulating the CORE processing parameters.
Full res image (pImage) is missing.
PFCNR_STATUS
Enumeration defining status of Noise Removal pre-calculation.
uint status
Status of engine defined in PFCENGINESTATUS. For NO-SFB version the status will always be ENGINESTATU...
LIPSHARPENTYPE eLipSharpenType
See definition of LIPSHARPENTYPE.
bool AbnormalTintDetected(TINTCORRECTION eTintMethod)
Query if Abnormal Tint detected.
Struct defining a rectangle.
Struct PFCPARAM the master structure of all processing parameters.
void * data
Pointer pointing to the first byte of image data buffer.
Whitens (bleaches) face. Recommended mainly for darker skin.
DCFMODE
Enumeration defining DCF analysis mode.
Fine tuned for Asian skin tone.
Operation cancelled by user.
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds, PFCFEATURE feature)
Overload method for precalc analysis.
Unable to locate function in the SFBEngine library.
PFCFEATURE
ENUM controlling types of calculations at the pre-calculation stage.
int height
Pixel height of image.
int iPreprocessEV
EV correction amount (Image Ambulace)
Struct defining an PFC engine instance.
Use Fast mode of Face Aware Exposure pre-calculations.
Calculates for all of the above.
int iDetailOffset
Offset to recommended level of preservation of details. Range -30 to 30.
PFCPOINT rightEye
Point of right eye in detected face.
Bitmap ReadImage(string filename)
Utility function for reading image file into Bitmap.
unsafe PFCAPPLYSTATUS Apply(ref Bitmap bm)
Apply correction.
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds, PFCFEATURE feature, int ISO, string CameraModel)
Overload method for precalc analysis.
PFCFBFACEINFO()
Class constructor.
bool bSkinToning
Set to TRUE to enable skin toning.
Moderate level of exposure correction.
int width
Pixel width of image.
int x
x coordinate of this point.
Apply correction on most skin regions regardless they are linked with a face or not.
int iFinishTemp
Temp correction amount.
float centerY
Y of center.
bool bTeeth
Set to TRUE to enable teeth whitening.
Struct defining an image to be used in PFC library.
Average usage with brighter tone.
Optimized to bring out more details in the shadows, more details in the highlights, and more pleasing skin tones.
bool bVibrancy
Set to true (recommended default) to enable Color Vibrancy in the library.
The face analysis did not complete successfully.
PFCPRESETID
ENUM for presets support by this SDK.
PFCFBPARAM fb
Face Beautification corrections.
float radius
only for MASK_ROUNDRECT - corner radius, relative to image w.
bool bContrast
Set to TRUE to also apply Athentech's patented Medical Imaging contrast technology.
PFCCOREMask mask2
masks for layer 2
int iFinishSaturation
Saturation correction amount.
int iContrast
Intensity of contrast or depth. Range 0 to 100.
SKINMODE eSmoothMode
Use SKINMODE_FACE to apply correction ONLY on skin regions included in faces. Use SKINMODE_BODY to ap...
AGGRESSIVENESS
Enumeration defining different Auto Exposure calculation modes.
Image side dimension smaller than 32 pixels.
bool bPreprocessEV
Enable EV correction (Image Ambulance)
float feather
relative length of gradient, from where it starts (1.0) to where it is 0.0,
int width
Pixel width of image.
int iColorVibrancy
Color Vibrancy amount.
int left
x in point coordinate of this rect.
int iSlim
Face slimming level. Range 0 to 100.
float width
radial/rounded: w of bounding rect, linear: ignored.
Stronger sharpening. Details are more pronounced.
Priority on minimum false positive detection.
Struct defining an image profile as calculated from PFC_Calc() function.
Struct defining an image to be used in PFC library.
PFCFEATURE
ENUM controlling types of calculations at the pre-calculation stage.
float transparency
overall transparency applied to the whole mask (strength 100 means transparency 0.0, 0 -> 1.0).
int iEnlargeLevel
Eye enlargement level. Range 0 to 100.
PFCRE_STATUS RE_Status
Status code for Red Eye pre-calc analysis.
PFC3DLutInfo lutInputSky
LUT data to apply.
PFC3DLutInfo lutOutput
LUT data to apply.
int rowBytes
Byte width of each scanline.
int iStrengthOffset
Offset to recommended level of noise removal strength. Range -5 to 5.
int height
Pixel height of image.
int iDeFlash
Deflash level. Range 0 to 100.
bool bDynamicRange
Set to TRUE to enable dynamic range correction.
bool bEnlarge
Set to TRUE to enable eye enlargement.
bool bSmooth
Set to TRUE to enable face smoothing.
int iCatchLight
Catchlight level. Range 0 to 100.
bool bUseAutomaticStrengthSelection
Set to TRUE (recommended default) to enable Automatic Strength Selection. Perfectly Clear will determ...
bool invert
invert mask (x = 1.0 - x). NOTE: UI meaning of invert is: if one mask layer set invert = true...
PFC3DLutInfo lutInputFoliageBrown
LUT data to apply.
int height
height of this rect.
int iVibrancy
Degree of color vibrancy. This value will only be use when bVibrancy is TRUE. Very large values can p...
CONTRASTMODE eContrastMode
Select contrast mode.
bool bEnhance
Set to TRUE to enable eye enhancement.
SKINSMOOTHTYPE eSmoothType
See enum definition of SKINSMOOTHTYPE.
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds)
Overload method for precalc analysis.
Darkens skin, makes it look naturally tanned.
PFCFB_STATUS FB_Status
Status code for Face Beautification pre-calc analysis.
int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, int ISO, string CameraModel, bool bFastFAE)
Overload method for auto correction.
float fBiasScale
Scalar value of how much BIAS correction should be applied. Range 0.0 to 1.0.
bool bLipSharpen
Set to TRUE to enable lip sharpening.
TINTCORRECTION
Enumeration defining different abnormal tint analysis mode.
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, PFCFEATURE feature, int ISO, string CameraModel)
Overload method for precalc analysis.
unsigned char * data
Pointer pointing to the first byte of image data buffer.
Makes skin look lighter and more pale.
int AutoCorrect(ref Bitmap bm, int ISO, string CameraModel, bool bFastFAE)
Performs auto correction.
SKINTONINGTYPE
Enumeration defining type of Skin Toning correction.
int AutoCorrect(ref Bitmap bm, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
Overload method for auto correction.
Pointer pProfile is NULL.
float fLightDiffusion
Scale value to control intensity of light diffusion correction.
int iLipSharpen
Lip sharpening level. Range 0 to 100.
int iFinishShadows
Shadows correction amount.
float fSharpenScale
Sharpening intensity. This value controls how much sharpening to be applied. Range 0...
int data3
Location of Blue channel.
Unable to create SFB Engine object for processing.
int y
y coordinate of this point.
bool bAbnormalTintRemoval
Set to true to enable Abnormal Tint Removal. Recommended default is FALSE.
Calculates for Perfectly Clear Core correction.
void * pPfcParam
Internal use only.
DCFMODE eDCFMode
Select different class of DCF.
int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, string pathPreset)
Overload method for auto correction.
int iSmoothLevel
Face smoothing level. Range 0 to 100.
bool bDeFlash
Set to TRUE to enable deflash.
float fDCF
Scale value to control intensity of Digital Color Fidelity correction. Range 0.0 to 1...
LIPSHARPENTYPE
Enumeration defining Lip Sharpening mode.
int iEyeCirc
Eye circle removal level. Range 0 to 100.
bool bInfrared
Set to TRUE (recommended default) to enable infrared correction. It's a good idea to turn Infrared Co...
int data2
Location of Green channel.
SKINTONINGTYPE eSkinToningType
See enum definition of SKINTONINGTYPE.
int iStrength
Set the strength of exposure correction. If Automatic Strength Selection is enabled, the recommended value is put in this variable upon function return. Range 0 to 150.
PerfectlyClear(string path="")
Class constructor.
PFCCOREMask mask1
masks for layer 1
int FBFaceCount()
Get number of faces.
PFCPIXELFORMAT format
Defines byte order of input buffer.
int iFinishWhites
Whites correction amount.
int top
y in point corrdinate of this rect.
Image source in format not supported by this version of API.
PFCCORE_MASK_TYPE type
Mask type.
PFCNR_STATUS NR_Status
Status code for Noise Removal pre-calc analysis.
Calculates for Perfectly Clear Noise Removal.
int iFinishBlacks
Blacks correction amount.
PFC3DLutInfo lutInputFoliageGreen
LUT data to apply.
PFCFB_STATUS
Enumeration defining status of Face Beautification pre-calculation.
unsafe PFCAPPLYSTATUS Apply(ref Bitmap bm, int iOpacity)
Apply correction.
Struct describing V3 parameters.
PFC3DLutInfo lutInputCorrective
LUT data to apply.
SKINMODE eSkinToningMode
Use SKINMODE_FACE to apply correction ONLY on skin regions included in faces. Use SKINMODE_BODY to ap...
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm)
Performs precalc analysis.
PFCAPPLYSTATUS
Enumeration defining return code from the Apply() function.
float centerX
X of center.
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, PFCFEATURE feature)
Overload method for precalc analysis.
int iFinishVibrancy
Vibrancy correction amount.
bool bSharpen
Set to TRUE to enable sharpening.
PFCPRESETID
ENUM for presets support by this SDK.
PFCV3PARAM layer0
params on layers 0 - top/inside
bool HasFaceBeautification()
Query if Face Beautification feature is available.
Skip Face Aware Exposure pre-calculations during Core pre-calculations.
Class defining face area detected from the SFB library.
The subtle correction removes the wrinkles and spots alone while it keeps the texture of the face unc...
PFCRECT face
Bounding rectangle of detected face.
PFCV3PARAM layer1
params on layers 1 - bottom/outside, 2 - fiinishing
PFCCOREPARAM core
Core corrections to apply.
int iBlackEnhancement
Set luminance threshold for Noise Management. Range 0 to 25.
Face beautification feature not available.
Structure encapsulating Red Eye Correction parameters.
Full res image (pImage) is missing.
BIASMODE
Enumeration defining BIAS analysis mode.
More aggressive in exposure correction.
bool bEnabled
Set to true to enable the entire Core correction.
void * pSFBParam
Internal use only.
Full res source image (pImage) is missing.
bool bBlemish
Set to TRUE to enable blemish removal.
Calculates for Red Eye Removal.
void SetParam(PFCPRESETID id)
Set process parameters in current instance.
Fine touch of sharpening.
int width
Pixel width of image.
CONTRASTMODE
Enumeration defining contrast mode.
Turn off bias correction.
bool bBlush
Set to TRUE to add blush.
Lip details are coarsely pronounced.
ADPTRRETURNCODE
General return code.
Struct defining an image profile as calculated from PFC_Calc() function.
int AutoCorrect(ref Bitmap bm, string pathPreset)
Overload method for auto correction.
float fInfrared
Scale value to control intensity of infrared correction. Range 0.0 to 1.0.
Optimized to bring higher contrast to the image.
bool bEnabled
Set to TRUE to enable red eye removal.
int columnBytes
Byte width of one pixel.
PFCCORE_STATUS
Enumeration defining status of Core pre-calculation.
Some warnings during processing.
bool bSlim
Set to TRUE to enable face slimming.
BIASMODE eBiasMode
Skin and depth bias control. Recommended value is BIAS_AVERAGE_PREFERENCE, unless you are printing to...
int iMaxStrength
Use this value to limit the maximum Exposure to be applied on the Automatic Exposure Strength Selecti...
bool bCatchLight
Set to TRUE to enable catchlight removal.
int iFinishContrast
Contrast correction amount.
bool bEnabled
Set to TRUE to enable entire face beautification.
Aggressive detection of tint.
PFCPOINT leftEye
Point of left eye in detected face.
PFCNRPARAM nr
Noise reduction corrections.
Calculates for Face Beautification.
SKINSMOOTHTYPE
Enumeration defining types of Skin Smoothing correction.