Perfectly Clear SDK Documentation  10.0.1.537
PerfectlyClearAdapter.cs
Go to the documentation of this file.
1 
6 using System;
7 using System.Text;
8 using System.Drawing;
9 using System.Drawing.Drawing2D;
10 using System.Diagnostics;
11 using System.Drawing.Imaging;
12 using System.IO;
13 using System.Runtime.InteropServices;
14 
16 {
18 [StructLayout(LayoutKind.Sequential, Pack = 1)]
19 public struct PFCPOINT
20 {
21  public int x;
22  public int y;
23 };
24 
26 [StructLayout(LayoutKind.Sequential, Pack = 1)]
27 public struct PFCRECT
28 {
29  public int left;
30  public int top;
31  public int width;
32  public int height;
33 };
34 
36 public struct PFCFBFACEINFO1
37 {
38  public PFCPOINT leftEye;
39  public PFCPOINT rightEye;
40  public PFCRECT face;
41 };
42 
44 public class PFCFBFACEINFO
45 {
46  public PFCPOINT leftEye;
47  public PFCPOINT rightEye;
48  public PFCRECT face;
49 
51  public PFCFBFACEINFO()
52  {
53  face.left = 0;
54  face.top = 0;
55  face.width = 0;
56  face.height = 0;
57  leftEye.x = 0;
58  leftEye.y = 0;
59  rightEye.x = 0;
60  rightEye.y = 0;
61  }
62 };
63 
65 [StructLayout(LayoutKind.Sequential, Pack = 1)]
66 public class PFCFACERECT
67 {
68  public PFCRECT rect;
69  public PFCRECT rcEyeL;
70  public PFCRECT rcEyeR;
71  public PFCRECT rcMouth;
72  public PFCPOINT ptEyeL;
73  public PFCPOINT ptEyeR;
74  public int angle;
75  public int blinkLevel;
76  public int blinkLevelL;
77  public int blinkLevelR;
78  public int childLevel;
79  public int confidence;
80  public int smileLevel;
81  public int yawAngle;
82  public int FAE1;
83  public int FAE2;
84  public int FAE3;
85  public int widthImage;
86  public int heightImage;
87  public IntPtr pWrapped;
88 
89  public PFCFACERECT()
90  {
91  pWrapped = IntPtr.Zero;
92  }
93 };
94 
96 public enum PFCFEATURE
97 {
98  CALC_CORE = 1,
99  CALC_NR = 2,
100  CALC_FB = 4,
101  CALC_RE = 8,
102  CALC_ALL = 15,
103  CALC_NOTINTCALC = 16,
104  CALC_NOFAE = 32,
105  CALC_FAEHISPEED = 64,
106  CALC_CARTOON_DETECTOR = 128,
107  CALC_SHARP = 256,
108  CALC_SCENE_DETECTION = 512
109 
110 };
111 
113 public enum PFCAIFEATURE
114 {
115  AI_SCENE_DETECTION = 1,
116  AI_CORRECTIONS = 2
117 };
118 
120 public enum PFCPIXELFORMAT
121 {
234 };
235 
237 public enum PFCPRESETID
238 {
242  PRESET_VIVID,
248 };
249 
251 public enum PFCNR_STATUS
252 {
261 };
262 
264 public enum PFCCORE_STATUS
265 {
274 };
275 
277 public enum PFCREJECTOPTION
278 {
279  PFC_REJECT_NONE = 0,
280  PFC_REJECT_MONOLITH = 1,
281  PFC_REJECT_CLIPART = 2
282 };
283 
285 public enum PFCFB_STATUS
286 {
298 };
299 
301 public enum PFCRE_STATUS
302 {
312 };
313 
315 public enum PFCAPPLYSTATUS
316 {
317  APPLY_SUCCESS = 0,
320  APPLY_CANCELLED = -3,
321  APPLY_NOSOURCE = -4,
322  APPLY_BADFORMAT = -5,
323  APPLY_INVALIDLICENSE = -6,
329  APPLY_LOOKS_MISSING = -12
330 };
331 
333 public enum TINTCORRECTION
334 {
339 };
340 
342 public enum AGGRESSIVENESS
343 {
344  CONSERVATIVE,
345  MODERATE,
346  AGGRESSIVE,
347 };
348 
350 public enum DCFMODE
351 {
354 };
355 
357 public enum CONTRASTMODE
358 {
359  HIGH_CONTRAST,
361 };
362 
364 public enum BIASMODE
365 {
366  BIAS_NONE,
371  BIAS_AUTO
372 };
373 
375 public enum ADPTRRETURNCODE
376 {
377  SUCCESS,
378  WARNING,
379  INTERNALERROR,
380  WRONG_FORMAT
381 };
382 
384 public enum SKINMODE
385 {
386  SKINMODE_FACE = 1,
388 };
389 
391 public enum SKINSMOOTHTYPE
392 {
396 };
397 
399 public enum SKINTONINGTYPE
400 {
406 };
407 
409 public enum LIPSHARPENTYPE
410 {
411  LIPSHARPENTYPE_FINE = 1,
414 };
415 
417 public struct PFCCOREPARAM
418 {
419  public bool bEnabled;
420  public bool bAbnormalTintRemoval;
422  public float fTintScale;
423  public int iBlackEnhancement;
424  public bool bVibrancy;
425  public int iVibrancy;
426  public int iStrength;
427  public bool bContrast;
429  public int iContrast;
431  public float fBiasScale;
434  public bool bSharpen;
435  public float fSharpenScale;
437  public bool bUseFAE;
439  public int iMaxStrength;
440  public bool bInfrared;
441  public float fInfrared;
442  public bool bLightDiffusion;
443  public float fLightDiffusion;
444  public bool bDynamicRange;
445  public bool bDCF;
446  public DCFMODE eDCFMode;
447  public float fDCF;
448  public int iLocalContrast;
449  public bool bLocalContrast;
450  public int iMinStrength;
451 };
452 
454 public struct PFCFBPARAM
455 {
456  public bool bEnabled;
457  public bool bSmooth;
458  public int iSmoothLevel;
461  public bool bEnlarge;
462  public int iEnlargeLevel;
463  public bool bEnhance;
464  public int iEnhanceLevel;
465  public bool bEyeCirc;
466  public int iEyeCirc;
467  public bool bTeeth;
468  public int iTeethLevel;
469  public bool bBlemish;
470  public int iBlemish;
471  public bool bSlim;
472  public int iSlim;
473  public bool bDeFlash;
474  public int iDeFlash;
475  public bool bCatchLight;
476  public int iCatchLight;
477  public int iCatchLightMode;
478  public bool bSkinToning;
485  public int iSkinToning;
488  public bool bLipSharpen;
489  public int iLipSharpen;
491  public bool bBlush;
492  public int iBlush;
493  public uint colorSkinToning;
494  public uint colorBlush;
495 };
496 
498 public unsafe struct PFCNRPARAM
499 {
500  public bool bEnabled;
501  public int iPreset;
502  public int iStrengthOffset;
510  public int iDetailOffset;
511 };
512 
514 public struct PFCREPARAM
515 {
516  public bool bEnabled;
517 };
518 
519 // V3 additions
520 public enum PFCCORE_MASK_TYPE
521 {
522  PFCCORE_MASK_NONE, // 0.0 everywhere, don't apply
523  PFCCORE_MASK_ALL, // 1.0 everywhere (background)
524  PFCCORE_MASK_RADIAL, // ellipse
525  PFCCORE_MASK_TOP, // linear from 1.0 on top
526  PFCCORE_MASK_BOTTOM, // linear from 1.0 on bottom
527  PFCCORE_MASK_ROUNDRECT // rounded rect
528 };
529 
530 /* Description of mask for grad filter, all coordinates are relative (Y/height, X/width) in final crop-rotated image */
534 public unsafe struct PFCCOREMask
535 {
536  public PFCCORE_MASK_TYPE type;
537  public float centerX;
538  public float centerY;
539  public float width;
540  public float height;
541  public float radius;
542  public float feather;
543  public float angle;
544  public float transparency;
545  [MarshalAsAttribute(UnmanagedType.I1)]
546  public bool invert;
547 };
548 
549 [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
551 public struct PFC3DLutInfo
552 {
553  [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 33)]
554  public string guid;
555 
556  public byte strength; // C++ unsigned char
557 }
558 
560 [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
561 public unsafe struct PFCV3PARAM
562 {
563  // Image Ambulance
564  [MarshalAsAttribute(UnmanagedType.I1)]
565  public bool bPreprocessEV;
566  public int iPreprocessEV;
567  // built-in 3D luts
568  public int iNeutralDensity;
569  public int iColorVibrancy;
570  public int iDarkSkin;
575  // custom output 3D Lut
577  // Finishing
578  public int iFinishTemp;
579  public int iFinishTint;
580  public int iFinishExposure;
581  public int iFinishBlacks;
582  public int iFinishShadows;
583  public int iFinishHighlights;
584  public int iFinishWhites;
585  public int iFinishSaturation;
586  public int iFinishVibrancy;
587  public int iFinishContrast;
589 
590  public int iDeltaR;
591  public int iDeltaG;
592  public int iDeltaB;
593 
594  public bool bDynamic;
595  public int iDynamic;
596  public int iDynamicWB;
597 };
598 
599 [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
601 public struct PFCPARAM
602 {
604  public PFCFBPARAM fb;
605  public PFCNRPARAM nr;
606  public PFCREPARAM re;
607  public PFCV3PARAM v3;
614 };
615 
617 public struct PFCSTATUS
618 {
619  public PFCCORE_STATUS CORE_Status;
620  public PFCNR_STATUS NR_Status;
621  public PFCFB_STATUS FB_Status;
622  public PFCRE_STATUS RE_Status;
623  public int Status;
624 }
625 
632  public unsafe class PerfectlyClear : IDisposable
633  {
635  protected unsafe struct PFCENGINE
636  {
637  void* pEngine;
638  public uint status;
639  };
641  protected unsafe struct PerfectlyClearImageTransfer
642  {
643  public int width;
644  public int height;
645  public int rowBytes;
646  public int columnBytes;
647  public int data1;
648  public int data2;
649  public int data3;
650  };
651 
653  protected unsafe struct PFCIMAGEPROFILE
654  {
655  void* pPfcParam;
656  void* pNoiseParam;
657  void* pRedEyeParam;
658  void* pSFBParam;
659  void* pInternal;
660 
665 
666  public int Status;
667  };
674 
676  protected unsafe struct PFCIMAGE
677  {
678  public int width;
679  public int height;
680  public int stride;
682  public void* data;
683  };
684 
685 
686  protected PFCENGINE* m_pEngine;
687  protected PFCENGINE* m_pAiEngine;
688  int m_loadedAiEngineFeatures;
689  protected PFCIMAGEPROFILE* m_pProfile;
690  public PFCPARAM m_Param;
691  public PFCSTATUS LastStatus;
692  public PFCSTATUS LastAiStatus;
693  private bool releaseProtection = false;
694 
728  public static int SetProtectionPath(string path, string licenseCode)
729  {
730 #if PROTECTION_ENABLED
731  try
732  {
733  byte* pLicpath = null;
734  if (!String.IsNullOrEmpty(path))
735  {
736  pLicpath = GetCharBuffer(path);
737  }
738 
739  byte* pLicenseCode = null;
740  if (!String.IsNullOrEmpty(licenseCode)) {
741  pLicenseCode = GetCharBuffer(licenseCode);
742  }
743 
744  int status = PFC_SetProtectionPath(pLicpath, pLicenseCode);
745 
746  FreeCharBuffer(pLicpath);
747  FreeCharBuffer(pLicenseCode);
748  //Trace.WriteLine("status " + status.ToString());
749 
750  return status;
751  }
752  catch (Exception ex)
753  {
754  Trace.WriteLine(ex.Message);
755  return 100;
756  }
757 #endif
758  return 0;
759  }
760 
761 
767  public static void ReleaseProtectionPath()
768  {
769  PFC_ReleaseProtectionPath();
770  }
771 
778  public PerfectlyClear()
779  {
780  m_pEngine = null;
781  m_pProfile = null;
782  m_pAiEngine = null;
783  m_loadedAiEngineFeatures = 0;
784 
785  try
786  {
787  m_pEngine = PFC_CreateEngine();
788  if (m_pEngine != null)
789  {
790  LastStatus.Status = (int)(*m_pEngine).status;
791  }
792 
793  m_pAiEngine = PFC_CreateEngine();
794  if (m_pAiEngine != null)
795  {
796  LastAiStatus.Status = (int)(*m_pAiEngine).status;
797  }
798  }
799  catch (Exception ex)
800  {
801  Trace.WriteLine(ex.Message);
802  }
803 
804  PFC_SetParam(ref m_Param, PFCPRESETID.PRESET_IAUTO_21);
805  }
806 
816  public PerfectlyClear(string path, string licenseCode = "")
817  {
818  m_pEngine = null;
819  m_pProfile = null;
820 
821 #if PROTECTION_ENABLED
822  try
823  {
824  byte* pLicpath = null;
825  if (!String.IsNullOrEmpty(path))
826  {
827  pLicpath = GetCharBuffer(path);
828  }
829 
830  byte* pLicenseCode = null;
831  if (!String.IsNullOrEmpty(licenseCode)) {
832  pLicenseCode = GetCharBuffer(licenseCode);
833  }
834 
835  int status = PFC_SetProtectionPath(pLicpath, pLicenseCode);
836  releaseProtection = true;
837 
838  FreeCharBuffer(pLicpath);
839  FreeCharBuffer(pLicenseCode);
840  //Trace.WriteLine("status " + status.ToString());
841  }
842  catch (Exception ex)
843  {
844  Trace.WriteLine(ex.Message);
845  }
846 #endif
847  try
848  {
849  m_pEngine = PFC_CreateEngine();
850  if (m_pEngine != null)
851  {
852  LastStatus.Status = (int)(*m_pEngine).status;
853  }
854 
855  m_pAiEngine = PFC_CreateEngine();
856  if (m_pAiEngine != null)
857  {
858  LastAiStatus.Status = (int)(*m_pAiEngine).status;
859  }
860  }
861  catch (Exception ex)
862  {
863  Trace.WriteLine(ex.Message);
864  }
865 
866  PFC_SetParam(ref m_Param, PFCPRESETID.PRESET_IAUTO_21);
867  }
868 
869  ~PerfectlyClear()
870  {
871 #if PROTECTION_ENABLED
872  if(releaseProtection) {
874  }
875 #endif
876  Dispose(false);
877  }
878 
884  public unsafe ADPTRRETURNCODE Calc(ref Bitmap bm)
885  {
886  return Calc(ref bm, PFCFEATURE.CALC_ALL, -1, null);
887  }
888 
894  public unsafe ADPTRRETURNCODE Calc(ref PFCImageFile imgfile)
895  {
896  return Calc(ref imgfile, PFCFEATURE.CALC_ALL, -1, null);
897  }
898 
905  public unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds)
906  {
907  return Calc(ref bm, ref bmds, PFCFEATURE.CALC_ALL, -1, null);
908  }
909 
916  public unsafe ADPTRRETURNCODE Calc(ref PFCImageFile imgfile, PFCFEATURE feature)
917  {
918  return Calc(ref imgfile, feature, -1, null);
919  }
920 
927  public unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, PFCFEATURE feature)
928  {
929  return Calc(ref bm, feature, -1, null);
930  }
931 
939  public unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds, PFCFEATURE feature)
940  {
941  return Calc(ref bm, ref bmds, feature, -1, null);
942  }
943 
953  public unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, PFCFEATURE feature, int ISO, string CameraModel, PFCREJECTOPTION rejectOption = PFCREJECTOPTION.PFC_REJECT_CLIPART)
954  {
955  BitmapData bd = null;
956  Byte* pBase = null;
957  bd = LockBitmapData(ref bm);
958  if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
959  bd.PixelFormat != PixelFormat.Format32bppArgb &&
960  bd.PixelFormat != PixelFormat.Format48bppRgb &&
961  bd.PixelFormat != PixelFormat.Format64bppArgb)
962  {
963  ReleaseBitmapData(ref bm, ref bd);
964  return ADPTRRETURNCODE.WRONG_FORMAT;
965  }
966  pBase = (Byte*)bd.Scan0.ToPointer();
967 
968  PFCIMAGE im;
969  im.width = bd.Width;
970  im.height = bd.Height;
971  im.stride = bd.Stride;
972  switch (bd.PixelFormat)
973  {
974  default:
975  case PixelFormat.Format24bppRgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat24bppRGB; break;
976  case PixelFormat.Format32bppArgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat32bppARGB; break;
977  case PixelFormat.Format48bppRgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat48bppRGB; break;
978  case PixelFormat.Format64bppArgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat64bppARGB; break;
979  }
980  im.data = (void*)pBase;
981 
982  if (m_pProfile != null)
983  PFC_ReleaseProfile(m_pProfile);
984 
985  byte* pModel = null;
986  if (CameraModel != null)
987  {
988  pModel = GetCharBuffer(CameraModel);
989  }
990  m_pProfile = PFC_Calc(&im, null, m_pEngine, feature, ISO, pModel, null, null, (int)rejectOption, m_pAiEngine);
991 
992  FreeCharBuffer(pModel);
993 
994  ReleaseBitmapData(ref bm, ref bd);
995 
996  LastStatus.NR_Status = (*m_pProfile).NR_Status;
997  LastStatus.CORE_Status = (*m_pProfile).CORE_Status;
998  LastStatus.FB_Status = (*m_pProfile).FB_Status;
999  LastStatus.RE_Status = (*m_pProfile).RE_Status;
1000  LastStatus.Status = (*m_pProfile).Status;
1001 
1002  return (LastStatus.Status == 0) ? ADPTRRETURNCODE.SUCCESS : ADPTRRETURNCODE.WARNING;
1003  }
1004 
1014  public unsafe ADPTRRETURNCODE Calc(ref PFCImageFile imgfile, PFCFEATURE feature, int ISO, string CameraModel, PFCREJECTOPTION rejectOption = PFCREJECTOPTION.PFC_REJECT_CLIPART)
1015  {
1016  PFCIMAGE im;
1017  im.width = imgfile.width();
1018  im.height = imgfile.height();
1019  im.stride = imgfile.stride();
1020  im.format = (PFCPIXELFORMAT)imgfile.pfcImageFormat();
1021  im.data = (void*)imgfile.raw_image();
1022 
1023  if (m_pProfile != null)
1024  PFC_ReleaseProfile(m_pProfile);
1025 
1026  byte* pModel = null;
1027  if (CameraModel != null)
1028  {
1029  pModel = GetCharBuffer(CameraModel);
1030  }
1031  m_pProfile = PFC_Calc(&im, null, m_pEngine, feature, ISO, pModel, null, null, (int)rejectOption, m_pAiEngine);
1032 
1033  FreeCharBuffer(pModel);
1034 
1035  LastStatus.NR_Status = (*m_pProfile).NR_Status;
1036  LastStatus.CORE_Status = (*m_pProfile).CORE_Status;
1037  LastStatus.FB_Status = (*m_pProfile).FB_Status;
1038  LastStatus.RE_Status = (*m_pProfile).RE_Status;
1039  LastStatus.Status = (*m_pProfile).Status;
1040 
1041  return (LastStatus.Status == 0) ? ADPTRRETURNCODE.SUCCESS : ADPTRRETURNCODE.WARNING;
1042  }
1043 
1053  public unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds, PFCFEATURE feature, int ISO, string CameraModel)
1054  {
1055  BitmapData bd = null;
1056  Byte* pBase = null;
1057  bd = LockBitmapData(ref bm);
1058  if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
1059  bd.PixelFormat != PixelFormat.Format32bppArgb &&
1060  bd.PixelFormat != PixelFormat.Format48bppRgb &&
1061  bd.PixelFormat != PixelFormat.Format64bppArgb)
1062  {
1063  ReleaseBitmapData(ref bm, ref bd);
1064  return ADPTRRETURNCODE.WRONG_FORMAT;
1065  }
1066  pBase = (Byte*)bd.Scan0.ToPointer();
1067 
1068  PFCIMAGE im;
1069  im.width = bd.Width;
1070  im.height = bd.Height;
1071  im.stride = bd.Stride;
1072  switch (bd.PixelFormat)
1073  {
1074  default:
1075  case PixelFormat.Format24bppRgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat24bppRGB; break;
1076  case PixelFormat.Format32bppArgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat32bppARGB; break;
1077  case PixelFormat.Format48bppRgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat48bppRGB; break;
1078  case PixelFormat.Format64bppArgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat64bppARGB; break;
1079  }
1080  im.data = (void*)pBase;
1081 
1082  BitmapData bdds = null;
1083  bdds = LockBitmapData(ref bmds);
1084  if (bdds.PixelFormat != PixelFormat.Format24bppRgb &&
1085  bdds.PixelFormat != PixelFormat.Format32bppArgb &&
1086  bdds.PixelFormat != PixelFormat.Format48bppRgb &&
1087  bdds.PixelFormat != PixelFormat.Format64bppArgb)
1088  {
1089  ReleaseBitmapData(ref bmds, ref bdds);
1090  return ADPTRRETURNCODE.WRONG_FORMAT;
1091  }
1092  pBase = (Byte*)bdds.Scan0.ToPointer();
1093 
1094  PFCIMAGE imds;
1095  imds.width = bdds.Width;
1096  imds.height = bdds.Height;
1097  imds.stride = bdds.Stride;
1098  switch (bdds.PixelFormat)
1099  {
1100  default:
1101  case PixelFormat.Format24bppRgb: imds.format = PFCPIXELFORMAT.PFC_PixelFormat24bppRGB; break;
1102  case PixelFormat.Format32bppArgb: imds.format = PFCPIXELFORMAT.PFC_PixelFormat32bppARGB; break;
1103  case PixelFormat.Format48bppRgb: imds.format = PFCPIXELFORMAT.PFC_PixelFormat48bppRGB; break;
1104  case PixelFormat.Format64bppArgb: imds.format = PFCPIXELFORMAT.PFC_PixelFormat64bppARGB; break;
1105  }
1106  imds.data = (void*)pBase;
1107 
1108  if (m_pProfile != null)
1109  PFC_ReleaseProfile(m_pProfile);
1110 
1111  byte* pModel = null;
1112  if (CameraModel != null)
1113  {
1114  pModel = GetCharBuffer(CameraModel);
1115  }
1116  m_pProfile = PFC_Calc(&im, &imds, m_pEngine, feature, ISO, pModel, null, null, 1, m_pAiEngine);
1117 
1118  FreeCharBuffer(pModel);
1119 
1120  ReleaseBitmapData(ref bm, ref bd);
1121  ReleaseBitmapData(ref bmds, ref bdds);
1122 
1123  LastStatus.NR_Status = (*m_pProfile).NR_Status;
1124  LastStatus.CORE_Status = (*m_pProfile).CORE_Status;
1125  LastStatus.FB_Status = (*m_pProfile).FB_Status;
1126  LastStatus.RE_Status = (*m_pProfile).RE_Status;
1127  LastStatus.Status = (*m_pProfile).Status;
1128 
1129  return (LastStatus.Status == 0) ? ADPTRRETURNCODE.SUCCESS : ADPTRRETURNCODE.WARNING;
1130  }
1131 
1138  public unsafe PFCAPPLYSTATUS Apply(ref Bitmap bm)
1139  {
1140  return Apply(ref bm, 100);
1141  }
1142 
1148  public unsafe PFCAPPLYSTATUS Apply(ref PFCImageFile imgfile)
1149  {
1150  return Apply(ref imgfile, 100);
1151  }
1152 
1159  public unsafe PFCAPPLYSTATUS Apply(ref Bitmap bm, int iOpacity)
1160  {
1161  if (m_pProfile == null)
1162  {
1163  return PFCAPPLYSTATUS.APPLY_ERROR_PROFILE_MISSING;
1164  }
1165 
1166  BitmapData bd = null;
1167  Byte* pBase = null;
1168  bd = LockBitmapData(ref bm);
1169  if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
1170  bd.PixelFormat != PixelFormat.Format32bppArgb &&
1171  bd.PixelFormat != PixelFormat.Format48bppRgb &&
1172  bd.PixelFormat != PixelFormat.Format64bppArgb)
1173  {
1174  ReleaseBitmapData(ref bm, ref bd);
1175  return PFCAPPLYSTATUS.APPLY_BADFORMAT;
1176  }
1177  pBase = (Byte*)bd.Scan0.ToPointer();
1178 
1179  PFCIMAGE im;
1180  im.width = bd.Width;
1181  im.height = bd.Height;
1182  im.stride = bd.Stride;
1183  switch (bd.PixelFormat)
1184  {
1185  default:
1186  case PixelFormat.Format24bppRgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat24bppRGB; break;
1187  case PixelFormat.Format32bppArgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat32bppARGB; break;
1188  case PixelFormat.Format48bppRgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat48bppRGB; break;
1189  case PixelFormat.Format64bppArgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat64bppARGB; break;
1190  }
1191  im.data = (void*)pBase;
1192 
1193  PFCAPPLYSTATUS ret = PFC_Apply(&im, m_pEngine, m_pProfile, ref m_Param, null, iOpacity, null);
1194 
1195  if (ret > 0)
1196  {
1197  int code = (int)ret;
1198  // Get individual return codes
1199  LastStatus.NR_Status = (PFCNR_STATUS)(code & 0x000000FF);
1200  LastStatus.CORE_Status = (PFCCORE_STATUS)((code >> 8) & 0x000000FF);
1201  LastStatus.FB_Status = (PFCFB_STATUS)((code >> 16) & 0x000000FF);
1202  LastStatus.RE_Status = (PFCRE_STATUS)((code >> 24) & 0x000000FF);
1203  LastStatus.Status = code;
1204  }
1205 
1206  ReleaseBitmapData(ref bm, ref bd);
1207  return ret;
1208  }
1209 
1216  public unsafe PFCAPPLYSTATUS Apply(ref PFCImageFile imgfile, int iOpacity)
1217  {
1218  if (m_pProfile == null)
1219  {
1220  return PFCAPPLYSTATUS.APPLY_ERROR_PROFILE_MISSING;
1221  }
1222 
1223  PFCIMAGE im;
1224  im.width = imgfile.width();
1225  im.height = imgfile.height();
1226  im.stride = imgfile.stride();
1227  im.format = (PFCPIXELFORMAT)imgfile.pfcImageFormat();
1228  im.data = (void*)imgfile.raw_image();
1229 
1230  PFCAPPLYSTATUS ret = PFC_Apply(&im, m_pEngine, m_pProfile, ref m_Param, null, iOpacity, null);
1231 
1232  if (ret > 0)
1233  {
1234  int code = (int)ret;
1235  // Get individual return codes
1236  LastStatus.NR_Status = (PFCNR_STATUS)(code & 0x000000FF);
1237  LastStatus.CORE_Status = (PFCCORE_STATUS)((code >> 8) & 0x000000FF);
1238  LastStatus.FB_Status = (PFCFB_STATUS)((code >> 16) & 0x000000FF);
1239  LastStatus.RE_Status = (PFCRE_STATUS)((code >> 24) & 0x000000FF);
1240  LastStatus.Status = code;
1241  }
1242 
1243  return ret;
1244  }
1245 
1276  public int AutoCorrect(ref Bitmap bm)
1277  {
1278  return AutoCorrect(ref bm, -1, null, false);
1279  }
1280 
1286  public int AutoCorrect(ref PFCImageFile imgfile)
1287  {
1288  return AutoCorrect(ref imgfile, -1, null, false);
1289  }
1290 
1298  public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds)
1299  {
1300  return AutoCorrect(ref bm, ref bmds, -1, null, false);
1301  }
1302 
1311  public int AutoCorrect(ref Bitmap bm, int ISO, string CameraModel, bool bFastFAE)
1312  {
1313  if(((PFCAIFEATURE)m_loadedAiEngineFeatures & PFCAIFEATURE.AI_SCENE_DETECTION) == PFCAIFEATURE.AI_SCENE_DETECTION) {
1314  ADPTRRETURNCODE sdRet = Calc(ref bm, PFCFEATURE.CALC_SCENE_DETECTION, ISO, CameraModel);
1315  if (sdRet == ADPTRRETURNCODE.SUCCESS) {
1316  int version = 0;
1317  int detectedCategory = GetScene(&version);
1318  if (detectedCategory >= 0) {
1319  PFCPARAM categoryParam = new PFCPARAM();
1320  if (0 == ReadScenePreset(ref categoryParam, detectedCategory)) {
1321  m_Param = categoryParam;
1322  }
1323  }
1324  }
1325  }
1326 
1327  PFCFEATURE feature = 0;
1328  if (m_Param.nr.bEnabled)
1329  feature |= PFCFEATURE.CALC_NR;
1330  if (m_Param.core.bEnabled)
1331  feature |= PFCFEATURE.CALC_CORE;
1332  if (m_Param.fb.bEnabled)
1333  feature |= PFCFEATURE.CALC_FB;
1334  if (m_Param.re.bEnabled)
1335  feature |= PFCFEATURE.CALC_RE;
1336  if (!m_Param.core.bAbnormalTintRemoval)
1337  feature |= PFCFEATURE.CALC_NOTINTCALC;
1338  // Any FAE optimization
1339  if (m_Param.core.bUseFAE)
1340  {
1341  if (bFastFAE)
1342  feature |= PFCFEATURE.CALC_FAEHISPEED;
1343  }
1344  else
1345  {
1346  feature |= PFCFEATURE.CALC_NOFAE;
1347  }
1348 
1349  ADPTRRETURNCODE ret = Calc(ref bm, feature, ISO, CameraModel);
1350 
1351  if (ret != ADPTRRETURNCODE.SUCCESS)
1352  {
1353  PFCNR_STATUS retNR = LastStatus.NR_Status;
1354  if (retNR == PFCNR_STATUS.PFC_NR_NOTFOUND || retNR == PFCNR_STATUS.PFC_NR_NOTENABLED)
1355  retNR = PFCNR_STATUS.PFC_NR_SUCCESS;
1356 
1357  PFCCORE_STATUS retCORE = LastStatus.CORE_Status;
1358  if (retCORE == PFCCORE_STATUS.PFC_CORE_NOTENABLED)
1359  retCORE = PFCCORE_STATUS.PFC_CORE_SUCCESS;
1360 
1361  PFCFB_STATUS retFB = LastStatus.FB_Status;
1362  if (retFB == PFCFB_STATUS.PFC_FB_NOTENABLED || retFB == PFCFB_STATUS.PFC_FB_WARNING)
1363  retFB = PFCFB_STATUS.PFC_FB_SUCCESS;
1364 
1365  PFCRE_STATUS retRE = LastStatus.RE_Status;
1366  if (retRE == PFCRE_STATUS.PFC_RE_NOTENABLED || retRE == PFCRE_STATUS.PFC_RE_NOT_FOUND)
1367  retRE = PFCRE_STATUS.PFC_RE_SUCCESS;
1368 
1369  int retInt = (((((((int)retRE << 8) | (int)retFB) << 8) | (int)retCORE) << 8) | (int)retNR);
1370  return retInt;
1371  }
1372  else
1373  {
1374  PFCAPPLYSTATUS aret = Apply(ref bm);
1375  return (int)aret;
1376  }
1377  }
1378 
1387  public int AutoCorrect(ref PFCImageFile imgfile, int ISO, string CameraModel, bool bFastFAE)
1388  {
1389  if(((PFCAIFEATURE)m_loadedAiEngineFeatures & PFCAIFEATURE.AI_SCENE_DETECTION) == PFCAIFEATURE.AI_SCENE_DETECTION) {
1390  ADPTRRETURNCODE sdRet = Calc(ref imgfile, PFCFEATURE.CALC_SCENE_DETECTION, ISO, CameraModel);
1391  if (sdRet == ADPTRRETURNCODE.SUCCESS) {
1392  int version = 0;
1393  int detectedCategory = GetScene(&version);
1394  if (detectedCategory >= 0) {
1395  PFCPARAM categoryParam = new PFCPARAM();
1396  if (0 == ReadScenePreset(ref categoryParam, detectedCategory)) {
1397  m_Param = categoryParam;
1398  }
1399  }
1400  }
1401  }
1402 
1403  PFCFEATURE feature = 0;
1404  if (m_Param.nr.bEnabled)
1405  feature |= PFCFEATURE.CALC_NR;
1406  if (m_Param.core.bEnabled)
1407  feature |= PFCFEATURE.CALC_CORE;
1408  if (m_Param.fb.bEnabled)
1409  feature |= PFCFEATURE.CALC_FB;
1410  if (m_Param.re.bEnabled)
1411  feature |= PFCFEATURE.CALC_RE;
1412  if (!m_Param.core.bAbnormalTintRemoval)
1413  feature |= PFCFEATURE.CALC_NOTINTCALC;
1414  // Any FAE optimization
1415  if (m_Param.core.bUseFAE)
1416  {
1417  if (bFastFAE)
1418  feature |= PFCFEATURE.CALC_FAEHISPEED;
1419  }
1420  else
1421  {
1422  feature |= PFCFEATURE.CALC_NOFAE;
1423  }
1424 
1425  ADPTRRETURNCODE ret = Calc(ref imgfile, feature, ISO, CameraModel);
1426 
1427  if (ret != ADPTRRETURNCODE.SUCCESS)
1428  {
1429  PFCNR_STATUS retNR = LastStatus.NR_Status;
1430  if (retNR == PFCNR_STATUS.PFC_NR_NOTFOUND || retNR == PFCNR_STATUS.PFC_NR_NOTENABLED)
1431  retNR = PFCNR_STATUS.PFC_NR_SUCCESS;
1432 
1433  PFCCORE_STATUS retCORE = LastStatus.CORE_Status;
1434  if (retCORE == PFCCORE_STATUS.PFC_CORE_NOTENABLED)
1435  retCORE = PFCCORE_STATUS.PFC_CORE_SUCCESS;
1436 
1437  PFCFB_STATUS retFB = LastStatus.FB_Status;
1438  if (retFB == PFCFB_STATUS.PFC_FB_NOTENABLED || retFB == PFCFB_STATUS.PFC_FB_WARNING)
1439  retFB = PFCFB_STATUS.PFC_FB_SUCCESS;
1440 
1441  PFCRE_STATUS retRE = LastStatus.RE_Status;
1442  if (retRE == PFCRE_STATUS.PFC_RE_NOTENABLED || retRE == PFCRE_STATUS.PFC_RE_NOT_FOUND)
1443  retRE = PFCRE_STATUS.PFC_RE_SUCCESS;
1444 
1445  int retInt = (((((((int)retRE << 8) | (int)retFB) << 8) | (int)retCORE) << 8) | (int)retNR);
1446  return retInt;
1447  }
1448  else
1449  {
1450  PFCAPPLYSTATUS aret = Apply(ref imgfile);
1451  return (int)aret;
1452  }
1453  }
1454 
1464  public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, int ISO, string CameraModel, bool bFastFAE)
1465  {
1466  if(((PFCAIFEATURE)m_loadedAiEngineFeatures & PFCAIFEATURE.AI_SCENE_DETECTION) == PFCAIFEATURE.AI_SCENE_DETECTION) {
1467  ADPTRRETURNCODE sdRet = Calc(ref bm, PFCFEATURE.CALC_SCENE_DETECTION, ISO, CameraModel);
1468  if (sdRet == ADPTRRETURNCODE.SUCCESS) {
1469  int version = 0;
1470  int detectedCategory = GetScene(&version);
1471  if (detectedCategory >= 0) {
1472  PFCPARAM categoryParam = new PFCPARAM();
1473  if (0 == ReadScenePreset(ref categoryParam, detectedCategory)) {
1474  m_Param = categoryParam;
1475  }
1476  }
1477  }
1478  }
1479 
1480  PFCFEATURE feature = 0;
1481  if (m_Param.nr.bEnabled)
1482  feature |= PFCFEATURE.CALC_NR;
1483  if (m_Param.core.bEnabled)
1484  feature |= PFCFEATURE.CALC_CORE;
1485  if (m_Param.fb.bEnabled)
1486  feature |= PFCFEATURE.CALC_FB;
1487  if (m_Param.re.bEnabled)
1488  feature |= PFCFEATURE.CALC_RE;
1489  if (!m_Param.core.bAbnormalTintRemoval)
1490  feature |= PFCFEATURE.CALC_NOTINTCALC;
1491  // Any FAE optimization
1492  if (m_Param.core.bUseFAE)
1493  {
1494  if (bFastFAE)
1495  feature |= PFCFEATURE.CALC_FAEHISPEED;
1496  }
1497  else
1498  {
1499  feature |= PFCFEATURE.CALC_NOFAE;
1500  }
1501 
1502  ADPTRRETURNCODE ret = Calc(ref bm, ref bmds, feature, ISO, CameraModel);
1503 
1504  if (ret != ADPTRRETURNCODE.SUCCESS)
1505  {
1506  PFCNR_STATUS retNR = LastStatus.NR_Status;
1507  if (retNR == PFCNR_STATUS.PFC_NR_NOTFOUND || retNR == PFCNR_STATUS.PFC_NR_NOTENABLED)
1508  retNR = PFCNR_STATUS.PFC_NR_SUCCESS;
1509 
1510  PFCCORE_STATUS retCORE = LastStatus.CORE_Status;
1511  if (retCORE == PFCCORE_STATUS.PFC_CORE_NOTENABLED)
1512  retCORE = PFCCORE_STATUS.PFC_CORE_SUCCESS;
1513 
1514  PFCFB_STATUS retFB = LastStatus.FB_Status;
1515  if (retFB == PFCFB_STATUS.PFC_FB_NOTENABLED || retFB == PFCFB_STATUS.PFC_FB_WARNING)
1516  retFB = PFCFB_STATUS.PFC_FB_SUCCESS;
1517 
1518  PFCRE_STATUS retRE = LastStatus.RE_Status;
1519  if (retRE == PFCRE_STATUS.PFC_RE_NOTENABLED || retRE == PFCRE_STATUS.PFC_RE_NOT_FOUND)
1520  retRE = PFCRE_STATUS.PFC_RE_SUCCESS;
1521 
1522  int retInt = (((((((int)retRE << 8) | (int)retFB) << 8) | (int)retCORE) << 8) | (int)retNR);
1523  return retInt;
1524  }
1525  else
1526  {
1527  PFCAPPLYSTATUS aret = Apply(ref bm);
1528  return (int)aret;
1529  }
1530  }
1531 
1538  public int AutoCorrect(ref Bitmap bm, string pathPreset)
1539  {
1540  int retCode = ReadPresets(pathPreset);
1541  if (retCode == 0)
1542  {
1543  return AutoCorrect(ref bm, -1, null, false);
1544  }
1545  return retCode-1000;
1546  }
1547 
1554  public int AutoCorrect(ref PFCImageFile imgfile, string pathPreset)
1555  {
1556  int retCode = ReadPresets(pathPreset);
1557  if (retCode == 0)
1558  {
1559  return AutoCorrect(ref imgfile, -1, null, false);
1560  }
1561  return retCode - 1000;
1562  }
1563 
1571  public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, string pathPreset)
1572  {
1573  int retCode = ReadPresets(pathPreset);
1574  if (retCode == 0)
1575  {
1576  return AutoCorrect(ref bm, ref bmds, -1, null, false);
1577  }
1578  return retCode - 1000;
1579  }
1580 
1590  public int AutoCorrect(ref Bitmap bm, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
1591  {
1592  int retCode = ReadPresets(pathPreset);
1593  if (retCode == 0)
1594  {
1595  return AutoCorrect(ref bm, ISO, CameraModel, bFastFAE);
1596  }
1597  return retCode - 1000;
1598  }
1599 
1609  public int AutoCorrect(ref PFCImageFile imgfile, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
1610  {
1611  int retCode = ReadPresets(pathPreset);
1612  if (retCode == 0)
1613  {
1614  return AutoCorrect(ref imgfile, ISO, CameraModel, bFastFAE);
1615  }
1616  return retCode - 1000;
1617  }
1618 
1629  public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
1630  {
1631  int retCode = ReadPresets(pathPreset);
1632  if (retCode == 0)
1633  {
1634  return AutoCorrect(ref bm, ref bmds, ISO, CameraModel, bFastFAE);
1635  }
1636  return retCode - 1000;
1637  }
1638 
1643  public void SetParam(PFCPRESETID id)
1644  {
1645  PFC_SetParam(ref m_Param, id);
1646  }
1647 
1665  public int ReadPresets(string path)
1666  {
1667  try
1668  {
1669  byte* presetpath = null;
1670  if (path != null)
1671  {
1672  presetpath = GetCharBuffer(path);
1673  }
1674 
1675  int status = PFC_ReadPresets(ref m_Param, presetpath);
1676  //Trace.WriteLine("status " + status.ToString());
1677  return status;
1678  }
1679  catch (Exception ex)
1680  {
1681  Trace.WriteLine(ex.Message);
1682  }
1683  return -8;
1684  }
1685 
1698  public int ReadPresetsFromStream(FileStream fs)
1699  {
1700  try
1701  {
1702  long len = fs.Length;
1703  byte[] buffer = new byte[len + 1];
1704  int size = (int)len;
1705  fs.Read(buffer, 0, size);
1706  buffer[size] = 0;
1707  byte* b = GetCharBuffer(buffer);
1708  // PFC_ReadPresetsFromStream return codes
1709  // 0 - success
1710  // -3 - Stream read error.
1711  // -4 - Parse error.
1712  int status = PFC_ReadPresetsFromStream(ref m_Param, b);
1713  FreeCharBuffer(b);
1714  return status;
1715  }
1716  catch (Exception ex)
1717  {
1718  Trace.WriteLine(ex.Message);
1719  }
1720  return -8;
1721  }
1722 
1728  {
1729  return PFC_HasFaceBeautification(m_pEngine);
1730  }
1731 
1737  public int FBFaceCount()
1738  {
1739  return PFC_FBFaceCount(m_pProfile);
1740  }
1741 
1750  public bool GetFaceInfo(ref PFCFBFACEINFO info, int index)
1751  {
1752  PFCFBFACEINFO1 fi;
1753  bool ret = PFC_GetFaceInfo(m_pProfile, &fi, index);
1754  info.face.left = fi.face.left;
1755  info.face.top = fi.face.top;
1756  info.face.width = fi.face.width;
1757  info.face.height = fi.face.height;
1758  info.leftEye.x = fi.leftEye.x;
1759  info.leftEye.y = fi.leftEye.y;
1760  info.rightEye.x = fi.rightEye.x;
1761  info.rightEye.y = fi.rightEye.y;
1762  return ret;
1763  }
1764 
1770  public bool AbnormalTintDetected(TINTCORRECTION eTintMethod)
1771  {
1772  return PFC_AbnormalTintDetected(m_pProfile, eTintMethod);
1773  }
1774 
1780  public void ApplyStrengthToParam(int strength)
1781  {
1782  PFC_ApplyStrengthToParam(ref m_Param, strength);
1783  }
1784 
1785  protected BitmapData LockBitmapData(ref Bitmap bm)
1786  {
1787  GraphicsUnit unit = GraphicsUnit.Pixel;
1788  RectangleF boundsF = bm.GetBounds(ref unit);
1789  Rectangle bounds = new Rectangle((int)boundsF.X,
1790  (int)boundsF.Y,
1791  (int)boundsF.Width,
1792  (int)boundsF.Height);
1793 
1794  BitmapData bitmapData =
1795  bm.LockBits(bounds, ImageLockMode.ReadWrite, bm.PixelFormat);
1796  return bitmapData;
1797  }
1798 
1799  protected void ReleaseBitmapData(ref Bitmap bm, ref BitmapData bitmapData)
1800  {
1801  bm.UnlockBits(bitmapData);
1802  }
1803 
1804  protected Bitmap DupBitmap(ref Bitmap bm)
1805  {
1806  PerfectlyClearImageTransfer tr, tr1;
1807  Byte* pBase = null;
1808  GraphicsUnit unit = GraphicsUnit.Pixel;
1809  RectangleF boundsF = bm.GetBounds(ref unit);
1810  Rectangle bounds = new Rectangle((int)boundsF.X,
1811  (int)boundsF.Y,
1812  (int)boundsF.Width,
1813  (int)boundsF.Height);
1814  BitmapData bd = bm.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
1815  Bitmap bm1 = new Bitmap(bd.Width, bd.Height, PixelFormat.Format24bppRgb);
1816  BitmapData bd1 = LockBitmapData(ref bm1);
1817  pBase = (Byte*)bd.Scan0.ToPointer();
1818  tr.columnBytes = (bd.PixelFormat == PixelFormat.Format24bppRgb) ? 3 : 4;
1819  tr.rowBytes = bd.Stride;
1820  tr.height = bd.Height;
1821  tr.width = bd.Width;
1822  tr.data1 = (int)(pBase + 2);
1823  tr.data2 = (int)(pBase + 1);
1824  tr.data3 = (int)pBase;
1825  pBase = (Byte*)bd1.Scan0.ToPointer();
1826  tr1.columnBytes = (bd1.PixelFormat == PixelFormat.Format24bppRgb) ? 3 : 4;
1827  tr1.rowBytes = bd1.Stride;
1828  tr1.height = bd1.Height;
1829  tr1.width = bd1.Width;
1830  tr1.data1 = (int)(pBase + 2);
1831  tr1.data2 = (int)(pBase + 1);
1832  tr1.data3 = (int)pBase;
1833  for (int i = 0; i < tr.height; i++)
1834  {
1835  for (int j = 0; j < tr.width; j++)
1836  {
1837  ((Byte*)tr1.data1)[j * tr1.columnBytes] = ((Byte*)tr.data1)[j * tr.columnBytes];
1838  ((Byte*)tr1.data2)[j * tr1.columnBytes] = ((Byte*)tr.data2)[j * tr.columnBytes];
1839  ((Byte*)tr1.data3)[j * tr1.columnBytes] = ((Byte*)tr.data3)[j * tr.columnBytes];
1840  }
1841  tr.data1 += (int)tr.rowBytes;
1842  tr.data2 += (int)tr.rowBytes;
1843  tr.data3 += (int)tr.rowBytes;
1844  tr1.data1 += (int)tr1.rowBytes;
1845  tr1.data2 += (int)tr1.rowBytes;
1846  tr1.data3 += (int)tr1.rowBytes;
1847  }
1848  ReleaseBitmapData(ref bm1, ref bd1);
1849  ReleaseBitmapData(ref bm, ref bd);
1850  return bm1;
1851  }
1852 
1853  protected Bitmap BW2RGB(ref Bitmap bm)
1854  {
1855  Byte* pBase = null;
1856  Byte* pBase1 = null;
1857  GraphicsUnit unit = GraphicsUnit.Pixel;
1858  RectangleF boundsF = bm.GetBounds(ref unit);
1859  Rectangle bounds = new Rectangle((int)boundsF.X,
1860  (int)boundsF.Y,
1861  (int)boundsF.Width,
1862  (int)boundsF.Height);
1863  BitmapData bd = bm.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed);
1864  Bitmap bm1 = new Bitmap(bd.Width, bd.Height, PixelFormat.Format24bppRgb);
1865  BitmapData bd1 = LockBitmapData(ref bm1);
1866  pBase = (Byte*)bd.Scan0.ToPointer();
1867  pBase1 = (Byte*)bd1.Scan0.ToPointer();
1868  for (int i = 0; i < bd.Height; i++)
1869  {
1870  for (int j = 0; j < bd.Width; j++)
1871  {
1872  pBase1[j * 3] = pBase[j];
1873  pBase1[j * 3 + 1] = pBase[j];
1874  pBase1[j * 3 + 2] = pBase[j];
1875  }
1876  pBase += bd.Stride;
1877  pBase1 += bd1.Stride;
1878  }
1879  ReleaseBitmapData(ref bm1, ref bd1);
1880  ReleaseBitmapData(ref bm, ref bd);
1881  return bm1;
1882  }
1883 
1891  public Bitmap ReadImage(string filename)
1892  {
1893  Bitmap bm = null;
1894  Bitmap myBitmap = new Bitmap(filename);
1895  if ((myBitmap.Flags & (int)ImageFlags.ColorSpaceYcck) != 0)
1896  {
1897  bm = DupBitmap(ref myBitmap);
1898  myBitmap.Dispose();
1899  }
1900  else
1901  {
1902  if (myBitmap.PixelFormat == PixelFormat.Format8bppIndexed)
1903  {
1904  bm = BW2RGB(ref myBitmap);
1905  myBitmap.Dispose();
1906  }
1907  else
1908  {
1909  bm = myBitmap;
1910  }
1911  }
1912  return bm;
1913  }
1914 
1915  protected Bitmap GetStatImage(ref Bitmap bm, int iMaxDimension)
1916  {
1917  // Build max dim reference image
1918  bool bNeedResize = true;
1919  int w, h, w1, h1;
1920  w = bm.Width;
1921  h = bm.Height;
1922  // Calculate size of reference image. One dimension is 1024.
1923  if (w > h)
1924  {
1925  if (w <= iMaxDimension)
1926  bNeedResize = false;
1927  w1 = iMaxDimension;
1928  h1 = w1 * h / w;
1929  }
1930  else
1931  {
1932  if (h <= iMaxDimension)
1933  bNeedResize = false;
1934  h1 = iMaxDimension;
1935  w1 = h1 * w / h;
1936  }
1937 
1938  if (bNeedResize)
1939  {
1940  //
1941  // Step 2.
1942  // Create temporary bitmap to assist red eye analysis.
1943  //
1944  Bitmap bmds = new Bitmap(w1, h1, bm.PixelFormat);
1945  {
1946  using (Graphics gr = Graphics.FromImage(bmds))
1947  {
1948  gr.SmoothingMode = SmoothingMode.HighQuality;
1949  gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
1950  gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
1951  gr.DrawImage(bm, new Rectangle(0, 0, w1, h1));
1952  }
1953  }
1954 
1955  return bmds;
1956  }
1957  else
1958  {
1959  Bitmap bmds = (Bitmap)bm.Clone();
1960  return bmds;
1961  }
1962  }
1963 
1983  public unsafe bool EnumFAEFaceRect(ref PFCFACERECT rect)
1984  {
1985  IntPtr wrapped = rect.pWrapped;
1986  IntPtr pRect = (IntPtr) PFC_EnumFAEFaceRect(m_pProfile, (void*)wrapped);
1987 
1988  if (pRect != IntPtr.Zero) {
1989  PFCFACERECT newRect = (PFCFACERECT) Marshal.PtrToStructure(pRect, typeof(PFCFACERECT));
1990  rect = newRect;
1991  rect.pWrapped = (IntPtr)pRect;
1992  return true;
1993  }
1994 
1995  rect.pWrapped = IntPtr.Zero;
1996  return false;
1997  }
1998 
2003  public int FAEFaceCount()
2004  {
2005  return PFC_FAEFaceCount(m_pProfile);
2006  }
2007 
2014  public int LoadAiEngine(PFCAIFEATURE aifeatures, string binPath)
2015  {
2016  byte* path = null;
2017  if (binPath != null)
2018  {
2019  path = GetCharBuffer(binPath);
2020  }
2021  int result = PFC_LoadAIEngine(m_pAiEngine, aifeatures, path);
2022  m_loadedAiEngineFeatures = result;
2023 
2024  if(((PFCAIFEATURE)m_loadedAiEngineFeatures & PFCAIFEATURE.AI_CORRECTIONS) == PFCAIFEATURE.AI_CORRECTIONS) {
2025  PFC_LoadAIEngine(m_pEngine, PFCAIFEATURE.AI_CORRECTIONS, path);
2026  }
2027 
2028  FreeCharBuffer(path);
2029 
2030  if(((PFCAIFEATURE)m_loadedAiEngineFeatures & PFCAIFEATURE.AI_SCENE_DETECTION) == PFCAIFEATURE.AI_SCENE_DETECTION) {
2031  LoadScenePresets(null);
2032  }
2033 
2034  return result;
2035  }
2036 
2037 
2048  public unsafe int LoadScenePresets(string filePath, int groupUUID = 0, int* arrProfileUUID = null, int arrProfileUUIDLen = 0)
2049  {
2050  byte* path = null;
2051  if (filePath != null)
2052  {
2053  path = GetCharBuffer(filePath);
2054  }
2055  int result = PFC_LoadScenePresets(m_pAiEngine, path, groupUUID, arrProfileUUID, arrProfileUUIDLen);
2056  FreeCharBuffer(path);
2057  return result;
2058  }
2059 
2067  public int ReadScenePreset(ref PFCPARAM param, int scene)
2068  {
2069  return PFC_ReadScenePreset(ref param, m_pAiEngine, scene);
2070  }
2071 
2078  public int GetScene(int* version)
2079  {
2080  return PFC_GetScene(m_pProfile, version);
2081  }
2082 
2091  public bool GetCategorizationEngineInfo(int* groupUUID, int* arrProfileUUID, int* arrProfileUUIDLen)
2092  {
2093  return PFC_GetSceneDetectionEngineInfo(m_pAiEngine, groupUUID, arrProfileUUID, arrProfileUUIDLen);
2094  }
2095 
2099  public void SetAddonPath(string dirPath)
2100  {
2101  byte* path = null;
2102  if (dirPath != null)
2103  {
2104  path = GetCharBuffer(dirPath);
2105  }
2106  PFC_SetAddonPath(path);
2107  FreeCharBuffer(path);
2108  }
2109 
2110  public void Dispose()
2111  {
2112  Dispose(true);
2113  GC.SuppressFinalize(this);
2114  }
2115 
2116  protected virtual void Dispose(bool disposing)
2117  {
2118  if (disposing)
2119  {
2120  }
2121 
2122  if (m_pProfile != null)
2123  {
2124  PFC_ReleaseProfile(m_pProfile);
2125  m_pProfile = null;
2126  }
2127 
2128  if (m_pEngine != null)
2129  {
2130  PFC_DestroyEngine(m_pEngine);
2131  m_pEngine = null;
2132  }
2133 
2134  if (m_pAiEngine != null)
2135  {
2136  PFC_DestroyEngine(m_pAiEngine);
2137  m_pEngine = null;
2138  }
2139  }
2140 
2141  static protected byte* GetCharBuffer(byte[] s)
2142  {
2143  int i, iCount = s.Length;
2144  IntPtr _memory = IntPtr.Zero;
2145  _memory = Marshal.AllocHGlobal(iCount + 1);
2146  byte* p = (byte*)_memory;
2147  for (i = 0; i < iCount; i++)
2148  {
2149  p[i] = (byte)s[i];
2150  }
2151  p[iCount] = 0;
2152 
2153  return (byte*)p;
2154  }
2155 
2156  static protected byte* GetCharBuffer(string s)
2157  {
2158  int i, iCount = s.Length;
2159  IntPtr _memory = IntPtr.Zero;
2160  _memory = Marshal.AllocHGlobal(iCount + 1);
2161  byte* p = (byte*)_memory;
2162  for (i = 0; i < iCount; i++)
2163  {
2164  p[i] = (byte)s[i];
2165  }
2166  p[iCount] = 0;
2167 
2168  return (byte*)p;
2169  }
2170 
2171  static protected void FreeCharBuffer(byte* p)
2172  {
2173  IntPtr _memory = (IntPtr)p;
2174  Marshal.FreeHGlobal(_memory);
2175  }
2176 
2177 #if ADAPTER64BIT
2178  [DllImport("PerfectlyClearPro")]
2179  static extern int PFC_SetProtectionPath(byte* path, byte* licenseCode);
2180 
2181  [DllImport("PerfectlyClearPro")]
2182  static extern void PFC_ReleaseProtectionPath();
2183 
2184  [DllImport("PerfectlyClearPro")]
2185  static extern PFCENGINE* PFC_CreateEngine();
2186 
2187  [DllImport("PerfectlyClearPro")]
2188  static extern void PFC_DestroyEngine(PFCENGINE* p);
2189 
2190  [DllImport("PerfectlyClearPro")]
2191  static extern void PFC_SetParam(ref PFCPARAM param, PFCPRESETID id);
2192 
2193  [DllImport("PerfectlyClearPro")]
2194  static extern int PFC_ReadPresets(ref PFCPARAM param, byte* filename);
2195 
2196  [DllImport("PerfectlyClearPro")]
2197  static extern int PFC_ReadPresetsFromStream(ref PFCPARAM param, byte* s);
2198 
2199  [DllImport("PerfectlyClearPro")]
2200  static extern PFCIMAGEPROFILE* PFC_Calc(PFCIMAGE* pImage, PFCIMAGE* pImageds, PFCENGINE* pEngine, PFCFEATURE feature, int iISO, byte* pCameraModel, void* pImageProfile, void* progfn, int iRejectOption, PFCENGINE* pEngineAI);
2201 
2202  [DllImport("PerfectlyClearPro")]
2203  static extern void PFC_ReleaseProfile(void* pProfile);
2204 
2205  [DllImport("PerfectlyClearPro")]
2206  static extern PFCAPPLYSTATUS PFC_Apply(PFCIMAGE* pImage, PFCENGINE* pEngine, void* pImageProfile, ref PFCPARAM param, void* progfn, int iOpacity, void* pBGProfile);
2207 
2208  [DllImport("PerfectlyClearPro")]
2209  static extern bool PFC_HasFaceBeautification(PFCENGINE* pEngine);
2210 
2211  [DllImport("PerfectlyClearPro")]
2212  static extern int PFC_FBFaceCount(void* pImageProfile);
2213 
2214  [DllImport("PerfectlyClearPro")]
2215  static extern bool PFC_GetFaceInfo(void* pImageProfile, PFCFBFACEINFO1* pFace, int index);
2216 
2217  [DllImport("PerfectlyClearPro")]
2218  static extern bool PFC_AbnormalTintDetected(void* pImageProfile, TINTCORRECTION eTintMethod);
2219 
2220  [DllImport("PerfectlyClearPro")]
2221  static extern void PFC_ApplyStrengthToParam(ref PFCPARAM param, int strength);
2222 
2223  [DllImport("PerfectlyClearPro")]
2224  static extern void* PFC_EnumFAEFaceRect(void *pImageProfile, void* p);
2225 
2226  [DllImport("PerfectlyClearPro")]
2227  static extern int PFC_FAEFaceCount(void* pImageProfile);
2228 
2229  [DllImport("PerfectlyClearPro")]
2230  static extern int PFC_LoadAIEngine(PFCENGINE* pEngineAI, PFCAIFEATURE aifeatures, byte *binPath);
2231 
2232  [DllImport("PerfectlyClearPro")]
2233  static extern int PFC_LoadScenePresets(PFCENGINE* pEngine, byte *filePath, int groupUUID, int *arrProfileUUID, int arrProfileUUIDLen);
2234 
2235  [DllImport("PerfectlyClearPro")]
2236  static extern int PFC_ReadScenePreset(ref PFCPARAM param, PFCENGINE *pEngineAI, int scene);
2237 
2238  [DllImport("PerfectlyClearPro")]
2239  static extern int PFC_GetScene(void* precalc, int *version);
2240 
2241  [DllImport("PerfectlyClearPro")]
2242  static extern bool PFC_GetSceneDetectionEngineInfo(PFCENGINE* pEngine, int* groupUUID, int* arrProfileUUID, int *arrProfileUUIDLen);
2243 
2244  [DllImport("PerfectlyClearPro")]
2245  static extern void PFC_SetAddonPath(byte* path);
2246 #endif
2247 
2248 #if ADAPTER32BIT
2249  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2250  static extern int PFC_SetProtectionPath(byte* path, byte* licenseCode);
2251 
2252  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2253  static extern void PFC_ReleaseProtectionPath();
2254 
2255  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2256  static extern PFCENGINE* PFC_CreateEngine();
2257 
2258  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2259  static extern void PFC_DestroyEngine(PFCENGINE* p);
2260 
2261  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2262  static extern void PFC_SetParam(ref PFCPARAM param, PFCPRESETID id);
2263 
2264  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2265  static extern int PFC_ReadPresets(ref PFCPARAM param, byte* filename);
2266 
2267  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2268  static extern int PFC_ReadPresetsFromStream(ref PFCPARAM param, byte* s);
2269 
2270  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2271  static extern PFCIMAGEPROFILE* PFC_Calc(PFCIMAGE* pImage, PFCIMAGE* pImageds, PFCENGINE* pEngine, PFCFEATURE feature, int iISO, byte* pCameraModel, void* pImageProfile, void* progfn, int iRejectOption, PFCENGINE* pEngineAI);
2272 
2273  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2274  static extern void PFC_ReleaseProfile(void* pProfile);
2275 
2276  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2277  static extern PFCAPPLYSTATUS PFC_Apply(PFCIMAGE* pImage, PFCENGINE* pEngine, void* pImageProfile, ref PFCPARAM param, void* progfn, int iOpacity, void* pBGProfile);
2278 
2279  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2280  static extern bool PFC_HasFaceBeautification(PFCENGINE* pEngine);
2281 
2282  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2283  static extern int PFC_FBFaceCount(void* pImageProfile);
2284 
2285  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2286  static extern bool PFC_GetFaceInfo(void* pImageProfile, PFCFBFACEINFO1* pFace, int index);
2287 
2288  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2289  static extern bool PFC_AbnormalTintDetected(void* pImageProfile, TINTCORRECTION eTintMethod);
2290 
2291  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2292  static extern void PFC_ApplyStrengthToParam(ref PFCPARAM param, int strength);
2293 
2294  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2295  static extern void* PFC_EnumFAEFaceRect(void *pImageProfile, void* p);
2296 
2297  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2298  static extern int PFC_FAEFaceCount(void* pImageProfile);
2299 
2300  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2301  static extern int PFC_LoadAIEngine(PFCENGINE* pEngineAI, PFCAIFEATURE aifeatures, byte *binPath);
2302 
2303  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2304  static extern int PFC_LoadScenePresets(PFCENGINE* pEngine, byte *filePath, int groupUUID, int *arrProfileUUID, int arrProfileUUIDLen);
2305 
2306  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2307  static extern int PFC_ReadScenePreset(ref PFCPARAM param, PFCENGINE *pEngineAI, int scene);
2308 
2309  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2310  static extern int PFC_GetScene(void* precalc, int *version);
2311 
2312  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2313  static extern bool PFC_GetSceneDetectionEngineInfo(PFCENGINE* pEngine, int* groupUUID, int* arrProfileUUID, int* arrProfileUUIDLen);
2314 
2315  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2316  static extern void PFC_SetAddonPath(byte* path);
2317 #endif
2318  }
2319 
2320 
2356  public unsafe class PFCImageFile : IDisposable
2357  {
2358  private IntPtr m_pNativeObject;
2359 
2361  public PFCImageFile()
2362  {
2363  m_pNativeObject = create_PFCImageFile();
2364  }
2365 
2366  public void Dispose()
2367  {
2368  Dispose(true);
2369  }
2370 
2371  protected virtual void Dispose(bool bDisposing)
2372  {
2373  if (this.m_pNativeObject != IntPtr.Zero)
2374  {
2375  delete_PFCImageFile(m_pNativeObject);
2376  m_pNativeObject = IntPtr.Zero;
2377  }
2378 
2379  if (bDisposing)
2380  {
2381  // No need to call the finalizer since we've now cleaned
2382  // up the unmanaged memory
2383  GC.SuppressFinalize(this);
2384  }
2385  }
2386 
2387  ~PFCImageFile()
2388  {
2389  Dispose(false);
2390  }
2391 
2394  {
2395  LOAD_OK,
2396  LOAD_ERROR,
2399  };
2400 
2402  public enum PFC_FILETYPE
2403  {
2404  PFC_JPEG = 1,
2405  PFC_PNG = 2
2406  };
2407 
2415  public PFC_FILE_LOAD_STATUS LoadImage(string filename, bool bConvertToSRGB = false, string iccFolderPath = null)
2416  {
2417  if (filename == null)
2418  {
2419  return PFC_FILE_LOAD_STATUS.LOAD_ERROR;
2420  }
2421 
2422  byte* pFilename = GetCharBuffer(filename);
2423 
2424  byte* pIccFolderPath = null;
2425  if (iccFolderPath != null)
2426  {
2427  pIccFolderPath = GetCharBuffer(iccFolderPath);
2428  }
2429 
2430  int result = PFCImageFile_LoadImageFile(m_pNativeObject, pFilename, bConvertToSRGB, pIccFolderPath);
2431 
2432  FreeCharBuffer(pFilename);
2433  FreeCharBuffer(pIccFolderPath);
2434 
2435  return (PFC_FILE_LOAD_STATUS)result;
2436  }
2437 
2446  public PFC_FILE_LOAD_STATUS LoadImage(string filename, PFC_FILETYPE type, bool bConvertToSRGB = true, string iccFolderPath = null)
2447  {
2448  if (filename == null)
2449  {
2450  return PFC_FILE_LOAD_STATUS.LOAD_ERROR;
2451  }
2452 
2453  byte* pFilename = GetCharBuffer(filename);
2454 
2455  byte* pIccFolderPath = null;
2456  if (iccFolderPath != null)
2457  {
2458  pIccFolderPath = GetCharBuffer(iccFolderPath);
2459  }
2460 
2461  int result = PFCImageFile_LoadImageFileType(m_pNativeObject, pFilename, (int)type, bConvertToSRGB, pIccFolderPath);
2462 
2463  FreeCharBuffer(pFilename);
2464  FreeCharBuffer(pIccFolderPath);
2465 
2466  return (PFC_FILE_LOAD_STATUS)result;
2467  }
2468 
2476  public bool SaveImageFile(string filename, int jpegQuality = 92, bool bConvertToOriginalColorSpace= true, bool bEmbedOriginalMetadata = true)
2477  {
2478  if (filename == null)
2479  {
2480  return false;
2481  }
2482 
2483  byte* pFilename = GetCharBuffer(filename);
2484 
2485  bool result = PFCImageFile_SaveImageFile(m_pNativeObject, pFilename, jpegQuality, bConvertToOriginalColorSpace, bEmbedOriginalMetadata);
2486 
2487  FreeCharBuffer(pFilename);
2488 
2489  return result;
2490  }
2491 
2500  public bool SaveImageFile(string filename, PFC_FILETYPE type, int jpegQuality = 92, bool bConvertToOriginalColorSpace = true, bool bEmbedOriginalMetadata = true)
2501  {
2502  if (filename == null)
2503  {
2504  return false;
2505  }
2506 
2507  byte* pFilename = GetCharBuffer(filename);
2508 
2509  bool result = PFCImageFile_SaveImageFileType(m_pNativeObject, pFilename, (int)type, jpegQuality, bConvertToOriginalColorSpace, bEmbedOriginalMetadata);
2510 
2511  FreeCharBuffer(pFilename);
2512 
2513  return result;
2514  }
2515 
2516  public void AllocBuffer(int width, int height, int bytes_per_pixel, int stride)
2517  {
2518  PFCImageFile_AllocBuffer(m_pNativeObject, width, height, bytes_per_pixel, stride);
2519  }
2520 
2521  public int pfcImageFormat()
2522  {
2523  return PFCImageFile_pfcImageFormat(m_pNativeObject);
2524  }
2525 
2526  public int exifOrientation()
2527  {
2528  return PFCImageFile_exifOrientation(m_pNativeObject);
2529  }
2530 
2531  public byte* raw_image()
2532  {
2533  return PFCImageFile_get_raw_image(m_pNativeObject);
2534  }
2535 
2536  public int width()
2537  {
2538  return PFCImageFile_get_width(m_pNativeObject);
2539  }
2540 
2541  public int height()
2542  {
2543  return PFCImageFile_get_height(m_pNativeObject);
2544  }
2545 
2546  public int bytes_per_pixel()
2547  {
2548  return PFCImageFile_get_bytes_per_pixel(m_pNativeObject);
2549  }
2550 
2551  public int stride()
2552  {
2553  return PFCImageFile_get_stride(m_pNativeObject);
2554  }
2555 
2556  public bool sourceSRGB()
2557  {
2558  return PFCImageFile_get_sourceSRGB(m_pNativeObject);
2559  }
2560 
2569  public PFC_FILE_LOAD_STATUS ExpandImageBuffer(MemoryStream inStream, PFC_FILETYPE type, bool bConvertToSRGB = true, string iccFolderPath = null)
2570  {
2571  byte* buffer = GetByteBuffer(inStream.ToArray());
2572  byte* pIccFolderPath = null;
2573  if (iccFolderPath != null)
2574  {
2575  pIccFolderPath = GetCharBuffer(iccFolderPath);
2576  }
2577  int result = PFCImageFile_ExpandImageBuffer(m_pNativeObject, buffer, inStream.Length, (int)type, bConvertToSRGB, pIccFolderPath);
2578  FreeCharBuffer(pIccFolderPath);
2579  FreeByteBuffer(buffer);
2580 
2581  return (PFC_FILE_LOAD_STATUS)result;
2582  }
2583 
2592  public MemoryStream CompressImageBuffer(PFC_FILETYPE type, int jpegQuality = 92, bool bConvertToOriginalColorSpace = true, bool bEmbedOriginalMetadata = true)
2593  {
2594  byte* compressedBuffer = null;
2595  int length = PFCImageFile_CompressImageBuffer(m_pNativeObject, &compressedBuffer, (int)type, jpegQuality, bConvertToOriginalColorSpace, bEmbedOriginalMetadata);
2596  if (length > 0 && compressedBuffer != null)
2597  {
2598  byte[] result = new byte[length];
2599  Marshal.Copy((IntPtr)(compressedBuffer), result, 0, length);
2600  deleteBuffer(compressedBuffer);
2601 
2602  // let the stream be resizable
2603  MemoryStream stream = new MemoryStream();
2604  stream.Write(result, 0, result.Length);
2605  return stream;
2606  }
2607  return new MemoryStream();
2608  }
2609 
2610  private static byte* GetCharBuffer(string s)
2611  {
2612  UTF8Encoding utf8 = new UTF8Encoding();
2613  Byte[] encodedBytes = utf8.GetBytes(s);
2614 
2615  int i, iCount = encodedBytes.Length;
2616  IntPtr _memory = IntPtr.Zero;
2617  _memory = Marshal.AllocHGlobal(iCount + 1);
2618  byte* p = (byte*)_memory;
2619  for (i = 0; i < iCount; i++)
2620  {
2621  p[i] = encodedBytes[i];
2622  }
2623  p[iCount] = 0;
2624 
2625  return (byte*)p;
2626  }
2627 
2628  private static void FreeCharBuffer(byte* p)
2629  {
2630  IntPtr _memory = (IntPtr)p;
2631  Marshal.FreeHGlobal(_memory);
2632  }
2633 
2634  private static byte* GetByteBuffer(byte[] bytes)
2635  {
2636  int length = bytes.Length;
2637  IntPtr p = Marshal.AllocHGlobal(length);
2638  Marshal.Copy(bytes, 0, p, length);
2639  return (byte*)p;
2640  }
2641 
2642  private static void FreeByteBuffer(byte* p)
2643  {
2644  IntPtr _memory = (IntPtr)p;
2645  Marshal.FreeHGlobal(_memory);
2646  }
2647 
2648 #if ADAPTER64BIT
2649  [DllImport("PFCImageFile")]
2650  static private extern unsafe IntPtr create_PFCImageFile();
2651 
2652  [DllImport("PFCImageFile")]
2653  static private extern void delete_PFCImageFile(IntPtr o);
2654 
2655  [DllImport("PFCImageFile")]
2656  static private extern unsafe int PFCImageFile_LoadImageFile(IntPtr o, byte* filename, bool bConvertToSRGB, byte* iccFolderPath);
2657 
2658  [DllImport("PFCImageFile")]
2659  static private extern unsafe int PFCImageFile_LoadImageFileType(IntPtr o, byte* filename, int type, bool bConvertToSRGB, byte* iccFolderPath);
2660 
2661  [DllImport("PFCImageFile")]
2662  static private extern unsafe bool PFCImageFile_SaveImageFile(IntPtr ptr, byte* filename, int jpegQuality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata);
2663 
2664  [DllImport("PFCImageFile")]
2665  static private extern unsafe bool PFCImageFile_SaveImageFileType(IntPtr ptr, byte* filename, int type, int jpegQuality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata);
2666 
2667  [DllImport("PFCImageFile")]
2668  static private extern unsafe void PFCImageFile_AllocBuffer(IntPtr ptr, int width, int height, int bytes_per_pixel, int stride);
2669 
2670  [DllImport("PFCImageFile")]
2671  static private extern unsafe int PFCImageFile_pfcImageFormat(IntPtr ptr);
2672 
2673  [DllImport("PFCImageFile")]
2674  static private extern unsafe int PFCImageFile_exifOrientation(IntPtr ptr);
2675 
2676  [DllImport("PFCImageFile")]
2677  static private extern unsafe byte* PFCImageFile_get_raw_image(IntPtr ptr);
2678 
2679  [DllImport("PFCImageFile")]
2680  static private extern unsafe int PFCImageFile_get_width(IntPtr ptr);
2681 
2682  [DllImport("PFCImageFile")]
2683  static private extern unsafe int PFCImageFile_get_height(IntPtr ptr);
2684 
2685  [DllImport("PFCImageFile")]
2686  static private extern unsafe int PFCImageFile_get_bytes_per_pixel(IntPtr ptr);
2687 
2688  [DllImport("PFCImageFile")]
2689  static private extern unsafe int PFCImageFile_get_stride(IntPtr ptr);
2690 
2691  [DllImport("PFCImageFile")]
2692  static private extern unsafe bool PFCImageFile_get_sourceSRGB(IntPtr ptr);
2693 
2694  [DllImport("PFCImageFile")]
2695  static private extern unsafe int PFCImageFile_ExpandImageBuffer(IntPtr ptr, byte* buffer, long size, int type, bool bConvertToSRGB, byte* iccFolderPath);
2696 
2697  [DllImport("PFCImageFile")]
2698  static private extern unsafe int PFCImageFile_CompressImageBuffer(IntPtr ptr, byte** destination, int type, int jpegQuality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata);
2699 
2700  [DllImport("PFCImageFile")]
2701  static private extern unsafe int deleteBuffer(byte* buffer);
2702 #endif
2703 
2704 #if ADAPTER32BIT
2705  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2706  static private extern unsafe IntPtr create_PFCImageFile();
2707 
2708  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2709  static private extern void delete_PFCImageFile(IntPtr o);
2710 
2711  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2712  static private extern unsafe int PFCImageFile_LoadImageFile(IntPtr o, byte* filename, bool bConvertToSRGB, byte* iccFolderPath);
2713 
2714  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2715  static private extern unsafe int PFCImageFile_LoadImageFileType(IntPtr o, byte* filename, int type, bool bConvertToSRGB, byte* iccFolderPath);
2716 
2717  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2718  static private extern unsafe bool PFCImageFile_SaveImageFile(IntPtr ptr, byte* filename, int jpegQuality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata);
2719 
2720  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2721  static private extern unsafe bool PFCImageFile_SaveImageFileType(IntPtr ptr, byte* filename, int type, int jpegQuality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata);
2722 
2723  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2724  static private extern unsafe void PFCImageFile_AllocBuffer(IntPtr ptr, int width, int height, int bytes_per_pixel, int stride);
2725 
2726  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2727  static private extern unsafe int PFCImageFile_pfcImageFormat(IntPtr ptr);
2728 
2729  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2730  static private extern unsafe int PFCImageFile_exifOrientation(IntPtr ptr);
2731 
2732  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2733  static private extern unsafe byte* PFCImageFile_get_raw_image(IntPtr ptr);
2734 
2735  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2736  static private extern unsafe int PFCImageFile_get_width(IntPtr ptr);
2737 
2738  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2739  static private extern unsafe int PFCImageFile_get_height(IntPtr ptr);
2740 
2741  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2742  static private extern unsafe int PFCImageFile_get_bytes_per_pixel(IntPtr ptr);
2743 
2744  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2745  static private extern unsafe int PFCImageFile_get_stride(IntPtr ptr);
2746 
2747  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2748  static private extern unsafe bool PFCImageFile_get_sourceSRGB(IntPtr ptr);
2749 
2750  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2751  static private extern unsafe int PFCImageFile_ExpandImageBuffer(IntPtr ptr, byte* buffer, long size, int type, bool bConvertToSRGB, byte* iccFolderPath);
2752 
2753  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2754  static private extern unsafe int PFCImageFile_CompressImageBuffer(IntPtr ptr, byte** destination, int type, int jpegQuality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata);
2755 
2756  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2757  static private extern unsafe int deleteBuffer(byte* buffer);
2758 #endif
2759  }
2760 }
PerfectlyClearAdapter.PFCFBPARAM.bSmooth
bool bSmooth
Set to TRUE to enable face smoothing.
Definition: PerfectlyClearAdapter.cs:457
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref Bitmap bm, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1590
TINTCORRECT_STRONGEST
@ TINTCORRECT_STRONGEST
Highest sensitivity level of tint detection.
Definition: PerfectlyClearPro.h:260
APPLY_ERROR_PROFILE_MISSING
@ APPLY_ERROR_PROFILE_MISSING
-1 Pointer pProfile is NULL
Definition: PerfectlyClearPro.h:385
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer.rowBytes
int rowBytes
Byte width of each scanline.
Definition: PerfectlyClearAdapter.cs:645
PerfectlyClearAdapter.PFCCOREMask.angle
float angle
CW.
Definition: PerfectlyClearAdapter.cs:543
PerfectlyClearAdapter.PFCV3PARAM.lutOutput
PFC3DLutInfo lutOutput
LUT data to apply.
Definition: PerfectlyClearAdapter.cs:576
PerfectlyClearAdapter.PFCCOREMask.width
float width
radial/rounded: w of bounding rect, linear: ignored.
Definition: PerfectlyClearAdapter.cs:539
PerfectlyClearAdapter.PerfectlyClear.Calc
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, PFCFEATURE feature)
Overload method for precalc analysis.
Definition: PerfectlyClearAdapter.cs:927
PerfectlyClearAdapter.PerfectlyClear.Calc
unsafe ADPTRRETURNCODE Calc(ref PFCImageFile imgfile, PFCFEATURE feature, int ISO, string CameraModel, PFCREJECTOPTION rejectOption=PFCREJECTOPTION.PFC_REJECT_CLIPART)
Overload method for precalc analysis.
Definition: PerfectlyClearAdapter.cs:1014
PFC_CORE_MONOLITHIMAGE
@ PFC_CORE_MONOLITHIMAGE
5 Image skipped due to legacy clipart detection method
Definition: PerfectlyClearPro.h:349
PerfectlyClearAdapter.PerfectlyClear.LoadScenePresets
unsafe int LoadScenePresets(string filePath, int groupUUID=0, int *arrProfileUUID=null, int arrProfileUUIDLen=0)
Loads scene optimized presets from presets file. Engine may be AI-enabled with PFC_LoadAIEngine()....
Definition: PerfectlyClearAdapter.cs:2048
PerfectlyClearAdapter.BIASMODE
BIASMODE
Enumeration defining BIAS analysis mode.
Definition: PerfectlyClearAdapter.cs:365
PerfectlyClearAdapter.PFCFACERECT.rect
PFCRECT rect
Specifies the bounding rectangle of a face.
Definition: PerfectlyClearAdapter.cs:68
PFC_RE_FULLRES_REQUIRED
@ PFC_RE_FULLRES_REQUIRED
2 Source image (pImage) is missing
Definition: PerfectlyClearPro.h:373
PerfectlyClearAdapter.PFCFBPARAM.iEnhanceLevel
int iEnhanceLevel
Eye enhancement level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:464
PerfectlyClearAdapter.PFCFBPARAM.bLipSharpen
bool bLipSharpen
Set to TRUE to enable lip sharpening.
Definition: PerfectlyClearAdapter.cs:488
PFC_RE_CANCELLED
@ PFC_RE_CANCELLED
7 Process cancelled
Definition: PerfectlyClearPro.h:378
PFCAIFEATURE
PFCAIFEATURE
Flags defining type of model(s) to load with PFC_LoadAIEngine().
Definition: PerfectlyClearPro.h:1032
PerfectlyClearAdapter.PFCCOREPARAM.eAggressiveness
AGGRESSIVENESS eAggressiveness
The desired level of lighting for Automatic Strength Selection to target at the Exposure Correction.
Definition: PerfectlyClearAdapter.cs:438
PerfectlyClearAdapter.PerfectlyClear.Apply
unsafe PFCAPPLYSTATUS Apply(ref Bitmap bm)
Apply correction.
Definition: PerfectlyClearAdapter.cs:1138
TINTCORRECT_AGGRESSIVE
@ TINTCORRECT_AGGRESSIVE
Aggressive detection of tint.
Definition: PerfectlyClearPro.h:257
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref Bitmap bm, string pathPreset)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1538
PerfectlyClearAdapter.PFCPARAM.mask0
PFCCOREMask mask0
masks for layer 0
Definition: PerfectlyClearAdapter.cs:611
PerfectlyClearAdapter.PFCV3PARAM.iFinishVibrancy
int iFinishVibrancy
Vibrancy correction amount.
Definition: PerfectlyClearAdapter.cs:586
CALC_FB
@ CALC_FB
Calculates for Face Beautification.
Definition: PerfectlyClearPro.h:161
HIGH_CONTRAST
@ HIGH_CONTRAST
Optimized to bring higher contrast to the image.
Definition: PerfectlyClearPro.h:266
PerfectlyClearAdapter.PFCV3PARAM.iFinishWhites
int iFinishWhites
Whites correction amount.
Definition: PerfectlyClearAdapter.cs:584
PRESET_INTELLIGENTAUTO
@ PRESET_INTELLIGENTAUTO
Intelligent Auto - this has been superceded by iAuto 2019 and is here for backwards compatability....
Definition: PerfectlyClearPro.h:178
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.Status
int Status
Definition: PerfectlyClearAdapter.cs:666
CALC_NOFAE
@ CALC_NOFAE
Skip Face Aware Exposure pre-calculations during Core pre-calculations.
Definition: PerfectlyClearPro.h:165
PFC_NR_ERRSETTINGS
@ PFC_NR_ERRSETTINGS
5 Invalid parameter
Definition: PerfectlyClearPro.h:337
PFC_PixelFormat64bppABGR
@ PFC_PixelFormat64bppABGR
Definition: PerfectlyClearPro.h:147
PerfectlyClearAdapter.PFCImageFile.LoadImage
PFC_FILE_LOAD_STATUS LoadImage(string filename, PFC_FILETYPE type, bool bConvertToSRGB=true, string iccFolderPath=null)
Load JPEG from file on disk.
Definition: PerfectlyClearAdapter.cs:2446
PerfectlyClearAdapter.ADPTRRETURNCODE.SUCCESS
@ SUCCESS
Processed successfully.
PerfectlyClearAdapter.ADPTRRETURNCODE
ADPTRRETURNCODE
General return code.
Definition: PerfectlyClearAdapter.cs:376
PerfectlyClearAdapter.PFCV3PARAM.iDeltaG
int iDeltaG
Delta G correction amount.
Definition: PerfectlyClearAdapter.cs:591
PerfectlyClearAdapter.PFCImageFile.ExpandImageBuffer
PFC_FILE_LOAD_STATUS ExpandImageBuffer(MemoryStream inStream, PFC_FILETYPE type, bool bConvertToSRGB=true, string iccFolderPath=null)
Load JPEG from MemoryStream.
Definition: PerfectlyClearAdapter.cs:2569
PerfectlyClearAdapter.PFCCOREPARAM.fInfrared
float fInfrared
Scale value to control intensity of infrared correction. Range 0.0 to 1.0.
Definition: PerfectlyClearAdapter.cs:441
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGE.stride
int stride
Byte width of each scanline.
Definition: PerfectlyClearAdapter.cs:680
PerfectlyClearAdapter.PerfectlyClear.Calc
unsafe ADPTRRETURNCODE Calc(ref PFCImageFile imgfile)
Overload method for precalc analysis.
Definition: PerfectlyClearAdapter.cs:894
PerfectlyClearAdapter.PFCV3PARAM.iDarkSkin
int iDarkSkin
Dark Skin output LUT amount.
Definition: PerfectlyClearAdapter.cs:570
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer.data2
int data2
Location of Green channel.
Definition: PerfectlyClearAdapter.cs:648
PerfectlyClearAdapter.PerfectlyClear.Calc
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds)
Overload method for precalc analysis.
Definition: PerfectlyClearAdapter.cs:905
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, string pathPreset)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1571
PFC_CORE_NOTENABLED
@ PFC_CORE_NOTENABLED
1 Feature not enabled
Definition: PerfectlyClearPro.h:345
PerfectlyClearAdapter.PFCCOREPARAM.bDCF
bool bDCF
Set to true to enable Digital Color Fidelity. Recommended value is FALSE.
Definition: PerfectlyClearAdapter.cs:445
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClear
PerfectlyClear(string path, string licenseCode="")
Class constructor.
Definition: PerfectlyClearAdapter.cs:816
PerfectlyClearAdapter.PerfectlyClear.LoadAiEngine
int LoadAiEngine(PFCAIFEATURE aifeatures, string binPath)
Load AI models into engine. Takes time and memory.
Definition: PerfectlyClearAdapter.cs:2014
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.pSFBParam
void * pSFBParam
Internal use only.
Definition: PerfectlyClearAdapter.cs:658
APPLY_SUCCESS
@ APPLY_SUCCESS
0 Success.
Definition: PerfectlyClearPro.h:384
PerfectlyClearAdapter.PFCPARAM.layer0
PFCV3PARAM layer0
params on layers 0 - top/inside
Definition: PerfectlyClearAdapter.cs:608
PerfectlyClearAdapter.PFCPOINT.x
int x
x coordinate of this point.
Definition: PerfectlyClearAdapter.cs:21
PerfectlyClearAdapter.PFCFBPARAM.iSlim
int iSlim
Face slimming level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:472
PerfectlyClearAdapter.DCFMODE.FIDELITY_VIVID
@ FIDELITY_VIVID
For more color vibrancy.
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer
Struct defining an image.
Definition: PerfectlyClearAdapter.cs:642
PFC_FB_SUCCESS
@ PFC_FB_SUCCESS
0 Success
Definition: PerfectlyClearPro.h:356
PerfectlyClearAdapter.PFCFBPARAM.bBlemish
bool bBlemish
Set to TRUE to enable blemish removal.
Definition: PerfectlyClearAdapter.cs:469
APPLY_BADFORMAT
@ APPLY_BADFORMAT
-5 Pixel format not supported
Definition: PerfectlyClearPro.h:389
PerfectlyClearAdapter.PFCImageFile.PFCImageFile
PFCImageFile()
Constructs empty PFCImageFile, to be filled with LoadImageFile()
Definition: PerfectlyClearAdapter.cs:2361
LIPSHARPENTYPE_FINE
@ LIPSHARPENTYPE_FINE
Fine touch of sharpening.
Definition: PerfectlyClearPro.h:324
PerfectlyClearAdapter.PFCPARAM.core
PFCCOREPARAM core
Core corrections to apply.
Definition: PerfectlyClearAdapter.cs:603
PerfectlyClearAdapter.PFCCOREMask.height
float height
radial/rounded: h of bounding rect, linear: dist from centerY where grad becomes 1....
Definition: PerfectlyClearAdapter.cs:540
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer.height
int height
Pixel height of image.
Definition: PerfectlyClearAdapter.cs:644
PFC_CORE_CANCELLED
@ PFC_CORE_CANCELLED
2 Process cancelled
Definition: PerfectlyClearPro.h:346
PRESET_BEAUTIFYPLUS
@ PRESET_BEAUTIFYPLUS
Beautify Plus provides stronger beautification corrections. This is in the 'Perfectly Clear Essential...
Definition: PerfectlyClearPro.h:175
PerfectlyClearAdapter.PFCFBFACEINFO1.leftEye
PFCPOINT leftEye
Point of left eye in detected face.
Definition: PerfectlyClearAdapter.cs:38
PerfectlyClearAdapter.PFCPARAM.mask2
PFCCOREMask mask2
masks for layer 2
Definition: PerfectlyClearAdapter.cs:613
PRESET_DETAILS
@ PRESET_DETAILS
iAuto Details - legacy preset for backwards compability. This is in the 'Athentech Legacy' group in E...
Definition: PerfectlyClearPro.h:176
PFC_FB_NOT_AVAILABLE
@ PFC_FB_NOT_AVAILABLE
10 Face beautification feature not available
Definition: PerfectlyClearPro.h:366
PerfectlyClearAdapter.PFCV3PARAM.iDeltaR
int iDeltaR
Delta R correction amount.
Definition: PerfectlyClearAdapter.cs:590
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref Bitmap bm, ref Bitmap bmds)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1298
APPLY_WASM_INVALID_CERTIFICATE
@ APPLY_WASM_INVALID_CERTIFICATE
-9 WASM certificate invalid or not matching APIKEY and domain
Definition: PerfectlyClearPro.h:393
SKINSMOOTHTYPE_SUBTLE
@ SKINSMOOTHTYPE_SUBTLE
The subtle correction removes the wrinkles and spots alone while it keeps the texture of the face unc...
Definition: PerfectlyClearPro.h:306
PerfectlyClearAdapter.PFCCOREPARAM.bLightDiffusion
bool bLightDiffusion
Set to true to enable light diffusion during DCF correction.
Definition: PerfectlyClearAdapter.cs:442
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGE.data
void * data
Pointer pointing to the first byte of image data buffer.
Definition: PerfectlyClearAdapter.cs:682
PFCFACERECT
struct PFCFaceRect PFCFACERECT
Structure defining face attributes detected by the Face Detection library.
PFC_CORE_INSUFFICIENTMEMORY
@ PFC_CORE_INSUFFICIENTMEMORY
4 Process aborted because of insufficient memory
Definition: PerfectlyClearPro.h:348
APPLY_WASM_INVALID_APIKEY
@ APPLY_WASM_INVALID_APIKEY
-8 Wrong APIKEY for WASM certificate
Definition: PerfectlyClearPro.h:392
PerfectlyClearAdapter.PFCPIXELFORMAT
PFCPIXELFORMAT
defines the format of the image data
Definition: PerfectlyClearAdapter.cs:121
SKINTONINGTYPE_WHITE
@ SKINTONINGTYPE_WHITE
Whitens (bleaches) face. Recommended mainly for darker skin.
Definition: PerfectlyClearPro.h:314
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer.data3
int data3
Location of Blue channel.
Definition: PerfectlyClearAdapter.cs:649
SKINSMOOTHTYPE_DEFAULT
@ SKINSMOOTHTYPE_DEFAULT
This type of correction provides a more uniform appearance to the complexion. It combines the natural...
Definition: PerfectlyClearPro.h:307
PFC_PixelFormat32bppARGB
@ PFC_PixelFormat32bppARGB
Definition: PerfectlyClearPro.h:119
PerfectlyClearAdapter.PFCPARAM
Struct PFCPARAM the master structure of all processing parameters.
Definition: PerfectlyClearAdapter.cs:602
PerfectlyClearAdapter.PFCImageFile.SaveImageFile
bool SaveImageFile(string filename, PFC_FILETYPE type, int jpegQuality=92, bool bConvertToOriginalColorSpace=true, bool bEmbedOriginalMetadata=true)
Write image data to file*.
Definition: PerfectlyClearAdapter.cs:2500
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGE.height
int height
Pixel height of image.
Definition: PerfectlyClearAdapter.cs:679
PerfectlyClearAdapter.PerfectlyClear.SetProtectionPath
static int SetProtectionPath(string path, string licenseCode)
Set path to location of SDK License files This enables license protection and allows activation using...
Definition: PerfectlyClearAdapter.cs:728
PerfectlyClearAdapter.PFCFBPARAM.bEnlarge
bool bEnlarge
Set to TRUE to enable eye enlargement.
Definition: PerfectlyClearAdapter.cs:461
PerfectlyClearAdapter.PerfectlyClear.ReadImage
Bitmap ReadImage(string filename)
Utility function for reading image file into Bitmap.
Definition: PerfectlyClearAdapter.cs:1891
PFC_FB_NO_CORRECTION
@ PFC_FB_NO_CORRECTION
8 No correction occur during process
Definition: PerfectlyClearPro.h:364
PerfectlyClearAdapter.PerfectlyClear.Calc
unsafe ADPTRRETURNCODE Calc(ref PFCImageFile imgfile, PFCFEATURE feature)
Overload method for precalc analysis.
Definition: PerfectlyClearAdapter.cs:916
PerfectlyClearAdapter.PFCV3PARAM.iFinishTemp
int iFinishTemp
Temp correction amount.
Definition: PerfectlyClearAdapter.cs:578
PerfectlyClearAdapter.PerfectlyClear.SetParam
void SetParam(PFCPRESETID id)
Set process parameters in current instance.
Definition: PerfectlyClearAdapter.cs:1643
PerfectlyClearAdapter.PFCCOREMask.invert
bool invert
invert mask (x = 1.0 - x). NOTE: UI meaning of invert is: if one mask layer set invert = true....
Definition: PerfectlyClearAdapter.cs:546
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGE.format
PFCPIXELFORMAT format
Defines byte order of input buffer.
Definition: PerfectlyClearAdapter.cs:681
PerfectlyClearAdapter.PFCPARAM.v3
PFCV3PARAM v3
V3 Corrections.
Definition: PerfectlyClearAdapter.cs:607
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.CORE_Status
PFCCORE_STATUS CORE_Status
Status code for CORE pre-calc analysis.
Definition: PerfectlyClearAdapter.cs:661
PerfectlyClearAdapter.PFCCOREMask.centerX
float centerX
X of center.
Definition: PerfectlyClearAdapter.cs:537
PerfectlyClearAdapter.PFCV3PARAM.iFinishExposure
int iFinishExposure
Exposure correction amount.
Definition: PerfectlyClearAdapter.cs:580
PerfectlyClearAdapter.PFCAPPLYSTATUS
PFCAPPLYSTATUS
Enumeration defining return code from the Apply() function.
Definition: PerfectlyClearAdapter.cs:316
PFCPARAM
Struct PFCPARAM the master structure of all processing parameters.
Definition: PerfectlyClearPro.h:580
PFC_RE_INVALID_PARAMETER
@ PFC_RE_INVALID_PARAMETER
5 Invalid parameter
Definition: PerfectlyClearPro.h:376
PerfectlyClearAdapter.PFCCOREPARAM.fTintScale
float fTintScale
Scalar value of how much tint correction should be applied. Range 0.0 to 1.0.
Definition: PerfectlyClearAdapter.cs:422
PerfectlyClearAdapter.PFCCOREMask.radius
float radius
only for MASK_ROUNDRECT - corner radius, relative to image w.
Definition: PerfectlyClearAdapter.cs:541
PFC_RE_NOT_FOUND
@ PFC_RE_NOT_FOUND
3 Red eye not found
Definition: PerfectlyClearPro.h:374
PerfectlyClearAdapter.AGGRESSIVENESS.AGGRESSIVE
@ AGGRESSIVE
More aggressive in exposure correction.
AI_CORRECTIONS
@ AI_CORRECTIONS
Loads AI-basedd corrections model.
Definition: PerfectlyClearPro.h:1034
PerfectlyClearAdapter.PFCAIFEATURE
PFCAIFEATURE
Flags defining type of model(s) to load with PFC_LoadAIEngine().
Definition: PerfectlyClearAdapter.cs:114
PerfectlyClearAdapter.PerfectlyClear.PFCENGINE.status
uint status
Status of engine defined in PFCENGINESTATUS. For NO-SFB version the status will always be ENGINESTATU...
Definition: PerfectlyClearAdapter.cs:638
PerfectlyClearAdapter.PFCFBPARAM.iEyeCirc
int iEyeCirc
Eye circle removal level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:466
PRESET_IAUTO_21_ASIA
@ PRESET_IAUTO_21_ASIA
Based on iAuto 21, but with brighter Skin & Depth Bias for truer skin tone.
Definition: PerfectlyClearPro.h:182
PerfectlyClearAdapter.PFCFBFACEINFO1.face
PFCRECT face
Bounding rectangle of detected face.
Definition: PerfectlyClearAdapter.cs:40
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref Bitmap bm)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1276
PerfectlyClearAdapter.PerfectlyClear.ReadPresets
int ReadPresets(string path)
Read a preset from .preset file.
Definition: PerfectlyClearAdapter.cs:1665
SKINMODE_BODY
@ SKINMODE_BODY
Apply correction on most skin regions regardless they are linked with a face or not.
Definition: PerfectlyClearPro.h:300
CALC_ALL
@ CALC_ALL
Calculates for all classic features, all of the above.
Definition: PerfectlyClearPro.h:163
PerfectlyClearAdapter.PFCFBPARAM.bBlush
bool bBlush
Set to TRUE to add blush.
Definition: PerfectlyClearAdapter.cs:491
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.FB_Status
PFCFB_STATUS FB_Status
Status code for Face Beautification pre-calc analysis.
Definition: PerfectlyClearAdapter.cs:663
PFCPRESETID
PFCPRESETID
ENUM for presets support by this SDK.
Definition: PerfectlyClearPro.h:173
PerfectlyClearAdapter.PFCV3PARAM.iColorVibrancy
int iColorVibrancy
Color Vibrancy amount.
Definition: PerfectlyClearAdapter.cs:569
PerfectlyClearAdapter.PFCREPARAM.bEnabled
bool bEnabled
Set to TRUE to enable red eye removal.
Definition: PerfectlyClearAdapter.cs:516
CALC_RE
@ CALC_RE
Calculates for Red Eye Removal.
Definition: PerfectlyClearPro.h:162
PerfectlyClearAdapter.AGGRESSIVENESS
AGGRESSIVENESS
Enumeration defining different Auto Exposure calculation modes.
Definition: PerfectlyClearAdapter.cs:343
PerfectlyClearAdapter.SKINMODE
SKINMODE
Enumeration defining modes in Perfect Smooth analysis.
Definition: PerfectlyClearAdapter.cs:385
PerfectlyClearAdapter.PFCImageFile.LoadImage
PFC_FILE_LOAD_STATUS LoadImage(string filename, bool bConvertToSRGB=false, string iccFolderPath=null)
Load JPEG from file on disk.
Definition: PerfectlyClearAdapter.cs:2415
PerfectlyClearAdapter.PFCFBPARAM.iCatchLight
int iCatchLight
Catchlight level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:476
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGE.width
int width
Pixel width of image.
Definition: PerfectlyClearAdapter.cs:678
APPLY_WASM_CERTIFICATE_WRONG_VERSION
@ APPLY_WASM_CERTIFICATE_WRONG_VERSION
-11 Wrong format version of WASM certificate
Definition: PerfectlyClearPro.h:395
PFC_NR_CANCELLED
@ PFC_NR_CANCELLED
3 Process cancelled
Definition: PerfectlyClearPro.h:335
PerfectlyClearAdapter.PFCCOREPARAM.bLocalContrast
bool bLocalContrast
Set to true to enable Local Contrast.
Definition: PerfectlyClearAdapter.cs:449
PerfectlyClearAdapter.PFCFBFACEINFO1.rightEye
PFCPOINT rightEye
Point of right eye in detected face.
Definition: PerfectlyClearAdapter.cs:39
PerfectlyClearAdapter.PFCNRPARAM.iDetailOffset
int iDetailOffset
Offset to recommended level of preservation of details. Range -30 to 30.
Definition: PerfectlyClearAdapter.cs:510
PerfectlyClearAdapter.PFCV3PARAM.lutInputFoliageGreen
PFC3DLutInfo lutInputFoliageGreen
LUT data to apply.
Definition: PerfectlyClearAdapter.cs:573
PFC_NR_FULLRES_REQUIRED
@ PFC_NR_FULLRES_REQUIRED
2 Source image (pImage) is missing
Definition: PerfectlyClearPro.h:334
PerfectlyClearAdapter.PFCRECT.top
int top
y in point corrdinate of this rect.
Definition: PerfectlyClearAdapter.cs:30
PerfectlyClearAdapter.PFCCOREPARAM.bUseFAE
bool bUseFAE
Set to true (recommended) to enable Face Aware Exposure selection. Recommended exposure will be calcu...
Definition: PerfectlyClearAdapter.cs:437
PerfectlyClearAdapter.PFCFBPARAM.iEnlargeLevel
int iEnlargeLevel
Eye enlargement level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:462
PFCAPPLYSTATUS
PFCAPPLYSTATUS
Enumeration defining return code from the Apply() function.
Definition: PerfectlyClearPro.h:383
PerfectlyClearAdapter.PFCV3PARAM.iNeutralDensity
int iNeutralDensity
Neutral density filter amout.
Definition: PerfectlyClearAdapter.cs:568
PerfectlyClearAdapter.PFCV3PARAM.lutInputFoliageBrown
PFC3DLutInfo lutInputFoliageBrown
LUT data to apply.
Definition: PerfectlyClearAdapter.cs:574
PerfectlyClearAdapter.PFCFBPARAM.bEnabled
bool bEnabled
Set to TRUE to enable entire face beautification.
Definition: PerfectlyClearAdapter.cs:456
PerfectlyClearAdapter.PFCImageFile.PFC_FILE_LOAD_STATUS
PFC_FILE_LOAD_STATUS
Return status after loading a file with PFCImageFile.
Definition: PerfectlyClearAdapter.cs:2394
PFC_CORE_NOSOURCEIMAGE
@ PFC_CORE_NOSOURCEIMAGE
3 Source image (pImage) is missing
Definition: PerfectlyClearPro.h:347
PFCIMAGEPROFILE
Struct defining an image profile as calculated from PFC_Calc() function.
Definition: PerfectlyClearPro.h:593
PerfectlyClearAdapter.PFCNR_STATUS
PFCNR_STATUS
Enumeration defining status of Noise Removal pre-calculation.
Definition: PerfectlyClearAdapter.cs:252
PFC_RE_NOTENABLED
@ PFC_RE_NOTENABLED
1 Feature not enabled
Definition: PerfectlyClearPro.h:372
PerfectlyClearAdapter.PerfectlyClear.Calc
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm)
Performs precalc analysis.
Definition: PerfectlyClearAdapter.cs:884
PerfectlyClearAdapter.PFCPOINT.y
int y
y coordinate of this point.
Definition: PerfectlyClearAdapter.cs:22
PFC_NR_SUCCESS
@ PFC_NR_SUCCESS
0 Success
Definition: PerfectlyClearPro.h:332
PerfectlyClearAdapter.DCFMODE
DCFMODE
Enumeration defining DCF analysis mode.
Definition: PerfectlyClearAdapter.cs:351
LOAD_FAILED_CONVERT_SRGB
@ LOAD_FAILED_CONVERT_SRGB
Error: failed to convert to sRGB.
Definition: PFCImageFile.h:23
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref PFCImageFile imgfile, int ISO, string CameraModel, bool bFastFAE)
Performs auto correction.
Definition: PerfectlyClearAdapter.cs:1387
PerfectlyClearAdapter.PFCFACERECT.childLevel
int childLevel
We don't implement this.
Definition: PerfectlyClearAdapter.cs:78
PFC_REJECT_MONOLITH
@ PFC_REJECT_MONOLITH
Reject simple images that don't benefit from correction, like solid colors. This was the default befo...
Definition: PerfectlyClearPro.h:404
PFC_PixelFormat24bppRGB
@ PFC_PixelFormat24bppRGB
Definition: PerfectlyClearPro.h:48
PRESET_IAUTO_2019
@ PRESET_IAUTO_2019
iAuto for even better image corrections
Definition: PerfectlyClearPro.h:179
APPLY_CANCELLED
@ APPLY_CANCELLED
-3 Operation cancelled
Definition: PerfectlyClearPro.h:387
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer.width
int width
Pixel width of image.
Definition: PerfectlyClearAdapter.cs:643
PerfectlyClearAdapter.PFCV3PARAM.bDynamic
bool bDynamic
Reserved should be 0.
Definition: PerfectlyClearAdapter.cs:594
PerfectlyClearAdapter.PFCCOREMask
Struct for core mask.
Definition: PerfectlyClearAdapter.cs:535
LIPSHARPENTYPE_COARSE
@ LIPSHARPENTYPE_COARSE
Lip details are coarsely pronounced.
Definition: PerfectlyClearPro.h:326
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.pInternal
void * pInternal
Internal use only.
Definition: PerfectlyClearAdapter.cs:659
PerfectlyClearAdapter.PFCFBPARAM.bTeeth
bool bTeeth
Set to TRUE to enable teeth whitening.
Definition: PerfectlyClearAdapter.cs:467
PerfectlyClearAdapter.PFCCOREPARAM.bContrast
bool bContrast
Set to TRUE to also apply Athentech's patented Medical Imaging contrast technology.
Definition: PerfectlyClearAdapter.cs:427
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.NR_Status
PFCNR_STATUS NR_Status
Status code for Noise Removal pre-calc analysis.
Definition: PerfectlyClearAdapter.cs:662
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.pRedEyeParam
void * pRedEyeParam
Internal use only.
Definition: PerfectlyClearAdapter.cs:657
PerfectlyClearAdapter.DCFMODE.FIDELITY_STANDARD
@ FIDELITY_STANDARD
For normal photo.
PerfectlyClearAdapter.PFCCOREPARAM.iContrast
int iContrast
Intensity of contrast or depth. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:429
PerfectlyClearAdapter.PFCPARAM.re
PFCREPARAM re
Red Eye Removal.
Definition: PerfectlyClearAdapter.cs:606
PerfectlyClearAdapter.AGGRESSIVENESS.MODERATE
@ MODERATE
Moderate level of exposure correction.
PerfectlyClearAdapter.PFCREPARAM
Structure encapsulating Red Eye Correction parameters.
Definition: PerfectlyClearAdapter.cs:515
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClear
PerfectlyClear()
Special class constructor for multithreading.
Definition: PerfectlyClearAdapter.cs:778
PerfectlyClearAdapter.PFCCOREPARAM.eContrastMode
CONTRASTMODE eContrastMode
Select contrast mode.
Definition: PerfectlyClearAdapter.cs:428
PerfectlyClearAdapter.PFCFACERECT.yawAngle
int yawAngle
The Yaw or profile angle, from -90 (left profile) to 90 (right profile)
Definition: PerfectlyClearAdapter.cs:81
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.pPfcParam
void * pPfcParam
Internal use only.
Definition: PerfectlyClearAdapter.cs:655
PerfectlyClearAdapter.PFCCOREPARAM.iLocalContrast
int iLocalContrast
Amount of Local Contrast to apply. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:448
PerfectlyClearAdapter.PFCFACERECT.widthImage
int widthImage
image width
Definition: PerfectlyClearAdapter.cs:85
PFC_CORE_SUCCESS
@ PFC_CORE_SUCCESS
0 Success
Definition: PerfectlyClearPro.h:344
PerfectlyClearAdapter.PFCV3PARAM.lutInputSky
PFC3DLutInfo lutInputSky
LUT data to apply.
Definition: PerfectlyClearAdapter.cs:572
PFC_NR_NOTFOUND
@ PFC_NR_NOTFOUND
7 Noise not found
Definition: PerfectlyClearPro.h:339
PerfectlyClearAdapter.PerfectlyClear.HasFaceBeautification
bool HasFaceBeautification()
Query if Face Beautification feature is available.
Definition: PerfectlyClearAdapter.cs:1727
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE
Struct defining an image profile as calculated from PFC_Calc() function.
Definition: PerfectlyClearAdapter.cs:654
PerfectlyClearAdapter.PFCCOREPARAM.bVibrancy
bool bVibrancy
Set to true (recommended default) to enable Color Vibrancy in the library.
Definition: PerfectlyClearAdapter.cs:424
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer.data1
int data1
Location of Red channel.
Definition: PerfectlyClearAdapter.cs:647
LOAD_ERROR
@ LOAD_ERROR
Error.
Definition: PFCImageFile.h:21
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.pNoiseParam
void * pNoiseParam
Internal use only.
Definition: PerfectlyClearAdapter.cs:656
PerfectlyClearAdapter.PFCFACERECT.smileLevel
int smileLevel
Indicates the presence of a smile.
Definition: PerfectlyClearAdapter.cs:80
PerfectlyClearAdapter.PFCFBPARAM.iSmoothLevel
int iSmoothLevel
Face smoothing level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:458
PerfectlyClearAdapter.PFCFEATURE
PFCFEATURE
ENUM controlling types of calculations at the pre-calculation stage.
Definition: PerfectlyClearAdapter.cs:97
PerfectlyClearAdapter.PFCCOREPARAM.bDynamicRange
bool bDynamicRange
Set to TRUE to enable dynamic range correction.
Definition: PerfectlyClearAdapter.cs:444
PerfectlyClearAdapter.PFCCOREPARAM.bUseAutomaticStrengthSelection
bool bUseAutomaticStrengthSelection
Set to TRUE (recommended default) to enable Automatic Strength Selection. Perfectly Clear will determ...
Definition: PerfectlyClearAdapter.cs:436
PerfectlyClearAdapter.PFCNRPARAM.iPreset
int iPreset
Definition: PerfectlyClearAdapter.cs:501
PerfectlyClearAdapter.PFCRECT.height
int height
height of this rect.
Definition: PerfectlyClearAdapter.cs:32
PerfectlyClearAdapter.PFCCOREPARAM.iMinStrength
int iMinStrength
Use this to set the min recommended exposure correction.
Definition: PerfectlyClearAdapter.cs:450
PerfectlyClearAdapter.PFCFBPARAM.iCatchLightMode
int iCatchLightMode
Definition: PerfectlyClearAdapter.cs:477
PFC_PixelFormat24bppBGR
@ PFC_PixelFormat24bppBGR
Definition: PerfectlyClearPro.h:61
PerfectlyClearAdapter.PFCImageFile.SaveImageFile
bool SaveImageFile(string filename, int jpegQuality=92, bool bConvertToOriginalColorSpace=true, bool bEmbedOriginalMetadata=true)
Write image data to file*.
Definition: PerfectlyClearAdapter.cs:2476
PFCIMAGE
Struct defining an image to be used in PFC library.
Definition: PerfectlyClearPro.h:247
PerfectlyClearAdapter.PFCCOREPARAM.bHighlightPreservation
bool bHighlightPreservation
Set to true to enable Highlight Preservation.
Definition: PerfectlyClearAdapter.cs:433
BIAS_BRIGHTER_PREFERENCE
@ BIAS_BRIGHTER_PREFERENCE
Average usage with brighter tone, corresponds to "Bright" in PfC Products.
Definition: PerfectlyClearPro.h:291
PerfectlyClearAdapter.PFCFBPARAM.bEnhance
bool bEnhance
Set to TRUE to enable eye enhancement.
Definition: PerfectlyClearAdapter.cs:463
PFC_NR_ERRBITMAP
@ PFC_NR_ERRBITMAP
4 Error reading image data
Definition: PerfectlyClearPro.h:336
PerfectlyClearAdapter.PFCRECT.left
int left
x in point coordinate of this rect.
Definition: PerfectlyClearAdapter.cs:29
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer.columnBytes
int columnBytes
Byte width of one pixel.
Definition: PerfectlyClearAdapter.cs:646
PFCENGINE
Struct defining an PFC engine instance.
Definition: PerfectlyClearPro.h:241
PerfectlyClearAdapter.PFCFACERECT.angle
int angle
Roll angle of the face, from -179 to 180 degrees. 0 degrees means the face it oriented "normally",...
Definition: PerfectlyClearAdapter.cs:74
PerfectlyClearAdapter.PFCV3PARAM.iFinishHighlights
int iFinishHighlights
Highlights correction amount.
Definition: PerfectlyClearAdapter.cs:583
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref PFCImageFile imgfile, string pathPreset)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1554
PerfectlyClearAdapter.PFCPARAM.fb
PFCFBPARAM fb
Face Beautification corrections.
Definition: PerfectlyClearAdapter.cs:604
PerfectlyClearAdapter.PFCCOREPARAM.fBiasScale
float fBiasScale
Scalar value of how much BIAS correction should be applied. Range 0.0 to 1.0.
Definition: PerfectlyClearAdapter.cs:431
PerfectlyClearAdapter.PerfectlyClear.FBFaceCount
int FBFaceCount()
Get number of faces.
Definition: PerfectlyClearAdapter.cs:1737
SKINMODE_FACE
@ SKINMODE_FACE
Apply correction ONLY on skin regions included in faces.
Definition: PerfectlyClearPro.h:299
PerfectlyClearAdapter.PFCCOREPARAM.iStrength
int iStrength
Set the strength of exposure correction. If Automatic Strength Selection is enabled,...
Definition: PerfectlyClearAdapter.cs:426
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGE
Struct defining an image to be used in PFC library.
Definition: PerfectlyClearAdapter.cs:677
PerfectlyClearAdapter.PFCFB_STATUS
PFCFB_STATUS
Enumeration defining status of Face Beautification pre-calculation.
Definition: PerfectlyClearAdapter.cs:286
BIAS_NONE
@ BIAS_NONE
Turn off bias correction.
Definition: PerfectlyClearPro.h:288
TINTCORRECT_DEFAULT
@ TINTCORRECT_DEFAULT
Moderate level of tint detection.
Definition: PerfectlyClearPro.h:258
PerfectlyClearAdapter.PerfectlyClear.PFCENGINE.pEngine
void * pEngine
Pointer to binary definition of the processing engine.
Definition: PerfectlyClearAdapter.cs:637
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref PFCImageFile imgfile, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1609
PerfectlyClearAdapter.PFCFBPARAM.iBlemish
int iBlemish
Blemish removal level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:470
PerfectlyClearAdapter.PFCREJECTOPTION
PFCREJECTOPTION
Enumeration defining reject options.
Definition: PerfectlyClearAdapter.cs:278
PerfectlyClearAdapter.PFCFBPARAM.eSkinToningMode
SKINMODE eSkinToningMode
Use SKINMODE_FACE to apply correction ONLY on skin regions included in faces. Use SKINMODE_BODY to ap...
Definition: PerfectlyClearAdapter.cs:486
SKINSMOOTHTYPE_SUPERSMOOTH
@ SKINSMOOTHTYPE_SUPERSMOOTH
This is a more aggressive and effective correction where the appearance of the entire skin (including...
Definition: PerfectlyClearPro.h:308
PFC_FB_FULLRES_REQUIRED
@ PFC_FB_FULLRES_REQUIRED
3 Source image (pImage) is missing
Definition: PerfectlyClearPro.h:359
PFC_REJECT_CLIPART
@ PFC_REJECT_CLIPART
Reject images classified as clipart, used by default.
Definition: PerfectlyClearPro.h:405
PerfectlyClearAdapter.PFCV3PARAM
Struct describing V3 parameters.
Definition: PerfectlyClearAdapter.cs:562
PerfectlyClearAdapter.PerfectlyClear.ReleaseProtectionPath
static void ReleaseProtectionPath()
Releases resources from SetProtectionPath.
Definition: PerfectlyClearAdapter.cs:767
PerfectlyClearAdapter.PFCPRESETID
PFCPRESETID
ENUM for presets support by this SDK.
Definition: PerfectlyClearAdapter.cs:238
PerfectlyClearAdapter.PFCPARAM.mask1
PFCCOREMask mask1
masks for layer 1
Definition: PerfectlyClearAdapter.cs:612
PerfectlyClearAdapter.PFCFACERECT.blinkLevelL
int blinkLevelL
Left eye Blink level.
Definition: PerfectlyClearAdapter.cs:76
PerfectlyClearAdapter.PFCFBPARAM.iDeFlash
int iDeFlash
Deflash level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:474
PerfectlyClearAdapter.PFCFBFACEINFO
Class defining face area detected from the SFB library.
Definition: PerfectlyClearAdapter.cs:45
AI_SCENE_DETECTION
@ AI_SCENE_DETECTION
Loads scene detection model.
Definition: PerfectlyClearPro.h:1033
PFC_PixelFormat48bppRGB
@ PFC_PixelFormat48bppRGB
Definition: PerfectlyClearPro.h:89
PerfectlyClearAdapter.PFCCOREPARAM.fLightDiffusion
float fLightDiffusion
Scale value to control intensity of light diffusion correction.
Definition: PerfectlyClearAdapter.cs:443
PerfectlyClearAdapter.PFCFBPARAM.colorSkinToning
uint colorSkinToning
Skin Toning color AARRGGBB default 0xFFF5BCA9 ({245, 188, 169})
Definition: PerfectlyClearAdapter.cs:493
CALC_CORE
@ CALC_CORE
Calculates for Perfectly Clear Core correction.
Definition: PerfectlyClearPro.h:159
PerfectlyClearAdapter.PFCV3PARAM.iPreprocessEV
int iPreprocessEV
EV correction amount (Image Ambulace)
Definition: PerfectlyClearAdapter.cs:566
PFC_PixelFormat48bppBGR
@ PFC_PixelFormat48bppBGR
Definition: PerfectlyClearPro.h:132
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, int ISO, string CameraModel, bool bFastFAE)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1464
PerfectlyClearAdapter.PFCFACERECT.blinkLevelR
int blinkLevelR
Right eye Blink level.
Definition: PerfectlyClearAdapter.cs:77
PerfectlyClearAdapter.PFCCOREPARAM.bSharpen
bool bSharpen
Set to true to enable sharpening.
Definition: PerfectlyClearAdapter.cs:434
PerfectlyClearAdapter.PerfectlyClear.Apply
unsafe PFCAPPLYSTATUS Apply(ref Bitmap bm, int iOpacity)
Apply correction.
Definition: PerfectlyClearAdapter.cs:1159
PerfectlyClearAdapter.PFCFBPARAM.eSmoothMode
SKINMODE eSmoothMode
Use SKINMODE_FACE to apply correction ONLY on skin regions included in faces. Use SKINMODE_BODY to ap...
Definition: PerfectlyClearAdapter.cs:459
PerfectlyClearAdapter.PFC3DLutInfo
Struct describing 3D Lut information.
Definition: PerfectlyClearAdapter.cs:552
TINTCORRECTION
TINTCORRECTION
Enumeration defining different abnormal tint analysis mode.
Definition: PerfectlyClearPro.h:256
PerfectlyClearAdapter.PFCFBFACEINFO.leftEye
PFCPOINT leftEye
Point of left eye in detected face.
Definition: PerfectlyClearAdapter.cs:46
PerfectlyClearAdapter.PFCCOREPARAM.bInfrared
bool bInfrared
Set to true (recommended default) to enable infrared correction. It's a good idea to turn Infrared Co...
Definition: PerfectlyClearAdapter.cs:440
PerfectlyClearAdapter.PFCFBPARAM.iTeethLevel
int iTeethLevel
Teeth whitening level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:468
LOAD_ERROR_UNSUPPORTED
@ LOAD_ERROR_UNSUPPORTED
Error: unsupported file.
Definition: PFCImageFile.h:22
PerfectlyClearAdapter.PFCFBFACEINFO.rightEye
PFCPOINT rightEye
Point of right eye in detected face.
Definition: PerfectlyClearAdapter.cs:47
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.RE_Status
PFCRE_STATUS RE_Status
Status code for Red Eye pre-calc analysis.
Definition: PerfectlyClearAdapter.cs:664
PerfectlyClearAdapter.PFCFACERECT.FAE1
int FAE1
Internal data for Face Aware Exposure.
Definition: PerfectlyClearAdapter.cs:82
SKINTONINGTYPE_FOUNDATION
@ SKINTONINGTYPE_FOUNDATION
Adjust skin to user defined foundation color.
Definition: PerfectlyClearPro.h:318
PerfectlyClearAdapter.PerfectlyClear.Apply
unsafe PFCAPPLYSTATUS Apply(ref PFCImageFile imgfile)
Apply correction.
Definition: PerfectlyClearAdapter.cs:1148
PerfectlyClearAdapter.PFCFBPARAM
Structure encapsulating Face Beautification parameters.
Definition: PerfectlyClearAdapter.cs:455
SKINTONINGTYPE_TAN
@ SKINTONINGTYPE_TAN
Darkens skin, makes it look naturally tanned.
Definition: PerfectlyClearPro.h:317
SKINTONINGTYPE_WARM
@ SKINTONINGTYPE_WARM
Warms skin tone.
Definition: PerfectlyClearPro.h:316
CALC_FAEHISPEED
@ CALC_FAEHISPEED
Use Fast mode of Face Aware Exposure pre-calculations.
Definition: PerfectlyClearPro.h:166
PerfectlyClearAdapter.PFCPARAM.nr
PFCNRPARAM nr
Noise reduction corrections.
Definition: PerfectlyClearAdapter.cs:605
PerfectlyClearAdapter.PFCRECT
Struct defining a rectangle.
Definition: PerfectlyClearAdapter.cs:28
HIGH_DEFINITION
@ HIGH_DEFINITION
Optimized to bring out more details in the shadows, more details in the highlights,...
Definition: PerfectlyClearPro.h:267
PerfectlyClearAdapter.PFCV3PARAM.iDynamic
int iDynamic
Reserved should be 0.
Definition: PerfectlyClearAdapter.cs:595
PFC_PixelFormat64bppARGB
@ PFC_PixelFormat64bppARGB
Definition: PerfectlyClearPro.h:104
PerfectlyClearAdapter.PFCFACERECT
Class defining face attributes from FAE.
Definition: PerfectlyClearAdapter.cs:67
PerfectlyClearAdapter.TINTCORRECTION
TINTCORRECTION
Enumeration defining different abnormal tint analysis mode.
Definition: PerfectlyClearAdapter.cs:334
PerfectlyClearAdapter.PFCV3PARAM.iFinishContrast
int iFinishContrast
Contrast correction amount.
Definition: PerfectlyClearAdapter.cs:587
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref Bitmap bm, int ISO, string CameraModel, bool bFastFAE)
Performs auto correction.
Definition: PerfectlyClearAdapter.cs:1311
PFC_FB_NOTENABLED
@ PFC_FB_NOTENABLED
1 Feature not enabled
Definition: PerfectlyClearPro.h:357
SKINTONINGTYPE_PALE
@ SKINTONINGTYPE_PALE
Makes skin look lighter and more pale.
Definition: PerfectlyClearPro.h:315
PerfectlyClearAdapter.SKINTONINGTYPE
SKINTONINGTYPE
Enumeration defining type of Skin Toning correction.
Definition: PerfectlyClearAdapter.cs:400
PerfectlyClearAdapter.PerfectlyClear.AbnormalTintDetected
bool AbnormalTintDetected(TINTCORRECTION eTintMethod)
Query if Abnormal Tint detected.
Definition: PerfectlyClearAdapter.cs:1770
PerfectlyClearAdapter.AGGRESSIVENESS.CONSERVATIVE
@ CONSERVATIVE
Less aggressive in exposure correction.
PerfectlyClearAdapter.CONTRASTMODE
CONTRASTMODE
Enumeration defining contrast mode.
Definition: PerfectlyClearAdapter.cs:358
PerfectlyClearAdapter.ADPTRRETURNCODE.WRONG_FORMAT
@ WRONG_FORMAT
Image source in format not supported by this version of API.
BIAS_AVERAGE_PREFERENCE
@ BIAS_AVERAGE_PREFERENCE
For average usage, corresponds to "Normal" in PfC Products.
Definition: PerfectlyClearPro.h:290
PFCFEATURE
PFCFEATURE
ENUM controlling types of calculations at the pre-calculation stage.
Definition: PerfectlyClearPro.h:158
PerfectlyClearAdapter.PFCV3PARAM.iFinishSaturation
int iFinishSaturation
Saturation correction amount.
Definition: PerfectlyClearAdapter.cs:585
PerfectlyClearAdapter.PFCCOREPARAM.iVibrancy
int iVibrancy
Degree of color vibrancy. This value will only be use when bVibrancy is TRUE. Very large values can p...
Definition: PerfectlyClearAdapter.cs:425
PFC_NR_MISC_ERROR
@ PFC_NR_MISC_ERROR
6 General error
Definition: PerfectlyClearPro.h:338
PerfectlyClearAdapter.PFCV3PARAM.iFinishPositiveContrast
int iFinishPositiveContrast
Positive Contrast correction amount.
Definition: PerfectlyClearAdapter.cs:588
PerfectlyClearAdapter.PFCCOREPARAM.bAbnormalTintRemoval
bool bAbnormalTintRemoval
Set to true to enable Abnormal Tint Removal. Recommended default is FALSE.
Definition: PerfectlyClearAdapter.cs:420
APPLY_INVALIDLICENSE
@ APPLY_INVALIDLICENSE
-6 Invalid License or validation failed
Definition: PerfectlyClearPro.h:390
PRESET_IAUTO_21
@ PRESET_IAUTO_21
The iAuto you love plus newly tuned settings for sharper images, accurate skin correction,...
Definition: PerfectlyClearPro.h:181
PerfectlyClearAdapter.PFCNRPARAM.bEnabled
bool bEnabled
Set to TRUE to enable noise removal.
Definition: PerfectlyClearAdapter.cs:500
PerfectlyClearAdapter.PFCCOREPARAM.eDCFMode
DCFMODE eDCFMode
Select different class of DCF.
Definition: PerfectlyClearAdapter.cs:446
PerfectlyClearAdapter.PerfectlyClear.FAEFaceCount
int FAEFaceCount()
Returns the count of the faces recogniced by FAE.
Definition: PerfectlyClearAdapter.cs:2003
PerfectlyClearAdapter.PFCFACERECT.rcEyeL
PFCRECT rcEyeL
Specifies the bounding rectangle of the left eye.
Definition: PerfectlyClearAdapter.cs:69
PerfectlyClearAdapter.PFCRECT.width
int width
width of this rect.
Definition: PerfectlyClearAdapter.cs:31
PRESET_IAUTO_2019_RE
@ PRESET_IAUTO_2019_RE
iAuto 2019 with Red Eye correciton enabled
Definition: PerfectlyClearPro.h:180
PerfectlyClearAdapter.PFCFBPARAM.eSkinToningType
SKINTONINGTYPE eSkinToningType
See enum definition of SKINTONINGTYPE.
Definition: PerfectlyClearAdapter.cs:487
PerfectlyClearAdapter.PFCCOREPARAM
Structure encapsulating the CORE processing parameters.
Definition: PerfectlyClearAdapter.cs:418
PerfectlyClearAdapter.PFCFACERECT.blinkLevel
int blinkLevel
Indicates the presence of a blink.
Definition: PerfectlyClearAdapter.cs:75
PerfectlyClearAdapter.PerfectlyClear.Calc
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds, PFCFEATURE feature)
Overload method for precalc analysis.
Definition: PerfectlyClearAdapter.cs:939
PerfectlyClearAdapter.PFCCOREPARAM.fDCF
float fDCF
Scale value to control intensity of Digital Color Fidelity correction. Range 0.0 to 1....
Definition: PerfectlyClearAdapter.cs:447
PFC_FB_NOT_EXECUTED
@ PFC_FB_NOT_EXECUTED
9 Not executed
Definition: PerfectlyClearPro.h:365
PFC_RE_GEN_ERROR
@ PFC_RE_GEN_ERROR
4 General error
Definition: PerfectlyClearPro.h:375
APPLY_WASM_INVALID_DOMAIN
@ APPLY_WASM_INVALID_DOMAIN
-7 Wrong domain for WASM certificate
Definition: PerfectlyClearPro.h:391
PerfectlyClearAdapter.LIPSHARPENTYPE
LIPSHARPENTYPE
Enumeration defining Lip Sharpening mode.
Definition: PerfectlyClearAdapter.cs:410
PerfectlyClearAdapter.PFCFBPARAM.colorBlush
uint colorBlush
Blush color AARRGGBB default 0xFFFD7171 ({253, 113, 113})
Definition: PerfectlyClearAdapter.cs:494
CALC_SCENE_DETECTION
@ CALC_SCENE_DETECTION
Calculate Scene Detection.
Definition: PerfectlyClearPro.h:169
PerfectlyClearAdapter.PFCFBPARAM.bSlim
bool bSlim
Set to TRUE to enable face slimming.
Definition: PerfectlyClearAdapter.cs:471
PerfectlyClearAdapter.PerfectlyClear.PFCENGINE
Struct defining an PFC engine instance.
Definition: PerfectlyClearAdapter.cs:636
PerfectlyClearAdapter.PFCCOREMask.transparency
float transparency
overall transparency applied to the whole mask (strength 100 means transparency 0....
Definition: PerfectlyClearAdapter.cs:544
PerfectlyClearAdapter.PFCV3PARAM.bPreprocessEV
bool bPreprocessEV
Enable EV correction (ImageAmbulance)
Definition: PerfectlyClearAdapter.cs:565
PerfectlyClearAdapter.PFCCOREPARAM.eBiasMode
BIASMODE eBiasMode
Skin and depth bias control. Recommended value is BIAS_AVERAGE_PREFERENCE, unless you are printing to...
Definition: PerfectlyClearAdapter.cs:430
PerfectlyClearAdapter.PerfectlyClear.ApplyStrengthToParam
void ApplyStrengthToParam(int strength)
Apply overall strength to parameters, same as Strength in Perfecly Clear products Adjusts the paramet...
Definition: PerfectlyClearAdapter.cs:1780
PerfectlyClearAdapter.ADPTRRETURNCODE.INTERNALERROR
@ INTERNALERROR
Internal errors.
PerfectlyClearAdapter.PFCFBPARAM.iLipSharpen
int iLipSharpen
Lip sharpening level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:489
PerfectlyClearAdapter.PFCFBPARAM.bSkinToning
bool bSkinToning
Set to TRUE to enable skin toning.
Definition: PerfectlyClearAdapter.cs:484
PerfectlyClearAdapter.PerfectlyClear.Apply
unsafe PFCAPPLYSTATUS Apply(ref PFCImageFile imgfile, int iOpacity)
Apply correction.
Definition: PerfectlyClearAdapter.cs:1216
PerfectlyClearAdapter.PFCV3PARAM.iDeltaB
int iDeltaB
Delta B correction amount.
Definition: PerfectlyClearAdapter.cs:592
PerfectlyClearAdapter.PFCFBPARAM.bCatchLight
bool bCatchLight
Set to TRUE to enable catchlight removal.
Definition: PerfectlyClearAdapter.cs:475
PerfectlyClearAdapter.PerfectlyClear.Calc
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds, PFCFEATURE feature, int ISO, string CameraModel)
Overload method for precalc analysis.
Definition: PerfectlyClearAdapter.cs:1053
PerfectlyClearAdapter.PFCCOREPARAM.iMaxStrength
int iMaxStrength
Use this value to limit the maximum Exposure to be applied on the Automatic Exposure Strength Selecti...
Definition: PerfectlyClearAdapter.cs:439
PerfectlyClearAdapter.PFCFACERECT.rcMouth
PFCRECT rcMouth
Specifies the bounding rectangle of the mouth.
Definition: PerfectlyClearAdapter.cs:71
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref PFCImageFile imgfile)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1286
PerfectlyClearAdapter.PFCCOREPARAM.fSharpenScale
float fSharpenScale
Sharpening intensity. This value controls how much sharpening to be applied. Range 0....
Definition: PerfectlyClearAdapter.cs:435
LIPSHARPENTYPE_MEDIUM
@ LIPSHARPENTYPE_MEDIUM
Stronger sharpening. Details are more pronounced.
Definition: PerfectlyClearPro.h:325
CALC_NR
@ CALC_NR
Calculates for Perfectly Clear Noise Removal.
Definition: PerfectlyClearPro.h:160
PFC_CORE_CLIPARTIMAGE
@ PFC_CORE_CLIPARTIMAGE
7 Image skipped due AI Clipart detection
Definition: PerfectlyClearPro.h:351
PFC_FB_CANCELLED
@ PFC_FB_CANCELLED
4 Process cancelled
Definition: PerfectlyClearPro.h:360
BIAS_AUTO
@ BIAS_AUTO
Apply auto calculated bias mode and strength.
Definition: PerfectlyClearPro.h:293
PerfectlyClearAdapter.PFCFBPARAM.iBlush
int iBlush
Blush level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:492
PerfectlyClearAdapter.PerfectlyClear.GetFaceInfo
bool GetFaceInfo(ref PFCFBFACEINFO info, int index)
Get face information.
Definition: PerfectlyClearAdapter.cs:1750
PerfectlyClearAdapter.PFCFACERECT.ptEyeR
PFCPOINT ptEyeR
Specifies the x,y coordinates of the right eye, in fixed-point arithmetics (10 bit precision).
Definition: PerfectlyClearAdapter.cs:73
PerfectlyClearAdapter.PFCFACERECT.FAE3
int FAE3
Internal data for Face Aware Exposure.
Definition: PerfectlyClearAdapter.cs:84
PerfectlyClearAdapter.PFCFACERECT.confidence
int confidence
A numerical parameter describing the confidence attributed by the detection algorithm to each face.
Definition: PerfectlyClearAdapter.cs:79
PerfectlyClearAdapter.PFCFBFACEINFO1
Legacy structure defining face area detected from the SFB library.
Definition: PerfectlyClearAdapter.cs:37
APPLY_LOOKS_MISSING
@ APPLY_LOOKS_MISSING
-12 tried to apply a LUT but the LUTs file was not found
Definition: PerfectlyClearPro.h:396
PerfectlyClearAdapter.PFCFACERECT.rcEyeR
PFCRECT rcEyeR
Specifies the bounding rectangle of the right eye.
Definition: PerfectlyClearAdapter.cs:70
PerfectlyClearAdapter.PFCFACERECT.FAE2
int FAE2
Internal data for Face Aware Exposure.
Definition: PerfectlyClearAdapter.cs:83
PRESET_BEAUTIFY
@ PRESET_BEAUTIFY
Beautify - provides a good default set of corrections for portratis and other photos of people....
Definition: PerfectlyClearPro.h:174
PerfectlyClearAdapter.PFCV3PARAM.iFinishShadows
int iFinishShadows
Shadows correction amount.
Definition: PerfectlyClearAdapter.cs:582
PerfectlyClearAdapter.PFCPARAM.layer2
PFCV3PARAM layer2
params on layers 2 - fiinishing
Definition: PerfectlyClearAdapter.cs:610
PerfectlyClearAdapter.PFCNRPARAM
Structure encapsulating Noise Removal parameters.
Definition: PerfectlyClearAdapter.cs:499
BIAS_DONT_BOTHER
@ BIAS_DONT_BOTHER
Reserved, never use.
Definition: PerfectlyClearPro.h:292
PerfectlyClearAdapter.PFCFBPARAM.eLipSharpenType
LIPSHARPENTYPE eLipSharpenType
See definition of LIPSHARPENTYPE.
Definition: PerfectlyClearAdapter.cs:490
PFC_FB_WARNING
@ PFC_FB_WARNING
2 Warning: face not detected
Definition: PerfectlyClearPro.h:358
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1629
PerfectlyClearAdapter.PFCNRPARAM.iStrengthOffset
int iStrengthOffset
Offset to recommended level of noise removal strength. Range -5 to 5.
Definition: PerfectlyClearAdapter.cs:509
PerfectlyClearAdapter.PFCRE_STATUS
PFCRE_STATUS
Enumeration defining status of Red Eye pre-calculation.
Definition: PerfectlyClearAdapter.cs:302
PFC_RE_SUCCESS
@ PFC_RE_SUCCESS
0 Success
Definition: PerfectlyClearPro.h:371
PerfectlyClearAdapter.PFCCORE_STATUS
PFCCORE_STATUS
Enumeration defining status of Core pre-calculation.
Definition: PerfectlyClearAdapter.cs:265
PFC_PixelFormat32bppABGR
@ PFC_PixelFormat32bppABGR
Definition: PerfectlyClearPro.h:76
PerfectlyClearAdapter.PFCFBFACEINFO.PFCFBFACEINFO
PFCFBFACEINFO()
Class constructor.
Definition: PerfectlyClearAdapter.cs:51
PerfectlyClearAdapter.PFCFBPARAM.iSkinToning
int iSkinToning
Skin Toning level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:485
PerfectlyClearAdapter.PFCCOREPARAM.iBlackEnhancement
int iBlackEnhancement
Set luminance threshold for Noise Management. Range 0 to 25.
Definition: PerfectlyClearAdapter.cs:423
PFC_NR_NOTENABLED
@ PFC_NR_NOTENABLED
1 Feature not enabled
Definition: PerfectlyClearPro.h:333
LOAD_OK
@ LOAD_OK
Success.
Definition: PFCImageFile.h:20
PerfectlyClearAdapter.PFCCOREMask.type
PFCCORE_MASK_TYPE type
Mask type.
Definition: PerfectlyClearAdapter.cs:536
PRESET_VIVID
@ PRESET_VIVID
Vivid - good for landscapes and other general photography. This is in the 'Perfectly Clear Essentials...
Definition: PerfectlyClearPro.h:177
PerfectlyClearAdapter.PFCV3PARAM.iFinishBlacks
int iFinishBlacks
Blacks correction amount.
Definition: PerfectlyClearAdapter.cs:581
PerfectlyClearAdapter.PFCFACERECT.heightImage
int heightImage
image height
Definition: PerfectlyClearAdapter.cs:86
PerfectlyClearAdapter.PFCCOREPARAM.bEnabled
bool bEnabled
Set to true to enable the entire Core correction.
Definition: PerfectlyClearAdapter.cs:419
PerfectlyClearAdapter.PFCImageFile.PFC_FILETYPE
PFC_FILETYPE
ENUM to set the filetype of files / buffers.
Definition: PerfectlyClearAdapter.cs:2403
PFCImageFile
PFCImageFile Class to encapsulate file handling.
Definition: PFCImageFile.h:69
PerfectlyClearAdapter.PFCImageFile
PFCImageFile Class to encapsulate file handling.
Definition: PerfectlyClearAdapter.cs:2357
PFC_FB_ANALYSIS_FAILED
@ PFC_FB_ANALYSIS_FAILED
7 The face analysis did not complete successfully
Definition: PerfectlyClearPro.h:363
PerfectlyClearAdapter.PFCV3PARAM.iDynamicWB
int iDynamicWB
Reserved should be 0.
Definition: PerfectlyClearAdapter.cs:596
PerfectlyClearAdapter.PerfectlyClear.EnumFAEFaceRect
unsafe bool EnumFAEFaceRect(ref PFCFACERECT rect)
Allows the user to iterate over the known faces to FAE.
Definition: PerfectlyClearAdapter.cs:1983
PerfectlyClearAdapter.SKINSMOOTHTYPE
SKINSMOOTHTYPE
Enumeration defining types of Skin Smoothing correction.
Definition: PerfectlyClearAdapter.cs:392
PerfectlyClearAdapter.PFCFBPARAM.bDeFlash
bool bDeFlash
Set to TRUE to enable deflash.
Definition: PerfectlyClearAdapter.cs:473
PerfectlyClearAdapter.PFCCOREPARAM.iHighlightPreservation
int iHighlightPreservation
Amount of Highlight Preservation to apply. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:432
APPLY_WASM_EXPIRED_CERTIFICATE
@ APPLY_WASM_EXPIRED_CERTIFICATE
-10 WASM certificate has expired
Definition: PerfectlyClearPro.h:394
PerfectlyClearAdapter.PFCSTATUS
Struct PFCSTATUS Process status of all sub sectors.
Definition: PerfectlyClearAdapter.cs:618
PFC_REJECT_NONE
@ PFC_REJECT_NONE
Disable image rejection.
Definition: PerfectlyClearPro.h:403
PerfectlyClearAdapter.PFCPOINT
Struct defining a point.
Definition: PerfectlyClearAdapter.cs:20
PerfectlyClearAdapter.PFCPARAM.layer1
PFCV3PARAM layer1
params on layers 1 - bottom/outside, 2 - fiinishing
Definition: PerfectlyClearAdapter.cs:609
PFC_FB_CREATE_ENGINE_FAILED
@ PFC_FB_CREATE_ENGINE_FAILED
6 Unable to create SFB Engine object for processing
Definition: PerfectlyClearPro.h:362
PerfectlyClearAdapter.PFCFBFACEINFO.face
PFCRECT face
Bounding rectangle of detected face.
Definition: PerfectlyClearAdapter.cs:48
PerfectlyClearAdapter.PerfectlyClear.ReadScenePreset
int ReadScenePreset(ref PFCPARAM param, int scene)
Fill param for the scene from the engine with previously loaded scene presets with LoadScenePresets.
Definition: PerfectlyClearAdapter.cs:2067
PerfectlyClearAdapter.PerfectlyClear
Definition: PerfectlyClearAdapter.cs:633
PFC_RE_NO_MEMORY
@ PFC_RE_NO_MEMORY
6 Insufficient memory
Definition: PerfectlyClearPro.h:377
APPLY_NOSOURCE
@ APPLY_NOSOURCE
-4 Pointer pImage is NULL, source image missing
Definition: PerfectlyClearPro.h:388
PerfectlyClearAdapter.PFCFBPARAM.eSmoothType
SKINSMOOTHTYPE eSmoothType
See enum definition of SKINSMOOTHTYPE.
Definition: PerfectlyClearAdapter.cs:460
PerfectlyClearAdapter.PFCCOREPARAM.eTintMode
TINTCORRECTION eTintMode
ENUM value defined in TINTCORRECTION. It sets the aggressiveness of Tint Removal.
Definition: PerfectlyClearAdapter.cs:421
PerfectlyClearAdapter.PFCCOREMask.feather
float feather
relative length of gradient, from where it starts (1.0) to where it is 0.0,
Definition: PerfectlyClearAdapter.cs:542
TINTCORRECT_CONSERVATIVE
@ TINTCORRECT_CONSERVATIVE
Priority on minimum false positive detection.
Definition: PerfectlyClearPro.h:259
BIAS_ASIAN_PREFERENCE
@ BIAS_ASIAN_PREFERENCE
Fine tuned for Asian skin tone.
Definition: PerfectlyClearPro.h:289
PerfectlyClearAdapter.PerfectlyClear.Calc
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, PFCFEATURE feature, int ISO, string CameraModel, PFCREJECTOPTION rejectOption=PFCREJECTOPTION.PFC_REJECT_CLIPART)
Overload method for precalc analysis.
Definition: PerfectlyClearAdapter.cs:953
CALC_CARTOON_DETECTOR
@ CALC_CARTOON_DETECTOR
Calculate legacy cartoon detector.
Definition: PerfectlyClearPro.h:167
PerfectlyClearAdapter.PerfectlyClear.SetAddonPath
void SetAddonPath(string dirPath)
Set path to directory containing runtime add-ons such as .looks file(s) This enables searching for ad...
Definition: PerfectlyClearAdapter.cs:2099
PerfectlyClearAdapter.PerfectlyClear.ReadPresetsFromStream
int ReadPresetsFromStream(FileStream fs)
Read a preset from a file stream.
Definition: PerfectlyClearAdapter.cs:1698
PerfectlyClearAdapter.PerfectlyClear.GetScene
int GetScene(int *version)
Get scene detection label from profile obtained with Pfc.Calc For this to work you need to pass AI_SC...
Definition: PerfectlyClearAdapter.cs:2078
APPLY_ERROR_ENGINE_MISSING
@ APPLY_ERROR_ENGINE_MISSING
-2 Pointer pEngine is NULL
Definition: PerfectlyClearPro.h:386
PerfectlyClearAdapter.ADPTRRETURNCODE.WARNING
@ WARNING
Some warnings during processing.
PFC_FB_FUNCTION_ERROR
@ PFC_FB_FUNCTION_ERROR
5 Unable to locate function in the SFBEngine library
Definition: PerfectlyClearPro.h:361
PerfectlyClearAdapter.PFCFBPARAM.bEyeCirc
bool bEyeCirc
Set to TRUE to enable eye circle removal.
Definition: PerfectlyClearAdapter.cs:465
CALC_NOTINTCALC
@ CALC_NOTINTCALC
Skip pre-calculations on Abnormal Tint Correction during Core pre-calculations.
Definition: PerfectlyClearPro.h:164
PFC_CORE_BELOWMINSIZE
@ PFC_CORE_BELOWMINSIZE
6 Image skipped, too small ( < 32 pixels )
Definition: PerfectlyClearPro.h:350
PerfectlyClearAdapter.PerfectlyClear.GetCategorizationEngineInfo
bool GetCategorizationEngineInfo(int *groupUUID, int *arrProfileUUID, int *arrProfileUUIDLen)
Get loaded (with PFC_LoadAIEngine) categorization model info Call first with arrProfileUUID to get ar...
Definition: PerfectlyClearAdapter.cs:2091
PerfectlyClearAdapter.PFCFACERECT.ptEyeL
PFCPOINT ptEyeL
Specifies the x,y coordinates of the left eye, in fixed-point arithmetics (10 bit precision).
Definition: PerfectlyClearAdapter.cs:72
PerfectlyClearAdapter.PFCV3PARAM.lutInputCorrective
PFC3DLutInfo lutInputCorrective
LUT data to apply.
Definition: PerfectlyClearAdapter.cs:571
PerfectlyClearAdapter.PFCV3PARAM.iFinishTint
int iFinishTint
Tint correction amount.
Definition: PerfectlyClearAdapter.cs:579
PFC_RE_NOT_SUPPORTED
@ PFC_RE_NOT_SUPPORTED
8 Not supported
Definition: PerfectlyClearPro.h:379
PerfectlyClearAdapter.PFCImageFile.CompressImageBuffer
MemoryStream CompressImageBuffer(PFC_FILETYPE type, int jpegQuality=92, bool bConvertToOriginalColorSpace=true, bool bEmbedOriginalMetadata=true)
Write image data to MemoryStream.
Definition: PerfectlyClearAdapter.cs:2592
PerfectlyClearAdapter.PFCCOREMask.centerY
float centerY
Y of center.
Definition: PerfectlyClearAdapter.cs:538
PerfectlyClearAdapter
Definition: PerfectlyClearAdapter.cs:16