C# Documentation

C# Documentation

Hey guys! 

I was looking through the documentation tonight for C#, and I noticed a lot of things that were wrong. Such as

In the General Procedure Documentation for Facial Tracking and Recognition

The code that is used there is:

   public override void OnFaceSetup(ref PXCMFaceAnalysis.Profile profile) {}

   public override void OnFaceLocationSetup(ref PXCMFaceAnalysis.Detection.Profile profile) {}

   public override void OnFaceLandmarkSetup(ref PXCMFaceAnalysis.Landmark.Profile profile) {}

When it really needs to be

       public override void OnFaceSetup(ref PXCMFaceAnalysis.ProfileInfo profile) { }

        public override void OnFaceLocationSetup(ref PXCMFaceAnalysis.Detection.ProfileInfo profile) { }

        public override void OnFaceDetectionSetup(ref PXCMFaceAnalysis.Detection.ProfileInfo profile) { }

I also noticed it a lot throughout the documentation, and it gets really confusing when you try to take that stuff and put it in your code to use. Like with the Face Recognition code. 

         

PXCMFaceAnalysis.Recognition.Model createModelFromImage(PXCMImage image) {

   PXCMImage[] images=new PXCMImages[]{image,null,null,null};

   PXCMScheduler.SyncPoint sp;

   face.ProcessImageAsync(images,out sp);

   sp.Synchronize();

   sp.Dispose();

 

   int fid;

   face.QueryFace(0,out fid);

 

   PXCMFaceAnalysis.Recognition rec=face.DynamicCast<PXCMFaceAnalysis.Recognition>(PXCFaceAnalysis::Recognition.CUID);

 

   PXCMFaceAnalysis.Recognition.Model m1;

   rec.CreateModel(fid,out m1);

   return m1;

}

 

bool IsSimilar(PXCMImage image1, PXCMImage image2) {

   PXCMFaceAnalysis.Recognition.Model[] ref=new PXCMFaceAnalysis.Recognition.Model[]{

                        createModelFromImage(image1)};

   PXCMFaceAnalysis.Recognition.Model cur=createModelFromImage(image2);

 

   uint index;

   return cur.Compare(ref,null,out index)>=pxcmStatus.PXCM_STATUS_NO_ERROR;

}

 

This returned many errors and I'm not to sure if this is right, but I was able to decipher it into

 

    PXCMFaceAnalysis.Recognition.Model createModelFromImage(PXCMImage image)
        {

            PXCMImage[] images = new PXCMImage[] { image, null, null, null };
            PXCMScheduler.SyncPoint sp;
            face.ProcessImageAsync(images, out sp);
            sp.Synchronize();
            sp.Dispose();
            int fid; ulong ts; 
            face.QueryFace(0, out fid, out ts);
            PXCMFaceAnalysis.Recognition rec = face.DynamicCast<PXCMFaceAnalysis.Recognition>(PXCMFaceAnalysis.CUID);
            PXCMFaceAnalysis.Recognition.Model m1;
            rec.CreateModel(fid, out m1);
            return m1;

        }

        bool IsSimilar(PXCMImage image1, PXCMImage image2) {

       PXCMFaceAnalysis.Recognition.Model[] reference = new PXCMFaceAnalysis.Recognition.Model[]{
       createModelFromImage(image1)};
       PXCMFaceAnalysis.Recognition.Model cur=createModelFromImage(image2);
       uint index;
            
       return cur.Compare(reference,null,out index)>=pxcmStatus.PXCM_STATUS_NO_ERROR;
    }

 

Just in case anyone needs it in the future. Does Intel plan on providing fully working C# documentation as it does C++? Because a lot of the C# code in the documentation is just bad.

What is your guy's take on this?

 

4 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

I saw the same problems Wezley,  That condition, and the potential speed issues when doing pattern recognition with Gaussian kernels, made me choose C++ for the PercSDK part of my app while the rest of the app was done in C#; connecting the two parts with a socket bridge.  If you know C++ perhaps you can go that route.  If not, then I know this is not a helpful reply but I wanted to let you know I agree with your assessment.

-- roschler

Thanks for the reply Robert!

I think I'm going to stick with C# since most of my current application is done in C#, but doing all the PerCSDK stuff in C++ in the future sounds helpful!
I hope Intel plans on fixing the documentation though. In all honesty it looks as if the person who did the Documentation just took the C++ code, and stuck it into a converter and then slapped it into the Documentation without further assessment to see if it is actually usable. 

I'm pretty sure they'll have it fixed soon enough though!

 

-Wezley

I could use some help here though, because I keep getting a null reference exception here:

  face.ProcessImageAsync(images,out sp); 

and here:

  face.QueryFace(0, out fid, out ts);
            PXCMFaceAnalysis.Recognition rec = face.DynamicCast<PXCMFaceAnalysis.Recognition>(PXCMFaceAnalysis.CUID);

 

Any ideas what's going on that is causing this? 

Leave a Comment

Please sign in to add a comment. Not a member? Join today