Perfectly Clear SDK Documentation  10.6.3.965
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  CALC_COMPOSITE = 1024,
110  CALC_SKINTONE = 2048,
111  CALC_AICOLOR = 4096
112 
113  };
114 
116 public enum PFCAIFEATURE
117 {
118  AI_SCENE_DETECTION = 1,
119  AI_CORRECTIONS = 2,
120  AI_COMPOSITE = 4,
121  AI_SKINTONE = 8,
122  AI_COLOR = 16
123 };
124 
126 public enum PFCPIXELFORMAT
127 {
240 };
241 
243 public enum PFCPRESETID
244 {
248  PRESET_VIVID,
255 
256 };
257 
259 public enum PFCNR_STATUS
260 {
269 };
270 
272 public enum PFCCORE_STATUS
273 {
282 };
283 
285 public enum PFCREJECTOPTION
286 {
287  PFC_REJECT_NONE = 0,
288  PFC_REJECT_MONOLITH = 1,
289  PFC_REJECT_CLIPART = 2
290 };
291 
293 public enum PFCFB_STATUS
294 {
306 };
307 
309 public enum PFCRE_STATUS
310 {
320 };
321 
323 public enum PFCAPPLYSTATUS
324 {
325  APPLY_SUCCESS = 0,
328  APPLY_CANCELLED = -3,
329  APPLY_NOSOURCE = -4,
330  APPLY_BADFORMAT = -5,
331  APPLY_INVALIDLICENSE = -6,
337  APPLY_LOOKS_MISSING = -12
338 };
339 
341 public enum TINTCORRECTION
342 {
347 };
348 
350 public enum AGGRESSIVENESS
351 {
352  CONSERVATIVE,
353  MODERATE,
354  AGGRESSIVE,
355 };
356 
358 public enum DCFMODE
359 {
362 };
363 
365 public enum CONTRASTMODE
366 {
367  HIGH_CONTRAST,
369 };
370 
372 public enum BIASMODE
373 {
374  BIAS_NONE,
379  BIAS_AUTO
380 };
381 
383 public enum ADPTRRETURNCODE
384 {
385  SUCCESS,
386  WARNING,
387  INTERNALERROR,
388  WRONG_FORMAT
389 };
390 
392 public enum SKINMODE
393 {
394  SKINMODE_FACE = 1,
396 };
397 
399 public enum SKINSMOOTHTYPE
400 {
404 };
405 
407 public enum SKINTONINGTYPE
408 {
414 };
415 
417 public enum LIPSHARPENTYPE
418 {
419  LIPSHARPENTYPE_FINE = 1,
422 };
423 
425 [StructLayout(LayoutKind.Sequential, Pack = 1)]
426 public struct SELECTIVECOLOR
427 {
428  public int r;
429  public int a;
430  public int m;
431  public int p;
432  public int H;
433  public int S;
434  public int L;
435 };
436 
438 public struct PFCCOREPARAM
439 {
440  public bool bEnabled;
441  public bool bAbnormalTintRemoval;
443  public float fTintScale;
444  public int iBlackEnhancement;
445  public bool bVibrancy;
446  public int iVibrancy;
447  public int iStrength;
448  public bool bContrast;
450  public int iContrast;
452  public float fBiasScale;
455  public bool bSharpen;
456  public float fSharpenScale;
458  public bool bUseFAE;
460  public int iMaxStrength;
461  public bool bInfrared;
462  public float fInfrared;
463  public bool bLightDiffusion;
464  public float fLightDiffusion;
465  public bool bDynamicRange;
466  public bool bDCF;
467  public DCFMODE eDCFMode;
468  public float fDCF;
469  public int iLocalContrast;
470  public bool bLocalContrast;
471  public int iMinStrength;
472  public int iSkintoneType;
473  public int iSkintoneStrengthLut;
475  public bool bSkintoneAuto;
477  public int iSplitColorWarm;
478  public int iSplitColorCold;
479  public bool bSelectiveColor;
488  };
489 
491 public struct PFCFBPARAM
492 {
493  public bool bEnabled;
494  public bool bSmooth;
495  public int iSmoothLevel;
498  public bool bEnlarge;
499  public int iEnlargeLevel;
500  public bool bEnhance;
501  public int iEnhanceLevel;
502  public bool bEyeCirc;
503  public int iEyeCirc;
504  public bool bTeeth;
505  public int iTeethLevel;
506  public bool bBlemish;
507  public int iBlemish;
508  public bool bSlim;
509  public int iSlim;
510  public bool bDeFlash;
511  public int iDeFlash;
512  public bool bCatchLight;
513  public int iCatchLight;
514  public int iCatchLightMode;
515  public bool bSkinToning;
522  public int iSkinToning;
525  public bool bLipSharpen;
526  public int iLipSharpen;
528  public bool bBlush;
529  public int iBlush;
530  public uint colorSkinToning;
531  public uint colorBlush;
532 };
533 
535 public unsafe struct PFCNRPARAM
536 {
537  public bool bEnabled;
538  public int iPreset;
539  public int iStrengthOffset;
547  public int iDetailOffset;
548 };
549 
551 public struct PFCREPARAM
552 {
553  public bool bEnabled;
554 };
555 
556 // V3 additions
557 public enum PFCCORE_MASK_TYPE
558 {
559  PFCCORE_MASK_NONE, // 0.0 everywhere, don't apply
560  PFCCORE_MASK_ALL, // 1.0 everywhere (background)
561  PFCCORE_MASK_RADIAL, // ellipse
562  PFCCORE_MASK_TOP, // linear from 1.0 on top
563  PFCCORE_MASK_BOTTOM, // linear from 1.0 on bottom
564  PFCCORE_MASK_ROUNDRECT // rounded rect
565 };
566 
567 /* Description of mask for grad filter, all coordinates are relative (Y/height, X/width) in final crop-rotated image */
571 public unsafe struct PFCCOREMask
572 {
573  public PFCCORE_MASK_TYPE type;
574  public float centerX;
575  public float centerY;
576  public float width;
577  public float height;
578  public float radius;
579  public float feather;
580  public float angle;
581  public float transparency;
582  [MarshalAsAttribute(UnmanagedType.I1)]
583  public bool invert;
584 };
585 
586 [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
588 public struct PFC3DLutInfo
589 {
590  [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 33)]
591  public string guid;
592 
593  public byte strength; // C++ unsigned char
594 }
595 
597 [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
598 public unsafe struct PFCV3PARAM
599 {
600  // Image Ambulance
601  [MarshalAsAttribute(UnmanagedType.I1)]
602  public bool bPreprocessEV;
603  public int iPreprocessEV;
604  // built-in 3D luts
605  public int iNeutralDensity;
606  public int iColorVibrancy;
607  public int iDarkSkin;
612  // custom output 3D Lut
614  // Finishing
615  public int iFinishTemp;
616  public int iFinishTint;
617  public int iFinishExposure;
618  public int iFinishBlacks;
619  public int iFinishShadows;
620  public int iFinishHighlights;
621  public int iFinishWhites;
622  public int iFinishSaturation;
623  public int iFinishVibrancy;
624  public int iFinishContrast;
626 
627  public int iDeltaR;
628  public int iDeltaG;
629  public int iDeltaB;
630 
631  public bool bDynamic;
632  public int iDynamic;
633  public int iDynamicWB;
634 
635  public int iOutLUTcontrast;
636  public int iOutLUTsaturation;
637 };
638 
640 [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
641 public unsafe struct DP2PARAM
642 {
643  public int iDensity;
644  public int iDeltaR;
645  public int iDeltaG;
646  public int iDeltaB;
647  public float fGamma;
648  public int iContrast;
649  public int iSaturation;
650  public int mode;
651  public bool bAuto;
652  public bool bEnable;
653 };
654 
655  [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
657 public struct PFCPARAM
658 {
660  public PFCFBPARAM fb;
661  public PFCNRPARAM nr;
662  public PFCREPARAM re;
663  public PFCV3PARAM v3;
670  public DP2PARAM dp2;
671  };
672 
674 public struct PFCSTATUS
675 {
676  public PFCCORE_STATUS CORE_Status;
677  public PFCNR_STATUS NR_Status;
678  public PFCFB_STATUS FB_Status;
679  public PFCRE_STATUS RE_Status;
680  public int Status;
681 }
682 
683 [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
685 public struct PFCSCENEDESCRIPTION
686  {
687  [MarshalAsAttribute(UnmanagedType.ByValTStr, SizeConst = 250)]
688  public string name;
689 
690  public int profileUUID; // C++ unsigned char
691 }
692 
699  public unsafe class PerfectlyClear : IDisposable
700  {
702  protected unsafe struct PFCENGINE
703  {
704  void* pEngine;
705  public uint status;
706  };
708  protected unsafe struct PerfectlyClearImageTransfer
709  {
710  public int width;
711  public int height;
712  public int rowBytes;
713  public int columnBytes;
714  public int data1;
715  public int data2;
716  public int data3;
717  };
718 
720  protected unsafe struct PFCIMAGEPROFILE
721  {
722  void* pPfcParam;
723  void* pNoiseParam;
724  void* pRedEyeParam;
725  void* pSFBParam;
726  void* pInternal;
727 
732 
733  public int Status;
734  };
741 
743  protected unsafe struct PFCIMAGE
744  {
745  public int width;
746  public int height;
747  public int stride;
749  public void* data;
750  };
751 
752 
753  protected PFCENGINE* m_pEngine;
754  protected PFCENGINE* m_pAiEngine;
755  int m_loadedAiEngineFeatures;
756  protected PFCIMAGEPROFILE* m_pProfile;
757  public PFCPARAM m_Param;
758  public PFCSTATUS LastStatus;
759  public PFCSTATUS LastAiStatus;
760  private bool releaseProtection = false;
761 
795  public static int SetProtectionPath(string path, string licenseCode)
796  {
797 #if PROTECTION_ENABLED
798  try
799  {
800  byte* pLicpath = null;
801  if (!String.IsNullOrEmpty(path))
802  {
803  pLicpath = GetCharBuffer(path);
804  }
805 
806  byte* pLicenseCode = null;
807  if (!String.IsNullOrEmpty(licenseCode)) {
808  pLicenseCode = GetCharBuffer(licenseCode);
809  }
810 
811  int status = PFC_SetProtectionPath(pLicpath, pLicenseCode);
812 
813  FreeCharBuffer(pLicpath);
814  FreeCharBuffer(pLicenseCode);
815  //Trace.WriteLine("status " + status.ToString());
816 
817  return status;
818  }
819  catch (Exception ex)
820  {
821  Trace.WriteLine(ex.Message);
822  return 100;
823  }
824 #endif
825  return 0;
826  }
827 
828 
834  public static void ReleaseProtectionPath()
835  {
836  PFC_ReleaseProtectionPath();
837  }
838 
845  public PerfectlyClear()
846  {
847  m_pEngine = null;
848  m_pProfile = null;
849  m_pAiEngine = null;
850  m_loadedAiEngineFeatures = 0;
851 
852  try
853  {
854  m_pEngine = PFC_CreateEngine();
855  if (m_pEngine != null)
856  {
857  LastStatus.Status = (int)(*m_pEngine).status;
858  }
859 
860  m_pAiEngine = PFC_CreateEngine();
861  if (m_pAiEngine != null)
862  {
863  LastAiStatus.Status = (int)(*m_pAiEngine).status;
864  }
865  }
866  catch (Exception ex)
867  {
868  Trace.WriteLine(ex.Message);
869  }
870 
871  PFC_SetParam(ref m_Param, PFCPRESETID.PRESET_IAUTO_PEOPLE);
872  }
873 
883  public PerfectlyClear(string path, string licenseCode = "")
884  {
885  m_pEngine = null;
886  m_pProfile = null;
887 
888 #if PROTECTION_ENABLED
889  try
890  {
891  byte* pLicpath = null;
892  if (!String.IsNullOrEmpty(path))
893  {
894  pLicpath = GetCharBuffer(path);
895  }
896 
897  byte* pLicenseCode = null;
898  if (!String.IsNullOrEmpty(licenseCode)) {
899  pLicenseCode = GetCharBuffer(licenseCode);
900  }
901 
902  int status = PFC_SetProtectionPath(pLicpath, pLicenseCode);
903  releaseProtection = true;
904 
905  FreeCharBuffer(pLicpath);
906  FreeCharBuffer(pLicenseCode);
907  //Trace.WriteLine("status " + status.ToString());
908  }
909  catch (Exception ex)
910  {
911  Trace.WriteLine(ex.Message);
912  }
913 #endif
914  try
915  {
916  m_pEngine = PFC_CreateEngine();
917  if (m_pEngine != null)
918  {
919  LastStatus.Status = (int)(*m_pEngine).status;
920  }
921 
922  m_pAiEngine = PFC_CreateEngine();
923  if (m_pAiEngine != null)
924  {
925  LastAiStatus.Status = (int)(*m_pAiEngine).status;
926  }
927  }
928  catch (Exception ex)
929  {
930  Trace.WriteLine(ex.Message);
931  }
932 
933  PFC_SetParam(ref m_Param, PFCPRESETID.PRESET_IAUTO_21);
934  }
935 
936  ~PerfectlyClear()
937  {
938 #if PROTECTION_ENABLED
939  if(releaseProtection) {
941  }
942 #endif
943  Dispose(false);
944  }
945 
951  public unsafe ADPTRRETURNCODE Calc(ref Bitmap bm)
952  {
953  return Calc(ref bm, PFCFEATURE.CALC_ALL, -1, null);
954  }
955 
961  public unsafe ADPTRRETURNCODE Calc(ref PFCImageFile imgfile)
962  {
963  return Calc(ref imgfile, PFCFEATURE.CALC_ALL, -1, null);
964  }
965 
972  public unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds)
973  {
974  return Calc(ref bm, ref bmds, PFCFEATURE.CALC_ALL, -1, null);
975  }
976 
983  public unsafe ADPTRRETURNCODE Calc(ref PFCImageFile imgfile, PFCFEATURE feature)
984  {
985  return Calc(ref imgfile, feature, -1, null);
986  }
987 
994  public unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, PFCFEATURE feature)
995  {
996  return Calc(ref bm, feature, -1, null);
997  }
998 
1006  public unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds, PFCFEATURE feature)
1007  {
1008  return Calc(ref bm, ref bmds, feature, -1, null);
1009  }
1010 
1020  public unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, PFCFEATURE feature, int ISO, string CameraModel, PFCREJECTOPTION rejectOption = PFCREJECTOPTION.PFC_REJECT_CLIPART)
1021  {
1022  BitmapData bd = null;
1023  Byte* pBase = null;
1024  bd = LockBitmapData(ref bm);
1025  if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
1026  bd.PixelFormat != PixelFormat.Format32bppArgb &&
1027  bd.PixelFormat != PixelFormat.Format48bppRgb &&
1028  bd.PixelFormat != PixelFormat.Format64bppArgb)
1029  {
1030  ReleaseBitmapData(ref bm, ref bd);
1031  return ADPTRRETURNCODE.WRONG_FORMAT;
1032  }
1033  pBase = (Byte*)bd.Scan0.ToPointer();
1034 
1035  PFCIMAGE im;
1036  im.width = bd.Width;
1037  im.height = bd.Height;
1038  im.stride = bd.Stride;
1039  switch (bd.PixelFormat)
1040  {
1041  default:
1042  case PixelFormat.Format24bppRgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat24bppRGB; break;
1043  case PixelFormat.Format32bppArgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat32bppARGB; break;
1044  case PixelFormat.Format48bppRgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat48bppRGB; break;
1045  case PixelFormat.Format64bppArgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat64bppARGB; break;
1046  }
1047  im.data = (void*)pBase;
1048 
1049  if (m_pProfile != null)
1050  PFC_ReleaseProfile(m_pProfile);
1051 
1052  byte* pModel = null;
1053  if (CameraModel != null)
1054  {
1055  pModel = GetCharBuffer(CameraModel);
1056  }
1057  m_pProfile = PFC_Calc(&im, null, m_pEngine, feature, ISO, pModel, null, null, (int)rejectOption, m_pAiEngine);
1058 
1059  FreeCharBuffer(pModel);
1060 
1061  ReleaseBitmapData(ref bm, ref bd);
1062 
1063  LastStatus.NR_Status = (*m_pProfile).NR_Status;
1064  LastStatus.CORE_Status = (*m_pProfile).CORE_Status;
1065  LastStatus.FB_Status = (*m_pProfile).FB_Status;
1066  LastStatus.RE_Status = (*m_pProfile).RE_Status;
1067  LastStatus.Status = (*m_pProfile).Status;
1068 
1069  return (LastStatus.Status == 0) ? ADPTRRETURNCODE.SUCCESS : ADPTRRETURNCODE.WARNING;
1070  }
1071 
1081  public unsafe ADPTRRETURNCODE Calc(ref PFCImageFile imgfile, PFCFEATURE feature, int ISO, string CameraModel, PFCREJECTOPTION rejectOption = PFCREJECTOPTION.PFC_REJECT_CLIPART)
1082  {
1083  PFCIMAGE im;
1084  im.width = imgfile.width();
1085  im.height = imgfile.height();
1086  im.stride = imgfile.stride();
1087  im.format = (PFCPIXELFORMAT)imgfile.pfcImageFormat();
1088  im.data = (void*)imgfile.raw_image();
1089 
1090  if (m_pProfile != null)
1091  PFC_ReleaseProfile(m_pProfile);
1092 
1093  byte* pModel = null;
1094  if (CameraModel != null)
1095  {
1096  pModel = GetCharBuffer(CameraModel);
1097  }
1098  m_pProfile = PFC_Calc(&im, null, m_pEngine, feature, ISO, pModel, null, null, (int)rejectOption, m_pAiEngine);
1099 
1100  FreeCharBuffer(pModel);
1101 
1102  LastStatus.NR_Status = (*m_pProfile).NR_Status;
1103  LastStatus.CORE_Status = (*m_pProfile).CORE_Status;
1104  LastStatus.FB_Status = (*m_pProfile).FB_Status;
1105  LastStatus.RE_Status = (*m_pProfile).RE_Status;
1106  LastStatus.Status = (*m_pProfile).Status;
1107 
1108  return (LastStatus.Status == 0) ? ADPTRRETURNCODE.SUCCESS : ADPTRRETURNCODE.WARNING;
1109  }
1110 
1120  public unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds, PFCFEATURE feature, int ISO, string CameraModel)
1121  {
1122  BitmapData bd = null;
1123  Byte* pBase = null;
1124  bd = LockBitmapData(ref bm);
1125  if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
1126  bd.PixelFormat != PixelFormat.Format32bppArgb &&
1127  bd.PixelFormat != PixelFormat.Format48bppRgb &&
1128  bd.PixelFormat != PixelFormat.Format64bppArgb)
1129  {
1130  ReleaseBitmapData(ref bm, ref bd);
1131  return ADPTRRETURNCODE.WRONG_FORMAT;
1132  }
1133  pBase = (Byte*)bd.Scan0.ToPointer();
1134 
1135  PFCIMAGE im;
1136  im.width = bd.Width;
1137  im.height = bd.Height;
1138  im.stride = bd.Stride;
1139  switch (bd.PixelFormat)
1140  {
1141  default:
1142  case PixelFormat.Format24bppRgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat24bppRGB; break;
1143  case PixelFormat.Format32bppArgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat32bppARGB; break;
1144  case PixelFormat.Format48bppRgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat48bppRGB; break;
1145  case PixelFormat.Format64bppArgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat64bppARGB; break;
1146  }
1147  im.data = (void*)pBase;
1148 
1149  BitmapData bdds = null;
1150  bdds = LockBitmapData(ref bmds);
1151  if (bdds.PixelFormat != PixelFormat.Format24bppRgb &&
1152  bdds.PixelFormat != PixelFormat.Format32bppArgb &&
1153  bdds.PixelFormat != PixelFormat.Format48bppRgb &&
1154  bdds.PixelFormat != PixelFormat.Format64bppArgb)
1155  {
1156  ReleaseBitmapData(ref bmds, ref bdds);
1157  return ADPTRRETURNCODE.WRONG_FORMAT;
1158  }
1159  pBase = (Byte*)bdds.Scan0.ToPointer();
1160 
1161  PFCIMAGE imds;
1162  imds.width = bdds.Width;
1163  imds.height = bdds.Height;
1164  imds.stride = bdds.Stride;
1165  switch (bdds.PixelFormat)
1166  {
1167  default:
1168  case PixelFormat.Format24bppRgb: imds.format = PFCPIXELFORMAT.PFC_PixelFormat24bppRGB; break;
1169  case PixelFormat.Format32bppArgb: imds.format = PFCPIXELFORMAT.PFC_PixelFormat32bppARGB; break;
1170  case PixelFormat.Format48bppRgb: imds.format = PFCPIXELFORMAT.PFC_PixelFormat48bppRGB; break;
1171  case PixelFormat.Format64bppArgb: imds.format = PFCPIXELFORMAT.PFC_PixelFormat64bppARGB; break;
1172  }
1173  imds.data = (void*)pBase;
1174 
1175  if (m_pProfile != null)
1176  PFC_ReleaseProfile(m_pProfile);
1177 
1178  byte* pModel = null;
1179  if (CameraModel != null)
1180  {
1181  pModel = GetCharBuffer(CameraModel);
1182  }
1183  m_pProfile = PFC_Calc(&im, &imds, m_pEngine, feature, ISO, pModel, null, null, 1, m_pAiEngine);
1184 
1185  FreeCharBuffer(pModel);
1186 
1187  ReleaseBitmapData(ref bm, ref bd);
1188  ReleaseBitmapData(ref bmds, ref bdds);
1189 
1190  LastStatus.NR_Status = (*m_pProfile).NR_Status;
1191  LastStatus.CORE_Status = (*m_pProfile).CORE_Status;
1192  LastStatus.FB_Status = (*m_pProfile).FB_Status;
1193  LastStatus.RE_Status = (*m_pProfile).RE_Status;
1194  LastStatus.Status = (*m_pProfile).Status;
1195 
1196  return (LastStatus.Status == 0) ? ADPTRRETURNCODE.SUCCESS : ADPTRRETURNCODE.WARNING;
1197  }
1198 
1205  public unsafe PFCAPPLYSTATUS Apply(ref Bitmap bm)
1206  {
1207  return Apply(ref bm, 100);
1208  }
1209 
1215  public unsafe PFCAPPLYSTATUS Apply(ref PFCImageFile imgfile)
1216  {
1217  return Apply(ref imgfile, 100);
1218  }
1219 
1226  public unsafe PFCAPPLYSTATUS Apply(ref Bitmap bm, int iOpacity)
1227  {
1228  if (m_pProfile == null)
1229  {
1230  return PFCAPPLYSTATUS.APPLY_ERROR_PROFILE_MISSING;
1231  }
1232 
1233  BitmapData bd = null;
1234  Byte* pBase = null;
1235  bd = LockBitmapData(ref bm);
1236  if (bd.PixelFormat != PixelFormat.Format24bppRgb &&
1237  bd.PixelFormat != PixelFormat.Format32bppArgb &&
1238  bd.PixelFormat != PixelFormat.Format48bppRgb &&
1239  bd.PixelFormat != PixelFormat.Format64bppArgb)
1240  {
1241  ReleaseBitmapData(ref bm, ref bd);
1242  return PFCAPPLYSTATUS.APPLY_BADFORMAT;
1243  }
1244  pBase = (Byte*)bd.Scan0.ToPointer();
1245 
1246  PFCIMAGE im;
1247  im.width = bd.Width;
1248  im.height = bd.Height;
1249  im.stride = bd.Stride;
1250  switch (bd.PixelFormat)
1251  {
1252  default:
1253  case PixelFormat.Format24bppRgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat24bppRGB; break;
1254  case PixelFormat.Format32bppArgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat32bppARGB; break;
1255  case PixelFormat.Format48bppRgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat48bppRGB; break;
1256  case PixelFormat.Format64bppArgb: im.format = PFCPIXELFORMAT.PFC_PixelFormat64bppARGB; break;
1257  }
1258  im.data = (void*)pBase;
1259 
1260  PFCAPPLYSTATUS ret = PFC_Apply(&im, m_pEngine, m_pProfile, ref m_Param, null, iOpacity, null);
1261 
1262  if (ret > 0)
1263  {
1264  int code = (int)ret;
1265  // Get individual return codes
1266  LastStatus.NR_Status = (PFCNR_STATUS)(code & 0x000000FF);
1267  LastStatus.CORE_Status = (PFCCORE_STATUS)((code >> 8) & 0x000000FF);
1268  LastStatus.FB_Status = (PFCFB_STATUS)((code >> 16) & 0x000000FF);
1269  LastStatus.RE_Status = (PFCRE_STATUS)((code >> 24) & 0x000000FF);
1270  LastStatus.Status = code;
1271  }
1272 
1273  ReleaseBitmapData(ref bm, ref bd);
1274  return ret;
1275  }
1276 
1283  public unsafe PFCAPPLYSTATUS Apply(ref PFCImageFile imgfile, int iOpacity)
1284  {
1285  if (m_pProfile == null)
1286  {
1287  return PFCAPPLYSTATUS.APPLY_ERROR_PROFILE_MISSING;
1288  }
1289 
1290  PFCIMAGE im;
1291  im.width = imgfile.width();
1292  im.height = imgfile.height();
1293  im.stride = imgfile.stride();
1294  im.format = (PFCPIXELFORMAT)imgfile.pfcImageFormat();
1295  im.data = (void*)imgfile.raw_image();
1296 
1297  PFCAPPLYSTATUS ret = PFC_Apply(&im, m_pEngine, m_pProfile, ref m_Param, null, iOpacity, null);
1298 
1299  if (ret > 0)
1300  {
1301  int code = (int)ret;
1302  // Get individual return codes
1303  LastStatus.NR_Status = (PFCNR_STATUS)(code & 0x000000FF);
1304  LastStatus.CORE_Status = (PFCCORE_STATUS)((code >> 8) & 0x000000FF);
1305  LastStatus.FB_Status = (PFCFB_STATUS)((code >> 16) & 0x000000FF);
1306  LastStatus.RE_Status = (PFCRE_STATUS)((code >> 24) & 0x000000FF);
1307  LastStatus.Status = code;
1308  }
1309 
1310  return ret;
1311  }
1312 
1344  public int AutoCorrect(ref Bitmap bm)
1345  {
1346  return AutoCorrect(ref bm, -1, null, false);
1347  }
1348 
1354  public int AutoCorrect(ref PFCImageFile imgfile)
1355  {
1356  return AutoCorrect(ref imgfile, -1, null, false);
1357  }
1358 
1366  public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds)
1367  {
1368  return AutoCorrect(ref bm, ref bmds, -1, null, false);
1369  }
1370 
1379  public int AutoCorrect(ref Bitmap bm, int ISO, string CameraModel, bool bFastFAE)
1380  {
1381  if(((PFCAIFEATURE)m_loadedAiEngineFeatures & PFCAIFEATURE.AI_SCENE_DETECTION) == PFCAIFEATURE.AI_SCENE_DETECTION) {
1382  ADPTRRETURNCODE sdRet = Calc(ref bm, PFCFEATURE.CALC_SCENE_DETECTION, ISO, CameraModel);
1383  if (sdRet == ADPTRRETURNCODE.SUCCESS) {
1384  int version = 0;
1385  int detectedCategory = GetScene(&version);
1386  if (detectedCategory >= 0) {
1387  PFCPARAM categoryParam = new PFCPARAM();
1388  if (0 == ReadScenePreset(ref categoryParam, detectedCategory)) {
1389  m_Param = categoryParam;
1390  }
1391  }
1392  }
1393  }
1394 
1395  PFCFEATURE feature = 0;
1396  if (m_Param.nr.bEnabled)
1397  feature |= PFCFEATURE.CALC_NR;
1398  if (m_Param.core.bEnabled)
1399  feature |= PFCFEATURE.CALC_CORE;
1400  if (m_Param.fb.bEnabled)
1401  feature |= PFCFEATURE.CALC_FB;
1402  if (m_Param.re.bEnabled)
1403  feature |= PFCFEATURE.CALC_RE;
1404  if (!m_Param.core.bAbnormalTintRemoval)
1405  feature |= PFCFEATURE.CALC_NOTINTCALC;
1406  // Any FAE optimization
1407  if (m_Param.core.bUseFAE)
1408  {
1409  if (bFastFAE)
1410  feature |= PFCFEATURE.CALC_FAEHISPEED;
1411  }
1412  else
1413  {
1414  feature |= PFCFEATURE.CALC_NOFAE;
1415  }
1416  if (m_Param.core.bSkintoneAuto)
1417  {
1418  feature |= PFCFEATURE.CALC_SCENE_DETECTION;
1419  }
1420  if (m_Param.dp2.bEnable && m_Param.dp2.bAuto)
1421  {
1422  feature |= PFCFEATURE.CALC_AICOLOR;
1423  }
1424 
1425  ADPTRRETURNCODE ret = Calc(ref bm, 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 bm);
1451  return (int)aret;
1452  }
1453  }
1454 
1463  public int AutoCorrect(ref PFCImageFile imgfile, int ISO, string CameraModel, bool bFastFAE)
1464  {
1465  if(((PFCAIFEATURE)m_loadedAiEngineFeatures & PFCAIFEATURE.AI_SCENE_DETECTION) == PFCAIFEATURE.AI_SCENE_DETECTION) {
1466  ADPTRRETURNCODE sdRet = Calc(ref imgfile, PFCFEATURE.CALC_SCENE_DETECTION, ISO, CameraModel);
1467  if (sdRet == ADPTRRETURNCODE.SUCCESS) {
1468  int version = 0;
1469  int detectedCategory = GetScene(&version);
1470  if (detectedCategory >= 0) {
1471  PFCPARAM categoryParam = new PFCPARAM();
1472  if (0 == ReadScenePreset(ref categoryParam, detectedCategory)) {
1473  m_Param = categoryParam;
1474  }
1475  }
1476  }
1477  }
1478 
1479  PFCFEATURE feature = 0;
1480  if (m_Param.nr.bEnabled)
1481  feature |= PFCFEATURE.CALC_NR;
1482  if (m_Param.core.bEnabled)
1483  feature |= PFCFEATURE.CALC_CORE;
1484  if (m_Param.fb.bEnabled)
1485  feature |= PFCFEATURE.CALC_FB;
1486  if (m_Param.re.bEnabled)
1487  feature |= PFCFEATURE.CALC_RE;
1488  if (!m_Param.core.bAbnormalTintRemoval)
1489  feature |= PFCFEATURE.CALC_NOTINTCALC;
1490  // Any FAE optimization
1491  if (m_Param.core.bUseFAE)
1492  {
1493  if (bFastFAE)
1494  feature |= PFCFEATURE.CALC_FAEHISPEED;
1495  }
1496  else
1497  {
1498  feature |= PFCFEATURE.CALC_NOFAE;
1499  }
1500  if (m_Param.core.bSkintoneAuto)
1501  {
1502  feature |= PFCFEATURE.CALC_SCENE_DETECTION;
1503  }
1504  if (m_Param.dp2.bEnable && m_Param.dp2.bAuto)
1505  {
1506  feature |= PFCFEATURE.CALC_AICOLOR;
1507  }
1508 
1509  ADPTRRETURNCODE ret = Calc(ref imgfile, feature, ISO, CameraModel);
1510 
1511  if (ret != ADPTRRETURNCODE.SUCCESS)
1512  {
1513  PFCNR_STATUS retNR = LastStatus.NR_Status;
1514  if (retNR == PFCNR_STATUS.PFC_NR_NOTFOUND || retNR == PFCNR_STATUS.PFC_NR_NOTENABLED)
1515  retNR = PFCNR_STATUS.PFC_NR_SUCCESS;
1516 
1517  PFCCORE_STATUS retCORE = LastStatus.CORE_Status;
1518  if (retCORE == PFCCORE_STATUS.PFC_CORE_NOTENABLED)
1519  retCORE = PFCCORE_STATUS.PFC_CORE_SUCCESS;
1520 
1521  PFCFB_STATUS retFB = LastStatus.FB_Status;
1522  if (retFB == PFCFB_STATUS.PFC_FB_NOTENABLED || retFB == PFCFB_STATUS.PFC_FB_WARNING)
1523  retFB = PFCFB_STATUS.PFC_FB_SUCCESS;
1524 
1525  PFCRE_STATUS retRE = LastStatus.RE_Status;
1526  if (retRE == PFCRE_STATUS.PFC_RE_NOTENABLED || retRE == PFCRE_STATUS.PFC_RE_NOT_FOUND)
1527  retRE = PFCRE_STATUS.PFC_RE_SUCCESS;
1528 
1529  int retInt = (((((((int)retRE << 8) | (int)retFB) << 8) | (int)retCORE) << 8) | (int)retNR);
1530  return retInt;
1531  }
1532  else
1533  {
1534  PFCAPPLYSTATUS aret = Apply(ref imgfile);
1535  return (int)aret;
1536  }
1537  }
1538 
1548  public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, int ISO, string CameraModel, bool bFastFAE)
1549  {
1550  if(((PFCAIFEATURE)m_loadedAiEngineFeatures & PFCAIFEATURE.AI_SCENE_DETECTION) == PFCAIFEATURE.AI_SCENE_DETECTION) {
1551  ADPTRRETURNCODE sdRet = Calc(ref bm, PFCFEATURE.CALC_SCENE_DETECTION, ISO, CameraModel);
1552  if (sdRet == ADPTRRETURNCODE.SUCCESS) {
1553  int version = 0;
1554  int detectedCategory = GetScene(&version);
1555  if (detectedCategory >= 0) {
1556  PFCPARAM categoryParam = new PFCPARAM();
1557  if (0 == ReadScenePreset(ref categoryParam, detectedCategory)) {
1558  m_Param = categoryParam;
1559  }
1560  }
1561  }
1562  }
1563 
1564  PFCFEATURE feature = 0;
1565  if (m_Param.nr.bEnabled)
1566  feature |= PFCFEATURE.CALC_NR;
1567  if (m_Param.core.bEnabled)
1568  feature |= PFCFEATURE.CALC_CORE;
1569  if (m_Param.fb.bEnabled)
1570  feature |= PFCFEATURE.CALC_FB;
1571  if (m_Param.re.bEnabled)
1572  feature |= PFCFEATURE.CALC_RE;
1573  if (!m_Param.core.bAbnormalTintRemoval)
1574  feature |= PFCFEATURE.CALC_NOTINTCALC;
1575  // Any FAE optimization
1576  if (m_Param.core.bUseFAE)
1577  {
1578  if (bFastFAE)
1579  feature |= PFCFEATURE.CALC_FAEHISPEED;
1580  }
1581  else
1582  {
1583  feature |= PFCFEATURE.CALC_NOFAE;
1584  }
1585  if (m_Param.core.bSkintoneAuto)
1586  {
1587  feature |= PFCFEATURE.CALC_SCENE_DETECTION;
1588  }
1589  if (m_Param.dp2.bEnable && m_Param.dp2.bAuto)
1590  {
1591  feature |= PFCFEATURE.CALC_AICOLOR;
1592  }
1593 
1594  ADPTRRETURNCODE ret = Calc(ref bm, ref bmds, feature, ISO, CameraModel);
1595 
1596  if (ret != ADPTRRETURNCODE.SUCCESS)
1597  {
1598  PFCNR_STATUS retNR = LastStatus.NR_Status;
1599  if (retNR == PFCNR_STATUS.PFC_NR_NOTFOUND || retNR == PFCNR_STATUS.PFC_NR_NOTENABLED)
1600  retNR = PFCNR_STATUS.PFC_NR_SUCCESS;
1601 
1602  PFCCORE_STATUS retCORE = LastStatus.CORE_Status;
1603  if (retCORE == PFCCORE_STATUS.PFC_CORE_NOTENABLED)
1604  retCORE = PFCCORE_STATUS.PFC_CORE_SUCCESS;
1605 
1606  PFCFB_STATUS retFB = LastStatus.FB_Status;
1607  if (retFB == PFCFB_STATUS.PFC_FB_NOTENABLED || retFB == PFCFB_STATUS.PFC_FB_WARNING)
1608  retFB = PFCFB_STATUS.PFC_FB_SUCCESS;
1609 
1610  PFCRE_STATUS retRE = LastStatus.RE_Status;
1611  if (retRE == PFCRE_STATUS.PFC_RE_NOTENABLED || retRE == PFCRE_STATUS.PFC_RE_NOT_FOUND)
1612  retRE = PFCRE_STATUS.PFC_RE_SUCCESS;
1613 
1614  int retInt = (((((((int)retRE << 8) | (int)retFB) << 8) | (int)retCORE) << 8) | (int)retNR);
1615  return retInt;
1616  }
1617  else
1618  {
1619  PFCAPPLYSTATUS aret = Apply(ref bm);
1620  return (int)aret;
1621  }
1622  }
1623 
1630  public int AutoCorrect(ref Bitmap bm, string pathPreset)
1631  {
1632  int retCode = ReadPresets(pathPreset);
1633  if (retCode == 0)
1634  {
1635  return AutoCorrect(ref bm, -1, null, false);
1636  }
1637  return retCode-1000;
1638  }
1639 
1646  public int AutoCorrect(ref PFCImageFile imgfile, string pathPreset)
1647  {
1648  int retCode = ReadPresets(pathPreset);
1649  if (retCode == 0)
1650  {
1651  return AutoCorrect(ref imgfile, -1, null, false);
1652  }
1653  return retCode - 1000;
1654  }
1655 
1663  public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, string pathPreset)
1664  {
1665  int retCode = ReadPresets(pathPreset);
1666  if (retCode == 0)
1667  {
1668  return AutoCorrect(ref bm, ref bmds, -1, null, false);
1669  }
1670  return retCode - 1000;
1671  }
1672 
1682  public int AutoCorrect(ref Bitmap bm, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
1683  {
1684  int retCode = ReadPresets(pathPreset);
1685  if (retCode == 0)
1686  {
1687  return AutoCorrect(ref bm, ISO, CameraModel, bFastFAE);
1688  }
1689  return retCode - 1000;
1690  }
1691 
1701  public int AutoCorrect(ref PFCImageFile imgfile, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
1702  {
1703  int retCode = ReadPresets(pathPreset);
1704  if (retCode == 0)
1705  {
1706  return AutoCorrect(ref imgfile, ISO, CameraModel, bFastFAE);
1707  }
1708  return retCode - 1000;
1709  }
1710 
1721  public int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
1722  {
1723  int retCode = ReadPresets(pathPreset);
1724  if (retCode == 0)
1725  {
1726  return AutoCorrect(ref bm, ref bmds, ISO, CameraModel, bFastFAE);
1727  }
1728  return retCode - 1000;
1729  }
1730 
1735  public void SetParam(PFCPRESETID id)
1736  {
1737  PFC_SetParam(ref m_Param, id);
1738  }
1739 
1759  public int ReadPresets(string path)
1760  {
1761  try
1762  {
1763  byte* presetpath = null;
1764  if (path != null)
1765  {
1766  presetpath = GetCharBuffer(path);
1767  }
1768 
1769  int status = PFC_ReadPresets(ref m_Param, presetpath);
1770  //Trace.WriteLine("status " + status.ToString());
1771  return status;
1772  }
1773  catch (Exception ex)
1774  {
1775  Trace.WriteLine(ex.Message);
1776  }
1777  return -8;
1778  }
1779 
1794  public int ReadPresetsFromStream(FileStream fs)
1795  {
1796  try
1797  {
1798  long len = fs.Length;
1799  byte[] buffer = new byte[len + 1];
1800  int size = (int)len;
1801  fs.Read(buffer, 0, size);
1802  buffer[size] = 0;
1803  byte* b = GetCharBuffer(buffer);
1804  // PFC_ReadPresetsFromStream return codes
1805  // 0 - success
1806  // -3 - Stream read error.
1807  // -4 - Parse error.
1808  int status = PFC_ReadPresetsFromStream(ref m_Param, b);
1809  FreeCharBuffer(b);
1810  return status;
1811  }
1812  catch (Exception ex)
1813  {
1814  Trace.WriteLine(ex.Message);
1815  }
1816  return -8;
1817  }
1818 
1824  {
1825  return PFC_HasFaceBeautification(m_pEngine);
1826  }
1827 
1833  public int FBFaceCount()
1834  {
1835  return PFC_FBFaceCount(m_pProfile);
1836  }
1837 
1846  public bool GetFaceInfo(ref PFCFBFACEINFO info, int index)
1847  {
1848  PFCFBFACEINFO1 fi;
1849  bool ret = PFC_GetFaceInfo(m_pProfile, &fi, index);
1850  info.face.left = fi.face.left;
1851  info.face.top = fi.face.top;
1852  info.face.width = fi.face.width;
1853  info.face.height = fi.face.height;
1854  info.leftEye.x = fi.leftEye.x;
1855  info.leftEye.y = fi.leftEye.y;
1856  info.rightEye.x = fi.rightEye.x;
1857  info.rightEye.y = fi.rightEye.y;
1858  return ret;
1859  }
1860 
1866  public bool AbnormalTintDetected(TINTCORRECTION eTintMethod)
1867  {
1868  return PFC_AbnormalTintDetected(m_pProfile, eTintMethod);
1869  }
1870 
1876  public void ApplyStrengthToParam(int strength)
1877  {
1878  PFC_ApplyStrengthToParam(ref m_Param, strength);
1879  }
1880 
1881  protected BitmapData LockBitmapData(ref Bitmap bm)
1882  {
1883  GraphicsUnit unit = GraphicsUnit.Pixel;
1884  RectangleF boundsF = bm.GetBounds(ref unit);
1885  Rectangle bounds = new Rectangle((int)boundsF.X,
1886  (int)boundsF.Y,
1887  (int)boundsF.Width,
1888  (int)boundsF.Height);
1889 
1890  BitmapData bitmapData =
1891  bm.LockBits(bounds, ImageLockMode.ReadWrite, bm.PixelFormat);
1892  return bitmapData;
1893  }
1894 
1895  protected void ReleaseBitmapData(ref Bitmap bm, ref BitmapData bitmapData)
1896  {
1897  bm.UnlockBits(bitmapData);
1898  }
1899 
1900  protected Bitmap DupBitmap(ref Bitmap bm)
1901  {
1902  PerfectlyClearImageTransfer tr, tr1;
1903  Byte* pBase = null;
1904  GraphicsUnit unit = GraphicsUnit.Pixel;
1905  RectangleF boundsF = bm.GetBounds(ref unit);
1906  Rectangle bounds = new Rectangle((int)boundsF.X,
1907  (int)boundsF.Y,
1908  (int)boundsF.Width,
1909  (int)boundsF.Height);
1910  BitmapData bd = bm.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
1911  Bitmap bm1 = new Bitmap(bd.Width, bd.Height, PixelFormat.Format24bppRgb);
1912  BitmapData bd1 = LockBitmapData(ref bm1);
1913  pBase = (Byte*)bd.Scan0.ToPointer();
1914  tr.columnBytes = (bd.PixelFormat == PixelFormat.Format24bppRgb) ? 3 : 4;
1915  tr.rowBytes = bd.Stride;
1916  tr.height = bd.Height;
1917  tr.width = bd.Width;
1918  tr.data1 = (int)(pBase + 2);
1919  tr.data2 = (int)(pBase + 1);
1920  tr.data3 = (int)pBase;
1921  pBase = (Byte*)bd1.Scan0.ToPointer();
1922  tr1.columnBytes = (bd1.PixelFormat == PixelFormat.Format24bppRgb) ? 3 : 4;
1923  tr1.rowBytes = bd1.Stride;
1924  tr1.height = bd1.Height;
1925  tr1.width = bd1.Width;
1926  tr1.data1 = (int)(pBase + 2);
1927  tr1.data2 = (int)(pBase + 1);
1928  tr1.data3 = (int)pBase;
1929  for (int i = 0; i < tr.height; i++)
1930  {
1931  for (int j = 0; j < tr.width; j++)
1932  {
1933  ((Byte*)tr1.data1)[j * tr1.columnBytes] = ((Byte*)tr.data1)[j * tr.columnBytes];
1934  ((Byte*)tr1.data2)[j * tr1.columnBytes] = ((Byte*)tr.data2)[j * tr.columnBytes];
1935  ((Byte*)tr1.data3)[j * tr1.columnBytes] = ((Byte*)tr.data3)[j * tr.columnBytes];
1936  }
1937  tr.data1 += (int)tr.rowBytes;
1938  tr.data2 += (int)tr.rowBytes;
1939  tr.data3 += (int)tr.rowBytes;
1940  tr1.data1 += (int)tr1.rowBytes;
1941  tr1.data2 += (int)tr1.rowBytes;
1942  tr1.data3 += (int)tr1.rowBytes;
1943  }
1944  ReleaseBitmapData(ref bm1, ref bd1);
1945  ReleaseBitmapData(ref bm, ref bd);
1946  return bm1;
1947  }
1948 
1949  protected Bitmap BW2RGB(ref Bitmap bm)
1950  {
1951  Byte* pBase = null;
1952  Byte* pBase1 = null;
1953  GraphicsUnit unit = GraphicsUnit.Pixel;
1954  RectangleF boundsF = bm.GetBounds(ref unit);
1955  Rectangle bounds = new Rectangle((int)boundsF.X,
1956  (int)boundsF.Y,
1957  (int)boundsF.Width,
1958  (int)boundsF.Height);
1959  BitmapData bd = bm.LockBits(bounds, ImageLockMode.ReadOnly, PixelFormat.Format8bppIndexed);
1960  Bitmap bm1 = new Bitmap(bd.Width, bd.Height, PixelFormat.Format24bppRgb);
1961  BitmapData bd1 = LockBitmapData(ref bm1);
1962  pBase = (Byte*)bd.Scan0.ToPointer();
1963  pBase1 = (Byte*)bd1.Scan0.ToPointer();
1964  for (int i = 0; i < bd.Height; i++)
1965  {
1966  for (int j = 0; j < bd.Width; j++)
1967  {
1968  pBase1[j * 3] = pBase[j];
1969  pBase1[j * 3 + 1] = pBase[j];
1970  pBase1[j * 3 + 2] = pBase[j];
1971  }
1972  pBase += bd.Stride;
1973  pBase1 += bd1.Stride;
1974  }
1975  ReleaseBitmapData(ref bm1, ref bd1);
1976  ReleaseBitmapData(ref bm, ref bd);
1977  return bm1;
1978  }
1979 
1987  public Bitmap ReadImage(string filename)
1988  {
1989  Bitmap bm = null;
1990  Bitmap myBitmap = new Bitmap(filename);
1991  if ((myBitmap.Flags & (int)ImageFlags.ColorSpaceYcck) != 0)
1992  {
1993  bm = DupBitmap(ref myBitmap);
1994  myBitmap.Dispose();
1995  }
1996  else
1997  {
1998  if (myBitmap.PixelFormat == PixelFormat.Format8bppIndexed)
1999  {
2000  bm = BW2RGB(ref myBitmap);
2001  myBitmap.Dispose();
2002  }
2003  else
2004  {
2005  bm = myBitmap;
2006  }
2007  }
2008  return bm;
2009  }
2010 
2011  protected Bitmap GetStatImage(ref Bitmap bm, int iMaxDimension)
2012  {
2013  // Build max dim reference image
2014  bool bNeedResize = true;
2015  int w, h, w1, h1;
2016  w = bm.Width;
2017  h = bm.Height;
2018  // Calculate size of reference image. One dimension is 1024.
2019  if (w > h)
2020  {
2021  if (w <= iMaxDimension)
2022  bNeedResize = false;
2023  w1 = iMaxDimension;
2024  h1 = w1 * h / w;
2025  }
2026  else
2027  {
2028  if (h <= iMaxDimension)
2029  bNeedResize = false;
2030  h1 = iMaxDimension;
2031  w1 = h1 * w / h;
2032  }
2033 
2034  if (bNeedResize)
2035  {
2036  //
2037  // Step 2.
2038  // Create temporary bitmap to assist red eye analysis.
2039  //
2040  Bitmap bmds = new Bitmap(w1, h1, bm.PixelFormat);
2041  {
2042  using (Graphics gr = Graphics.FromImage(bmds))
2043  {
2044  gr.SmoothingMode = SmoothingMode.HighQuality;
2045  gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
2046  gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
2047  gr.DrawImage(bm, new Rectangle(0, 0, w1, h1));
2048  }
2049  }
2050 
2051  return bmds;
2052  }
2053  else
2054  {
2055  Bitmap bmds = (Bitmap)bm.Clone();
2056  return bmds;
2057  }
2058  }
2059 
2079  public unsafe bool EnumFAEFaceRect(ref PFCFACERECT rect)
2080  {
2081  IntPtr wrapped = rect.pWrapped;
2082  IntPtr pRect = (IntPtr) PFC_EnumFAEFaceRect(m_pProfile, (void*)wrapped);
2083 
2084  if (pRect != IntPtr.Zero) {
2085  PFCFACERECT newRect = (PFCFACERECT) Marshal.PtrToStructure(pRect, typeof(PFCFACERECT));
2086  rect = newRect;
2087  rect.pWrapped = (IntPtr)pRect;
2088  return true;
2089  }
2090 
2091  rect.pWrapped = IntPtr.Zero;
2092  return false;
2093  }
2094 
2099  public int FAEFaceCount()
2100  {
2101  return PFC_FAEFaceCount(m_pProfile);
2102  }
2103 
2110  public int LoadAiEngine(PFCAIFEATURE aifeatures, string binPath)
2111  {
2112  byte* path = null;
2113  if (binPath != null)
2114  {
2115  path = GetCharBuffer(binPath);
2116  }
2117  int result = PFC_LoadAIEngine(m_pAiEngine, aifeatures, path);
2118  m_loadedAiEngineFeatures = result;
2119 
2120  if(((PFCAIFEATURE)m_loadedAiEngineFeatures & PFCAIFEATURE.AI_CORRECTIONS) == PFCAIFEATURE.AI_CORRECTIONS) {
2121  PFC_LoadAIEngine(m_pEngine, PFCAIFEATURE.AI_CORRECTIONS, path);
2122  }
2123 
2124  FreeCharBuffer(path);
2125 
2126  if(((PFCAIFEATURE)m_loadedAiEngineFeatures & PFCAIFEATURE.AI_SCENE_DETECTION) == PFCAIFEATURE.AI_SCENE_DETECTION) {
2127  LoadScenePresets(null);
2128  }
2129 
2130  return result;
2131  }
2132 
2133 
2144  public unsafe int LoadScenePresets(string filePath, int groupUUID = 0, int* arrProfileUUID = null, int arrProfileUUIDLen = 0)
2145  {
2146  byte* path = null;
2147  if (filePath != null)
2148  {
2149  path = GetCharBuffer(filePath);
2150  }
2151  int result = PFC_LoadScenePresets(m_pAiEngine, path, groupUUID, arrProfileUUID, arrProfileUUIDLen);
2152  FreeCharBuffer(path);
2153  return result;
2154  }
2155 
2163  public int ReadScenePreset(ref PFCPARAM param, int scene)
2164  {
2165  return PFC_ReadScenePreset(ref param, m_pAiEngine, scene);
2166  }
2167 
2174  public int GetScene(int* version)
2175  {
2176  return PFC_GetScene(m_pProfile, version);
2177  }
2178 
2187  public bool GetCategorizationEngineInfo(int* groupUUID, int* arrProfileUUID, int* arrProfileUUIDLen)
2188  {
2189  return PFC_GetSceneDetectionEngineInfo(m_pAiEngine, groupUUID, arrProfileUUID, arrProfileUUIDLen);
2190  }
2191 
2195  public void SetAddonPath(string dirPath)
2196  {
2197  byte* path = null;
2198  if (dirPath != null)
2199  {
2200  path = GetCharBuffer(dirPath);
2201  }
2202  PFC_SetAddonPath(path);
2203  FreeCharBuffer(path);
2204  }
2205 
2222  public bool GetSceneDescription(int index, ref PFCSCENEDESCRIPTION sceneDescription)
2223  {
2224  bool result = PFC_GetSceneDescription(m_pAiEngine, index, ref sceneDescription);
2225  return result;
2226  }
2227 
2228  public void Dispose()
2229  {
2230  Dispose(true);
2231  GC.SuppressFinalize(this);
2232  }
2233 
2234  protected virtual void Dispose(bool disposing)
2235  {
2236  if (disposing)
2237  {
2238  }
2239 
2240  if (m_pProfile != null)
2241  {
2242  PFC_ReleaseProfile(m_pProfile);
2243  m_pProfile = null;
2244  }
2245 
2246  if (m_pEngine != null)
2247  {
2248  PFC_DestroyEngine(m_pEngine);
2249  m_pEngine = null;
2250  }
2251 
2252  if (m_pAiEngine != null)
2253  {
2254  PFC_DestroyEngine(m_pAiEngine);
2255  m_pEngine = null;
2256  }
2257  }
2258 
2259  static protected byte* GetCharBuffer(byte[] s)
2260  {
2261  int i, iCount = s.Length;
2262  IntPtr _memory = IntPtr.Zero;
2263  _memory = Marshal.AllocHGlobal(iCount + 1);
2264  byte* p = (byte*)_memory;
2265  for (i = 0; i < iCount; i++)
2266  {
2267  p[i] = (byte)s[i];
2268  }
2269  p[iCount] = 0;
2270 
2271  return (byte*)p;
2272  }
2273 
2274  static protected byte* GetCharBuffer(string s)
2275  {
2276  int i, iCount = s.Length;
2277  IntPtr _memory = IntPtr.Zero;
2278  _memory = Marshal.AllocHGlobal(iCount + 1);
2279  byte* p = (byte*)_memory;
2280  for (i = 0; i < iCount; i++)
2281  {
2282  p[i] = (byte)s[i];
2283  }
2284  p[iCount] = 0;
2285 
2286  return (byte*)p;
2287  }
2288 
2289  static protected void FreeCharBuffer(byte* p)
2290  {
2291  IntPtr _memory = (IntPtr)p;
2292  Marshal.FreeHGlobal(_memory);
2293  }
2294 
2295 #if ADAPTER64BIT
2296  [DllImport("PerfectlyClearPro")]
2297  static extern int PFC_SetProtectionPath(byte* path, byte* licenseCode);
2298 
2299  [DllImport("PerfectlyClearPro")]
2300  static extern void PFC_ReleaseProtectionPath();
2301 
2302  [DllImport("PerfectlyClearPro")]
2303  static extern PFCENGINE* PFC_CreateEngine();
2304 
2305  [DllImport("PerfectlyClearPro")]
2306  static extern void PFC_DestroyEngine(PFCENGINE* p);
2307 
2308  [DllImport("PerfectlyClearPro")]
2309  static extern void PFC_SetParam(ref PFCPARAM param, PFCPRESETID id);
2310 
2311  [DllImport("PerfectlyClearPro")]
2312  static extern int PFC_ReadPresets(ref PFCPARAM param, byte* filename);
2313 
2314  [DllImport("PerfectlyClearPro")]
2315  static extern int PFC_ReadPresetsFromStream(ref PFCPARAM param, byte* s);
2316 
2317  [DllImport("PerfectlyClearPro")]
2318  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);
2319 
2320  [DllImport("PerfectlyClearPro")]
2321  static extern void PFC_ReleaseProfile(void* pProfile);
2322 
2323  [DllImport("PerfectlyClearPro")]
2324  static extern PFCAPPLYSTATUS PFC_Apply(PFCIMAGE* pImage, PFCENGINE* pEngine, void* pImageProfile, ref PFCPARAM param, void* progfn, int iOpacity, void* pBGProfile);
2325 
2326  [DllImport("PerfectlyClearPro")]
2327  static extern bool PFC_HasFaceBeautification(PFCENGINE* pEngine);
2328 
2329  [DllImport("PerfectlyClearPro")]
2330  static extern int PFC_FBFaceCount(void* pImageProfile);
2331 
2332  [DllImport("PerfectlyClearPro")]
2333  static extern bool PFC_GetFaceInfo(void* pImageProfile, PFCFBFACEINFO1* pFace, int index);
2334 
2335  [DllImport("PerfectlyClearPro")]
2336  static extern bool PFC_AbnormalTintDetected(void* pImageProfile, TINTCORRECTION eTintMethod);
2337 
2338  [DllImport("PerfectlyClearPro")]
2339  static extern void PFC_ApplyStrengthToParam(ref PFCPARAM param, int strength);
2340 
2341  [DllImport("PerfectlyClearPro")]
2342  static extern void* PFC_EnumFAEFaceRect(void *pImageProfile, void* p);
2343 
2344  [DllImport("PerfectlyClearPro")]
2345  static extern int PFC_FAEFaceCount(void* pImageProfile);
2346 
2347  [DllImport("PerfectlyClearPro")]
2348  static extern int PFC_LoadAIEngine(PFCENGINE* pEngineAI, PFCAIFEATURE aifeatures, byte *binPath);
2349 
2350  [DllImport("PerfectlyClearPro")]
2351  static extern int PFC_LoadScenePresets(PFCENGINE* pEngine, byte *filePath, int groupUUID, int *arrProfileUUID, int arrProfileUUIDLen);
2352 
2353  [DllImport("PerfectlyClearPro")]
2354  static extern int PFC_ReadScenePreset(ref PFCPARAM param, PFCENGINE *pEngineAI, int scene);
2355 
2356  [DllImport("PerfectlyClearPro")]
2357  static extern int PFC_GetScene(void* precalc, int *version);
2358 
2359  [DllImport("PerfectlyClearPro")]
2360  static extern bool PFC_GetSceneDetectionEngineInfo(PFCENGINE* pEngine, int* groupUUID, int* arrProfileUUID, int *arrProfileUUIDLen);
2361 
2362  [DllImport("PerfectlyClearPro")]
2363  static extern void PFC_SetAddonPath(byte* path);
2364 
2365  [DllImport("PerfectlyClearPro")]
2366  static extern bool PFC_GetSceneDescription(PFCENGINE* p, int index, ref PFCSCENEDESCRIPTION description);
2367 
2368 #endif
2369 
2370 #if ADAPTER32BIT
2371  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2372  static extern int PFC_SetProtectionPath(byte* path, byte* licenseCode);
2373 
2374  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2375  static extern void PFC_ReleaseProtectionPath();
2376 
2377  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2378  static extern PFCENGINE* PFC_CreateEngine();
2379 
2380  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2381  static extern void PFC_DestroyEngine(PFCENGINE* p);
2382 
2383  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2384  static extern void PFC_SetParam(ref PFCPARAM param, PFCPRESETID id);
2385 
2386  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2387  static extern int PFC_ReadPresets(ref PFCPARAM param, byte* filename);
2388 
2389  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2390  static extern int PFC_ReadPresetsFromStream(ref PFCPARAM param, byte* s);
2391 
2392  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2393  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);
2394 
2395  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2396  static extern void PFC_ReleaseProfile(void* pProfile);
2397 
2398  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2399  static extern PFCAPPLYSTATUS PFC_Apply(PFCIMAGE* pImage, PFCENGINE* pEngine, void* pImageProfile, ref PFCPARAM param, void* progfn, int iOpacity, void* pBGProfile);
2400 
2401  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2402  static extern bool PFC_HasFaceBeautification(PFCENGINE* pEngine);
2403 
2404  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2405  static extern int PFC_FBFaceCount(void* pImageProfile);
2406 
2407  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2408  static extern bool PFC_GetFaceInfo(void* pImageProfile, PFCFBFACEINFO1* pFace, int index);
2409 
2410  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2411  static extern bool PFC_AbnormalTintDetected(void* pImageProfile, TINTCORRECTION eTintMethod);
2412 
2413  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2414  static extern void PFC_ApplyStrengthToParam(ref PFCPARAM param, int strength);
2415 
2416  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2417  static extern void* PFC_EnumFAEFaceRect(void *pImageProfile, void* p);
2418 
2419  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2420  static extern int PFC_FAEFaceCount(void* pImageProfile);
2421 
2422  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2423  static extern int PFC_LoadAIEngine(PFCENGINE* pEngineAI, PFCAIFEATURE aifeatures, byte *binPath);
2424 
2425  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2426  static extern int PFC_LoadScenePresets(PFCENGINE* pEngine, byte *filePath, int groupUUID, int *arrProfileUUID, int arrProfileUUIDLen);
2427 
2428  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2429  static extern int PFC_ReadScenePreset(ref PFCPARAM param, PFCENGINE *pEngineAI, int scene);
2430 
2431  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2432  static extern int PFC_GetScene(void* precalc, int *version);
2433 
2434  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2435  static extern bool PFC_GetSceneDetectionEngineInfo(PFCENGINE* pEngine, int* groupUUID, int* arrProfileUUID, int* arrProfileUUIDLen);
2436 
2437  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2438  static extern void PFC_SetAddonPath(byte* path);
2439 
2440  [DllImport("PerfectlyClearPro", CallingConvention = CallingConvention.Cdecl)]
2441  static extern unsafe bool PFC_GetSceneDescription(PFCENGINE* p, int index, ref PFCSCENEDESCRIPTION description);
2442 #endif
2443  }
2444 
2445 
2481  public unsafe class PFCImageFile : IDisposable
2482  {
2483  private IntPtr m_pNativeObject;
2484 
2486  public PFCImageFile()
2487  {
2488  m_pNativeObject = create_PFCImageFile();
2489  }
2490 
2491  public void Dispose()
2492  {
2493  Dispose(true);
2494  }
2495 
2496  protected virtual void Dispose(bool bDisposing)
2497  {
2498  if (this.m_pNativeObject != IntPtr.Zero)
2499  {
2500  delete_PFCImageFile(m_pNativeObject);
2501  m_pNativeObject = IntPtr.Zero;
2502  }
2503 
2504  if (bDisposing)
2505  {
2506  // No need to call the finalizer since we've now cleaned
2507  // up the unmanaged memory
2508  GC.SuppressFinalize(this);
2509  }
2510  }
2511 
2512  ~PFCImageFile()
2513  {
2514  Dispose(false);
2515  }
2516 
2519  {
2520  LOAD_OK,
2521  LOAD_ERROR,
2524  };
2525 
2527  public enum PFC_FILETYPE
2528  {
2529  PFC_JPEG = 1,
2530  PFC_PNG = 2
2531  };
2532 
2540  public PFC_FILE_LOAD_STATUS LoadImage(string filename, bool bConvertToSRGB = false, string iccFolderPath = null)
2541  {
2542  if (filename == null)
2543  {
2544  return PFC_FILE_LOAD_STATUS.LOAD_ERROR;
2545  }
2546 
2547  byte* pFilename = GetCharBuffer(filename);
2548 
2549  byte* pIccFolderPath = null;
2550  if (iccFolderPath != null)
2551  {
2552  pIccFolderPath = GetCharBuffer(iccFolderPath);
2553  }
2554 
2555  int result = PFCImageFile_LoadImageFile(m_pNativeObject, pFilename, bConvertToSRGB, pIccFolderPath);
2556 
2557  FreeCharBuffer(pFilename);
2558  FreeCharBuffer(pIccFolderPath);
2559 
2560  return (PFC_FILE_LOAD_STATUS)result;
2561  }
2562 
2571  public PFC_FILE_LOAD_STATUS LoadImage(string filename, PFC_FILETYPE type, bool bConvertToSRGB = true, string iccFolderPath = null)
2572  {
2573  if (filename == null)
2574  {
2575  return PFC_FILE_LOAD_STATUS.LOAD_ERROR;
2576  }
2577 
2578  byte* pFilename = GetCharBuffer(filename);
2579 
2580  byte* pIccFolderPath = null;
2581  if (iccFolderPath != null)
2582  {
2583  pIccFolderPath = GetCharBuffer(iccFolderPath);
2584  }
2585 
2586  int result = PFCImageFile_LoadImageFileType(m_pNativeObject, pFilename, (int)type, bConvertToSRGB, pIccFolderPath);
2587 
2588  FreeCharBuffer(pFilename);
2589  FreeCharBuffer(pIccFolderPath);
2590 
2591  return (PFC_FILE_LOAD_STATUS)result;
2592  }
2593 
2601  public bool SaveImageFile(string filename, int jpegQuality = 92, bool bConvertToOriginalColorSpace= true, bool bEmbedOriginalMetadata = true)
2602  {
2603  if (filename == null)
2604  {
2605  return false;
2606  }
2607 
2608  byte* pFilename = GetCharBuffer(filename);
2609 
2610  bool result = PFCImageFile_SaveImageFile(m_pNativeObject, pFilename, jpegQuality, bConvertToOriginalColorSpace, bEmbedOriginalMetadata);
2611 
2612  FreeCharBuffer(pFilename);
2613 
2614  return result;
2615  }
2616 
2625  public bool SaveImageFile(string filename, PFC_FILETYPE type, int jpegQuality = 92, bool bConvertToOriginalColorSpace = true, bool bEmbedOriginalMetadata = true)
2626  {
2627  if (filename == null)
2628  {
2629  return false;
2630  }
2631 
2632  byte* pFilename = GetCharBuffer(filename);
2633 
2634  bool result = PFCImageFile_SaveImageFileType(m_pNativeObject, pFilename, (int)type, jpegQuality, bConvertToOriginalColorSpace, bEmbedOriginalMetadata);
2635 
2636  FreeCharBuffer(pFilename);
2637 
2638  return result;
2639  }
2640 
2641  public void AllocBuffer(int width, int height, int bytes_per_pixel, int stride)
2642  {
2643  PFCImageFile_AllocBuffer(m_pNativeObject, width, height, bytes_per_pixel, stride);
2644  }
2645 
2646  public int pfcImageFormat()
2647  {
2648  return PFCImageFile_pfcImageFormat(m_pNativeObject);
2649  }
2650 
2651  public int exifOrientation()
2652  {
2653  return PFCImageFile_exifOrientation(m_pNativeObject);
2654  }
2655 
2656  public byte* raw_image()
2657  {
2658  return PFCImageFile_get_raw_image(m_pNativeObject);
2659  }
2660 
2661  public int width()
2662  {
2663  return PFCImageFile_get_width(m_pNativeObject);
2664  }
2665 
2666  public int height()
2667  {
2668  return PFCImageFile_get_height(m_pNativeObject);
2669  }
2670 
2671  public int bytes_per_pixel()
2672  {
2673  return PFCImageFile_get_bytes_per_pixel(m_pNativeObject);
2674  }
2675 
2676  public int stride()
2677  {
2678  return PFCImageFile_get_stride(m_pNativeObject);
2679  }
2680 
2681  public bool sourceSRGB()
2682  {
2683  return PFCImageFile_get_sourceSRGB(m_pNativeObject);
2684  }
2685 
2694  public PFC_FILE_LOAD_STATUS ExpandImageBuffer(MemoryStream inStream, PFC_FILETYPE type, bool bConvertToSRGB = true, string iccFolderPath = null)
2695  {
2696  byte* buffer = GetByteBuffer(inStream.ToArray());
2697  byte* pIccFolderPath = null;
2698  if (iccFolderPath != null)
2699  {
2700  pIccFolderPath = GetCharBuffer(iccFolderPath);
2701  }
2702  int result = PFCImageFile_ExpandImageBuffer(m_pNativeObject, buffer, inStream.Length, (int)type, bConvertToSRGB, pIccFolderPath);
2703  FreeCharBuffer(pIccFolderPath);
2704  FreeByteBuffer(buffer);
2705 
2706  return (PFC_FILE_LOAD_STATUS)result;
2707  }
2708 
2717  public MemoryStream CompressImageBuffer(PFC_FILETYPE type, int jpegQuality = 92, bool bConvertToOriginalColorSpace = true, bool bEmbedOriginalMetadata = true)
2718  {
2719  byte* compressedBuffer = null;
2720  int length = PFCImageFile_CompressImageBuffer(m_pNativeObject, &compressedBuffer, (int)type, jpegQuality, bConvertToOriginalColorSpace, bEmbedOriginalMetadata);
2721  if (length > 0 && compressedBuffer != null)
2722  {
2723  byte[] result = new byte[length];
2724  Marshal.Copy((IntPtr)(compressedBuffer), result, 0, length);
2725  deleteBuffer(compressedBuffer);
2726 
2727  // let the stream be resizable
2728  MemoryStream stream = new MemoryStream();
2729  stream.Write(result, 0, result.Length);
2730  return stream;
2731  }
2732  return new MemoryStream();
2733  }
2734 
2735  private static byte* GetCharBuffer(string s)
2736  {
2737  UTF8Encoding utf8 = new UTF8Encoding();
2738  Byte[] encodedBytes = utf8.GetBytes(s);
2739 
2740  int i, iCount = encodedBytes.Length;
2741  IntPtr _memory = IntPtr.Zero;
2742  _memory = Marshal.AllocHGlobal(iCount + 1);
2743  byte* p = (byte*)_memory;
2744  for (i = 0; i < iCount; i++)
2745  {
2746  p[i] = encodedBytes[i];
2747  }
2748  p[iCount] = 0;
2749 
2750  return (byte*)p;
2751  }
2752 
2753  private static void FreeCharBuffer(byte* p)
2754  {
2755  IntPtr _memory = (IntPtr)p;
2756  Marshal.FreeHGlobal(_memory);
2757  }
2758 
2759  private static byte* GetByteBuffer(byte[] bytes)
2760  {
2761  int length = bytes.Length;
2762  IntPtr p = Marshal.AllocHGlobal(length);
2763  Marshal.Copy(bytes, 0, p, length);
2764  return (byte*)p;
2765  }
2766 
2767  private static void FreeByteBuffer(byte* p)
2768  {
2769  IntPtr _memory = (IntPtr)p;
2770  Marshal.FreeHGlobal(_memory);
2771  }
2772 
2773 #if ADAPTER64BIT
2774  [DllImport("PFCImageFile")]
2775  static private extern unsafe IntPtr create_PFCImageFile();
2776 
2777  [DllImport("PFCImageFile")]
2778  static private extern void delete_PFCImageFile(IntPtr o);
2779 
2780  [DllImport("PFCImageFile")]
2781  static private extern unsafe int PFCImageFile_LoadImageFile(IntPtr o, byte* filename, bool bConvertToSRGB, byte* iccFolderPath);
2782 
2783  [DllImport("PFCImageFile")]
2784  static private extern unsafe int PFCImageFile_LoadImageFileType(IntPtr o, byte* filename, int type, bool bConvertToSRGB, byte* iccFolderPath);
2785 
2786  [DllImport("PFCImageFile")]
2787  static private extern unsafe bool PFCImageFile_SaveImageFile(IntPtr ptr, byte* filename, int jpegQuality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata);
2788 
2789  [DllImport("PFCImageFile")]
2790  static private extern unsafe bool PFCImageFile_SaveImageFileType(IntPtr ptr, byte* filename, int type, int jpegQuality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata);
2791 
2792  [DllImport("PFCImageFile")]
2793  static private extern unsafe void PFCImageFile_AllocBuffer(IntPtr ptr, int width, int height, int bytes_per_pixel, int stride);
2794 
2795  [DllImport("PFCImageFile")]
2796  static private extern unsafe int PFCImageFile_pfcImageFormat(IntPtr ptr);
2797 
2798  [DllImport("PFCImageFile")]
2799  static private extern unsafe int PFCImageFile_exifOrientation(IntPtr ptr);
2800 
2801  [DllImport("PFCImageFile")]
2802  static private extern unsafe byte* PFCImageFile_get_raw_image(IntPtr ptr);
2803 
2804  [DllImport("PFCImageFile")]
2805  static private extern unsafe int PFCImageFile_get_width(IntPtr ptr);
2806 
2807  [DllImport("PFCImageFile")]
2808  static private extern unsafe int PFCImageFile_get_height(IntPtr ptr);
2809 
2810  [DllImport("PFCImageFile")]
2811  static private extern unsafe int PFCImageFile_get_bytes_per_pixel(IntPtr ptr);
2812 
2813  [DllImport("PFCImageFile")]
2814  static private extern unsafe int PFCImageFile_get_stride(IntPtr ptr);
2815 
2816  [DllImport("PFCImageFile")]
2817  static private extern unsafe bool PFCImageFile_get_sourceSRGB(IntPtr ptr);
2818 
2819  [DllImport("PFCImageFile")]
2820  static private extern unsafe int PFCImageFile_ExpandImageBuffer(IntPtr ptr, byte* buffer, long size, int type, bool bConvertToSRGB, byte* iccFolderPath);
2821 
2822  [DllImport("PFCImageFile")]
2823  static private extern unsafe int PFCImageFile_CompressImageBuffer(IntPtr ptr, byte** destination, int type, int jpegQuality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata);
2824 
2825  [DllImport("PFCImageFile")]
2826  static private extern unsafe int deleteBuffer(byte* buffer);
2827 #endif
2828 
2829 #if ADAPTER32BIT
2830  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2831  static private extern unsafe IntPtr create_PFCImageFile();
2832 
2833  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2834  static private extern void delete_PFCImageFile(IntPtr o);
2835 
2836  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2837  static private extern unsafe int PFCImageFile_LoadImageFile(IntPtr o, byte* filename, bool bConvertToSRGB, byte* iccFolderPath);
2838 
2839  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2840  static private extern unsafe int PFCImageFile_LoadImageFileType(IntPtr o, byte* filename, int type, bool bConvertToSRGB, byte* iccFolderPath);
2841 
2842  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2843  static private extern unsafe bool PFCImageFile_SaveImageFile(IntPtr ptr, byte* filename, int jpegQuality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata);
2844 
2845  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2846  static private extern unsafe bool PFCImageFile_SaveImageFileType(IntPtr ptr, byte* filename, int type, int jpegQuality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata);
2847 
2848  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2849  static private extern unsafe void PFCImageFile_AllocBuffer(IntPtr ptr, int width, int height, int bytes_per_pixel, int stride);
2850 
2851  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2852  static private extern unsafe int PFCImageFile_pfcImageFormat(IntPtr ptr);
2853 
2854  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2855  static private extern unsafe int PFCImageFile_exifOrientation(IntPtr ptr);
2856 
2857  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2858  static private extern unsafe byte* PFCImageFile_get_raw_image(IntPtr ptr);
2859 
2860  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2861  static private extern unsafe int PFCImageFile_get_width(IntPtr ptr);
2862 
2863  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2864  static private extern unsafe int PFCImageFile_get_height(IntPtr ptr);
2865 
2866  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2867  static private extern unsafe int PFCImageFile_get_bytes_per_pixel(IntPtr ptr);
2868 
2869  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2870  static private extern unsafe int PFCImageFile_get_stride(IntPtr ptr);
2871 
2872  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2873  static private extern unsafe bool PFCImageFile_get_sourceSRGB(IntPtr ptr);
2874 
2875  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2876  static private extern unsafe int PFCImageFile_ExpandImageBuffer(IntPtr ptr, byte* buffer, long size, int type, bool bConvertToSRGB, byte* iccFolderPath);
2877 
2878  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2879  static private extern unsafe int PFCImageFile_CompressImageBuffer(IntPtr ptr, byte** destination, int type, int jpegQuality, bool bConvertToOriginalColorSpace, bool bEmbedOriginalMetadata);
2880 
2881  [DllImport("PFCImageFile", CallingConvention = CallingConvention.Cdecl)]
2882  static private extern unsafe int deleteBuffer(byte* buffer);
2883 #endif
2884  }
2885 }
PerfectlyClearAdapter.PFCFBPARAM.bSmooth
bool bSmooth
Set to TRUE to enable face smoothing.
Definition: PerfectlyClearAdapter.cs:494
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref Bitmap bm, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1682
TINTCORRECT_STRONGEST
@ TINTCORRECT_STRONGEST
Highest sensitivity level of tint detection.
Definition: PerfectlyClearPro.h:270
APPLY_ERROR_PROFILE_MISSING
@ APPLY_ERROR_PROFILE_MISSING
-1 Pointer pProfile is NULL
Definition: PerfectlyClearPro.h:395
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer.rowBytes
int rowBytes
Byte width of each scanline.
Definition: PerfectlyClearAdapter.cs:712
PerfectlyClearAdapter.PFCCOREMask.angle
float angle
CW.
Definition: PerfectlyClearAdapter.cs:580
PerfectlyClearAdapter.PFCV3PARAM.lutOutput
PFC3DLutInfo lutOutput
LUT data to apply.
Definition: PerfectlyClearAdapter.cs:613
PerfectlyClearAdapter.PFCCOREMask.width
float width
radial/rounded: w of bounding rect, linear: ignored.
Definition: PerfectlyClearAdapter.cs:576
PerfectlyClearAdapter.PerfectlyClear.Calc
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, PFCFEATURE feature)
Overload method for precalc analysis.
Definition: PerfectlyClearAdapter.cs:994
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:1081
PFC_CORE_MONOLITHIMAGE
@ PFC_CORE_MONOLITHIMAGE
5 Image skipped due to legacy clipart detection method
Definition: PerfectlyClearPro.h:359
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:2144
PerfectlyClearAdapter.BIASMODE
BIASMODE
Enumeration defining BIAS analysis mode.
Definition: PerfectlyClearAdapter.cs:373
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:383
PerfectlyClearAdapter.PFCFBPARAM.iEnhanceLevel
int iEnhanceLevel
Eye enhancement level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:501
PerfectlyClearAdapter.PFCFBPARAM.bLipSharpen
bool bLipSharpen
Set to TRUE to enable lip sharpening.
Definition: PerfectlyClearAdapter.cs:525
PFC_RE_CANCELLED
@ PFC_RE_CANCELLED
7 Process cancelled
Definition: PerfectlyClearPro.h:388
PFCAIFEATURE
PFCAIFEATURE
Flags defining type of model(s) to load with PFC_LoadAIEngine().
Definition: PerfectlyClearPro.h:1095
PerfectlyClearAdapter.PFCCOREPARAM.eAggressiveness
AGGRESSIVENESS eAggressiveness
The desired level of lighting for Automatic Strength Selection to target at the Exposure Correction.
Definition: PerfectlyClearAdapter.cs:459
PerfectlyClearAdapter.PerfectlyClear.Apply
unsafe PFCAPPLYSTATUS Apply(ref Bitmap bm)
Apply correction.
Definition: PerfectlyClearAdapter.cs:1205
TINTCORRECT_AGGRESSIVE
@ TINTCORRECT_AGGRESSIVE
Aggressive detection of tint.
Definition: PerfectlyClearPro.h:267
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref Bitmap bm, string pathPreset)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1630
PerfectlyClearAdapter.PFCPARAM.mask0
PFCCOREMask mask0
masks for layer 0
Definition: PerfectlyClearAdapter.cs:667
PerfectlyClearAdapter.PFCV3PARAM.iFinishVibrancy
int iFinishVibrancy
Vibrancy correction amount.
Definition: PerfectlyClearAdapter.cs:623
CALC_FB
@ CALC_FB
Calculates for Face Beautification.
Definition: PerfectlyClearPro.h:166
HIGH_CONTRAST
@ HIGH_CONTRAST
Optimized to bring higher contrast to the image.
Definition: PerfectlyClearPro.h:276
CALC_SKINTONE
@ CALC_SKINTONE
Calculate Skintone Detection.
Definition: PerfectlyClearPro.h:176
PerfectlyClearAdapter.PFCV3PARAM.iFinishWhites
int iFinishWhites
Whites correction amount.
Definition: PerfectlyClearAdapter.cs:621
PRESET_INTELLIGENTAUTO
@ PRESET_INTELLIGENTAUTO
Intelligent Auto - this has been superceded by iAuto 2019 and is here for backwards compatability....
Definition: PerfectlyClearPro.h:187
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.Status
int Status
Definition: PerfectlyClearAdapter.cs:733
CALC_NOFAE
@ CALC_NOFAE
Skip Face Aware Exposure pre-calculations during Core pre-calculations.
Definition: PerfectlyClearPro.h:170
PFC_NR_ERRSETTINGS
@ PFC_NR_ERRSETTINGS
5 Invalid parameter
Definition: PerfectlyClearPro.h:347
PFC_PixelFormat64bppABGR
@ PFC_PixelFormat64bppABGR
Definition: PerfectlyClearPro.h:152
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:2571
PerfectlyClearAdapter.PFCCOREPARAM.selectiveColor3
SELECTIVECOLOR selectiveColor3
Definition of range of Selective Color correction
Definition: PerfectlyClearAdapter.cs:483
PerfectlyClearAdapter.ADPTRRETURNCODE.SUCCESS
@ SUCCESS
Processed successfully.
PerfectlyClearAdapter.ADPTRRETURNCODE
ADPTRRETURNCODE
General return code.
Definition: PerfectlyClearAdapter.cs:384
PerfectlyClearAdapter.PFCV3PARAM.iDeltaG
int iDeltaG
Delta G correction amount.
Definition: PerfectlyClearAdapter.cs:628
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:2694
PerfectlyClearAdapter.PFCCOREPARAM.fInfrared
float fInfrared
Scale value to control intensity of infrared correction. Range 0.0 to 1.0.
Definition: PerfectlyClearAdapter.cs:462
PerfectlyClearAdapter.SELECTIVECOLOR.S
int S
correction of S, -100 .. 100
Definition: PerfectlyClearAdapter.cs:433
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGE.stride
int stride
Byte width of each scanline.
Definition: PerfectlyClearAdapter.cs:747
PerfectlyClearAdapter.PerfectlyClear.Calc
unsafe ADPTRRETURNCODE Calc(ref PFCImageFile imgfile)
Overload method for precalc analysis.
Definition: PerfectlyClearAdapter.cs:961
PerfectlyClearAdapter.DP2PARAM.fGamma
float fGamma
0.3 .. 4.0
Definition: PerfectlyClearAdapter.cs:647
PerfectlyClearAdapter.PFCV3PARAM.iDarkSkin
int iDarkSkin
Dark Skin output LUT amount.
Definition: PerfectlyClearAdapter.cs:607
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer.data2
int data2
Location of Green channel.
Definition: PerfectlyClearAdapter.cs:715
PerfectlyClearAdapter.PerfectlyClear.Calc
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm, ref Bitmap bmds)
Overload method for precalc analysis.
Definition: PerfectlyClearAdapter.cs:972
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref Bitmap bm, ref Bitmap bmds, string pathPreset)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1663
PFC_CORE_NOTENABLED
@ PFC_CORE_NOTENABLED
1 Feature not enabled
Definition: PerfectlyClearPro.h:355
PerfectlyClearAdapter.PFCCOREPARAM.bDCF
bool bDCF
Set to true to enable Digital Color Fidelity. Recommended value is FALSE.
Definition: PerfectlyClearAdapter.cs:466
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClear
PerfectlyClear(string path, string licenseCode="")
Class constructor.
Definition: PerfectlyClearAdapter.cs:883
PerfectlyClearAdapter.PerfectlyClear.LoadAiEngine
int LoadAiEngine(PFCAIFEATURE aifeatures, string binPath)
Load AI models into engine. Takes time and memory.
Definition: PerfectlyClearAdapter.cs:2110
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.pSFBParam
void * pSFBParam
Internal use only.
Definition: PerfectlyClearAdapter.cs:725
APPLY_SUCCESS
@ APPLY_SUCCESS
0 Success.
Definition: PerfectlyClearPro.h:394
PerfectlyClearAdapter.PFCPARAM.layer0
PFCV3PARAM layer0
params on layers 0 - top/inside
Definition: PerfectlyClearAdapter.cs:664
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:509
PerfectlyClearAdapter.DCFMODE.FIDELITY_VIVID
@ FIDELITY_VIVID
For more color vibrancy.
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer
Struct defining an image.
Definition: PerfectlyClearAdapter.cs:709
PFC_FB_SUCCESS
@ PFC_FB_SUCCESS
0 Success
Definition: PerfectlyClearPro.h:366
PerfectlyClearAdapter.PFCFBPARAM.bBlemish
bool bBlemish
Set to TRUE to enable blemish removal.
Definition: PerfectlyClearAdapter.cs:506
APPLY_BADFORMAT
@ APPLY_BADFORMAT
-5 Pixel format not supported
Definition: PerfectlyClearPro.h:399
PerfectlyClearAdapter.PFCImageFile.PFCImageFile
PFCImageFile()
Constructs empty PFCImageFile, to be filled with LoadImageFile()
Definition: PerfectlyClearAdapter.cs:2486
LIPSHARPENTYPE_FINE
@ LIPSHARPENTYPE_FINE
Fine touch of sharpening.
Definition: PerfectlyClearPro.h:334
PerfectlyClearAdapter.PFCPARAM.core
PFCCOREPARAM core
Core corrections to apply.
Definition: PerfectlyClearAdapter.cs:659
PerfectlyClearAdapter.PFCCOREMask.height
float height
radial/rounded: h of bounding rect, linear: dist from centerY where grad becomes 1....
Definition: PerfectlyClearAdapter.cs:577
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer.height
int height
Pixel height of image.
Definition: PerfectlyClearAdapter.cs:711
PFC_CORE_CANCELLED
@ PFC_CORE_CANCELLED
2 Process cancelled
Definition: PerfectlyClearPro.h:356
PRESET_BEAUTIFYPLUS
@ PRESET_BEAUTIFYPLUS
Beautify Plus provides stronger beautification corrections. This is in the 'Perfectly Clear Essential...
Definition: PerfectlyClearPro.h:184
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:669
PRESET_DETAILS
@ PRESET_DETAILS
iAuto Details - legacy preset for backwards compability. This is in the 'Athentech Legacy' group in E...
Definition: PerfectlyClearPro.h:185
PFC_FB_NOT_AVAILABLE
@ PFC_FB_NOT_AVAILABLE
10 Face beautification feature not available
Definition: PerfectlyClearPro.h:376
PerfectlyClearAdapter.PFCV3PARAM.iDeltaR
int iDeltaR
Delta R correction amount.
Definition: PerfectlyClearAdapter.cs:627
PerfectlyClearAdapter.PFCCOREPARAM.iSplitColorCold
int iSplitColorCold
Enhance cold tones.
Definition: PerfectlyClearAdapter.cs:478
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref Bitmap bm, ref Bitmap bmds)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1366
APPLY_WASM_INVALID_CERTIFICATE
@ APPLY_WASM_INVALID_CERTIFICATE
-9 WASM certificate invalid or not matching APIKEY and domain
Definition: PerfectlyClearPro.h:403
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:316
PerfectlyClearAdapter.PFCCOREPARAM.bLightDiffusion
bool bLightDiffusion
Set to true to enable light diffusion during DCF correction.
Definition: PerfectlyClearAdapter.cs:463
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGE.data
void * data
Pointer pointing to the first byte of image data buffer.
Definition: PerfectlyClearAdapter.cs:749
PerfectlyClearAdapter.DP2PARAM.iDeltaG
int iDeltaG
-100 .. 100
Definition: PerfectlyClearAdapter.cs:645
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:358
PerfectlyClearAdapter.PFCCOREPARAM.iSplitColorWarm
int iSplitColorWarm
Enhance warm tones.
Definition: PerfectlyClearAdapter.cs:477
APPLY_WASM_INVALID_APIKEY
@ APPLY_WASM_INVALID_APIKEY
-8 Wrong APIKEY for WASM certificate
Definition: PerfectlyClearPro.h:402
PerfectlyClearAdapter.PFCPIXELFORMAT
PFCPIXELFORMAT
defines the format of the image data
Definition: PerfectlyClearAdapter.cs:127
SKINTONINGTYPE_WHITE
@ SKINTONINGTYPE_WHITE
Whitens (bleaches) face. Recommended mainly for darker skin.
Definition: PerfectlyClearPro.h:324
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer.data3
int data3
Location of Blue channel.
Definition: PerfectlyClearAdapter.cs:716
SKINSMOOTHTYPE_DEFAULT
@ SKINSMOOTHTYPE_DEFAULT
This type of correction provides a more uniform appearance to the complexion. It combines the natural...
Definition: PerfectlyClearPro.h:317
PFC_PixelFormat32bppARGB
@ PFC_PixelFormat32bppARGB
Definition: PerfectlyClearPro.h:124
PerfectlyClearAdapter.PFCPARAM
Struct PFCPARAM the master structure of all processing parameters.
Definition: PerfectlyClearAdapter.cs:658
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:2625
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGE.height
int height
Pixel height of image.
Definition: PerfectlyClearAdapter.cs:746
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:795
PerfectlyClearAdapter.PFCFBPARAM.bEnlarge
bool bEnlarge
Set to TRUE to enable eye enlargement.
Definition: PerfectlyClearAdapter.cs:498
PerfectlyClearAdapter.PerfectlyClear.ReadImage
Bitmap ReadImage(string filename)
Utility function for reading image file into Bitmap.
Definition: PerfectlyClearAdapter.cs:1987
PFC_FB_NO_CORRECTION
@ PFC_FB_NO_CORRECTION
8 No correction occur during process
Definition: PerfectlyClearPro.h:374
PerfectlyClearAdapter.PerfectlyClear.Calc
unsafe ADPTRRETURNCODE Calc(ref PFCImageFile imgfile, PFCFEATURE feature)
Overload method for precalc analysis.
Definition: PerfectlyClearAdapter.cs:983
PerfectlyClearAdapter.PFCV3PARAM.iFinishTemp
int iFinishTemp
Temp correction amount.
Definition: PerfectlyClearAdapter.cs:615
PerfectlyClearAdapter.PerfectlyClear.SetParam
void SetParam(PFCPRESETID id)
Set process parameters in current instance.
Definition: PerfectlyClearAdapter.cs:1735
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:583
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGE.format
PFCPIXELFORMAT format
Defines byte order of input buffer.
Definition: PerfectlyClearAdapter.cs:748
PerfectlyClearAdapter.PFCPARAM.v3
PFCV3PARAM v3
V3 Corrections.
Definition: PerfectlyClearAdapter.cs:663
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.CORE_Status
PFCCORE_STATUS CORE_Status
Status code for CORE pre-calc analysis.
Definition: PerfectlyClearAdapter.cs:728
PerfectlyClearAdapter.PFCCOREMask.centerX
float centerX
X of center.
Definition: PerfectlyClearAdapter.cs:574
PerfectlyClearAdapter.PFCV3PARAM.iFinishExposure
int iFinishExposure
Exposure correction amount.
Definition: PerfectlyClearAdapter.cs:617
PerfectlyClearAdapter.PFCAPPLYSTATUS
PFCAPPLYSTATUS
Enumeration defining return code from the Apply() function.
Definition: PerfectlyClearAdapter.cs:324
PFCPARAM
Struct PFCPARAM the master structure of all processing parameters.
Definition: PerfectlyClearPro.h:641
PFC_RE_INVALID_PARAMETER
@ PFC_RE_INVALID_PARAMETER
5 Invalid parameter
Definition: PerfectlyClearPro.h:386
PerfectlyClearAdapter.PFCCOREPARAM.fTintScale
float fTintScale
Scalar value of how much tint correction should be applied. Range 0.0 to 1.0.
Definition: PerfectlyClearAdapter.cs:443
PerfectlyClearAdapter.PFCCOREMask.radius
float radius
only for MASK_ROUNDRECT - corner radius, relative to image w.
Definition: PerfectlyClearAdapter.cs:578
PerfectlyClearAdapter.PFCCOREPARAM.iSkintoneStrengthExposure
int iSkintoneStrengthExposure
Strength of exposure bias -50 .. 50 applied with input skintone correction.
Definition: PerfectlyClearAdapter.cs:474
PFC_RE_NOT_FOUND
@ PFC_RE_NOT_FOUND
3 Red eye not found
Definition: PerfectlyClearPro.h:384
PerfectlyClearAdapter.AGGRESSIVENESS.AGGRESSIVE
@ AGGRESSIVE
More aggressive in exposure correction.
AI_CORRECTIONS
@ AI_CORRECTIONS
Loads AI-based corrections model, requiring the file dynamic.pnn
Definition: PerfectlyClearPro.h:1097
PerfectlyClearAdapter.PFCAIFEATURE
PFCAIFEATURE
Flags defining type of model(s) to load with PFC_LoadAIEngine().
Definition: PerfectlyClearAdapter.cs:117
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:705
PerfectlyClearAdapter.PFCCOREPARAM.bSkintoneAuto
bool bSkintoneAuto
if TRUE iSkintoneType is detected, StrengthLut|StrengthExposure are obtained from PFC_GetAutoSkintone...
Definition: PerfectlyClearAdapter.cs:475
CALC_AICOLOR
@ CALC_AICOLOR
Calculate Auto WB params.
Definition: PerfectlyClearPro.h:177
PerfectlyClearAdapter.SELECTIVECOLOR.p
int p
end of Hue range ramp
Definition: PerfectlyClearAdapter.cs:431
PerfectlyClearAdapter.PFCCOREPARAM.iSkintoneType
int iSkintoneType
Skintone type, pale to dark, 1 .. 10 defines type of input skintone correction.
Definition: PerfectlyClearAdapter.cs:472
PerfectlyClearAdapter.PFCFBPARAM.iEyeCirc
int iEyeCirc
Eye circle removal level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:503
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:191
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:1344
PerfectlyClearAdapter.PerfectlyClear.ReadPresets
int ReadPresets(string path)
Read a preset from .preset file.
Definition: PerfectlyClearAdapter.cs:1759
SKINMODE_BODY
@ SKINMODE_BODY
Apply correction on most skin regions regardless they are linked with a face or not.
Definition: PerfectlyClearPro.h:310
CALC_ALL
@ CALC_ALL
Calculates for all classic features, all of the above.
Definition: PerfectlyClearPro.h:168
PerfectlyClearAdapter.PFCFBPARAM.bBlush
bool bBlush
Set to TRUE to add blush.
Definition: PerfectlyClearAdapter.cs:528
PRESET_IAUTO_PEOPLE
@ PRESET_IAUTO_PEOPLE
New default preset for 2023 - same corrections as iAuto People from the Universal AI Preset Selection...
Definition: PerfectlyClearPro.h:192
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.FB_Status
PFCFB_STATUS FB_Status
Status code for Face Beautification pre-calc analysis.
Definition: PerfectlyClearAdapter.cs:730
PerfectlyClearAdapter.DP2PARAM.bAuto
bool bAuto
if true use ai-detected params instead
Definition: PerfectlyClearAdapter.cs:651
PFCPRESETID
PFCPRESETID
ENUM for presets support by this SDK.
Definition: PerfectlyClearPro.h:181
PerfectlyClearAdapter.PFCV3PARAM.iColorVibrancy
int iColorVibrancy
Color Vibrancy amount.
Definition: PerfectlyClearAdapter.cs:606
PerfectlyClearAdapter.PFCREPARAM.bEnabled
bool bEnabled
Set to TRUE to enable red eye removal.
Definition: PerfectlyClearAdapter.cs:553
PerfectlyClearAdapter.PFCCOREPARAM.iSkintoneAutoStrength
int iSkintoneAutoStrength
If bSkintonAuto is TRUE defines percents of iSkintoneStrengthLut iSkintoneStrengthExposure to apply,...
Definition: PerfectlyClearAdapter.cs:476
CALC_RE
@ CALC_RE
Calculates for Red Eye Removal.
Definition: PerfectlyClearPro.h:167
PerfectlyClearAdapter.AGGRESSIVENESS
AGGRESSIVENESS
Enumeration defining different Auto Exposure calculation modes.
Definition: PerfectlyClearAdapter.cs:351
PerfectlyClearAdapter.SKINMODE
SKINMODE
Enumeration defining modes in Perfect Smooth analysis.
Definition: PerfectlyClearAdapter.cs:393
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:2540
PerfectlyClearAdapter.PFCFBPARAM.iCatchLight
int iCatchLight
Catchlight level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:513
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGE.width
int width
Pixel width of image.
Definition: PerfectlyClearAdapter.cs:745
APPLY_WASM_CERTIFICATE_WRONG_VERSION
@ APPLY_WASM_CERTIFICATE_WRONG_VERSION
-11 Wrong format version of WASM certificate
Definition: PerfectlyClearPro.h:405
PFC_NR_CANCELLED
@ PFC_NR_CANCELLED
3 Process cancelled
Definition: PerfectlyClearPro.h:345
PerfectlyClearAdapter.PFCCOREPARAM.bLocalContrast
bool bLocalContrast
Set to true to enable Local Contrast.
Definition: PerfectlyClearAdapter.cs:470
PerfectlyClearAdapter.PFCFBFACEINFO1.rightEye
PFCPOINT rightEye
Point of right eye in detected face.
Definition: PerfectlyClearAdapter.cs:39
PerfectlyClearAdapter.DP2PARAM.mode
int mode
reserved unused
Definition: PerfectlyClearAdapter.cs:650
PerfectlyClearAdapter.PFCNRPARAM.iDetailOffset
int iDetailOffset
Offset to recommended level of preservation of details. Range -30 to 30.
Definition: PerfectlyClearAdapter.cs:547
PerfectlyClearAdapter.PFCV3PARAM.lutInputFoliageGreen
PFC3DLutInfo lutInputFoliageGreen
LUT data to apply.
Definition: PerfectlyClearAdapter.cs:610
PFC_NR_FULLRES_REQUIRED
@ PFC_NR_FULLRES_REQUIRED
2 Source image (pImage) is missing
Definition: PerfectlyClearPro.h:344
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:458
PerfectlyClearAdapter.PFCFBPARAM.iEnlargeLevel
int iEnlargeLevel
Eye enlargement level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:499
PFCAPPLYSTATUS
PFCAPPLYSTATUS
Enumeration defining return code from the Apply() function.
Definition: PerfectlyClearPro.h:393
PerfectlyClearAdapter.PFCV3PARAM.iNeutralDensity
int iNeutralDensity
Neutral density filter amout.
Definition: PerfectlyClearAdapter.cs:605
PerfectlyClearAdapter.PFCV3PARAM.lutInputFoliageBrown
PFC3DLutInfo lutInputFoliageBrown
LUT data to apply.
Definition: PerfectlyClearAdapter.cs:611
PerfectlyClearAdapter.PFCFBPARAM.bEnabled
bool bEnabled
Set to TRUE to enable entire face beautification.
Definition: PerfectlyClearAdapter.cs:493
PerfectlyClearAdapter.PFCImageFile.PFC_FILE_LOAD_STATUS
PFC_FILE_LOAD_STATUS
Return status after loading a file with PFCImageFile.
Definition: PerfectlyClearAdapter.cs:2519
PFC_CORE_NOSOURCEIMAGE
@ PFC_CORE_NOSOURCEIMAGE
3 Source image (pImage) is missing
Definition: PerfectlyClearPro.h:357
PFCIMAGEPROFILE
Struct defining an image profile as calculated from PFC_Calc() function.
Definition: PerfectlyClearPro.h:655
PerfectlyClearAdapter.DP2PARAM.iDeltaR
int iDeltaR
-100 .. 100
Definition: PerfectlyClearAdapter.cs:644
PerfectlyClearAdapter.PFCNR_STATUS
PFCNR_STATUS
Enumeration defining status of Noise Removal pre-calculation.
Definition: PerfectlyClearAdapter.cs:260
PFC_RE_NOTENABLED
@ PFC_RE_NOTENABLED
1 Feature not enabled
Definition: PerfectlyClearPro.h:382
PerfectlyClearAdapter.PerfectlyClear.Calc
unsafe ADPTRRETURNCODE Calc(ref Bitmap bm)
Performs precalc analysis.
Definition: PerfectlyClearAdapter.cs:951
PerfectlyClearAdapter.SELECTIVECOLOR
Struct defining selective color correction.
Definition: PerfectlyClearAdapter.cs:427
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:342
PerfectlyClearAdapter.DCFMODE
DCFMODE
Enumeration defining DCF analysis mode.
Definition: PerfectlyClearAdapter.cs:359
LOAD_FAILED_CONVERT_SRGB
@ LOAD_FAILED_CONVERT_SRGB
Error: failed to convert to sRGB.
Definition: PFCImageFile.h:26
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref PFCImageFile imgfile, int ISO, string CameraModel, bool bFastFAE)
Performs auto correction.
Definition: PerfectlyClearAdapter.cs:1463
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:414
PFC_PixelFormat24bppRGB
@ PFC_PixelFormat24bppRGB
Definition: PerfectlyClearPro.h:53
PRESET_IAUTO_2019
@ PRESET_IAUTO_2019
iAuto for even better image corrections
Definition: PerfectlyClearPro.h:188
APPLY_CANCELLED
@ APPLY_CANCELLED
-3 Operation cancelled
Definition: PerfectlyClearPro.h:397
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer.width
int width
Pixel width of image.
Definition: PerfectlyClearAdapter.cs:710
PerfectlyClearAdapter.PFCV3PARAM.bDynamic
bool bDynamic
Enable Dynamic correction.
Definition: PerfectlyClearAdapter.cs:631
PerfectlyClearAdapter.DP2PARAM
Struct describing V3 parameters.
Definition: PerfectlyClearAdapter.cs:642
PerfectlyClearAdapter.PFCCOREMask
Struct for core mask.
Definition: PerfectlyClearAdapter.cs:572
LIPSHARPENTYPE_COARSE
@ LIPSHARPENTYPE_COARSE
Lip details are coarsely pronounced.
Definition: PerfectlyClearPro.h:336
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.pInternal
void * pInternal
Internal use only.
Definition: PerfectlyClearAdapter.cs:726
PerfectlyClearAdapter.PFCFBPARAM.bTeeth
bool bTeeth
Set to TRUE to enable teeth whitening.
Definition: PerfectlyClearAdapter.cs:504
PerfectlyClearAdapter.PFCCOREPARAM.bContrast
bool bContrast
Set to TRUE to also apply Athentech's patented Medical Imaging contrast technology.
Definition: PerfectlyClearAdapter.cs:448
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.NR_Status
PFCNR_STATUS NR_Status
Status code for Noise Removal pre-calc analysis.
Definition: PerfectlyClearAdapter.cs:729
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.pRedEyeParam
void * pRedEyeParam
Internal use only.
Definition: PerfectlyClearAdapter.cs:724
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:450
PerfectlyClearAdapter.DP2PARAM.iDensity
int iDensity
-100 .. 100 // Same meaning as DP2 Adjust params
Definition: PerfectlyClearAdapter.cs:643
CALC_COMPOSITE
@ CALC_COMPOSITE
Calculate Composite Detection.
Definition: PerfectlyClearPro.h:175
PerfectlyClearAdapter.PFCPARAM.re
PFCREPARAM re
Red Eye Removal.
Definition: PerfectlyClearAdapter.cs:662
PerfectlyClearAdapter.AGGRESSIVENESS.MODERATE
@ MODERATE
Moderate level of exposure correction.
PerfectlyClearAdapter.PFCREPARAM
Structure encapsulating Red Eye Correction parameters.
Definition: PerfectlyClearAdapter.cs:552
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClear
PerfectlyClear()
Special class constructor for multithreading.
Definition: PerfectlyClearAdapter.cs:845
PerfectlyClearAdapter.SELECTIVECOLOR.m
int m
end of flat part of Hue range
Definition: PerfectlyClearAdapter.cs:430
PerfectlyClearAdapter.PFCCOREPARAM.eContrastMode
CONTRASTMODE eContrastMode
Select contrast mode.
Definition: PerfectlyClearAdapter.cs:449
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:722
PerfectlyClearAdapter.PFCCOREPARAM.iLocalContrast
int iLocalContrast
Amount of Local Contrast to apply. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:469
PerfectlyClearAdapter.PFCFACERECT.widthImage
int widthImage
image width
Definition: PerfectlyClearAdapter.cs:85
PFC_CORE_SUCCESS
@ PFC_CORE_SUCCESS
0 Success
Definition: PerfectlyClearPro.h:354
PerfectlyClearAdapter.PFCV3PARAM.lutInputSky
PFC3DLutInfo lutInputSky
LUT data to apply.
Definition: PerfectlyClearAdapter.cs:609
PerfectlyClearAdapter.PFCCOREPARAM.selectiveColor0
SELECTIVECOLOR selectiveColor0
Definition of range of Selective Color correction
Definition: PerfectlyClearAdapter.cs:480
PFC_NR_NOTFOUND
@ PFC_NR_NOTFOUND
7 Noise not found
Definition: PerfectlyClearPro.h:349
PerfectlyClearAdapter.PerfectlyClear.HasFaceBeautification
bool HasFaceBeautification()
Query if Face Beautification feature is available.
Definition: PerfectlyClearAdapter.cs:1823
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE
Struct defining an image profile as calculated from PFC_Calc() function.
Definition: PerfectlyClearAdapter.cs:721
PerfectlyClearAdapter.PFCCOREPARAM.bVibrancy
bool bVibrancy
Set to true (recommended default) to enable Color Vibrancy in the library.
Definition: PerfectlyClearAdapter.cs:445
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer.data1
int data1
Location of Red channel.
Definition: PerfectlyClearAdapter.cs:714
LOAD_ERROR
@ LOAD_ERROR
Error.
Definition: PFCImageFile.h:24
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGEPROFILE.pNoiseParam
void * pNoiseParam
Internal use only.
Definition: PerfectlyClearAdapter.cs:723
PerfectlyClearAdapter.PFCFACERECT.smileLevel
int smileLevel
Indicates the presence of a smile.
Definition: PerfectlyClearAdapter.cs:80
PFCSCENEDESCRIPTION
Scene description.
Definition: PerfectlyClearPro.h:1210
PerfectlyClearAdapter.PFCFBPARAM.iSmoothLevel
int iSmoothLevel
Face smoothing level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:495
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:465
PerfectlyClearAdapter.PFCCOREPARAM.bUseAutomaticStrengthSelection
bool bUseAutomaticStrengthSelection
Set to TRUE (recommended default) to enable Automatic Strength Selection. Perfectly Clear will determ...
Definition: PerfectlyClearAdapter.cs:457
PerfectlyClearAdapter.PFCNRPARAM.iPreset
int iPreset
Definition: PerfectlyClearAdapter.cs:538
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:471
PerfectlyClearAdapter.PFCFBPARAM.iCatchLightMode
int iCatchLightMode
Definition: PerfectlyClearAdapter.cs:514
PFC_PixelFormat24bppBGR
@ PFC_PixelFormat24bppBGR
Definition: PerfectlyClearPro.h:66
PerfectlyClearAdapter.PFCImageFile.SaveImageFile
bool SaveImageFile(string filename, int jpegQuality=92, bool bConvertToOriginalColorSpace=true, bool bEmbedOriginalMetadata=true)
Write image data to file*.
Definition: PerfectlyClearAdapter.cs:2601
AI_SKINTONE
@ AI_SKINTONE
Loads skintone detection model. This is enabled automatically when using AI_SCENE_DETECTION.
Definition: PerfectlyClearPro.h:1099
PerfectlyClearAdapter.DP2PARAM.iSaturation
int iSaturation
-100 .. 100
Definition: PerfectlyClearAdapter.cs:649
PFCIMAGE
Struct defining an image to be used in PFC library.
Definition: PerfectlyClearPro.h:257
PerfectlyClearAdapter.PFCCOREPARAM.bHighlightPreservation
bool bHighlightPreservation
Set to true to enable Highlight Preservation.
Definition: PerfectlyClearAdapter.cs:454
BIAS_BRIGHTER_PREFERENCE
@ BIAS_BRIGHTER_PREFERENCE
Average usage with brighter tone, corresponds to "Bright" in PfC Products.
Definition: PerfectlyClearPro.h:301
PerfectlyClearAdapter.PFCFBPARAM.bEnhance
bool bEnhance
Set to TRUE to enable eye enhancement.
Definition: PerfectlyClearAdapter.cs:500
PerfectlyClearAdapter.PFCCOREPARAM.selectiveColor5
SELECTIVECOLOR selectiveColor5
Definition of range of Selective Color correction
Definition: PerfectlyClearAdapter.cs:485
PFC_NR_ERRBITMAP
@ PFC_NR_ERRBITMAP
4 Error reading image data
Definition: PerfectlyClearPro.h:346
PerfectlyClearAdapter.SELECTIVECOLOR.L
int L
correction of L, -100 .. 100
Definition: PerfectlyClearAdapter.cs:434
PerfectlyClearAdapter.PFCRECT.left
int left
x in point coordinate of this rect.
Definition: PerfectlyClearAdapter.cs:29
PerfectlyClearAdapter.PFCCOREPARAM.selectiveColor1
SELECTIVECOLOR selectiveColor1
Definition of range of Selective Color correction
Definition: PerfectlyClearAdapter.cs:481
PerfectlyClearAdapter.PerfectlyClear.PerfectlyClearImageTransfer.columnBytes
int columnBytes
Byte width of one pixel.
Definition: PerfectlyClearAdapter.cs:713
PFCENGINE
Struct defining an PFC engine instance.
Definition: PerfectlyClearPro.h:251
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.PFCCOREPARAM.selectiveColor6
SELECTIVECOLOR selectiveColor6
Definition of range of Selective Color correction
Definition: PerfectlyClearAdapter.cs:486
PerfectlyClearAdapter.PFCV3PARAM.iFinishHighlights
int iFinishHighlights
Highlights correction amount.
Definition: PerfectlyClearAdapter.cs:620
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref PFCImageFile imgfile, string pathPreset)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1646
PerfectlyClearAdapter.PFCPARAM.fb
PFCFBPARAM fb
Face Beautification corrections.
Definition: PerfectlyClearAdapter.cs:660
PerfectlyClearAdapter.PFCCOREPARAM.fBiasScale
float fBiasScale
Scalar value of how much BIAS correction should be applied. Range 0.0 to 1.0.
Definition: PerfectlyClearAdapter.cs:452
PerfectlyClearAdapter.SELECTIVECOLOR.H
int H
shift of Hue, -180 .. 180
Definition: PerfectlyClearAdapter.cs:432
PerfectlyClearAdapter.PerfectlyClear.FBFaceCount
int FBFaceCount()
Get number of faces.
Definition: PerfectlyClearAdapter.cs:1833
SKINMODE_FACE
@ SKINMODE_FACE
Apply correction ONLY on skin regions included in faces.
Definition: PerfectlyClearPro.h:309
PerfectlyClearAdapter.PFCCOREPARAM.iStrength
int iStrength
Set the strength of exposure correction. If Automatic Strength Selection is enabled,...
Definition: PerfectlyClearAdapter.cs:447
PerfectlyClearAdapter.PerfectlyClear.PFCIMAGE
Struct defining an image to be used in PFC library.
Definition: PerfectlyClearAdapter.cs:744
PerfectlyClearAdapter.PFCFB_STATUS
PFCFB_STATUS
Enumeration defining status of Face Beautification pre-calculation.
Definition: PerfectlyClearAdapter.cs:294
PerfectlyClearAdapter.PFCV3PARAM.iOutLUTsaturation
int iOutLUTsaturation
lutOutput saturation -100 .. 100
Definition: PerfectlyClearAdapter.cs:636
BIAS_NONE
@ BIAS_NONE
Turn off bias correction.
Definition: PerfectlyClearPro.h:298
TINTCORRECT_DEFAULT
@ TINTCORRECT_DEFAULT
Moderate level of tint detection.
Definition: PerfectlyClearPro.h:268
PerfectlyClearAdapter.PerfectlyClear.PFCENGINE.pEngine
void * pEngine
Pointer to binary definition of the processing engine.
Definition: PerfectlyClearAdapter.cs:704
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref PFCImageFile imgfile, string pathPreset, int ISO, string CameraModel, bool bFastFAE)
Overload method for auto correction.
Definition: PerfectlyClearAdapter.cs:1701
PerfectlyClearAdapter.PFCFBPARAM.iBlemish
int iBlemish
Blemish removal level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:507
PerfectlyClearAdapter.PFCREJECTOPTION
PFCREJECTOPTION
Enumeration defining reject options.
Definition: PerfectlyClearAdapter.cs:286
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:523
PerfectlyClearAdapter.PerfectlyClear.GetSceneDescription
bool GetSceneDescription(int index, ref PFCSCENEDESCRIPTION sceneDescription)
Get the scene description for the given index number Requires an initialized ai engine.
Definition: PerfectlyClearAdapter.cs:2222
SKINSMOOTHTYPE_SUPERSMOOTH
@ SKINSMOOTHTYPE_SUPERSMOOTH
This is a more aggressive and effective correction where the appearance of the entire skin (including...
Definition: PerfectlyClearPro.h:318
PFC_FB_FULLRES_REQUIRED
@ PFC_FB_FULLRES_REQUIRED
3 Source image (pImage) is missing
Definition: PerfectlyClearPro.h:369
PFC_REJECT_CLIPART
@ PFC_REJECT_CLIPART
Reject images classified as clipart, used by default.
Definition: PerfectlyClearPro.h:415
PerfectlyClearAdapter.DP2PARAM.bEnable
bool bEnable
enables overall correction
Definition: PerfectlyClearAdapter.cs:652
PerfectlyClearAdapter.PFCV3PARAM
Struct describing V3 parameters.
Definition: PerfectlyClearAdapter.cs:599
PerfectlyClearAdapter.PerfectlyClear.ReleaseProtectionPath
static void ReleaseProtectionPath()
Releases resources from SetProtectionPath.
Definition: PerfectlyClearAdapter.cs:834
PerfectlyClearAdapter.PFCPRESETID
PFCPRESETID
ENUM for presets support by this SDK.
Definition: PerfectlyClearAdapter.cs:244
PerfectlyClearAdapter.PFCPARAM.mask1
PFCCOREMask mask1
masks for layer 1
Definition: PerfectlyClearAdapter.cs:668
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:511
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, requiring one or two pnn files with filenames like pro_and_universal_202...
Definition: PerfectlyClearPro.h:1096
PFC_PixelFormat48bppRGB
@ PFC_PixelFormat48bppRGB
Definition: PerfectlyClearPro.h:94
PerfectlyClearAdapter.PFCCOREPARAM.fLightDiffusion
float fLightDiffusion
Scale value to control intensity of light diffusion correction.
Definition: PerfectlyClearAdapter.cs:464
PerfectlyClearAdapter.PFCFBPARAM.colorSkinToning
uint colorSkinToning
Skin Toning color AARRGGBB default 0xFFF5BCA9 ({245, 188, 169})
Definition: PerfectlyClearAdapter.cs:530
CALC_CORE
@ CALC_CORE
Calculates for Perfectly Clear Core correction.
Definition: PerfectlyClearPro.h:164
PerfectlyClearAdapter.PFCV3PARAM.iPreprocessEV
int iPreprocessEV
EV correction amount (Image Ambulace)
Definition: PerfectlyClearAdapter.cs:603
PFC_PixelFormat48bppBGR
@ PFC_PixelFormat48bppBGR
Definition: PerfectlyClearPro.h:137
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:1548
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:455
PerfectlyClearAdapter.PerfectlyClear.Apply
unsafe PFCAPPLYSTATUS Apply(ref Bitmap bm, int iOpacity)
Apply correction.
Definition: PerfectlyClearAdapter.cs:1226
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:496
PerfectlyClearAdapter.PFC3DLutInfo
Struct describing 3D Lut information.
Definition: PerfectlyClearAdapter.cs:589
TINTCORRECTION
TINTCORRECTION
Enumeration defining different abnormal tint analysis mode.
Definition: PerfectlyClearPro.h:266
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:461
PerfectlyClearAdapter.PFCFBPARAM.iTeethLevel
int iTeethLevel
Teeth whitening level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:505
PerfectlyClearAdapter.SELECTIVECOLOR.a
int a
start of flat part of Hue range
Definition: PerfectlyClearAdapter.cs:429
LOAD_ERROR_UNSUPPORTED
@ LOAD_ERROR_UNSUPPORTED
Error: unsupported file.
Definition: PFCImageFile.h:25
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:731
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:328
PerfectlyClearAdapter.PerfectlyClear.Apply
unsafe PFCAPPLYSTATUS Apply(ref PFCImageFile imgfile)
Apply correction.
Definition: PerfectlyClearAdapter.cs:1215
PerfectlyClearAdapter.PFCFBPARAM
Structure encapsulating Face Beautification parameters.
Definition: PerfectlyClearAdapter.cs:492
SKINTONINGTYPE_TAN
@ SKINTONINGTYPE_TAN
Darkens skin, makes it look naturally tanned.
Definition: PerfectlyClearPro.h:327
SKINTONINGTYPE_WARM
@ SKINTONINGTYPE_WARM
Warms skin tone.
Definition: PerfectlyClearPro.h:326
CALC_FAEHISPEED
@ CALC_FAEHISPEED
Use Fast mode of Face Aware Exposure pre-calculations.
Definition: PerfectlyClearPro.h:171
PerfectlyClearAdapter.PFCPARAM.nr
PFCNRPARAM nr
Noise reduction corrections.
Definition: PerfectlyClearAdapter.cs:661
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:277
PerfectlyClearAdapter.PFCV3PARAM.iDynamic
int iDynamic
Dynamic correction strength 0 .. 100.
Definition: PerfectlyClearAdapter.cs:632
PFC_PixelFormat64bppARGB
@ PFC_PixelFormat64bppARGB
Definition: PerfectlyClearPro.h:109
PerfectlyClearAdapter.PFCCOREPARAM.selectiveColor2
SELECTIVECOLOR selectiveColor2
Definition of range of Selective Color correction
Definition: PerfectlyClearAdapter.cs:482
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:342
PerfectlyClearAdapter.PFCV3PARAM.iFinishContrast
int iFinishContrast
Contrast correction amount.
Definition: PerfectlyClearAdapter.cs:624
PerfectlyClearAdapter.PerfectlyClear.AutoCorrect
int AutoCorrect(ref Bitmap bm, int ISO, string CameraModel, bool bFastFAE)
Performs auto correction.
Definition: PerfectlyClearAdapter.cs:1379
PFC_FB_NOTENABLED
@ PFC_FB_NOTENABLED
1 Feature not enabled
Definition: PerfectlyClearPro.h:367
SKINTONINGTYPE_PALE
@ SKINTONINGTYPE_PALE
Makes skin look lighter and more pale.
Definition: PerfectlyClearPro.h:325
PerfectlyClearAdapter.SKINTONINGTYPE
SKINTONINGTYPE
Enumeration defining type of Skin Toning correction.
Definition: PerfectlyClearAdapter.cs:408
PerfectlyClearAdapter.PerfectlyClear.AbnormalTintDetected
bool AbnormalTintDetected(TINTCORRECTION eTintMethod)
Query if Abnormal Tint detected.
Definition: PerfectlyClearAdapter.cs:1866
PerfectlyClearAdapter.AGGRESSIVENESS.CONSERVATIVE
@ CONSERVATIVE
Less aggressive in exposure correction.
PerfectlyClearAdapter.CONTRASTMODE
CONTRASTMODE
Enumeration defining contrast mode.
Definition: PerfectlyClearAdapter.cs:366
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:300
PFCFEATURE
PFCFEATURE
ENUM controlling types of calculations at the pre-calculation stage.
Definition: PerfectlyClearPro.h:163
PerfectlyClearAdapter.PFCV3PARAM.iFinishSaturation
int iFinishSaturation
Saturation correction amount.
Definition: PerfectlyClearAdapter.cs:622
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:446
PFC_NR_MISC_ERROR
@ PFC_NR_MISC_ERROR
6 General error
Definition: PerfectlyClearPro.h:348
PerfectlyClearAdapter.DP2PARAM.iContrast
int iContrast
-100 .. 100
Definition: PerfectlyClearAdapter.cs:648
PerfectlyClearAdapter.PFCV3PARAM.iFinishPositiveContrast
int iFinishPositiveContrast
Positive Contrast correction amount.
Definition: PerfectlyClearAdapter.cs:625
PerfectlyClearAdapter.PFCCOREPARAM.bAbnormalTintRemoval
bool bAbnormalTintRemoval
Set to true to enable Abnormal Tint Removal. Recommended default is FALSE.
Definition: PerfectlyClearAdapter.cs:441
APPLY_INVALIDLICENSE
@ APPLY_INVALIDLICENSE
-6 Invalid License or validation failed
Definition: PerfectlyClearPro.h:400
PRESET_IAUTO_21
@ PRESET_IAUTO_21
The iAuto you love plus newly (2021) tuned settings for sharper images, accurate skin correction,...
Definition: PerfectlyClearPro.h:190
PerfectlyClearAdapter.PFCNRPARAM.bEnabled
bool bEnabled
Set to TRUE to enable noise removal.
Definition: PerfectlyClearAdapter.cs:537
PerfectlyClearAdapter.PFCCOREPARAM.eDCFMode
DCFMODE eDCFMode
Select different class of DCF.
Definition: PerfectlyClearAdapter.cs:467
PerfectlyClearAdapter.PerfectlyClear.FAEFaceCount
int FAEFaceCount()
Returns the count of the faces recogniced by FAE.
Definition: PerfectlyClearAdapter.cs:2099
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:189
PerfectlyClearAdapter.PFCFBPARAM.eSkinToningType
SKINTONINGTYPE eSkinToningType
See enum definition of SKINTONINGTYPE.
Definition: PerfectlyClearAdapter.cs:524
PerfectlyClearAdapter.PFCCOREPARAM
Structure encapsulating the CORE processing parameters.
Definition: PerfectlyClearAdapter.cs:439
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:1006
PerfectlyClearAdapter.PFCCOREPARAM.fDCF
float fDCF
Scale value to control intensity of Digital Color Fidelity correction. Range 0.0 to 1....
Definition: PerfectlyClearAdapter.cs:468
PFC_FB_NOT_EXECUTED
@ PFC_FB_NOT_EXECUTED
9 Not executed
Definition: PerfectlyClearPro.h:375
PFC_RE_GEN_ERROR
@ PFC_RE_GEN_ERROR
4 General error
Definition: PerfectlyClearPro.h:385
APPLY_WASM_INVALID_DOMAIN
@ APPLY_WASM_INVALID_DOMAIN
-7 Wrong domain for WASM certificate
Definition: PerfectlyClearPro.h:401
PerfectlyClearAdapter.LIPSHARPENTYPE
LIPSHARPENTYPE
Enumeration defining Lip Sharpening mode.
Definition: PerfectlyClearAdapter.cs:418
PerfectlyClearAdapter.PFCFBPARAM.colorBlush
uint colorBlush
Blush color AARRGGBB default 0xFFFD7171 ({253, 113, 113})
Definition: PerfectlyClearAdapter.cs:531
CALC_SCENE_DETECTION
@ CALC_SCENE_DETECTION
Calculate Scene Detection.
Definition: PerfectlyClearPro.h:174
PerfectlyClearAdapter.PFCFBPARAM.bSlim
bool bSlim
Set to TRUE to enable face slimming.
Definition: PerfectlyClearAdapter.cs:508
PerfectlyClearAdapter.PerfectlyClear.PFCENGINE
Struct defining an PFC engine instance.
Definition: PerfectlyClearAdapter.cs:703
PerfectlyClearAdapter.PFCCOREMask.transparency
float transparency
overall transparency applied to the whole mask (strength 100 means transparency 0....
Definition: PerfectlyClearAdapter.cs:581
PerfectlyClearAdapter.PFCV3PARAM.bPreprocessEV
bool bPreprocessEV
Enable EV correction (ImageAmbulance)
Definition: PerfectlyClearAdapter.cs:602
PerfectlyClearAdapter.PFCSCENEDESCRIPTION
Struct describing Scene information.
Definition: PerfectlyClearAdapter.cs:686
PerfectlyClearAdapter.PFCCOREPARAM.eBiasMode
BIASMODE eBiasMode
Skin and depth bias control. Recommended value is BIAS_AVERAGE_PREFERENCE, unless you are printing to...
Definition: PerfectlyClearAdapter.cs:451
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:1876
PerfectlyClearAdapter.ADPTRRETURNCODE.INTERNALERROR
@ INTERNALERROR
Internal errors.
PerfectlyClearAdapter.PFCFBPARAM.iLipSharpen
int iLipSharpen
Lip sharpening level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:526
PerfectlyClearAdapter.PFCFBPARAM.bSkinToning
bool bSkinToning
Set to TRUE to enable skin toning.
Definition: PerfectlyClearAdapter.cs:521
PerfectlyClearAdapter.DP2PARAM.iDeltaB
int iDeltaB
-100 .. 100
Definition: PerfectlyClearAdapter.cs:646
PerfectlyClearAdapter.PerfectlyClear.Apply
unsafe PFCAPPLYSTATUS Apply(ref PFCImageFile imgfile, int iOpacity)
Apply correction.
Definition: PerfectlyClearAdapter.cs:1283
PerfectlyClearAdapter.PFCV3PARAM.iDeltaB
int iDeltaB
Delta B correction amount.
Definition: PerfectlyClearAdapter.cs:629
PerfectlyClearAdapter.PFCFBPARAM.bCatchLight
bool bCatchLight
Set to TRUE to enable catchlight removal.
Definition: PerfectlyClearAdapter.cs:512
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:1120
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:460
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:1354
PerfectlyClearAdapter.PFCCOREPARAM.fSharpenScale
float fSharpenScale
Sharpening intensity. This value controls how much sharpening to be applied. Range 0....
Definition: PerfectlyClearAdapter.cs:456
LIPSHARPENTYPE_MEDIUM
@ LIPSHARPENTYPE_MEDIUM
Stronger sharpening. Details are more pronounced.
Definition: PerfectlyClearPro.h:335
CALC_NR
@ CALC_NR
Calculates for Perfectly Clear Noise Removal.
Definition: PerfectlyClearPro.h:165
PerfectlyClearAdapter.PFCCOREPARAM.selectiveColor7
SELECTIVECOLOR selectiveColor7
Definition of range of Selective Color correction
Definition: PerfectlyClearAdapter.cs:487
PFC_CORE_CLIPARTIMAGE
@ PFC_CORE_CLIPARTIMAGE
7 Image skipped due AI Clipart detection
Definition: PerfectlyClearPro.h:361
PFC_FB_CANCELLED
@ PFC_FB_CANCELLED
4 Process cancelled
Definition: PerfectlyClearPro.h:370
BIAS_AUTO
@ BIAS_AUTO
Apply auto calculated bias mode and strength.
Definition: PerfectlyClearPro.h:303
PerfectlyClearAdapter.PFCFBPARAM.iBlush
int iBlush
Blush level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:529
PerfectlyClearAdapter.PerfectlyClear.GetFaceInfo
bool GetFaceInfo(ref PFCFBFACEINFO info, int index)
Get face information.
Definition: PerfectlyClearAdapter.cs:1846
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:406
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:183
PerfectlyClearAdapter.PFCV3PARAM.iFinishShadows
int iFinishShadows
Shadows correction amount.
Definition: PerfectlyClearAdapter.cs:619
PerfectlyClearAdapter.PFCCOREPARAM.iSkintoneStrengthLut
int iSkintoneStrengthLut
Strength of lut correction 0 .. 100 applied with input skintone correction.
Definition: PerfectlyClearAdapter.cs:473
PerfectlyClearAdapter.PFCPARAM.layer2
PFCV3PARAM layer2
params on layers 2 - fiinishing
Definition: PerfectlyClearAdapter.cs:666
PerfectlyClearAdapter.PFCNRPARAM
Structure encapsulating Noise Removal parameters.
Definition: PerfectlyClearAdapter.cs:536
BIAS_DONT_BOTHER
@ BIAS_DONT_BOTHER
Reserved, never use.
Definition: PerfectlyClearPro.h:302
PerfectlyClearAdapter.PFCFBPARAM.eLipSharpenType
LIPSHARPENTYPE eLipSharpenType
See definition of LIPSHARPENTYPE.
Definition: PerfectlyClearAdapter.cs:527
PFC_FB_WARNING
@ PFC_FB_WARNING
2 Warning: face not detected
Definition: PerfectlyClearPro.h:368
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:1721
PerfectlyClearAdapter.PFCNRPARAM.iStrengthOffset
int iStrengthOffset
Offset to recommended level of noise removal strength. Range -5 to 5.
Definition: PerfectlyClearAdapter.cs:546
PerfectlyClearAdapter.PFCRE_STATUS
PFCRE_STATUS
Enumeration defining status of Red Eye pre-calculation.
Definition: PerfectlyClearAdapter.cs:310
PFC_RE_SUCCESS
@ PFC_RE_SUCCESS
0 Success
Definition: PerfectlyClearPro.h:381
PerfectlyClearAdapter.PFCCORE_STATUS
PFCCORE_STATUS
Enumeration defining status of Core pre-calculation.
Definition: PerfectlyClearAdapter.cs:273
PFC_PixelFormat32bppABGR
@ PFC_PixelFormat32bppABGR
Definition: PerfectlyClearPro.h:81
PerfectlyClearAdapter.PFCFBFACEINFO.PFCFBFACEINFO
PFCFBFACEINFO()
Class constructor.
Definition: PerfectlyClearAdapter.cs:51
PerfectlyClearAdapter.PFCPARAM.dp2
DP2PARAM dp2
DP2 param.
Definition: PerfectlyClearAdapter.cs:670
PerfectlyClearAdapter.PFCFBPARAM.iSkinToning
int iSkinToning
Skin Toning level. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:522
PerfectlyClearAdapter.PFCCOREPARAM.iBlackEnhancement
int iBlackEnhancement
Set luminance threshold for Noise Management. Range 0 to 25.
Definition: PerfectlyClearAdapter.cs:444
PerfectlyClearAdapter.PFCV3PARAM.iOutLUTcontrast
int iOutLUTcontrast
lutOutput contrast -100 .. 100
Definition: PerfectlyClearAdapter.cs:635
PFC_NR_NOTENABLED
@ PFC_NR_NOTENABLED
1 Feature not enabled
Definition: PerfectlyClearPro.h:343
LOAD_OK
@ LOAD_OK
Success.
Definition: PFCImageFile.h:23
PerfectlyClearAdapter.PFCCOREMask.type
PFCCORE_MASK_TYPE type
Mask type.
Definition: PerfectlyClearAdapter.cs:573
PRESET_VIVID
@ PRESET_VIVID
Vivid - good for landscapes and other general photography. This is in the 'Perfectly Clear Essentials...
Definition: PerfectlyClearPro.h:186
PerfectlyClearAdapter.PFCCOREPARAM.selectiveColor4
SELECTIVECOLOR selectiveColor4
Definition of range of Selective Color correction
Definition: PerfectlyClearAdapter.cs:484
PerfectlyClearAdapter.SELECTIVECOLOR.r
int r
start of Hue range ramp
Definition: PerfectlyClearAdapter.cs:428
PerfectlyClearAdapter.PFCV3PARAM.iFinishBlacks
int iFinishBlacks
Blacks correction amount.
Definition: PerfectlyClearAdapter.cs:618
PerfectlyClearAdapter.PFCFACERECT.heightImage
int heightImage
image height
Definition: PerfectlyClearAdapter.cs:86
PerfectlyClearAdapter.PFCCOREPARAM.bSelectiveColor
bool bSelectiveColor
Apply Selective Color HSL correction.
Definition: PerfectlyClearAdapter.cs:479
PerfectlyClearAdapter.PFCCOREPARAM.bEnabled
bool bEnabled
Set to true to enable the entire Core correction.
Definition: PerfectlyClearAdapter.cs:440
PerfectlyClearAdapter.PFCImageFile.PFC_FILETYPE
PFC_FILETYPE
ENUM to set the filetype of files / buffers.
Definition: PerfectlyClearAdapter.cs:2528
PFCImageFile
PFCImageFile Class to encapsulate file handling.
Definition: PFCImageFile.h:72
PerfectlyClearAdapter.PFCImageFile
PFCImageFile Class to encapsulate file handling.
Definition: PerfectlyClearAdapter.cs:2482
PFC_FB_ANALYSIS_FAILED
@ PFC_FB_ANALYSIS_FAILED
7 The face analysis did not complete successfully
Definition: PerfectlyClearPro.h:373
PerfectlyClearAdapter.PFCV3PARAM.iDynamicWB
int iDynamicWB
Strength of color component of Dynamic correction 0 .. 100.
Definition: PerfectlyClearAdapter.cs:633
PerfectlyClearAdapter.PerfectlyClear.EnumFAEFaceRect
unsafe bool EnumFAEFaceRect(ref PFCFACERECT rect)
Allows the user to iterate over the known faces to FAE.
Definition: PerfectlyClearAdapter.cs:2079
PerfectlyClearAdapter.SKINSMOOTHTYPE
SKINSMOOTHTYPE
Enumeration defining types of Skin Smoothing correction.
Definition: PerfectlyClearAdapter.cs:400
PerfectlyClearAdapter.PFCFBPARAM.bDeFlash
bool bDeFlash
Set to TRUE to enable deflash.
Definition: PerfectlyClearAdapter.cs:510
PerfectlyClearAdapter.PFCCOREPARAM.iHighlightPreservation
int iHighlightPreservation
Amount of Highlight Preservation to apply. Range 0 to 100.
Definition: PerfectlyClearAdapter.cs:453
APPLY_WASM_EXPIRED_CERTIFICATE
@ APPLY_WASM_EXPIRED_CERTIFICATE
-10 WASM certificate has expired
Definition: PerfectlyClearPro.h:404
PerfectlyClearAdapter.PFCSTATUS
Struct PFCSTATUS Process status of all sub sectors.
Definition: PerfectlyClearAdapter.cs:675
PFC_REJECT_NONE
@ PFC_REJECT_NONE
Disable image rejection.
Definition: PerfectlyClearPro.h:413
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:665
PFC_FB_CREATE_ENGINE_FAILED
@ PFC_FB_CREATE_ENGINE_FAILED
6 Unable to create SFB Engine object for processing
Definition: PerfectlyClearPro.h:372
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:2163
PerfectlyClearAdapter.PerfectlyClear
Definition: PerfectlyClearAdapter.cs:700
PFC_RE_NO_MEMORY
@ PFC_RE_NO_MEMORY
6 Insufficient memory
Definition: PerfectlyClearPro.h:387
APPLY_NOSOURCE
@ APPLY_NOSOURCE
-4 Pointer pImage is NULL, source image missing
Definition: PerfectlyClearPro.h:398
PerfectlyClearAdapter.PFCFBPARAM.eSmoothType
SKINSMOOTHTYPE eSmoothType
See enum definition of SKINSMOOTHTYPE.
Definition: PerfectlyClearAdapter.cs:497
AI_COMPOSITE
@ AI_COMPOSITE
Loads composite detection model, requiring the file composite.pnn
Definition: PerfectlyClearPro.h:1098
PerfectlyClearAdapter.PFCCOREPARAM.eTintMode
TINTCORRECTION eTintMode
ENUM value defined in TINTCORRECTION. It sets the aggressiveness of Tint Removal.
Definition: PerfectlyClearAdapter.cs:442
PerfectlyClearAdapter.PFCCOREMask.feather
float feather
relative length of gradient, from where it starts (1.0) to where it is 0.0,
Definition: PerfectlyClearAdapter.cs:579
TINTCORRECT_CONSERVATIVE
@ TINTCORRECT_CONSERVATIVE
Priority on minimum false positive detection.
Definition: PerfectlyClearPro.h:269
BIAS_ASIAN_PREFERENCE
@ BIAS_ASIAN_PREFERENCE
Fine tuned for Asian skin tone.
Definition: PerfectlyClearPro.h:299
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:1020
CALC_CARTOON_DETECTOR
@ CALC_CARTOON_DETECTOR
Calculate legacy cartoon detector.
Definition: PerfectlyClearPro.h:172
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:2195
PerfectlyClearAdapter.PerfectlyClear.ReadPresetsFromStream
int ReadPresetsFromStream(FileStream fs)
Read a preset from a file stream.
Definition: PerfectlyClearAdapter.cs:1794
AI_COLOR
@ AI_COLOR
Loads AI White Balance color corrections model, requiring the file aicolor.pnn
Definition: PerfectlyClearPro.h:1100
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:2174
APPLY_ERROR_ENGINE_MISSING
@ APPLY_ERROR_ENGINE_MISSING
-2 Pointer pEngine is NULL
Definition: PerfectlyClearPro.h:396
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:371
PerfectlyClearAdapter.PFCFBPARAM.bEyeCirc
bool bEyeCirc
Set to TRUE to enable eye circle removal.
Definition: PerfectlyClearAdapter.cs:502
CALC_NOTINTCALC
@ CALC_NOTINTCALC
Skip pre-calculations on Abnormal Tint Correction during Core pre-calculations.
Definition: PerfectlyClearPro.h:169
PFC_CORE_BELOWMINSIZE
@ PFC_CORE_BELOWMINSIZE
6 Image skipped, too small ( < 32 pixels )
Definition: PerfectlyClearPro.h:360
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:2187
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:608
PerfectlyClearAdapter.PFCV3PARAM.iFinishTint
int iFinishTint
Tint correction amount.
Definition: PerfectlyClearAdapter.cs:616
PFC_RE_NOT_SUPPORTED
@ PFC_RE_NOT_SUPPORTED
8 Not supported
Definition: PerfectlyClearPro.h:389
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:2717
PerfectlyClearAdapter.PFCCOREMask.centerY
float centerY
Y of center.
Definition: PerfectlyClearAdapter.cs:575
PerfectlyClearAdapter
Definition: PerfectlyClearAdapter.cs:16