9 using System.Drawing.Drawing2D;
11 using System.Drawing.Imaging;
13 using System.Runtime.InteropServices;
453 public enum PFCCORE_MASK_TYPE
460 PFCCORE_MASK_ROUNDRECT
481 [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
485 [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 33)]
488 public byte strength;
519 [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
610 private bool releaseProtection =
false;
647 #if PROTECTION_ENABLED 650 byte* pLicpath = null;
651 if (!String.IsNullOrEmpty(path))
653 pLicpath = GetCharBuffer(path);
656 byte* pLicenseCode = null;
657 if (!String.IsNullOrEmpty(licenseCode)) {
658 pLicenseCode = GetCharBuffer(licenseCode);
661 int status = PFC_SetProtectionPath(pLicpath, pLicenseCode);
663 FreeCharBuffer(pLicpath);
664 FreeCharBuffer(pLicenseCode);
671 Trace.WriteLine(ex.Message);
686 PFC_ReleaseProtectionPath();
702 m_pEngine = PFC_CreateEngine();
703 if (m_pEngine != null)
705 LastStatus.Status = (int)(*m_pEngine).status;
710 Trace.WriteLine(ex.Message);
713 PFC_SetParam(ref m_Param,
PFCPRESETID.PRESET_IAUTO_2019);
730 #if PROTECTION_ENABLED 733 byte* pLicpath = null;
734 if (!String.IsNullOrEmpty(path))
736 pLicpath = GetCharBuffer(path);
739 byte* pLicenseCode = null;
740 if (!String.IsNullOrEmpty(licenseCode)) {
741 pLicenseCode = GetCharBuffer(licenseCode);
744 int status = PFC_SetProtectionPath(pLicpath, pLicenseCode);
745 releaseProtection =
true;
747 FreeCharBuffer(pLicpath);
748 FreeCharBuffer(pLicenseCode);
753 Trace.WriteLine(ex.Message);
758 m_pEngine = PFC_CreateEngine();
759 if (m_pEngine != null)
761 LastStatus.Status = (int)(*m_pEngine).status;
766 Trace.WriteLine(ex.Message);
769 PFC_SetParam(ref m_Param,
PFCPRESETID.PRESET_IAUTO_2019);
774 #if PROTECTION_ENABLED 775 if(releaseProtection) {
821 return Calc(ref imgfile, feature, -1, null);
832 return Calc(ref bm, feature, -1, null);
844 return Calc(ref bm, ref bmds, feature, -1, null);
857 BitmapData bd = null;
859 bd = LockBitmapData(ref bm);
860 if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
861 bd.PixelFormat != PixelFormat.Format32bppArgb &&
862 bd.PixelFormat != PixelFormat.Format48bppRgb &&
863 bd.PixelFormat != PixelFormat.Format64bppArgb)
865 ReleaseBitmapData(ref bm, ref bd);
868 pBase = (Byte*)bd.Scan0.ToPointer();
874 switch (bd.PixelFormat)
882 im.
data = (
void*)pBase;
884 if (m_pProfile != null)
885 PFC_ReleaseProfile(m_pProfile);
888 if (CameraModel != null)
890 pModel = GetCharBuffer(CameraModel);
892 m_pProfile = PFC_Calc(&im, null, m_pEngine, feature, ISO, pModel, null, null, 1);
894 FreeCharBuffer(pModel);
896 ReleaseBitmapData(ref bm, ref bd);
898 LastStatus.NR_Status = (*m_pProfile).NR_Status;
899 LastStatus.CORE_Status = (*m_pProfile).CORE_Status;
900 LastStatus.FB_Status = (*m_pProfile).FB_Status;
901 LastStatus.RE_Status = (*m_pProfile).RE_Status;
902 LastStatus.Status = (*m_pProfile).Status;
918 im.
width = imgfile.width();
919 im.
height = imgfile.height();
920 im.
stride = imgfile.stride();
922 im.
data = (
void*)imgfile.raw_image();
924 if (m_pProfile != null)
925 PFC_ReleaseProfile(m_pProfile);
928 if (CameraModel != null)
930 pModel = GetCharBuffer(CameraModel);
932 m_pProfile = PFC_Calc(&im, null, m_pEngine, feature, ISO, pModel, null, null, 1);
934 FreeCharBuffer(pModel);
936 LastStatus.NR_Status = (*m_pProfile).NR_Status;
937 LastStatus.CORE_Status = (*m_pProfile).CORE_Status;
938 LastStatus.FB_Status = (*m_pProfile).FB_Status;
939 LastStatus.RE_Status = (*m_pProfile).RE_Status;
940 LastStatus.Status = (*m_pProfile).Status;
956 BitmapData bd = null;
958 bd = LockBitmapData(ref bm);
959 if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
960 bd.PixelFormat != PixelFormat.Format32bppArgb &&
961 bd.PixelFormat != PixelFormat.Format48bppRgb &&
962 bd.PixelFormat != PixelFormat.Format64bppArgb)
964 ReleaseBitmapData(ref bm, ref bd);
967 pBase = (Byte*)bd.Scan0.ToPointer();
973 switch (bd.PixelFormat)
981 im.
data = (
void*)pBase;
983 BitmapData bdds = null;
984 bdds = LockBitmapData(ref bmds);
985 if (bdds.PixelFormat != PixelFormat.Format24bppRgb &&
986 bdds.PixelFormat != PixelFormat.Format32bppArgb &&
987 bdds.PixelFormat != PixelFormat.Format48bppRgb &&
988 bdds.PixelFormat != PixelFormat.Format64bppArgb)
990 ReleaseBitmapData(ref bmds, ref bdds);
993 pBase = (Byte*)bdds.Scan0.ToPointer();
996 imds.
width = bdds.Width;
997 imds.
height = bdds.Height;
998 imds.
stride = bdds.Stride;
999 switch (bdds.PixelFormat)
1003 case PixelFormat.Format32bppArgb: imds.
format =
PFCPIXELFORMAT.PFC_PixelFormat32bppARGB;
break;
1005 case PixelFormat.Format64bppArgb: imds.
format =
PFCPIXELFORMAT.PFC_PixelFormat64bppARGB;
break;
1007 imds.
data = (
void*)pBase;
1009 if (m_pProfile != null)
1010 PFC_ReleaseProfile(m_pProfile);
1012 byte* pModel = null;
1013 if (CameraModel != null)
1015 pModel = GetCharBuffer(CameraModel);
1017 m_pProfile = PFC_Calc(&im, &imds, m_pEngine, feature, ISO, pModel, null, null, 1);
1019 FreeCharBuffer(pModel);
1021 ReleaseBitmapData(ref bm, ref bd);
1022 ReleaseBitmapData(ref bmds, ref bdds);
1024 LastStatus.NR_Status = (*m_pProfile).NR_Status;
1025 LastStatus.CORE_Status = (*m_pProfile).CORE_Status;
1026 LastStatus.FB_Status = (*m_pProfile).FB_Status;
1027 LastStatus.RE_Status = (*m_pProfile).RE_Status;
1028 LastStatus.Status = (*m_pProfile).Status;
1041 return Apply(ref bm, 100);
1051 return Apply(ref imgfile, 100);
1062 if (m_pProfile == null)
1067 BitmapData bd = null;
1069 bd = LockBitmapData(ref bm);
1070 if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
1071 bd.PixelFormat != PixelFormat.Format32bppArgb &&
1072 bd.PixelFormat != PixelFormat.Format48bppRgb &&
1073 bd.PixelFormat != PixelFormat.Format64bppArgb)
1075 ReleaseBitmapData(ref bm, ref bd);
1078 pBase = (Byte*)bd.Scan0.ToPointer();
1081 im.
width = bd.Width;
1084 switch (bd.PixelFormat)
1092 im.
data = (
void*)pBase;
1094 PFCAPPLYSTATUS ret = PFC_Apply(&im, m_pEngine, m_pProfile, ref m_Param, null, iOpacity, null);
1098 int code = (int)ret;
1100 LastStatus.NR_Status = (
PFCNR_STATUS)(code & 0x000000FF);
1101 LastStatus.CORE_Status = (
PFCCORE_STATUS)((code >> 8) & 0x000000FF);
1102 LastStatus.FB_Status = (
PFCFB_STATUS)((code >> 16) & 0x000000FF);
1103 LastStatus.RE_Status = (
PFCRE_STATUS)((code >> 24) & 0x000000FF);
1104 LastStatus.Status = code;
1107 ReleaseBitmapData(ref bm, ref bd);
1119 if (m_pProfile == null)
1125 im.
width = imgfile.width();
1126 im.
height = imgfile.height();
1127 im.
stride = imgfile.stride();
1129 im.
data = (
void*)imgfile.raw_image();
1131 PFCAPPLYSTATUS ret = PFC_Apply(&im, m_pEngine, m_pProfile, ref m_Param, null, iOpacity, null);
1135 int code = (int)ret;
1137 LastStatus.NR_Status = (
PFCNR_STATUS)(code & 0x000000FF);
1138 LastStatus.CORE_Status = (
PFCCORE_STATUS)((code >> 8) & 0x000000FF);
1139 LastStatus.FB_Status = (
PFCFB_STATUS)((code >> 16) & 0x000000FF);
1140 LastStatus.RE_Status = (
PFCRE_STATUS)((code >> 24) & 0x000000FF);
1141 LastStatus.Status = code;
1147 public unsafe
PFCAPPLYSTATUS ApplyLocal(ref Bitmap bm,
int xOffset,
int yOffset,
int widthOrig,
int heightOrig)
1149 return ApplyLocal(ref bm, xOffset, yOffset, widthOrig, heightOrig, 100);
1152 public unsafe
PFCAPPLYSTATUS ApplyLocal(ref Bitmap bm,
int xOffset,
int yOffset,
int widthOrig,
int heightOrig,
int iOpacity)
1154 BitmapData bd = null;
1156 bd = LockBitmapData(ref bm);
1157 if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
1158 bd.PixelFormat != PixelFormat.Format32bppArgb &&
1159 bd.PixelFormat != PixelFormat.Format48bppRgb &&
1160 bd.PixelFormat != PixelFormat.Format64bppArgb)
1162 ReleaseBitmapData(ref bm, ref bd);
1165 pBase = (Byte*)bd.Scan0.ToPointer();
1168 im.
width = bd.Width;
1171 switch (bd.PixelFormat)
1179 im.
data = (
void*)pBase;
1181 PFCAPPLYSTATUS ret = PFC_ApplyLocal(&im, xOffset, yOffset, widthOrig, heightOrig, m_pEngine, m_pProfile, ref m_Param, iOpacity);
1183 ReleaseBitmapData(ref bm, ref bd);
1187 public unsafe
PFCAPPLYSTATUS ApplyLocal(ref
PFCImageFile imgfile,
int xOffset,
int yOffset,
int widthOrig,
int heightOrig,
int iOpacity)
1190 im.
width = imgfile.width();
1191 im.
height = imgfile.height();
1192 im.
stride = imgfile.stride();
1194 im.
data = (
void*)imgfile.raw_image();
1196 PFCAPPLYSTATUS ret = PFC_ApplyLocal(&im, xOffset, yOffset, widthOrig, heightOrig, m_pEngine, m_pProfile, ref m_Param, iOpacity);
1255 return AutoCorrect(ref bm, ref bmds, -1, null,
false);
1266 public int AutoCorrect(ref Bitmap bm,
int ISO,
string CameraModel,
bool bFastFAE)
1310 int retInt = (((((((int)retRE << 8) | (int)retFB) << 8) | (
int)retCORE) << 8) | (int)retNR);
1372 int retInt = (((((((int)retRE << 8) | (int)retFB) << 8) | (
int)retCORE) << 8) | (int)retNR);
1391 public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds,
int ISO,
string CameraModel,
bool bFastFAE)
1435 int retInt = (((((((int)retRE << 8) | (int)retFB) << 8) | (
int)retCORE) << 8) | (int)retNR);
1458 return retCode-1000;
1474 return retCode - 1000;
1484 public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds,
string pathPreset)
1489 return AutoCorrect(ref bm, ref bmds, -1, null,
false);
1491 return retCode - 1000;
1503 public int AutoCorrect(ref Bitmap bm,
string pathPreset,
int ISO,
string CameraModel,
bool bFastFAE)
1508 return AutoCorrect(ref bm, ISO, CameraModel, bFastFAE);
1510 return retCode - 1000;
1527 return AutoCorrect(ref imgfile, ISO, CameraModel, bFastFAE);
1529 return retCode - 1000;
1542 public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds,
string pathPreset,
int ISO,
string CameraModel,
bool bFastFAE)
1547 return AutoCorrect(ref bm, ref bmds, ISO, CameraModel, bFastFAE);
1549 return retCode - 1000;
1558 PFC_SetParam(ref m_Param,
id);
1582 byte* presetpath = null;
1585 presetpath = GetCharBuffer(path);
1588 int status = PFC_ReadPresets(ref m_Param, presetpath);
1592 catch (Exception ex)
1594 Trace.WriteLine(ex.Message);
1615 long len = fs.Length;
1616 byte[] buffer =
new byte[len + 1];
1617 int size = (int)len;
1618 fs.Read(buffer, 0, size);
1620 byte* b = GetCharBuffer(buffer);
1625 int status = PFC_ReadPresetsFromStream(ref m_Param, b);
1629 catch (Exception ex)
1631 Trace.WriteLine(ex.Message);
1642 return PFC_HasFaceBeautification(m_pEngine);
1652 return PFC_FBFaceCount(m_pProfile);
1666 bool ret = PFC_GetFaceInfo(m_pProfile, &fi, index);
1685 return PFC_AbnormalTintDetected(m_pProfile, eTintMethod);
1695 PFC_ApplyStrengthToParam(ref m_Param, strength);
1698 protected BitmapData LockBitmapData(ref Bitmap bm)
1700 GraphicsUnit unit = GraphicsUnit.Pixel;
1701 RectangleF boundsF = bm.GetBounds(ref unit);
1702 Rectangle bounds =
new Rectangle((
int)boundsF.X,
1705 (
int)boundsF.Height);
1707 BitmapData bitmapData =
1708 bm.LockBits(bounds, ImageLockMode.ReadWrite, bm.PixelFormat);
1712 protected void ReleaseBitmapData(ref Bitmap bm, ref BitmapData bitmapData)
1714 bm.UnlockBits(bitmapData);
1717 protected Bitmap DupBitmap(ref Bitmap bm)
1719 PerfectlyClearImageTransfer tr, tr1;
1721 GraphicsUnit unit = GraphicsUnit.Pixel;
1722 RectangleF boundsF = bm.GetBounds(ref unit);
1723 Rectangle bounds =
new Rectangle((
int)boundsF.X,
1726 (
int)boundsF.Height);
1727 BitmapData bd = bm.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
1728 Bitmap bm1 =
new Bitmap(bd.Width, bd.Height, PixelFormat.Format24bppRgb);
1729 BitmapData bd1 = LockBitmapData(ref bm1);
1730 pBase = (Byte*)bd.Scan0.ToPointer();
1731 tr.columnBytes = (bd.PixelFormat == PixelFormat.Format24bppRgb) ? 3 : 4;
1732 tr.rowBytes = bd.Stride;
1733 tr.height = bd.Height;
1734 tr.width = bd.Width;
1735 tr.data1 = (int)(pBase + 2);
1736 tr.data2 = (int)(pBase + 1);
1737 tr.data3 = (int)pBase;
1738 pBase = (Byte*)bd1.Scan0.ToPointer();
1739 tr1.columnBytes = (bd1.PixelFormat == PixelFormat.Format24bppRgb) ? 3 : 4;
1740 tr1.rowBytes = bd1.Stride;
1741 tr1.height = bd1.Height;
1742 tr1.width = bd1.Width;
1743 tr1.data1 = (int)(pBase + 2);
1744 tr1.data2 = (int)(pBase + 1);
1745 tr1.data3 = (int)pBase;
1746 for (
int i = 0; i < tr.height; i++)
1748 for (
int j = 0; j < tr.width; j++)
1750 ((Byte*)tr1.data1)[j * tr1.columnBytes] = ((Byte*)tr.data1)[j * tr.columnBytes];
1751 ((Byte*)tr1.data2)[j * tr1.columnBytes] = ((Byte*)tr.data2)[j * tr.columnBytes];
1752 ((Byte*)tr1.data3)[j * tr1.columnBytes] = ((Byte*)tr.data3)[j * tr.columnBytes];
1754 tr.data1 += (int)tr.rowBytes;
1755 tr.data2 += (
int)tr.rowBytes;
1756 tr.data3 += (int)tr.rowBytes;
1757 tr1.data1 += (
int)tr1.rowBytes;
1758 tr1.data2 += (int)tr1.rowBytes;
1759 tr1.data3 += (
int)tr1.rowBytes;
1761 ReleaseBitmapData(ref bm1, ref bd1);
1762 ReleaseBitmapData(ref bm, ref bd);
1766 protected Bitmap BW2RGB(ref Bitmap bm)
1769 Byte* pBase1 = null;
1770 GraphicsUnit unit = GraphicsUnit.Pixel;
1771 RectangleF boundsF = bm.GetBounds(ref unit);
1772 Rectangle bounds =
new Rectangle((
int)boundsF.X,
1775 (
int)boundsF.Height);
1776 BitmapData bd = bm.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed);
1777 Bitmap bm1 =
new Bitmap(bd.Width, bd.Height, PixelFormat.Format24bppRgb);
1778 BitmapData bd1 = LockBitmapData(ref bm1);
1779 pBase = (Byte*)bd.Scan0.ToPointer();
1780 pBase1 = (Byte*)bd1.Scan0.ToPointer();
1781 for (
int i = 0; i < bd.Height; i++)
1783 for (
int j = 0; j < bd.Width; j++)
1785 pBase1[j * 3] = pBase[j];
1786 pBase1[j * 3 + 1] = pBase[j];
1787 pBase1[j * 3 + 2] = pBase[j];
1790 pBase1 += bd1.Stride;
1792 ReleaseBitmapData(ref bm1, ref bd1);
1793 ReleaseBitmapData(ref bm, ref bd);
1807 Bitmap myBitmap =
new Bitmap(filename);
1808 if ((myBitmap.Flags & (
int)ImageFlags.ColorSpaceYcck) != 0)
1810 bm = DupBitmap(ref myBitmap);
1815 if (myBitmap.PixelFormat == PixelFormat.Format8bppIndexed)
1817 bm = BW2RGB(ref myBitmap);
1828 protected Bitmap GetStatImage(ref Bitmap bm,
int iMaxDimension)
1831 bool bNeedResize =
true;
1838 if (w <= iMaxDimension)
1839 bNeedResize =
false;
1845 if (h <= iMaxDimension)
1846 bNeedResize =
false;
1857 Bitmap bmds =
new Bitmap(w1, h1, bm.PixelFormat);
1859 using (Graphics gr = Graphics.FromImage(bmds))
1861 gr.SmoothingMode = SmoothingMode.HighQuality;
1862 gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
1863 gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
1864 gr.DrawImage(bm,
new Rectangle(0, 0, w1, h1));
1872 Bitmap bmds = (Bitmap)bm.Clone();
1877 public void Dispose()
1880 GC.SuppressFinalize(
this);
1883 protected virtual void Dispose(
bool disposing)
1889 if (m_pProfile != null)
1891 PFC_ReleaseProfile(m_pProfile);
1895 if (m_pEngine != null)
1897 PFC_DestroyEngine(m_pEngine);
1902 static protected byte* GetCharBuffer(byte[] s)
1904 int i, iCount = s.Length;
1905 IntPtr _memory = IntPtr.Zero;
1906 _memory = Marshal.AllocHGlobal(iCount + 1);
1907 byte* p = (byte*)_memory;
1908 for (i = 0; i < iCount; i++)
1917 static protected byte* GetCharBuffer(
string s)
1919 int i, iCount = s.Length;
1920 IntPtr _memory = IntPtr.Zero;
1921 _memory = Marshal.AllocHGlobal(iCount + 1);
1922 byte* p = (byte*)_memory;
1923 for (i = 0; i < iCount; i++)
1932 static protected void FreeCharBuffer(byte* p)
1934 IntPtr _memory = (IntPtr)p;
1935 Marshal.FreeHGlobal(_memory);
1939 [DllImport(
"PerfectlyClearPro")]
1940 static extern int PFC_SetProtectionPath(byte* path, byte* licenseCode);
1942 [DllImport(
"PerfectlyClearPro")]
1943 static extern void PFC_ReleaseProtectionPath();
1945 [DllImport(
"PerfectlyClearPro")]
1946 static extern PFCENGINE* PFC_CreateEngine();
1948 [DllImport(
"PerfectlyClearPro")]
1949 static extern void PFC_DestroyEngine(
PFCENGINE* p);
1951 [DllImport(
"PerfectlyClearPro")]
1954 [DllImport(
"PerfectlyClearPro")]
1955 static extern int PFC_ReadPresets(ref
PFCPARAM param, byte* filename);
1957 [DllImport(
"PerfectlyClearPro")]
1958 static extern int PFC_ReadPresetsFromStream(ref
PFCPARAM param, byte* s);
1960 [DllImport(
"PerfectlyClearPro")]
1963 [DllImport(
"PerfectlyClearPro")]
1964 static extern void PFC_ReleaseProfile(
void* pProfile);
1966 [DllImport(
"PerfectlyClearPro")]
1969 [DllImport(
"PerfectlyClearPro")]
1972 [DllImport(
"PerfectlyClearPro")]
1973 static extern bool PFC_HasFaceBeautification(
PFCENGINE* pEngine);
1975 [DllImport(
"PerfectlyClearPro")]
1976 static extern int PFC_FBFaceCount(
void* pImageProfile);
1978 [DllImport(
"PerfectlyClearPro")]
1979 static extern bool PFC_GetFaceInfo(
void* pImageProfile, PFCFBFACEINFO1* pFace,
int index);
1981 [DllImport(
"PerfectlyClearPro")]
1982 static extern bool PFC_AbnormalTintDetected(
void* pImageProfile,
TINTCORRECTION eTintMethod);
1984 [DllImport(
"PerfectlyClearPro")]
1985 static extern void PFC_ApplyStrengthToParam(ref
PFCPARAM param,
int strength);
1989 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
1990 static extern int PFC_SetProtectionPath(byte* path, byte* licenseCode);
1992 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
1993 static extern void PFC_ReleaseProtectionPath();
1995 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
1996 static extern PFCENGINE* PFC_CreateEngine();
1998 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
1999 static extern void PFC_DestroyEngine(
PFCENGINE* p);
2001 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2004 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2005 static extern int PFC_ReadPresets(ref
PFCPARAM param, byte* filename);
2007 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2008 static extern int PFC_ReadPresetsFromStream(ref
PFCPARAM param, byte* s);
2010 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2013 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2014 static extern void PFC_ReleaseProfile(
void* pProfile);
2016 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2019 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2022 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2023 static extern bool PFC_HasFaceBeautification(
PFCENGINE* pEngine);
2025 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2026 static extern int PFC_FBFaceCount(
void* pImageProfile);
2028 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2029 static extern bool PFC_GetFaceInfo(
void* pImageProfile, PFCFBFACEINFO1* pFace,
int index);
2031 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2032 static extern bool PFC_AbnormalTintDetected(
void* pImageProfile,
TINTCORRECTION eTintMethod);
2034 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2035 static extern void PFC_ApplyStrengthToParam(ref
PFCPARAM param,
int strength);
2077 private IntPtr m_pNativeObject;
2082 m_pNativeObject = create_PFCImageFile();
2085 public void Dispose()
2090 protected virtual void Dispose(
bool bDisposing)
2092 if (this.m_pNativeObject != IntPtr.Zero)
2094 delete_PFCImageFile(m_pNativeObject);
2095 m_pNativeObject = IntPtr.Zero;
2102 GC.SuppressFinalize(
this);
2136 if (filename == null)
2141 byte* pFilename = GetCharBuffer(filename);
2143 byte* pIccFolderPath = null;
2144 if (iccFolderPath != null)
2146 pIccFolderPath = GetCharBuffer(iccFolderPath);
2149 int result = PFCImageFile_LoadImageFile(m_pNativeObject, pFilename, bConvertToSRGB, pIccFolderPath);
2151 FreeCharBuffer(pFilename);
2152 FreeCharBuffer(pIccFolderPath);
2167 if (filename == null)
2172 byte* pFilename = GetCharBuffer(filename);
2174 byte* pIccFolderPath = null;
2175 if (iccFolderPath != null)
2177 pIccFolderPath = GetCharBuffer(iccFolderPath);
2180 int result = PFCImageFile_LoadImageFileType(m_pNativeObject, pFilename, (
int)type, bConvertToSRGB, pIccFolderPath);
2182 FreeCharBuffer(pFilename);
2183 FreeCharBuffer(pIccFolderPath);
2195 public bool SaveImageFile(
string filename,
int jpegQuality = 92,
bool bConvertToOriginalColorSpace=
true,
bool bEmbedOriginalMetadata =
true)
2197 if (filename == null)
2202 byte* pFilename = GetCharBuffer(filename);
2204 bool result = PFCImageFile_SaveImageFile(m_pNativeObject, pFilename, jpegQuality, bConvertToOriginalColorSpace, bEmbedOriginalMetadata);
2206 FreeCharBuffer(pFilename);
2219 public bool SaveImageFile(
string filename,
PFC_FILETYPE type,
int jpegQuality = 92,
bool bConvertToOriginalColorSpace =
true,
bool bEmbedOriginalMetadata =
true)
2221 if (filename == null)
2226 byte* pFilename = GetCharBuffer(filename);
2228 bool result = PFCImageFile_SaveImageFileType(m_pNativeObject, pFilename, (
int)type, jpegQuality, bConvertToOriginalColorSpace, bEmbedOriginalMetadata);
2230 FreeCharBuffer(pFilename);
2235 public void AllocBuffer(
int width,
int height,
int bytes_per_pixel,
int stride)
2237 PFCImageFile_AllocBuffer(m_pNativeObject, width, height, bytes_per_pixel, stride);
2240 public int pfcImageFormat()
2242 return PFCImageFile_pfcImageFormat(m_pNativeObject);
2245 public int exifOrientation()
2247 return PFCImageFile_exifOrientation(m_pNativeObject);
2250 public byte* raw_image()
2252 return PFCImageFile_get_raw_image(m_pNativeObject);
2257 return PFCImageFile_get_width(m_pNativeObject);
2262 return PFCImageFile_get_height(m_pNativeObject);
2265 public int bytes_per_pixel()
2267 return PFCImageFile_get_bytes_per_pixel(m_pNativeObject);
2272 return PFCImageFile_get_stride(m_pNativeObject);
2275 public bool sourceSRGB()
2277 return PFCImageFile_get_sourceSRGB(m_pNativeObject);
2290 byte* buffer = GetByteBuffer(inStream.ToArray());
2291 byte* pIccFolderPath = null;
2292 if (iccFolderPath != null)
2294 pIccFolderPath = GetCharBuffer(iccFolderPath);
2296 int result = PFCImageFile_ExpandImageBuffer(m_pNativeObject, buffer, inStream.Length, (
int)type, bConvertToSRGB, pIccFolderPath);
2297 FreeCharBuffer(pIccFolderPath);
2298 FreeByteBuffer(buffer);
2313 byte* compressedBuffer = null;
2314 int length = PFCImageFile_CompressImageBuffer(m_pNativeObject, &compressedBuffer, (
int)type, jpegQuality, bConvertToOriginalColorSpace, bEmbedOriginalMetadata);
2315 if (length > 0 && compressedBuffer != null)
2317 byte[] result =
new byte[length];
2318 Marshal.Copy((IntPtr)(compressedBuffer), result, 0, length);
2319 deleteBuffer(compressedBuffer);
2322 MemoryStream stream =
new MemoryStream();
2323 stream.Write(result, 0, result.Length);
2326 return new MemoryStream();
2329 private static byte* GetCharBuffer(
string s)
2331 UTF8Encoding utf8 =
new UTF8Encoding();
2332 Byte[] encodedBytes = utf8.GetBytes(s);
2334 int i, iCount = encodedBytes.Length;
2335 IntPtr _memory = IntPtr.Zero;
2336 _memory = Marshal.AllocHGlobal(iCount + 1);
2337 byte* p = (byte*)_memory;
2338 for (i = 0; i < iCount; i++)
2340 p[i] = encodedBytes[i];
2347 private static void FreeCharBuffer(byte* p)
2349 IntPtr _memory = (IntPtr)p;
2350 Marshal.FreeHGlobal(_memory);
2353 private static byte* GetByteBuffer(byte[] bytes)
2355 int length = bytes.Length;
2356 IntPtr p = Marshal.AllocHGlobal(length);
2357 Marshal.Copy(bytes, 0, p, length);
2361 private static void FreeByteBuffer(byte* p)
2363 IntPtr _memory = (IntPtr)p;
2364 Marshal.FreeHGlobal(_memory);
2368 [DllImport(
"PFCImageFile")]
2369 static private extern unsafe IntPtr create_PFCImageFile();
2371 [DllImport(
"PFCImageFile")]
2372 static private extern void delete_PFCImageFile(IntPtr o);
2374 [DllImport(
"PFCImageFile")]
2375 static private extern unsafe
int PFCImageFile_LoadImageFile(IntPtr o, byte* filename,
bool bConvertToSRGB, byte* iccFolderPath);
2377 [DllImport(
"PFCImageFile")]
2378 static private extern unsafe
int PFCImageFile_LoadImageFileType(IntPtr o, byte* filename,
int type,
bool bConvertToSRGB, byte* iccFolderPath);
2380 [DllImport(
"PFCImageFile")]
2381 static private extern unsafe
bool PFCImageFile_SaveImageFile(IntPtr ptr, byte* filename,
int jpegQuality,
bool bConvertToOriginalColorSpace,
bool bEmbedOriginalMetadata);
2383 [DllImport(
"PFCImageFile")]
2384 static private extern unsafe
bool PFCImageFile_SaveImageFileType(IntPtr ptr, byte* filename,
int type,
int jpegQuality,
bool bConvertToOriginalColorSpace,
bool bEmbedOriginalMetadata);
2386 [DllImport(
"PFCImageFile")]
2387 static private extern unsafe
void PFCImageFile_AllocBuffer(IntPtr ptr,
int width,
int height,
int bytes_per_pixel,
int stride);
2389 [DllImport(
"PFCImageFile")]
2390 static private extern unsafe
int PFCImageFile_pfcImageFormat(IntPtr ptr);
2392 [DllImport(
"PFCImageFile")]
2393 static private extern unsafe
int PFCImageFile_exifOrientation(IntPtr ptr);
2395 [DllImport(
"PFCImageFile")]
2396 static private extern unsafe byte* PFCImageFile_get_raw_image(IntPtr ptr);
2398 [DllImport(
"PFCImageFile")]
2399 static private extern unsafe
int PFCImageFile_get_width(IntPtr ptr);
2401 [DllImport(
"PFCImageFile")]
2402 static private extern unsafe
int PFCImageFile_get_height(IntPtr ptr);
2404 [DllImport(
"PFCImageFile")]
2405 static private extern unsafe
int PFCImageFile_get_bytes_per_pixel(IntPtr ptr);
2407 [DllImport(
"PFCImageFile")]
2408 static private extern unsafe
int PFCImageFile_get_stride(IntPtr ptr);
2410 [DllImport(
"PFCImageFile")]
2411 static private extern unsafe
bool PFCImageFile_get_sourceSRGB(IntPtr ptr);
2413 [DllImport(
"PFCImageFile")]
2414 static private extern unsafe
int PFCImageFile_ExpandImageBuffer(IntPtr ptr, byte* buffer,
long size,
int type,
bool bConvertToSRGB, byte* iccFolderPath);
2416 [DllImport(
"PFCImageFile")]
2417 static private extern unsafe
int PFCImageFile_CompressImageBuffer(IntPtr ptr, byte** destination,
int type,
int jpegQuality,
bool bConvertToOriginalColorSpace,
bool bEmbedOriginalMetadata);
2419 [DllImport(
"PFCImageFile")]
2420 static private extern unsafe
int deleteBuffer(byte* buffer);
2424 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2425 static private extern unsafe IntPtr create_PFCImageFile();
2427 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2428 static private extern void delete_PFCImageFile(IntPtr o);
2430 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2431 static private extern unsafe
int PFCImageFile_LoadImageFile(IntPtr o, byte* filename,
bool bConvertToSRGB, byte* iccFolderPath);
2433 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2434 static private extern unsafe
int PFCImageFile_LoadImageFileType(IntPtr o, byte* filename,
int type,
bool bConvertToSRGB, byte* iccFolderPath);
2436 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2437 static private extern unsafe
bool PFCImageFile_SaveImageFile(IntPtr ptr, byte* filename,
int jpegQuality,
bool bConvertToOriginalColorSpace,
bool bEmbedOriginalMetadata);
2439 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2440 static private extern unsafe
bool PFCImageFile_SaveImageFileType(IntPtr ptr, byte* filename,
int type,
int jpegQuality,
bool bConvertToOriginalColorSpace,
bool bEmbedOriginalMetadata);
2442 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2443 static private extern unsafe
void PFCImageFile_AllocBuffer(IntPtr ptr,
int width,
int height,
int bytes_per_pixel,
int stride);
2445 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2446 static private extern unsafe
int PFCImageFile_pfcImageFormat(IntPtr ptr);
2448 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2449 static private extern unsafe
int PFCImageFile_exifOrientation(IntPtr ptr);
2451 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2452 static private extern unsafe byte* PFCImageFile_get_raw_image(IntPtr ptr);
2454 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2455 static private extern unsafe
int PFCImageFile_get_width(IntPtr ptr);
2457 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2458 static private extern unsafe
int PFCImageFile_get_height(IntPtr ptr);
2460 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2461 static private extern unsafe
int PFCImageFile_get_bytes_per_pixel(IntPtr ptr);
2463 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2464 static private extern unsafe
int PFCImageFile_get_stride(IntPtr ptr);
2466 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2467 static private extern unsafe
bool PFCImageFile_get_sourceSRGB(IntPtr ptr);
2469 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2470 static private extern unsafe
int PFCImageFile_ExpandImageBuffer(IntPtr ptr, byte* buffer,
long size,
int type,
bool bConvertToSRGB, byte* iccFolderPath);
2472 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2473 static private extern unsafe
int PFCImageFile_CompressImageBuffer(IntPtr ptr, byte** destination,
int type,
int jpegQuality,
bool bConvertToOriginalColorSpace,
bool bEmbedOriginalMetadata);
2475 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2476 static private extern unsafe
int deleteBuffer(byte* buffer);
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 AutoCorrect(ref PFCImageFile imgfile, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
Overload method for auto correction.
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...
MemoryStream CompressImageBuffer(PFC_FILETYPE type, int jpegQuality=92, bool bConvertToOriginalColorSpace=true, bool bEmbedOriginalMetadata=true)
Write image data to MemoryStream.
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.
void ApplyStrengthToParam(int strength)
Apply overall strength to parameters, same as Strength in Perfecly Clear products Adjusts the paramet...
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.
unsafe ADPTRRETURNCODE Calc(ref PFCImageFile imgfile, PFCFEATURE feature)
Overload method for precalc analysis.
PFC_FILE_LOAD_STATUS ExpandImageBuffer(MemoryStream inStream, PFC_FILETYPE type, bool bConvertToSRGB=true, string iccFolderPath=null)
Load JPEG from MemoryStream.
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.
bool SaveImageFile(string filename, int jpegQuality=92, bool bConvertToOriginalColorSpace=true, bool bEmbedOriginalMetadata=true)
Write image data to file*.
int ReadPresetsFromStream(FileStream fs)
Read a preset from a file stream.
Warning. e.g. face not detected.
For average usage, corresponds to "Normal" in PfC Products.
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.
PFCImageFile()
Constructs empty PFCImageFile, to be filled with LoadImageFile()
PFC_FILE_LOAD_STATUS LoadImage(string filename, bool bConvertToSRGB=false, string iccFolderPath=null)
Load JPEG from file on disk.
int ReadPresets(string path)
Read a preset from .preset file.
Same as iAuto 2019 but also with Red Eye Correction enabled.
PFCPIXELFORMAT
defines the format of the image data
Highest sensitivity level of tint detection.
Apply correction ONLY on skin regions included in faces.
Beautify Plus provides stronger beautification corrections. This is in the 'Perfectly Clear Essential...
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.
Error: failed to convert to sRGB.
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.
PerfectlyClear()
Special class constructor for multithreading.
bool bHighlightPreservation
Set to true to enable Highlight Preservation.
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.
PFC_FILETYPE
ENUM to set the filetype of files / buffers.
Struct defining an image to be used in PFC library.
Average usage with brighter tone, corresponds to "Bright" in PfC Products.
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.
static int SetProtectionPath(string path, string licenseCode)
Set path to location of SDK License files This enables license protection and allows activation using...
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.
int AutoCorrect(ref PFCImageFile imgfile)
Overload method for auto correction.
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.
PFCImageFile Class to encapsulate file handling.
PFCRE_STATUS RE_Status
Status code for Red Eye pre-calc analysis.
PFC3DLutInfo lutInputSky
LUT data to apply.
unsafe PFCAPPLYSTATUS Apply(ref PFCImageFile imgfile, int iOpacity)
Apply correction.
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.
Intelligent Auto - this has been superceded by iAuto 2019 and is here for backwards compatability...
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...
Vivid - good for landscapes and other general photography. This is in the 'Perfectly Clear Essentials...
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.
iAuto Details - legacy preset for backwards compability. This is in the 'Athentech Legacy' group in E...
int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, int ISO, string CameraModel, bool bFastFAE)
Overload method for auto correction.
unsafe ADPTRRETURNCODE Calc(ref PFCImageFile imgfile)
Overload method for precalc analysis.
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.
unsafe ADPTRRETURNCODE Calc(ref PFCImageFile imgfile, PFCFEATURE feature, int ISO, string CameraModel)
Overload method for precalc analysis.
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.
bool SaveImageFile(string filename, PFC_FILETYPE type, int jpegQuality=92, bool bConvertToOriginalColorSpace=true, bool bEmbedOriginalMetadata=true)
Write image data to file*.
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.
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...
Beautify - provides a good default set of corrections for portratis and other photos of people...
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
unsafe PFCAPPLYSTATUS Apply(ref PFCImageFile imgfile)
Apply correction.
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.
PerfectlyClear(string path, string licenseCode="")
Class constructor.
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.
PFC_FILE_LOAD_STATUS
Return status after loading a file with PFCImageFile.
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.
PFCImageFile Class to encapsulate file handling.
int iHighlightPreservation
Amount of Highlight Preservation to apply. Range 0 to 100.
Fine touch of sharpening.
int AutoCorrect(ref PFCImageFile imgfile, string pathPreset)
Overload method for auto correction.
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.
int AutoCorrect(ref PFCImageFile imgfile, int ISO, string CameraModel, bool bFastFAE)
Performs auto correction.
Optimized to bring higher contrast to the image.
bool bEnabled
Set to TRUE to enable red eye removal.
New iAuto for even better image corrections - this is the default Preset and a great starting point f...
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...
static void ReleaseProtectionPath()
Releases resources from SetProtectionPath.
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.
PFC_FILE_LOAD_STATUS LoadImage(string filename, PFC_FILETYPE type, bool bConvertToSRGB=true, string iccFolderPath=null)
Load JPEG from file on disk.