9 using System.Drawing.Drawing2D;
11 using System.Drawing.Imaging;
13 using System.Runtime.InteropServices;
464 public enum PFCCORE_MASK_TYPE
471 PFCCORE_MASK_ROUNDRECT
492 [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
496 [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 33)]
499 public byte strength;
530 [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
621 private bool releaseProtection =
false;
658 #if PROTECTION_ENABLED 661 byte* pLicpath = null;
662 if (!String.IsNullOrEmpty(path))
664 pLicpath = GetCharBuffer(path);
667 byte* pLicenseCode = null;
668 if (!String.IsNullOrEmpty(licenseCode)) {
669 pLicenseCode = GetCharBuffer(licenseCode);
672 int status = PFC_SetProtectionPath(pLicpath, pLicenseCode);
674 FreeCharBuffer(pLicpath);
675 FreeCharBuffer(pLicenseCode);
682 Trace.WriteLine(ex.Message);
697 PFC_ReleaseProtectionPath();
713 m_pEngine = PFC_CreateEngine();
714 if (m_pEngine != null)
716 LastStatus.Status = (int)(*m_pEngine).status;
721 Trace.WriteLine(ex.Message);
724 PFC_SetParam(ref m_Param,
PFCPRESETID.PRESET_IAUTO_21);
741 #if PROTECTION_ENABLED 744 byte* pLicpath = null;
745 if (!String.IsNullOrEmpty(path))
747 pLicpath = GetCharBuffer(path);
750 byte* pLicenseCode = null;
751 if (!String.IsNullOrEmpty(licenseCode)) {
752 pLicenseCode = GetCharBuffer(licenseCode);
755 int status = PFC_SetProtectionPath(pLicpath, pLicenseCode);
756 releaseProtection =
true;
758 FreeCharBuffer(pLicpath);
759 FreeCharBuffer(pLicenseCode);
764 Trace.WriteLine(ex.Message);
769 m_pEngine = PFC_CreateEngine();
770 if (m_pEngine != null)
772 LastStatus.Status = (int)(*m_pEngine).status;
777 Trace.WriteLine(ex.Message);
780 PFC_SetParam(ref m_Param,
PFCPRESETID.PRESET_IAUTO_21);
785 #if PROTECTION_ENABLED 786 if(releaseProtection) {
832 return Calc(ref imgfile, feature, -1, null);
843 return Calc(ref bm, feature, -1, null);
855 return Calc(ref bm, ref bmds, feature, -1, null);
869 BitmapData bd = null;
871 bd = LockBitmapData(ref bm);
872 if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
873 bd.PixelFormat != PixelFormat.Format32bppArgb &&
874 bd.PixelFormat != PixelFormat.Format48bppRgb &&
875 bd.PixelFormat != PixelFormat.Format64bppArgb)
877 ReleaseBitmapData(ref bm, ref bd);
880 pBase = (Byte*)bd.Scan0.ToPointer();
886 switch (bd.PixelFormat)
894 im.
data = (
void*)pBase;
896 if (m_pProfile != null)
897 PFC_ReleaseProfile(m_pProfile);
900 if (CameraModel != null)
902 pModel = GetCharBuffer(CameraModel);
904 m_pProfile = PFC_Calc(&im, null, m_pEngine, feature, ISO, pModel, null, null, (
int)rejectOption);
906 FreeCharBuffer(pModel);
908 ReleaseBitmapData(ref bm, ref bd);
910 LastStatus.NR_Status = (*m_pProfile).NR_Status;
911 LastStatus.CORE_Status = (*m_pProfile).CORE_Status;
912 LastStatus.FB_Status = (*m_pProfile).FB_Status;
913 LastStatus.RE_Status = (*m_pProfile).RE_Status;
914 LastStatus.Status = (*m_pProfile).Status;
931 im.
width = imgfile.width();
932 im.
height = imgfile.height();
933 im.
stride = imgfile.stride();
935 im.
data = (
void*)imgfile.raw_image();
937 if (m_pProfile != null)
938 PFC_ReleaseProfile(m_pProfile);
941 if (CameraModel != null)
943 pModel = GetCharBuffer(CameraModel);
945 m_pProfile = PFC_Calc(&im, null, m_pEngine, feature, ISO, pModel, null, null, (
int)rejectOption);
947 FreeCharBuffer(pModel);
949 LastStatus.NR_Status = (*m_pProfile).NR_Status;
950 LastStatus.CORE_Status = (*m_pProfile).CORE_Status;
951 LastStatus.FB_Status = (*m_pProfile).FB_Status;
952 LastStatus.RE_Status = (*m_pProfile).RE_Status;
953 LastStatus.Status = (*m_pProfile).Status;
969 BitmapData bd = null;
971 bd = LockBitmapData(ref bm);
972 if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
973 bd.PixelFormat != PixelFormat.Format32bppArgb &&
974 bd.PixelFormat != PixelFormat.Format48bppRgb &&
975 bd.PixelFormat != PixelFormat.Format64bppArgb)
977 ReleaseBitmapData(ref bm, ref bd);
980 pBase = (Byte*)bd.Scan0.ToPointer();
986 switch (bd.PixelFormat)
994 im.
data = (
void*)pBase;
996 BitmapData bdds = null;
997 bdds = LockBitmapData(ref bmds);
998 if (bdds.PixelFormat != PixelFormat.Format24bppRgb &&
999 bdds.PixelFormat != PixelFormat.Format32bppArgb &&
1000 bdds.PixelFormat != PixelFormat.Format48bppRgb &&
1001 bdds.PixelFormat != PixelFormat.Format64bppArgb)
1003 ReleaseBitmapData(ref bmds, ref bdds);
1006 pBase = (Byte*)bdds.Scan0.ToPointer();
1009 imds.
width = bdds.Width;
1010 imds.
height = bdds.Height;
1011 imds.
stride = bdds.Stride;
1012 switch (bdds.PixelFormat)
1016 case PixelFormat.Format32bppArgb: imds.
format =
PFCPIXELFORMAT.PFC_PixelFormat32bppARGB;
break;
1018 case PixelFormat.Format64bppArgb: imds.
format =
PFCPIXELFORMAT.PFC_PixelFormat64bppARGB;
break;
1020 imds.
data = (
void*)pBase;
1022 if (m_pProfile != null)
1023 PFC_ReleaseProfile(m_pProfile);
1025 byte* pModel = null;
1026 if (CameraModel != null)
1028 pModel = GetCharBuffer(CameraModel);
1030 m_pProfile = PFC_Calc(&im, &imds, m_pEngine, feature, ISO, pModel, null, null, 1);
1032 FreeCharBuffer(pModel);
1034 ReleaseBitmapData(ref bm, ref bd);
1035 ReleaseBitmapData(ref bmds, ref bdds);
1037 LastStatus.NR_Status = (*m_pProfile).NR_Status;
1038 LastStatus.CORE_Status = (*m_pProfile).CORE_Status;
1039 LastStatus.FB_Status = (*m_pProfile).FB_Status;
1040 LastStatus.RE_Status = (*m_pProfile).RE_Status;
1041 LastStatus.Status = (*m_pProfile).Status;
1054 return Apply(ref bm, 100);
1064 return Apply(ref imgfile, 100);
1075 if (m_pProfile == null)
1080 BitmapData bd = null;
1082 bd = LockBitmapData(ref bm);
1083 if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
1084 bd.PixelFormat != PixelFormat.Format32bppArgb &&
1085 bd.PixelFormat != PixelFormat.Format48bppRgb &&
1086 bd.PixelFormat != PixelFormat.Format64bppArgb)
1088 ReleaseBitmapData(ref bm, ref bd);
1091 pBase = (Byte*)bd.Scan0.ToPointer();
1094 im.
width = bd.Width;
1097 switch (bd.PixelFormat)
1105 im.
data = (
void*)pBase;
1107 PFCAPPLYSTATUS ret = PFC_Apply(&im, m_pEngine, m_pProfile, ref m_Param, null, iOpacity, null);
1111 int code = (int)ret;
1113 LastStatus.NR_Status = (
PFCNR_STATUS)(code & 0x000000FF);
1114 LastStatus.CORE_Status = (
PFCCORE_STATUS)((code >> 8) & 0x000000FF);
1115 LastStatus.FB_Status = (
PFCFB_STATUS)((code >> 16) & 0x000000FF);
1116 LastStatus.RE_Status = (
PFCRE_STATUS)((code >> 24) & 0x000000FF);
1117 LastStatus.Status = code;
1120 ReleaseBitmapData(ref bm, ref bd);
1132 if (m_pProfile == null)
1138 im.
width = imgfile.width();
1139 im.
height = imgfile.height();
1140 im.
stride = imgfile.stride();
1142 im.
data = (
void*)imgfile.raw_image();
1144 PFCAPPLYSTATUS ret = PFC_Apply(&im, m_pEngine, m_pProfile, ref m_Param, null, iOpacity, null);
1148 int code = (int)ret;
1150 LastStatus.NR_Status = (
PFCNR_STATUS)(code & 0x000000FF);
1151 LastStatus.CORE_Status = (
PFCCORE_STATUS)((code >> 8) & 0x000000FF);
1152 LastStatus.FB_Status = (
PFCFB_STATUS)((code >> 16) & 0x000000FF);
1153 LastStatus.RE_Status = (
PFCRE_STATUS)((code >> 24) & 0x000000FF);
1154 LastStatus.Status = code;
1160 public unsafe
PFCAPPLYSTATUS ApplyLocal(ref Bitmap bm,
int xOffset,
int yOffset,
int widthOrig,
int heightOrig)
1162 return ApplyLocal(ref bm, xOffset, yOffset, widthOrig, heightOrig, 100);
1165 public unsafe
PFCAPPLYSTATUS ApplyLocal(ref Bitmap bm,
int xOffset,
int yOffset,
int widthOrig,
int heightOrig,
int iOpacity)
1167 BitmapData bd = null;
1169 bd = LockBitmapData(ref bm);
1170 if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
1171 bd.PixelFormat != PixelFormat.Format32bppArgb &&
1172 bd.PixelFormat != PixelFormat.Format48bppRgb &&
1173 bd.PixelFormat != PixelFormat.Format64bppArgb)
1175 ReleaseBitmapData(ref bm, ref bd);
1178 pBase = (Byte*)bd.Scan0.ToPointer();
1181 im.
width = bd.Width;
1184 switch (bd.PixelFormat)
1192 im.
data = (
void*)pBase;
1194 PFCAPPLYSTATUS ret = PFC_ApplyLocal(&im, xOffset, yOffset, widthOrig, heightOrig, m_pEngine, m_pProfile, ref m_Param, iOpacity);
1196 ReleaseBitmapData(ref bm, ref bd);
1200 public unsafe
PFCAPPLYSTATUS ApplyLocal(ref
PFCImageFile imgfile,
int xOffset,
int yOffset,
int widthOrig,
int heightOrig,
int iOpacity)
1203 im.
width = imgfile.width();
1204 im.
height = imgfile.height();
1205 im.
stride = imgfile.stride();
1207 im.
data = (
void*)imgfile.raw_image();
1209 PFCAPPLYSTATUS ret = PFC_ApplyLocal(&im, xOffset, yOffset, widthOrig, heightOrig, m_pEngine, m_pProfile, ref m_Param, iOpacity);
1268 return AutoCorrect(ref bm, ref bmds, -1, null,
false);
1279 public int AutoCorrect(ref Bitmap bm,
int ISO,
string CameraModel,
bool bFastFAE)
1323 int retInt = (((((((int)retRE << 8) | (int)retFB) << 8) | (
int)retCORE) << 8) | (int)retNR);
1385 int retInt = (((((((int)retRE << 8) | (int)retFB) << 8) | (
int)retCORE) << 8) | (int)retNR);
1404 public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds,
int ISO,
string CameraModel,
bool bFastFAE)
1448 int retInt = (((((((int)retRE << 8) | (int)retFB) << 8) | (
int)retCORE) << 8) | (int)retNR);
1471 return retCode-1000;
1487 return retCode - 1000;
1497 public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds,
string pathPreset)
1502 return AutoCorrect(ref bm, ref bmds, -1, null,
false);
1504 return retCode - 1000;
1516 public int AutoCorrect(ref Bitmap bm,
string pathPreset,
int ISO,
string CameraModel,
bool bFastFAE)
1521 return AutoCorrect(ref bm, ISO, CameraModel, bFastFAE);
1523 return retCode - 1000;
1540 return AutoCorrect(ref imgfile, ISO, CameraModel, bFastFAE);
1542 return retCode - 1000;
1555 public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds,
string pathPreset,
int ISO,
string CameraModel,
bool bFastFAE)
1560 return AutoCorrect(ref bm, ref bmds, ISO, CameraModel, bFastFAE);
1562 return retCode - 1000;
1571 PFC_SetParam(ref m_Param,
id);
1595 byte* presetpath = null;
1598 presetpath = GetCharBuffer(path);
1601 int status = PFC_ReadPresets(ref m_Param, presetpath);
1605 catch (Exception ex)
1607 Trace.WriteLine(ex.Message);
1628 long len = fs.Length;
1629 byte[] buffer =
new byte[len + 1];
1630 int size = (int)len;
1631 fs.Read(buffer, 0, size);
1633 byte* b = GetCharBuffer(buffer);
1638 int status = PFC_ReadPresetsFromStream(ref m_Param, b);
1642 catch (Exception ex)
1644 Trace.WriteLine(ex.Message);
1655 return PFC_HasFaceBeautification(m_pEngine);
1665 return PFC_FBFaceCount(m_pProfile);
1679 bool ret = PFC_GetFaceInfo(m_pProfile, &fi, index);
1698 return PFC_AbnormalTintDetected(m_pProfile, eTintMethod);
1708 PFC_ApplyStrengthToParam(ref m_Param, strength);
1711 protected BitmapData LockBitmapData(ref Bitmap bm)
1713 GraphicsUnit unit = GraphicsUnit.Pixel;
1714 RectangleF boundsF = bm.GetBounds(ref unit);
1715 Rectangle bounds =
new Rectangle((
int)boundsF.X,
1718 (
int)boundsF.Height);
1720 BitmapData bitmapData =
1721 bm.LockBits(bounds, ImageLockMode.ReadWrite, bm.PixelFormat);
1725 protected void ReleaseBitmapData(ref Bitmap bm, ref BitmapData bitmapData)
1727 bm.UnlockBits(bitmapData);
1730 protected Bitmap DupBitmap(ref Bitmap bm)
1732 PerfectlyClearImageTransfer tr, tr1;
1734 GraphicsUnit unit = GraphicsUnit.Pixel;
1735 RectangleF boundsF = bm.GetBounds(ref unit);
1736 Rectangle bounds =
new Rectangle((
int)boundsF.X,
1739 (
int)boundsF.Height);
1740 BitmapData bd = bm.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
1741 Bitmap bm1 =
new Bitmap(bd.Width, bd.Height, PixelFormat.Format24bppRgb);
1742 BitmapData bd1 = LockBitmapData(ref bm1);
1743 pBase = (Byte*)bd.Scan0.ToPointer();
1744 tr.columnBytes = (bd.PixelFormat == PixelFormat.Format24bppRgb) ? 3 : 4;
1745 tr.rowBytes = bd.Stride;
1746 tr.height = bd.Height;
1747 tr.width = bd.Width;
1748 tr.data1 = (int)(pBase + 2);
1749 tr.data2 = (int)(pBase + 1);
1750 tr.data3 = (int)pBase;
1751 pBase = (Byte*)bd1.Scan0.ToPointer();
1752 tr1.columnBytes = (bd1.PixelFormat == PixelFormat.Format24bppRgb) ? 3 : 4;
1753 tr1.rowBytes = bd1.Stride;
1754 tr1.height = bd1.Height;
1755 tr1.width = bd1.Width;
1756 tr1.data1 = (int)(pBase + 2);
1757 tr1.data2 = (int)(pBase + 1);
1758 tr1.data3 = (int)pBase;
1759 for (
int i = 0; i < tr.height; i++)
1761 for (
int j = 0; j < tr.width; j++)
1763 ((Byte*)tr1.data1)[j * tr1.columnBytes] = ((Byte*)tr.data1)[j * tr.columnBytes];
1764 ((Byte*)tr1.data2)[j * tr1.columnBytes] = ((Byte*)tr.data2)[j * tr.columnBytes];
1765 ((Byte*)tr1.data3)[j * tr1.columnBytes] = ((Byte*)tr.data3)[j * tr.columnBytes];
1767 tr.data1 += (int)tr.rowBytes;
1768 tr.data2 += (
int)tr.rowBytes;
1769 tr.data3 += (int)tr.rowBytes;
1770 tr1.data1 += (
int)tr1.rowBytes;
1771 tr1.data2 += (int)tr1.rowBytes;
1772 tr1.data3 += (
int)tr1.rowBytes;
1774 ReleaseBitmapData(ref bm1, ref bd1);
1775 ReleaseBitmapData(ref bm, ref bd);
1779 protected Bitmap BW2RGB(ref Bitmap bm)
1782 Byte* pBase1 = null;
1783 GraphicsUnit unit = GraphicsUnit.Pixel;
1784 RectangleF boundsF = bm.GetBounds(ref unit);
1785 Rectangle bounds =
new Rectangle((
int)boundsF.X,
1788 (
int)boundsF.Height);
1789 BitmapData bd = bm.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed);
1790 Bitmap bm1 =
new Bitmap(bd.Width, bd.Height, PixelFormat.Format24bppRgb);
1791 BitmapData bd1 = LockBitmapData(ref bm1);
1792 pBase = (Byte*)bd.Scan0.ToPointer();
1793 pBase1 = (Byte*)bd1.Scan0.ToPointer();
1794 for (
int i = 0; i < bd.Height; i++)
1796 for (
int j = 0; j < bd.Width; j++)
1798 pBase1[j * 3] = pBase[j];
1799 pBase1[j * 3 + 1] = pBase[j];
1800 pBase1[j * 3 + 2] = pBase[j];
1803 pBase1 += bd1.Stride;
1805 ReleaseBitmapData(ref bm1, ref bd1);
1806 ReleaseBitmapData(ref bm, ref bd);
1820 Bitmap myBitmap =
new Bitmap(filename);
1821 if ((myBitmap.Flags & (
int)ImageFlags.ColorSpaceYcck) != 0)
1823 bm = DupBitmap(ref myBitmap);
1828 if (myBitmap.PixelFormat == PixelFormat.Format8bppIndexed)
1830 bm = BW2RGB(ref myBitmap);
1841 protected Bitmap GetStatImage(ref Bitmap bm,
int iMaxDimension)
1844 bool bNeedResize =
true;
1851 if (w <= iMaxDimension)
1852 bNeedResize =
false;
1858 if (h <= iMaxDimension)
1859 bNeedResize =
false;
1870 Bitmap bmds =
new Bitmap(w1, h1, bm.PixelFormat);
1872 using (Graphics gr = Graphics.FromImage(bmds))
1874 gr.SmoothingMode = SmoothingMode.HighQuality;
1875 gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
1876 gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
1877 gr.DrawImage(bm,
new Rectangle(0, 0, w1, h1));
1885 Bitmap bmds = (Bitmap)bm.Clone();
1890 public void Dispose()
1893 GC.SuppressFinalize(
this);
1896 protected virtual void Dispose(
bool disposing)
1902 if (m_pProfile != null)
1904 PFC_ReleaseProfile(m_pProfile);
1908 if (m_pEngine != null)
1910 PFC_DestroyEngine(m_pEngine);
1915 static protected byte* GetCharBuffer(byte[] s)
1917 int i, iCount = s.Length;
1918 IntPtr _memory = IntPtr.Zero;
1919 _memory = Marshal.AllocHGlobal(iCount + 1);
1920 byte* p = (byte*)_memory;
1921 for (i = 0; i < iCount; i++)
1930 static protected byte* GetCharBuffer(
string s)
1932 int i, iCount = s.Length;
1933 IntPtr _memory = IntPtr.Zero;
1934 _memory = Marshal.AllocHGlobal(iCount + 1);
1935 byte* p = (byte*)_memory;
1936 for (i = 0; i < iCount; i++)
1945 static protected void FreeCharBuffer(byte* p)
1947 IntPtr _memory = (IntPtr)p;
1948 Marshal.FreeHGlobal(_memory);
1952 [DllImport(
"PerfectlyClearPro")]
1953 static extern int PFC_SetProtectionPath(byte* path, byte* licenseCode);
1955 [DllImport(
"PerfectlyClearPro")]
1956 static extern void PFC_ReleaseProtectionPath();
1958 [DllImport(
"PerfectlyClearPro")]
1959 static extern PFCENGINE* PFC_CreateEngine();
1961 [DllImport(
"PerfectlyClearPro")]
1962 static extern void PFC_DestroyEngine(
PFCENGINE* p);
1964 [DllImport(
"PerfectlyClearPro")]
1967 [DllImport(
"PerfectlyClearPro")]
1968 static extern int PFC_ReadPresets(ref
PFCPARAM param, byte* filename);
1970 [DllImport(
"PerfectlyClearPro")]
1971 static extern int PFC_ReadPresetsFromStream(ref
PFCPARAM param, byte* s);
1973 [DllImport(
"PerfectlyClearPro")]
1976 [DllImport(
"PerfectlyClearPro")]
1977 static extern void PFC_ReleaseProfile(
void* pProfile);
1979 [DllImport(
"PerfectlyClearPro")]
1982 [DllImport(
"PerfectlyClearPro")]
1985 [DllImport(
"PerfectlyClearPro")]
1986 static extern bool PFC_HasFaceBeautification(
PFCENGINE* pEngine);
1988 [DllImport(
"PerfectlyClearPro")]
1989 static extern int PFC_FBFaceCount(
void* pImageProfile);
1991 [DllImport(
"PerfectlyClearPro")]
1992 static extern bool PFC_GetFaceInfo(
void* pImageProfile, PFCFBFACEINFO1* pFace,
int index);
1994 [DllImport(
"PerfectlyClearPro")]
1995 static extern bool PFC_AbnormalTintDetected(
void* pImageProfile,
TINTCORRECTION eTintMethod);
1997 [DllImport(
"PerfectlyClearPro")]
1998 static extern void PFC_ApplyStrengthToParam(ref
PFCPARAM param,
int strength);
2002 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2003 static extern int PFC_SetProtectionPath(byte* path, byte* licenseCode);
2005 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2006 static extern void PFC_ReleaseProtectionPath();
2008 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2009 static extern PFCENGINE* PFC_CreateEngine();
2011 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2012 static extern void PFC_DestroyEngine(
PFCENGINE* p);
2014 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2017 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2018 static extern int PFC_ReadPresets(ref
PFCPARAM param, byte* filename);
2020 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2021 static extern int PFC_ReadPresetsFromStream(ref
PFCPARAM param, byte* s);
2023 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2026 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2027 static extern void PFC_ReleaseProfile(
void* pProfile);
2029 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2032 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2035 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2036 static extern bool PFC_HasFaceBeautification(
PFCENGINE* pEngine);
2038 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2039 static extern int PFC_FBFaceCount(
void* pImageProfile);
2041 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2042 static extern bool PFC_GetFaceInfo(
void* pImageProfile, PFCFBFACEINFO1* pFace,
int index);
2044 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2045 static extern bool PFC_AbnormalTintDetected(
void* pImageProfile,
TINTCORRECTION eTintMethod);
2047 [DllImport(
"PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2048 static extern void PFC_ApplyStrengthToParam(ref
PFCPARAM param,
int strength);
2090 private IntPtr m_pNativeObject;
2095 m_pNativeObject = create_PFCImageFile();
2098 public void Dispose()
2103 protected virtual void Dispose(
bool bDisposing)
2105 if (this.m_pNativeObject != IntPtr.Zero)
2107 delete_PFCImageFile(m_pNativeObject);
2108 m_pNativeObject = IntPtr.Zero;
2115 GC.SuppressFinalize(
this);
2149 if (filename == null)
2154 byte* pFilename = GetCharBuffer(filename);
2156 byte* pIccFolderPath = null;
2157 if (iccFolderPath != null)
2159 pIccFolderPath = GetCharBuffer(iccFolderPath);
2162 int result = PFCImageFile_LoadImageFile(m_pNativeObject, pFilename, bConvertToSRGB, pIccFolderPath);
2164 FreeCharBuffer(pFilename);
2165 FreeCharBuffer(pIccFolderPath);
2180 if (filename == null)
2185 byte* pFilename = GetCharBuffer(filename);
2187 byte* pIccFolderPath = null;
2188 if (iccFolderPath != null)
2190 pIccFolderPath = GetCharBuffer(iccFolderPath);
2193 int result = PFCImageFile_LoadImageFileType(m_pNativeObject, pFilename, (
int)type, bConvertToSRGB, pIccFolderPath);
2195 FreeCharBuffer(pFilename);
2196 FreeCharBuffer(pIccFolderPath);
2208 public bool SaveImageFile(
string filename,
int jpegQuality = 92,
bool bConvertToOriginalColorSpace=
true,
bool bEmbedOriginalMetadata =
true)
2210 if (filename == null)
2215 byte* pFilename = GetCharBuffer(filename);
2217 bool result = PFCImageFile_SaveImageFile(m_pNativeObject, pFilename, jpegQuality, bConvertToOriginalColorSpace, bEmbedOriginalMetadata);
2219 FreeCharBuffer(pFilename);
2232 public bool SaveImageFile(
string filename,
PFC_FILETYPE type,
int jpegQuality = 92,
bool bConvertToOriginalColorSpace =
true,
bool bEmbedOriginalMetadata =
true)
2234 if (filename == null)
2239 byte* pFilename = GetCharBuffer(filename);
2241 bool result = PFCImageFile_SaveImageFileType(m_pNativeObject, pFilename, (
int)type, jpegQuality, bConvertToOriginalColorSpace, bEmbedOriginalMetadata);
2243 FreeCharBuffer(pFilename);
2248 public void AllocBuffer(
int width,
int height,
int bytes_per_pixel,
int stride)
2250 PFCImageFile_AllocBuffer(m_pNativeObject, width, height, bytes_per_pixel, stride);
2253 public int pfcImageFormat()
2255 return PFCImageFile_pfcImageFormat(m_pNativeObject);
2258 public int exifOrientation()
2260 return PFCImageFile_exifOrientation(m_pNativeObject);
2263 public byte* raw_image()
2265 return PFCImageFile_get_raw_image(m_pNativeObject);
2270 return PFCImageFile_get_width(m_pNativeObject);
2275 return PFCImageFile_get_height(m_pNativeObject);
2278 public int bytes_per_pixel()
2280 return PFCImageFile_get_bytes_per_pixel(m_pNativeObject);
2285 return PFCImageFile_get_stride(m_pNativeObject);
2288 public bool sourceSRGB()
2290 return PFCImageFile_get_sourceSRGB(m_pNativeObject);
2303 byte* buffer = GetByteBuffer(inStream.ToArray());
2304 byte* pIccFolderPath = null;
2305 if (iccFolderPath != null)
2307 pIccFolderPath = GetCharBuffer(iccFolderPath);
2309 int result = PFCImageFile_ExpandImageBuffer(m_pNativeObject, buffer, inStream.Length, (
int)type, bConvertToSRGB, pIccFolderPath);
2310 FreeCharBuffer(pIccFolderPath);
2311 FreeByteBuffer(buffer);
2326 byte* compressedBuffer = null;
2327 int length = PFCImageFile_CompressImageBuffer(m_pNativeObject, &compressedBuffer, (
int)type, jpegQuality, bConvertToOriginalColorSpace, bEmbedOriginalMetadata);
2328 if (length > 0 && compressedBuffer != null)
2330 byte[] result =
new byte[length];
2331 Marshal.Copy((IntPtr)(compressedBuffer), result, 0, length);
2332 deleteBuffer(compressedBuffer);
2335 MemoryStream stream =
new MemoryStream();
2336 stream.Write(result, 0, result.Length);
2339 return new MemoryStream();
2342 private static byte* GetCharBuffer(
string s)
2344 UTF8Encoding utf8 =
new UTF8Encoding();
2345 Byte[] encodedBytes = utf8.GetBytes(s);
2347 int i, iCount = encodedBytes.Length;
2348 IntPtr _memory = IntPtr.Zero;
2349 _memory = Marshal.AllocHGlobal(iCount + 1);
2350 byte* p = (byte*)_memory;
2351 for (i = 0; i < iCount; i++)
2353 p[i] = encodedBytes[i];
2360 private static void FreeCharBuffer(byte* p)
2362 IntPtr _memory = (IntPtr)p;
2363 Marshal.FreeHGlobal(_memory);
2366 private static byte* GetByteBuffer(byte[] bytes)
2368 int length = bytes.Length;
2369 IntPtr p = Marshal.AllocHGlobal(length);
2370 Marshal.Copy(bytes, 0, p, length);
2374 private static void FreeByteBuffer(byte* p)
2376 IntPtr _memory = (IntPtr)p;
2377 Marshal.FreeHGlobal(_memory);
2381 [DllImport(
"PFCImageFile")]
2382 static private extern unsafe IntPtr create_PFCImageFile();
2384 [DllImport(
"PFCImageFile")]
2385 static private extern void delete_PFCImageFile(IntPtr o);
2387 [DllImport(
"PFCImageFile")]
2388 static private extern unsafe
int PFCImageFile_LoadImageFile(IntPtr o, byte* filename,
bool bConvertToSRGB, byte* iccFolderPath);
2390 [DllImport(
"PFCImageFile")]
2391 static private extern unsafe
int PFCImageFile_LoadImageFileType(IntPtr o, byte* filename,
int type,
bool bConvertToSRGB, byte* iccFolderPath);
2393 [DllImport(
"PFCImageFile")]
2394 static private extern unsafe
bool PFCImageFile_SaveImageFile(IntPtr ptr, byte* filename,
int jpegQuality,
bool bConvertToOriginalColorSpace,
bool bEmbedOriginalMetadata);
2396 [DllImport(
"PFCImageFile")]
2397 static private extern unsafe
bool PFCImageFile_SaveImageFileType(IntPtr ptr, byte* filename,
int type,
int jpegQuality,
bool bConvertToOriginalColorSpace,
bool bEmbedOriginalMetadata);
2399 [DllImport(
"PFCImageFile")]
2400 static private extern unsafe
void PFCImageFile_AllocBuffer(IntPtr ptr,
int width,
int height,
int bytes_per_pixel,
int stride);
2402 [DllImport(
"PFCImageFile")]
2403 static private extern unsafe
int PFCImageFile_pfcImageFormat(IntPtr ptr);
2405 [DllImport(
"PFCImageFile")]
2406 static private extern unsafe
int PFCImageFile_exifOrientation(IntPtr ptr);
2408 [DllImport(
"PFCImageFile")]
2409 static private extern unsafe byte* PFCImageFile_get_raw_image(IntPtr ptr);
2411 [DllImport(
"PFCImageFile")]
2412 static private extern unsafe
int PFCImageFile_get_width(IntPtr ptr);
2414 [DllImport(
"PFCImageFile")]
2415 static private extern unsafe
int PFCImageFile_get_height(IntPtr ptr);
2417 [DllImport(
"PFCImageFile")]
2418 static private extern unsafe
int PFCImageFile_get_bytes_per_pixel(IntPtr ptr);
2420 [DllImport(
"PFCImageFile")]
2421 static private extern unsafe
int PFCImageFile_get_stride(IntPtr ptr);
2423 [DllImport(
"PFCImageFile")]
2424 static private extern unsafe
bool PFCImageFile_get_sourceSRGB(IntPtr ptr);
2426 [DllImport(
"PFCImageFile")]
2427 static private extern unsafe
int PFCImageFile_ExpandImageBuffer(IntPtr ptr, byte* buffer,
long size,
int type,
bool bConvertToSRGB, byte* iccFolderPath);
2429 [DllImport(
"PFCImageFile")]
2430 static private extern unsafe
int PFCImageFile_CompressImageBuffer(IntPtr ptr, byte** destination,
int type,
int jpegQuality,
bool bConvertToOriginalColorSpace,
bool bEmbedOriginalMetadata);
2432 [DllImport(
"PFCImageFile")]
2433 static private extern unsafe
int deleteBuffer(byte* buffer);
2437 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2438 static private extern unsafe IntPtr create_PFCImageFile();
2440 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2441 static private extern void delete_PFCImageFile(IntPtr o);
2443 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2444 static private extern unsafe
int PFCImageFile_LoadImageFile(IntPtr o, byte* filename,
bool bConvertToSRGB, byte* iccFolderPath);
2446 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2447 static private extern unsafe
int PFCImageFile_LoadImageFileType(IntPtr o, byte* filename,
int type,
bool bConvertToSRGB, byte* iccFolderPath);
2449 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2450 static private extern unsafe
bool PFCImageFile_SaveImageFile(IntPtr ptr, byte* filename,
int jpegQuality,
bool bConvertToOriginalColorSpace,
bool bEmbedOriginalMetadata);
2452 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2453 static private extern unsafe
bool PFCImageFile_SaveImageFileType(IntPtr ptr, byte* filename,
int type,
int jpegQuality,
bool bConvertToOriginalColorSpace,
bool bEmbedOriginalMetadata);
2455 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2456 static private extern unsafe
void PFCImageFile_AllocBuffer(IntPtr ptr,
int width,
int height,
int bytes_per_pixel,
int stride);
2458 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2459 static private extern unsafe
int PFCImageFile_pfcImageFormat(IntPtr ptr);
2461 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2462 static private extern unsafe
int PFCImageFile_exifOrientation(IntPtr ptr);
2464 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2465 static private extern unsafe byte* PFCImageFile_get_raw_image(IntPtr ptr);
2467 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2468 static private extern unsafe
int PFCImageFile_get_width(IntPtr ptr);
2470 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2471 static private extern unsafe
int PFCImageFile_get_height(IntPtr ptr);
2473 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2474 static private extern unsafe
int PFCImageFile_get_bytes_per_pixel(IntPtr ptr);
2476 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2477 static private extern unsafe
int PFCImageFile_get_stride(IntPtr ptr);
2479 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2480 static private extern unsafe
bool PFCImageFile_get_sourceSRGB(IntPtr ptr);
2482 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2483 static private extern unsafe
int PFCImageFile_ExpandImageBuffer(IntPtr ptr, byte* buffer,
long size,
int type,
bool bConvertToSRGB, byte* iccFolderPath);
2485 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2486 static private extern unsafe
int PFCImageFile_CompressImageBuffer(IntPtr ptr, byte** destination,
int type,
int jpegQuality,
bool bConvertToOriginalColorSpace,
bool bEmbedOriginalMetadata);
2488 [DllImport(
"PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2489 static private extern unsafe
int deleteBuffer(byte* buffer);
unsafe ADPTRRETURNCODE Calc(ref PFCImageFile imgfile, PFCFEATURE feature, int ISO, string CameraModel, PFCREJECTOPTION rejectOption=PFCREJECTOPTION.PFC_REJECT_CLIPART)
Overload method for precalc analysis.
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.
Reject images classified as clipart, used by default.
bool bDCF
Set to true to enable Digital Color Fidelity. Recommended value is FALSE.
4 Error reading image data
Skip pre-calculations on Abnormal Tint Correction during Core pre-calculations.
int iTeethLevel
Teeth whitening level. Range 0 to 100.
4 Process aborted because of insufficient memory
PFCPIXELFORMAT format
Defines byte order of input buffer.
int iFinishExposure
Exposure correction amount.
-6 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.
2 Source 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.
8 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.
-5 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.
2 Warning: 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.
iAuto 2019 with Red Eye correciton 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.
2 Source 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.
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, PFCFEATURE feature, int ISO, string CameraModel, PFCREJECTOPTION rejectOption=PFCREJECTOPTION.PFC_REJECT_CLIPART)
Overload method for precalc analysis.
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.
7 Image skipped due AI Clipart detection
Fine tuned for Asian skin tone.
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds, PFCFEATURE feature)
Overload method for precalc analysis.
5 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.
PFCREJECTOPTION
Enumeration defining reject options.
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.
-2 Pointer pEngine is NULL
7 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.
6 Image skipped, too small ( < 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.
5 Image skipped due to legacy clipart detection method
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...
-4 Pointer pImage is NULL, source image missing
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.
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.
-1 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.
6 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.
Based on iAuto 21, but with brighter Skin & Depth Bias for truer skin tone.
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.
10 Face beautification feature not available
Structure encapsulating Red Eye Correction parameters.
PerfectlyClear(string path, string licenseCode="")
Class constructor.
3 Source 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.
3 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.
The iAuto you love plus newly tuned settings for sharper images, accurate skin correction, and more depth. Read more here: https://eyeq.photos/business/iauto-2021.
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.
Reject simple images that don't benefit from correction, like solid colors. This was the default befo...
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.
iAuto for even better image corrections
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.