Exemplo n.º 1
0
        /// <summary>
        ///   Sample a function equidistantly in an interval.
        ///   Instance represents: Input function.
        /// </summary>
        /// <param name="XMin">Minimum x value of the output function.</param>
        /// <param name="XMax">Maximum x value of the output function.</param>
        /// <param name="XDist">Distance of the samples.</param>
        /// <param name="border">Border treatment for the input function. Default: "constant"</param>
        /// <returns>Sampled function.</returns>
        public HFunction1D SampleFunct1d(
            HTuple XMin,
            HTuple XMax,
            HTuple XDist,
            string border)
        {
            IntPtr proc = HalconAPI.PreCall(1391);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, XMin);
            HalconAPI.Store(proc, 2, XMax);
            HalconAPI.Store(proc, 3, XDist);
            HalconAPI.StoreS(proc, 4, border);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            this.UnpinTuple();
            HalconAPI.UnpinTuple(XMin);
            HalconAPI.UnpinTuple(XMax);
            HalconAPI.UnpinTuple(XDist);
            HFunction1D hfunction1D;
            int         procResult = HFunction1D.LoadNew(proc, 0, err, out hfunction1D);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hfunction1D);
        }
Exemplo n.º 2
0
        /// <summary>
        ///   Absolute value of the y values.
        ///   Instance represents: Input function.
        /// </summary>
        /// <returns>Function with the absolute values of the y values.</returns>
        public HFunction1D AbsFunct1d()
        {
            IntPtr proc = HalconAPI.PreCall(1384);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            this.UnpinTuple();
            HFunction1D hfunction1D;
            int         procResult = HFunction1D.LoadNew(proc, 0, err, out hfunction1D);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hfunction1D);
        }
Exemplo n.º 3
0
        /// <summary>
        ///   Smooth an equidistant 1D function with a Gaussian function.
        ///   Instance represents: Function to be smoothed.
        /// </summary>
        /// <param name="sigma">Sigma of the Gaussian function for the smoothing. Default: 2.0</param>
        /// <returns>Smoothed function.</returns>
        public HFunction1D SmoothFunct1dGauss(double sigma)
        {
            IntPtr proc = HalconAPI.PreCall(1395);

            this.Store(proc, 0);
            HalconAPI.StoreD(proc, 1, sigma);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            this.UnpinTuple();
            HFunction1D hfunction1D;
            int         procResult = HFunction1D.LoadNew(proc, 0, err, out hfunction1D);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hfunction1D);
        }
Exemplo n.º 4
0
        /// <summary>
        ///   Smooth an equidistant 1D function by averaging its values.
        ///   Instance represents: 1D function.
        /// </summary>
        /// <param name="smoothSize">Size of the averaging mask. Default: 9</param>
        /// <param name="iterations">Number of iterations for the smoothing. Default: 3</param>
        /// <returns>Smoothed function.</returns>
        public HFunction1D SmoothFunct1dMean(int smoothSize, int iterations)
        {
            IntPtr proc = HalconAPI.PreCall(1401);

            this.Store(proc, 0);
            HalconAPI.StoreI(proc, 1, smoothSize);
            HalconAPI.StoreI(proc, 2, iterations);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            this.UnpinTuple();
            HFunction1D hfunction1D;
            int         procResult = HFunction1D.LoadNew(proc, 0, err, out hfunction1D);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hfunction1D);
        }
Exemplo n.º 5
0
        /// <summary>
        ///   Multiplication and addition of the y values.
        ///   Instance represents: Input function.
        /// </summary>
        /// <param name="mult">Factor for scaling of the y values. Default: 2.0</param>
        /// <param name="add">Constant which is added to the y values. Default: 0.0</param>
        /// <returns>Transformed function.</returns>
        public HFunction1D ScaleYFunct1d(double mult, double add)
        {
            IntPtr proc = HalconAPI.PreCall(1382);

            this.Store(proc, 0);
            HalconAPI.StoreD(proc, 1, mult);
            HalconAPI.StoreD(proc, 2, add);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            this.UnpinTuple();
            HFunction1D hfunction1D;
            int         procResult = HFunction1D.LoadNew(proc, 0, err, out hfunction1D);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hfunction1D);
        }
Exemplo n.º 6
0
        /// <summary>
        ///   Compose two functions.
        ///   Instance represents: Input function 1.
        /// </summary>
        /// <param name="function2">Input function 2.</param>
        /// <param name="border">Border treatment for the input functions. Default: "constant"</param>
        /// <returns>Composed function.</returns>
        public HFunction1D ComposeFunct1d(HFunction1D function2, string border)
        {
            IntPtr proc = HalconAPI.PreCall(1377);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, (HData)function2);
            HalconAPI.StoreS(proc, 2, border);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            this.UnpinTuple();
            HalconAPI.UnpinTuple((HTuple)((HData)function2));
            HFunction1D hfunction1D;
            int         procResult = HFunction1D.LoadNew(proc, 0, err, out hfunction1D);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hfunction1D);
        }
Exemplo n.º 7
0
 internal static int LoadNew(IntPtr proc, int parIndex, int err, out HFunction1D obj)
 {
     return(HFunction1D.LoadNew(proc, parIndex, HTupleType.MIXED, err, out obj));
 }