コード例 #1
0
ファイル: PDetector.cs プロジェクト: videoai/papillon-swig
    public static PResult Create(SWIGTYPE_p_papillon__PPlugin plugin, PProperties parameters, PDetector detector)
    {
        PResult ret = new PResult(PapillonPINVOKE.PDetector_Create__SWIG_1(SWIGTYPE_p_papillon__PPlugin.getCPtr(plugin), PProperties.getCPtr(parameters), PDetector.getCPtr(detector)), true);

        if (PapillonPINVOKE.SWIGPendingException.Pending)
        {
            throw PapillonPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
コード例 #2
0
ファイル: PProperties.cs プロジェクト: videoai/papillon-swig
    public static PProperties CreateFromKeyValueString(string s)
    {
        PProperties ret = new PProperties(PapillonPINVOKE.PProperties_CreateFromKeyValueString(s), true);

        if (PapillonPINVOKE.SWIGPendingException.Pending)
        {
            throw PapillonPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
コード例 #3
0
ファイル: PProperties.cs プロジェクト: videoai/papillon-swig
    public PProperties Set(string key, bool value)
    {
        PProperties ret = new PProperties(PapillonPINVOKE.PProperties_Set__SWIG_2(swigCPtr, key, value), false);

        if (PapillonPINVOKE.SWIGPendingException.Pending)
        {
            throw PapillonPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
コード例 #4
0
    public PEventBuilder Payload(PProperties payload)
    {
        PEventBuilder ret = new PEventBuilder(PapillonPINVOKE.PEventBuilder_Payload__SWIG_0(swigCPtr, PProperties.getCPtr(payload)), false);

        if (PapillonPINVOKE.SWIGPendingException.Pending)
        {
            throw PapillonPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
コード例 #5
0
    public static PResult Create(string productName, PProperties parameters, PDescriber describer)
    {
        PResult ret = new PResult(PapillonPINVOKE.PDescriber_Create__SWIG_0(productName, PProperties.getCPtr(parameters), PDescriber.getCPtr(describer)), true);

        if (PapillonPINVOKE.SWIGPendingException.Pending)
        {
            throw PapillonPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
コード例 #6
0
    public PResult Create(SWIGTYPE_p_papillon__PPlugin plugin, PProperties parameters)
    {
        PResult ret = new PResult(PapillonPINVOKE.PPluginInstance_Create(swigCPtr, SWIGTYPE_p_papillon__PPlugin.getCPtr(plugin), PProperties.getCPtr(parameters)), true);

        if (PapillonPINVOKE.SWIGPendingException.Pending)
        {
            throw PapillonPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
コード例 #7
0
        static void Main(string[] args)
        {
            PLog.OpenConsoleLogger();
            PapillonSDK.Initialise();
            string SAMPLE_DIR            = PPath.Join(PUtils.GetEnv("PAPILLON_INSTALL_DIR"), "Data", "Samples");
            string TITLE                 = "Papillon SDK - Face Detection Example";
            bool   ENABLE_FACE_LOCALISER = true;


            // ************************************************************************
            // 1. Open Video Stream
            // ************************************************************************
            PInputVideoStream ivs = new PInputVideoStream();

            PInputVideoStream.Open(PPath.Join(SAMPLE_DIR, "face_log.avi"), ivs).OrDie(); // video file
            //PInputVideoStream.Open("https://youtu.be/Wi7k6IPYNj4?decode_with=vlc", ivs).OrDie(); break; // youtube stream (VLC plugin required)
            //PInputVideoStream.Open("device:0", ivs).OrDie();                                     break; // webcam
            //PInputVideoStream.Open(PPath.Join(SAMPLE_DIR, "face_log.avi"), ivs).OrDie();        break; // video file

            // ************************************************************************
            // 2. Create and configure Face Detector
            // ************************************************************************
            PDetector   faceDetector = new PDetector();
            PProperties parameters   = new PProperties();

            PDetector.Create("FaceDetector2", parameters, faceDetector).OrDie();
            faceDetector.EnableLocaliser(ENABLE_FACE_LOCALISER);
            faceDetector.SetMinDetectionSize(80);

            // ************************************************************************
            // 3. Apply Face Detector on each frame of the video stream
            // ************************************************************************
            PFrame frame = new PFrame();

            while (ivs.GetFrame(frame).Ok() && !PUtils.IsEscPressed())
            {
                PDetectionList listFaces = new PDetectionList();
                faceDetector.Detect(frame, listFaces);
                PUtils.DisplayDetectionList(frame, listFaces, TITLE);
            }
        }
コード例 #8
0
ファイル: PDescriptor.cs プロジェクト: videoai/papillon-swig
    public PProperties GetProperties()
    {
        PProperties ret = new PProperties(PapillonPINVOKE.PDescriptor_GetProperties(swigCPtr), false);

        return(ret);
    }
コード例 #9
0
ファイル: PDescriptor.cs プロジェクト: videoai/papillon-swig
    public PProperties GetPropertiesShared()
    {
        PProperties ret = new PProperties(PapillonPINVOKE.PDescriptor_GetPropertiesShared(swigCPtr), true);

        return(ret);
    }
コード例 #10
0
ファイル: PProperties.cs プロジェクト: videoai/papillon-swig
 public PProperties(PProperties other) : this(PapillonPINVOKE.new_PProperties__SWIG_1(PProperties.getCPtr(other)), true)
 {
     if (PapillonPINVOKE.SWIGPendingException.Pending)
     {
         throw PapillonPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #11
0
ファイル: PProperties.cs プロジェクト: videoai/papillon-swig
    public static PProperties Empty()
    {
        PProperties ret = new PProperties(PapillonPINVOKE.PProperties_Empty(), false);

        return(ret);
    }
コード例 #12
0
ファイル: PProperties.cs プロジェクト: videoai/papillon-swig
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(PProperties obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
コード例 #13
0
ファイル: PDescription.cs プロジェクト: videoai/papillon-swig
 public PDescription(string name, PObjectType objectType, PGuid identityId, PProperties properties) : this(PapillonPINVOKE.new_PDescription__SWIG_1(name, PObjectType.getCPtr(objectType), PGuid.getCPtr(identityId), PProperties.getCPtr(properties)), true)
 {
     if (PapillonPINVOKE.SWIGPendingException.Pending)
     {
         throw PapillonPINVOKE.SWIGPendingException.Retrieve();
     }
 }
コード例 #14
0
        static void Main(string[] args)
        {
            PLog.OpenConsoleLogger();
            PapillonSDK.Initialise();
            string SAMPLE_DIR = PPath.Join(PUtils.GetEnv("PAPILLON_INSTALL_DIR"), "Data", "Samples");


            // 1. load an image from disk (can be JPEG, TIF, BMP or PNG) and display it on screen
            PImage image = new PImage();

            image.Load(PPath.Join(SAMPLE_DIR, "sample.jpg")).OrDie();
            image.DisplayScaled("Papillon SDK - Original");
            // 2. perform some basic manipulations
            PImage image2 = new PImage();

            image.Resize(image2, 2.0f, PImage.EInterpolation.E_INTERPOLATION_CUBIC);     // create a new image by resizing the image loaded before
            image2.ExtractSubImage(image2, 50, 50, 700, 500);                            // extract a sub-image
            image2.DrawRectangle(new PRectanglei(5, 5, 690, 490), PColour3i.Black(), 2); // draw a rectangle on top of the image
            image2.Convert(image2, PImage.EPixelFormat.E_GREY8U);                        // convert image to grayscale
            image2.Display("Papillon SDK - Some basic manipulations");                   // display the new image in another window
            PImage rotatedImage = new PImage();

            image.Rotate(rotatedImage, 0);
            rotatedImage.Display("Rotated", 1500);
            image.Rotate(rotatedImage, 90);
            rotatedImage.Display("Rotated", 1500);
            image.Rotate(rotatedImage, 270);
            rotatedImage.Display("Rotated", 1500);
            image.Rotate(rotatedImage, -90);
            rotatedImage.Display("Rotated", 1500);
            // 3. save image to JPG format with a quality set to 90%
            image.Save("img1.jpg", 90);                                                                         // quality is an optional parameter; set to 95 by default
            image2.Save("img2.png");
            // 4. apply ENHANCE BRIGHTNESS image filter if the plugin is available)
            PImageFilter brightnessFilter = new PImageFilter();
            PProperties  param            = new PProperties();

            if (PImageFilter.Create("EnhanceBrightness", param, brightnessFilter).Ok())                          // create image filter from plugin
            {
                brightnessFilter.Set("scale", new PDouble(1.5));
                brightnessFilter.Set("delta", new PDouble(20));

                PImage brightImage = new PImage();
                brightnessFilter.Apply(image, brightImage);
                brightImage.Display("Papillon SDK - Enhance brightness");

                // swap red and blue channels
                PImage brightImageSwapped = new PImage();
                brightImage.SwapRGB(brightImageSwapped);
                brightImageSwapped.Display("Papillon SDK - Enhance brightness (rgb swapped)");
            }

            // 5. apply LACE image filter (if the plugin is available)
            PImageFilter laceFilter           = new PImageFilter();
            PProperties  laceFilterParameters = new PProperties();

            laceFilterParameters.Set("strength", new PDouble(0.5));
            if (PImageFilter.Create("LACE", laceFilterParameters, laceFilter).Ok())                                             // create image filter from plugin
            {
                PImage lacedImage = new PImage();
                laceFilter.Apply(image, lacedImage);
                lacedImage.Display("Papillon SDK - LACE (strength 0.5)");
            }
            // 6. apply HISTOGRAM EQUALISATION image filter (if the plugin is available)
            PImageFilter histogramEqualisationFilter = new PImageFilter();

            if (PImageFilter.Create("HistogramEqualisation", new PProperties(), histogramEqualisationFilter).Ok())           // create image filter from plugin
            {
                PImage histogramEqualisedImage = new PImage();
                histogramEqualisationFilter.Apply(image, histogramEqualisedImage);
                histogramEqualisedImage.Display("Papillon SDK - Histogram Equalised", 1000);
            }
        }
コード例 #15
0
    public PProperties GetPayload()
    {
        PProperties ret = new PProperties(PapillonPINVOKE.PEvent_GetPayload(swigCPtr), false);

        return(ret);
    }
コード例 #16
0
 public PWatchlistOptions(float threshold, int topN, bool normalisation, PProperties additionalParameters) : this(PapillonPINVOKE.new_PWatchlistOptions__SWIG_1(threshold, topN, normalisation, PProperties.getCPtr(additionalParameters)), true)
 {
     if (PapillonPINVOKE.SWIGPendingException.Pending)
     {
         throw PapillonPINVOKE.SWIGPendingException.Retrieve();
     }
 }