コード例 #1
0
ファイル: HFunction1D.cs プロジェクト: zshankang/OpenHalcon
        /// <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);
        }
コード例 #2
0
ファイル: HFunction1D.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>
        ///   Calculate transformation parameters between two functions.
        ///   Instance represents: Function 1.
        /// </summary>
        /// <param name="function2">Function 2.</param>
        /// <param name="border">Border treatment for function 2. Default: "constant"</param>
        /// <param name="paramsConst">Values of the parameters to remain constant. Default: [1.0,0.0,1.0,0.0]</param>
        /// <param name="useParams">Should a parameter be adapted for it? Default: ["true","true","true","true"]</param>
        /// <param name="chiSquare">Quadratic error of the output function.</param>
        /// <param name="covar">Covariance Matrix of the transformation parameters.</param>
        /// <returns>Transformation parameters between the functions.</returns>
        public HTuple MatchFunct1dTrans(
            HFunction1D function2,
            string border,
            HTuple paramsConst,
            HTuple useParams,
            out double chiSquare,
            out HTuple covar)
        {
            IntPtr proc = HalconAPI.PreCall(1393);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, (HData)function2);
            HalconAPI.StoreS(proc, 2, border);
            HalconAPI.Store(proc, 3, paramsConst);
            HalconAPI.Store(proc, 4, useParams);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            int err1 = HalconAPI.CallProcedure(proc);

            this.UnpinTuple();
            HalconAPI.UnpinTuple((HTuple)((HData)function2));
            HalconAPI.UnpinTuple(paramsConst);
            HalconAPI.UnpinTuple(useParams);
            HTuple tuple;
            int    err2       = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err1, out tuple);
            int    err3       = HalconAPI.LoadD(proc, 1, err2, out chiSquare);
            int    procResult = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, err3, out covar);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(tuple);
        }
コード例 #3
0
        /// <summary>
        ///   Plot a function using gnuplot.
        ///   Instance represents: Identifier for the gnuplot output stream.
        /// </summary>
        /// <param name="function">Function to be plotted.</param>
        public void GnuplotPlotFunct1d(HFunction1D function)
        {
            IntPtr proc = HalconAPI.PreCall(1295);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, (HData)function);
            int procResult = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple((HTuple)((HData)function));
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
コード例 #4
0
        /// <summary>
        ///   Specify a fuzzy function.
        ///   Instance represents: Measure object handle.
        /// </summary>
        /// <param name="setType">Selection of the fuzzy set. Default: "contrast"</param>
        /// <param name="function">Fuzzy function.</param>
        public void SetFuzzyMeasure(string setType, HFunction1D function)
        {
            IntPtr proc = HalconAPI.PreCall(831);

            this.Store(proc, 0);
            HalconAPI.StoreS(proc, 1, setType);
            HalconAPI.Store(proc, 2, (HData)function);
            int procResult = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple((HTuple)((HData)function));
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
コード例 #5
0
ファイル: HFunction1D.cs プロジェクト: zshankang/OpenHalcon
        internal static int LoadNew(
            IntPtr proc,
            int parIndex,
            HTupleType type,
            int err,
            out HFunction1D obj)
        {
            HTuple tuple;

            err = HTuple.LoadNew(proc, parIndex, err, out tuple);
            obj = new HFunction1D(new HData(tuple));
            return(err);
        }
コード例 #6
0
ファイル: HFunction1D.cs プロジェクト: zshankang/OpenHalcon
        /// <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);
        }
コード例 #7
0
ファイル: HFunction1D.cs プロジェクト: zshankang/OpenHalcon
        /// <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);
        }
コード例 #8
0
ファイル: HFunction1D.cs プロジェクト: zshankang/OpenHalcon
        /// <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);
        }
コード例 #9
0
ファイル: HFunction1D.cs プロジェクト: zshankang/OpenHalcon
        /// <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);
        }
コード例 #10
0
ファイル: HFunction1D.cs プロジェクト: zshankang/OpenHalcon
        /// <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);
        }
コード例 #11
0
ファイル: HFunction1D.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>
        ///   Compute the distance of two functions.
        ///   Instance represents: Input function 1.
        /// </summary>
        /// <param name="function2">Input function 2.</param>
        /// <param name="mode">Modes of invariants. Default: "length"</param>
        /// <param name="sigma">Variance of the optional smoothing with a Gaussian filter. Default: 0.0</param>
        /// <returns>Distance of the functions.</returns>
        public HTuple DistanceFunct1d(HFunction1D function2, string mode, double sigma)
        {
            IntPtr proc = HalconAPI.PreCall(1394);

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

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

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(tuple);
        }
コード例 #12
0
ファイル: HFunction1D.cs プロジェクト: zshankang/OpenHalcon
 internal static int LoadNew(IntPtr proc, int parIndex, int err, out HFunction1D obj)
 {
     return(HFunction1D.LoadNew(proc, parIndex, HTupleType.MIXED, err, out obj));
 }