コード例 #1
0
        /// <summary>
        ///   Return the parameters of a Gaussian Mixture Model.
        ///   Instance represents: GMM handle.
        /// </summary>
        /// <param name="numClasses">Number of classes of the GMM.</param>
        /// <param name="minCenters">Minimum number of centers per GMM class.</param>
        /// <param name="maxCenters">Maximum number of centers per GMM class.</param>
        /// <param name="covarType">Type of the covariance matrices.</param>
        /// <returns>Number of dimensions of the feature space.</returns>
        public int GetParamsClassGmm(
            out int numClasses,
            out HTuple minCenters,
            out HTuple maxCenters,
            out string covarType)
        {
            IntPtr proc = HalconAPI.PreCall(1839);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            HalconAPI.InitOCT(proc, 3);
            HalconAPI.InitOCT(proc, 4);
            int err1 = HalconAPI.CallProcedure(proc);
            int intValue;
            int err2       = HalconAPI.LoadI(proc, 0, err1, out intValue);
            int err3       = HalconAPI.LoadI(proc, 1, err2, out numClasses);
            int err4       = HTuple.LoadNew(proc, 2, HTupleType.INTEGER, err3, out minCenters);
            int err5       = HTuple.LoadNew(proc, 3, HTupleType.INTEGER, err4, out maxCenters);
            int procResult = HalconAPI.LoadS(proc, 4, err5, out covarType);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(intValue);
        }
コード例 #2
0
        /// <summary>
        ///   Get information about an OCR classifier.
        ///   Instance represents: ID of the OCR classifier.
        /// </summary>
        /// <param name="widthPattern">Width of the scaled characters.</param>
        /// <param name="heightPattern">Height of the scaled characters.</param>
        /// <param name="interpolation">Interpolation mode for scaling the characters.</param>
        /// <param name="widthMaxChar">Width of the largest trained character.</param>
        /// <param name="heightMaxChar">Height of the largest trained character.</param>
        /// <param name="features">Used features.</param>
        /// <param name="characters">All characters of the set.</param>
        public void InfoOcrClassBox(
            out int widthPattern,
            out int heightPattern,
            out int interpolation,
            out int widthMaxChar,
            out int heightMaxChar,
            out HTuple features,
            out HTuple characters)
        {
            IntPtr proc = HalconAPI.PreCall(715);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            HalconAPI.InitOCT(proc, 3);
            HalconAPI.InitOCT(proc, 4);
            HalconAPI.InitOCT(proc, 5);
            HalconAPI.InitOCT(proc, 6);
            int err1       = HalconAPI.CallProcedure(proc);
            int err2       = HalconAPI.LoadI(proc, 0, err1, out widthPattern);
            int err3       = HalconAPI.LoadI(proc, 1, err2, out heightPattern);
            int err4       = HalconAPI.LoadI(proc, 2, err3, out interpolation);
            int err5       = HalconAPI.LoadI(proc, 3, err4, out widthMaxChar);
            int err6       = HalconAPI.LoadI(proc, 4, err5, out heightMaxChar);
            int err7       = HTuple.LoadNew(proc, 5, err6, out features);
            int procResult = HTuple.LoadNew(proc, 6, err7, out characters);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
コード例 #3
0
ファイル: HClassBox.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>
        ///   Describe the classes of a box classifier.
        ///   Instance represents: Handle of the classifier.
        /// </summary>
        /// <param name="dimensions">Highest dimension for output. Default: 3</param>
        /// <param name="boxIdx">Indices of the boxes.</param>
        /// <param name="boxLowerBound">Lower bounds of the boxes (for each dimension).</param>
        /// <param name="boxHigherBound">Higher bounds of the boxes (for each dimension).</param>
        /// <param name="boxNumSamplesTrain">Number of training samples that were used to define this box (for each dimension).</param>
        /// <param name="boxNumSamplesWrong">Number of training samples that were assigned incorrectly to the box.</param>
        /// <returns>Indices of the classes.</returns>
        public int DescriptClassBox(
            int dimensions,
            out int boxIdx,
            out int boxLowerBound,
            out int boxHigherBound,
            out int boxNumSamplesTrain,
            out int boxNumSamplesWrong)
        {
            IntPtr proc = HalconAPI.PreCall(1896);

            this.Store(proc, 0);
            HalconAPI.StoreI(proc, 1, dimensions);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            HalconAPI.InitOCT(proc, 3);
            HalconAPI.InitOCT(proc, 4);
            HalconAPI.InitOCT(proc, 5);
            int err1 = HalconAPI.CallProcedure(proc);
            int intValue;
            int err2       = HalconAPI.LoadI(proc, 0, err1, out intValue);
            int err3       = HalconAPI.LoadI(proc, 1, err2, out boxIdx);
            int err4       = HalconAPI.LoadI(proc, 2, err3, out boxLowerBound);
            int err5       = HalconAPI.LoadI(proc, 3, err4, out boxHigherBound);
            int err6       = HalconAPI.LoadI(proc, 4, err5, out boxNumSamplesTrain);
            int procResult = HalconAPI.LoadI(proc, 5, err6, out boxNumSamplesWrong);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(intValue);
        }
コード例 #4
0
        /// <summary>
        ///   Detect and read 2D data code symbols in an image or train the 2D data code model.
        ///   Instance represents: Handle of the 2D data code model.
        /// </summary>
        /// <param name="image">Input image. If the image has a reduced domain, the data code search is reduced to that domain. This usually reduces the runtime of the operator. However, if the datacode is not fully inside the domain, the datacode might not be found correctly. In rare cases, data codes may be found outside the domain. If these results  are undesirable, they have to be subsequently eliminated. </param>
        /// <param name="genParamName">Names of (optional) parameters for controlling the behavior of the operator. Default: []</param>
        /// <param name="genParamValue">Values of the optional generic parameters. Default: []</param>
        /// <param name="resultHandles">Handles of all successfully decoded 2D data code symbols.</param>
        /// <param name="decodedDataStrings">Decoded data strings of all detected 2D data code symbols in the image.</param>
        /// <returns>XLD contours that surround the successfully decoded data code symbols. The order of the contour points reflects the orientation of the detected symbols. The contours begin in the top left corner (see 'orientation' at get_data_code_2d_results) and continue clockwise.  Alignment{left} Figure[1][1][60]{get_data_code_2d_results-xld_qrcode} Order of points of SymbolXLDs Figure Alignment @f$ </returns>
        public HXLDCont FindDataCode2d(
            HImage image,
            string genParamName,
            int genParamValue,
            out int resultHandles,
            out string decodedDataStrings)
        {
            IntPtr proc = HalconAPI.PreCall(1768);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, (HObjectBase)image);
            HalconAPI.StoreS(proc, 1, genParamName);
            HalconAPI.StoreI(proc, 2, genParamValue);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int      err1 = HalconAPI.CallProcedure(proc);
            HXLDCont hxldCont;
            int      err2       = HXLDCont.LoadNew(proc, 1, err1, out hxldCont);
            int      err3       = HalconAPI.LoadI(proc, 0, err2, out resultHandles);
            int      procResult = HalconAPI.LoadS(proc, 1, err3, out decodedDataStrings);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)image);
            return(hxldCont);
        }
コード例 #5
0
ファイル: HSerial.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>
        ///   Get the parameters of a serial device.
        ///   Instance represents: Serial interface handle.
        /// </summary>
        /// <param name="dataBits">Number of data bits of the serial interface.</param>
        /// <param name="flowControl">Type of flow control of the serial interface.</param>
        /// <param name="parity">Parity of the serial interface.</param>
        /// <param name="stopBits">Number of stop bits of the serial interface.</param>
        /// <param name="totalTimeOut">Total timeout of the serial interface in ms.</param>
        /// <param name="interCharTimeOut">Inter-character timeout of the serial interface in ms.</param>
        /// <returns>Speed of the serial interface.</returns>
        public int GetSerialParam(
            out int dataBits,
            out string flowControl,
            out string parity,
            out int stopBits,
            out int totalTimeOut,
            out int interCharTimeOut)
        {
            IntPtr proc = HalconAPI.PreCall(310);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            HalconAPI.InitOCT(proc, 3);
            HalconAPI.InitOCT(proc, 4);
            HalconAPI.InitOCT(proc, 5);
            HalconAPI.InitOCT(proc, 6);
            int err1 = HalconAPI.CallProcedure(proc);
            int intValue;
            int err2       = HalconAPI.LoadI(proc, 0, err1, out intValue);
            int err3       = HalconAPI.LoadI(proc, 1, err2, out dataBits);
            int err4       = HalconAPI.LoadS(proc, 2, err3, out flowControl);
            int err5       = HalconAPI.LoadS(proc, 3, err4, out parity);
            int err6       = HalconAPI.LoadI(proc, 4, err5, out stopBits);
            int err7       = HalconAPI.LoadI(proc, 5, err6, out totalTimeOut);
            int procResult = HalconAPI.LoadI(proc, 6, err7, out interCharTimeOut);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(intValue);
        }
コード例 #6
0
        /// <summary>
        ///   Return the parameters of a multilayer perceptron.
        ///   Instance represents: MLP handle.
        /// </summary>
        /// <param name="numHidden">Number of hidden units of the MLP.</param>
        /// <param name="numOutput">Number of output variables (classes) of the MLP.</param>
        /// <param name="outputFunction">Type of the activation function in the output layer of the MLP.</param>
        /// <param name="preprocessing">Type of preprocessing used to transform the feature vectors.</param>
        /// <param name="numComponents">Preprocessing parameter: Number of transformed features.</param>
        /// <returns>Number of input variables (features) of the MLP.</returns>
        public int GetParamsClassMlp(
            out int numHidden,
            out int numOutput,
            out string outputFunction,
            out string preprocessing,
            out int numComponents)
        {
            IntPtr proc = HalconAPI.PreCall(1882);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            HalconAPI.InitOCT(proc, 3);
            HalconAPI.InitOCT(proc, 4);
            HalconAPI.InitOCT(proc, 5);
            int err1 = HalconAPI.CallProcedure(proc);
            int intValue;
            int err2       = HalconAPI.LoadI(proc, 0, err1, out intValue);
            int err3       = HalconAPI.LoadI(proc, 1, err2, out numHidden);
            int err4       = HalconAPI.LoadI(proc, 2, err3, out numOutput);
            int err5       = HalconAPI.LoadS(proc, 3, err4, out outputFunction);
            int err6       = HalconAPI.LoadS(proc, 4, err5, out preprocessing);
            int procResult = HalconAPI.LoadI(proc, 5, err6, out numComponents);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(intValue);
        }
コード例 #7
0
ファイル: HInfo.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>Get number of the different parameter classes of a HALCON-operator.</summary>
        /// <param name="operatorName">Name of the operator. Default: "get_param_num"</param>
        /// <param name="inpObjPar">Number of the input object parameters.</param>
        /// <param name="outpObjPar">Number of the output object parameters.</param>
        /// <param name="inpCtrlPar">Number of the input control parameters.</param>
        /// <param name="outpCtrlPar">Number of the output control parameters.</param>
        /// <param name="type">System operator or user procedure.</param>
        /// <returns>Name of the called C-function.</returns>
        public static string GetParamNum(
            string operatorName,
            out int inpObjPar,
            out int outpObjPar,
            out int inpCtrlPar,
            out int outpCtrlPar,
            out string type)
        {
            IntPtr proc = HalconAPI.PreCall(1112);

            HalconAPI.StoreS(proc, 0, operatorName);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            HalconAPI.InitOCT(proc, 3);
            HalconAPI.InitOCT(proc, 4);
            HalconAPI.InitOCT(proc, 5);
            int    err1 = HalconAPI.CallProcedure(proc);
            string stringValue;
            int    err2       = HalconAPI.LoadS(proc, 0, err1, out stringValue);
            int    err3       = HalconAPI.LoadI(proc, 1, err2, out inpObjPar);
            int    err4       = HalconAPI.LoadI(proc, 2, err3, out outpObjPar);
            int    err5       = HalconAPI.LoadI(proc, 3, err4, out inpCtrlPar);
            int    err6       = HalconAPI.LoadI(proc, 4, err5, out outpCtrlPar);
            int    procResult = HalconAPI.LoadS(proc, 5, err6, out type);

            HalconAPI.PostCall(proc, procResult);
            return(stringValue);
        }
コード例 #8
0
        /// <summary>
        ///   Return the parameters of an OCR classifier.
        ///   Instance represents: Handle of the OCR classifier.
        /// </summary>
        /// <param name="widthCharacter">Width of the rectangle to which the gray values of the segmented character are zoomed.</param>
        /// <param name="heightCharacter">Height of the rectangle to which the gray values of the segmented character are zoomed.</param>
        /// <param name="interpolation">Interpolation mode for the zooming of the characters.</param>
        /// <param name="features">Features to be used for classification.</param>
        /// <param name="characters">Characters of the character set to be read.</param>
        /// <param name="preprocessing">Type of preprocessing used to transform the feature vectors.</param>
        /// <param name="numTrees">Number of different trees used during the classifcation.</param>
        public void GetParamsOcrClassKnn(
            out int widthCharacter,
            out int heightCharacter,
            out string interpolation,
            out string features,
            out HTuple characters,
            out string preprocessing,
            out int numTrees)
        {
            IntPtr proc = HalconAPI.PreCall(657);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            HalconAPI.InitOCT(proc, 3);
            HalconAPI.InitOCT(proc, 4);
            HalconAPI.InitOCT(proc, 5);
            HalconAPI.InitOCT(proc, 6);
            int err1       = HalconAPI.CallProcedure(proc);
            int err2       = HalconAPI.LoadI(proc, 0, err1, out widthCharacter);
            int err3       = HalconAPI.LoadI(proc, 1, err2, out heightCharacter);
            int err4       = HalconAPI.LoadS(proc, 2, err3, out interpolation);
            int err5       = HalconAPI.LoadS(proc, 3, err4, out features);
            int err6       = HTuple.LoadNew(proc, 4, err5, out characters);
            int err7       = HalconAPI.LoadS(proc, 5, err6, out preprocessing);
            int procResult = HalconAPI.LoadI(proc, 6, err7, out numTrees);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
コード例 #9
0
        /// <summary>
        ///   Prepare a component model for matching based on trained components.
        ///   Instance represents: Handle of the training result.
        /// </summary>
        /// <param name="angleStart">Smallest rotation of the component model. Default: -0.39</param>
        /// <param name="angleExtent">Extent of the rotation of the component model. Default: 0.79</param>
        /// <param name="minContrastComp">Minimum contrast of the components in the search images. Default: "auto"</param>
        /// <param name="minScoreComp">Minimum score of the instances of the components to be found. Default: 0.5</param>
        /// <param name="numLevelsComp">Maximum number of pyramid levels for the components. Default: "auto"</param>
        /// <param name="angleStepComp">Step length of the angles (resolution) for the components. Default: "auto"</param>
        /// <param name="optimizationComp">Kind of optimization for the components. Default: "auto"</param>
        /// <param name="metricComp">Match metric used for the components. Default: "use_polarity"</param>
        /// <param name="pregenerationComp">Complete pregeneration of the shape models for the components if equal to 'true'. Default: "false"</param>
        /// <param name="rootRanking">Ranking of the model components expressing the suitability to act as the root component.</param>
        /// <returns>Handle of the component model.</returns>
        public HComponentModel CreateTrainedComponentModel(
            double angleStart,
            double angleExtent,
            int minContrastComp,
            double minScoreComp,
            int numLevelsComp,
            double angleStepComp,
            string optimizationComp,
            string metricComp,
            string pregenerationComp,
            out int rootRanking)
        {
            IntPtr proc = HalconAPI.PreCall(1005);

            this.Store(proc, 0);
            HalconAPI.StoreD(proc, 1, angleStart);
            HalconAPI.StoreD(proc, 2, angleExtent);
            HalconAPI.StoreI(proc, 3, minContrastComp);
            HalconAPI.StoreD(proc, 4, minScoreComp);
            HalconAPI.StoreI(proc, 5, numLevelsComp);
            HalconAPI.StoreD(proc, 6, angleStepComp);
            HalconAPI.StoreS(proc, 7, optimizationComp);
            HalconAPI.StoreS(proc, 8, metricComp);
            HalconAPI.StoreS(proc, 9, pregenerationComp);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int             err1 = HalconAPI.CallProcedure(proc);
            HComponentModel hcomponentModel;
            int             err2       = HComponentModel.LoadNew(proc, 0, err1, out hcomponentModel);
            int             procResult = HalconAPI.LoadI(proc, 1, err2, out rootRanking);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hcomponentModel);
        }
コード例 #10
0
        /// <summary>
        ///   Add a text label to a 3D scene.
        ///   Instance represents: Handle of the 3D scene.
        /// </summary>
        /// <param name="text">Text of the label. Default: "label"</param>
        /// <param name="referencePoint">Point of reference of the label.</param>
        /// <param name="position">Position of the label. Default: "top"</param>
        /// <param name="relatesTo">Indicates fixed or relative positioning. Default: "point"</param>
        /// <returns>Index of the new label in the 3D scene.</returns>
        public int AddScene3dLabel(
            string text,
            HTuple referencePoint,
            HTuple position,
            HTuple relatesTo)
        {
            IntPtr proc = HalconAPI.PreCall(2040);

            this.Store(proc, 0);
            HalconAPI.StoreS(proc, 1, text);
            HalconAPI.Store(proc, 2, referencePoint);
            HalconAPI.Store(proc, 3, position);
            HalconAPI.Store(proc, 4, relatesTo);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(referencePoint);
            HalconAPI.UnpinTuple(position);
            HalconAPI.UnpinTuple(relatesTo);
            int intValue;
            int procResult = HalconAPI.LoadI(proc, 0, err, out intValue);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(intValue);
        }
コード例 #11
0
ファイル: HXLDPara.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>
        ///   Return information about the gray values of the area enclosed by XLD parallels.
        ///   Instance represents: Input XLD Parallels.
        /// </summary>
        /// <param name="image">Corresponding gray value image.</param>
        /// <param name="qualityMin">Minimum quality factor.</param>
        /// <param name="qualityMax">Maximum quality factor.</param>
        /// <param name="grayMin">Minimum mean gray value.</param>
        /// <param name="grayMax">Maximum mean gray value.</param>
        /// <param name="standardMin">Minimum standard deviation.</param>
        /// <param name="standardMax">Maximum standard deviation.</param>
        public void InfoParallelsXld(
            HImage image,
            out double qualityMin,
            out double qualityMax,
            out int grayMin,
            out int grayMax,
            out double standardMin,
            out double standardMax)
        {
            IntPtr proc = HalconAPI.PreCall(40);

            this.Store(proc, 1);
            HalconAPI.Store(proc, 2, (HObjectBase)image);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            HalconAPI.InitOCT(proc, 3);
            HalconAPI.InitOCT(proc, 4);
            HalconAPI.InitOCT(proc, 5);
            int err1       = HalconAPI.CallProcedure(proc);
            int err2       = HalconAPI.LoadD(proc, 0, err1, out qualityMin);
            int err3       = HalconAPI.LoadD(proc, 1, err2, out qualityMax);
            int err4       = HalconAPI.LoadI(proc, 2, err3, out grayMin);
            int err5       = HalconAPI.LoadI(proc, 3, err4, out grayMax);
            int err6       = HalconAPI.LoadD(proc, 4, err5, out standardMin);
            int procResult = HalconAPI.LoadD(proc, 5, err6, out standardMax);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)image);
        }
コード例 #12
0
        /// <summary>
        ///   Return the parameters of a support vector machine.
        ///   Instance represents: SVM handle.
        /// </summary>
        /// <param name="kernelType">The kernel type.</param>
        /// <param name="kernelParam">Additional parameter for the kernel.</param>
        /// <param name="nu">Regularization constant of the SVM.</param>
        /// <param name="numClasses">Number of classes of the test data.</param>
        /// <param name="mode">The mode of the SVM.</param>
        /// <param name="preprocessing">Type of preprocessing used to transform the feature vectors.</param>
        /// <param name="numComponents">Preprocessing parameter: Number of transformed features (ignored for Preprocessing $=$ 'none' and Preprocessing $=$ 'normalization').</param>
        /// <returns>Number of input variables (features) of the SVM.</returns>
        public int GetParamsClassSvm(
            out string kernelType,
            out double kernelParam,
            out double nu,
            out int numClasses,
            out string mode,
            out string preprocessing,
            out int numComponents)
        {
            IntPtr proc = HalconAPI.PreCall(1860);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            HalconAPI.InitOCT(proc, 3);
            HalconAPI.InitOCT(proc, 4);
            HalconAPI.InitOCT(proc, 5);
            HalconAPI.InitOCT(proc, 6);
            HalconAPI.InitOCT(proc, 7);
            int err1 = HalconAPI.CallProcedure(proc);
            int intValue;
            int err2       = HalconAPI.LoadI(proc, 0, err1, out intValue);
            int err3       = HalconAPI.LoadS(proc, 1, err2, out kernelType);
            int err4       = HalconAPI.LoadD(proc, 2, err3, out kernelParam);
            int err5       = HalconAPI.LoadD(proc, 3, err4, out nu);
            int err6       = HalconAPI.LoadI(proc, 4, err5, out numClasses);
            int err7       = HalconAPI.LoadS(proc, 5, err6, out mode);
            int err8       = HalconAPI.LoadS(proc, 6, err7, out preprocessing);
            int procResult = HalconAPI.LoadI(proc, 7, err8, out numComponents);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(intValue);
        }
コード例 #13
0
        /// <summary>
        ///   Return the parameters of an NCC model.
        ///   Instance represents: Handle of the model.
        /// </summary>
        /// <param name="angleStart">Smallest rotation of the pattern.</param>
        /// <param name="angleExtent">Extent of the rotation angles.</param>
        /// <param name="angleStep">Step length of the angles (resolution).</param>
        /// <param name="metric">Match metric.</param>
        /// <returns>Number of pyramid levels.</returns>
        public int GetNccModelParams(
            out double angleStart,
            out double angleExtent,
            out double angleStep,
            out string metric)
        {
            IntPtr proc = HalconAPI.PreCall(988);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            HalconAPI.InitOCT(proc, 3);
            HalconAPI.InitOCT(proc, 4);
            int err1 = HalconAPI.CallProcedure(proc);
            int intValue;
            int err2       = HalconAPI.LoadI(proc, 0, err1, out intValue);
            int err3       = HalconAPI.LoadD(proc, 1, err2, out angleStart);
            int err4       = HalconAPI.LoadD(proc, 2, err3, out angleExtent);
            int err5       = HalconAPI.LoadD(proc, 3, err4, out angleStep);
            int procResult = HalconAPI.LoadS(proc, 4, err5, out metric);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(intValue);
        }
コード例 #14
0
        /// <summary>
        ///   Add preparation data to an existing sample identifier.
        ///   Instance represents: Handle of the sample identifier.
        /// </summary>
        /// <param name="sampleImage">Image that shows an object.</param>
        /// <param name="objectIdx">Index of the object visible in the SampleImage. Default: "unknown"</param>
        /// <param name="genParamName">Generic parameter name. Default: []</param>
        /// <param name="genParamValue">Generic parameter value. Default: []</param>
        /// <returns>Index of the object sample.</returns>
        public int AddSampleIdentifierPreparationData(
            HImage sampleImage,
            int objectIdx,
            HTuple genParamName,
            HTuple genParamValue)
        {
            IntPtr proc = HalconAPI.PreCall(914);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, (HObjectBase)sampleImage);
            HalconAPI.StoreI(proc, 1, objectIdx);
            HalconAPI.Store(proc, 2, genParamName);
            HalconAPI.Store(proc, 3, genParamValue);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(genParamName);
            HalconAPI.UnpinTuple(genParamValue);
            int intValue;
            int procResult = HalconAPI.LoadI(proc, 0, err, out intValue);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)sampleImage);
            return(intValue);
        }
コード例 #15
0
        /// <summary>
        ///   Identify objects with a sample identifier.
        ///   Instance represents: Handle of the sample identifier.
        /// </summary>
        /// <param name="image">Image showing the object to be identified.</param>
        /// <param name="numResults">Number of suggested object indices. Default: 1</param>
        /// <param name="ratingThreshold">Rating threshold. Default: 0.0</param>
        /// <param name="genParamName">Generic parameter name. Default: []</param>
        /// <param name="genParamValue">Generic parameter value. Default: []</param>
        /// <param name="rating">Rating value of the identified object.</param>
        /// <returns>Index of the identified object.</returns>
        public int ApplySampleIdentifier(
            HImage image,
            int numResults,
            double ratingThreshold,
            HTuple genParamName,
            HTuple genParamValue,
            out double rating)
        {
            IntPtr proc = HalconAPI.PreCall(904);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, (HObjectBase)image);
            HalconAPI.StoreI(proc, 1, numResults);
            HalconAPI.StoreD(proc, 2, ratingThreshold);
            HalconAPI.Store(proc, 3, genParamName);
            HalconAPI.Store(proc, 4, genParamValue);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int err1 = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(genParamName);
            HalconAPI.UnpinTuple(genParamValue);
            int intValue;
            int err2       = HalconAPI.LoadI(proc, 0, err1, out intValue);
            int procResult = HalconAPI.LoadD(proc, 1, err2, out rating);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)image);
            return(intValue);
        }
コード例 #16
0
ファイル: HInfo.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>Query the possible line widths.</summary>
        /// <param name="min">Displayable minimum width.</param>
        /// <param name="max">Displayable maximum width.</param>
        public static void QueryLineWidth(out int min, out int max)
        {
            IntPtr proc = HalconAPI.PreCall(1254);

            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int err1       = HalconAPI.CallProcedure(proc);
            int err2       = HalconAPI.LoadI(proc, 0, err1, out min);
            int procResult = HalconAPI.LoadI(proc, 1, err2, out max);

            HalconAPI.PostCall(proc, procResult);
        }
コード例 #17
0
ファイル: HSystem.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>Number of entries in the HALCON database.</summary>
        /// <param name="relationName">Relation of interest of the HALCON database. Default: "object"</param>
        /// <returns>Number of tuples in the relation.</returns>
        public static int CountRelation(string relationName)
        {
            IntPtr proc = HalconAPI.PreCall(324);

            HalconAPI.StoreS(proc, 0, relationName);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            int intValue;
            int procResult = HalconAPI.LoadI(proc, 0, err, out intValue);

            HalconAPI.PostCall(proc, procResult);
            return(intValue);
        }
コード例 #18
0
        /// <summary>
        ///   Return the number of training samples stored in the training data.
        ///   Instance represents: Handle of training data.
        /// </summary>
        /// <returns>Number of stored training samples.</returns>
        public int GetSampleNumClassTrainData()
        {
            IntPtr proc = HalconAPI.PreCall(1793);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            int intValue;
            int procResult = HalconAPI.LoadI(proc, 0, err, out intValue);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(intValue);
        }
コード例 #19
0
ファイル: HObject.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>
        ///   Number of objects in a tuple.
        ///   Instance represents: Objects to be examined.
        /// </summary>
        /// <returns>Number of objects in the tuple Objects.</returns>
        public int CountObj()
        {
            IntPtr proc = HalconAPI.PreCall(592);

            this.Store(proc, 1);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            int intValue;
            int procResult = HalconAPI.LoadI(proc, 0, err, out intValue);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(intValue);
        }
コード例 #20
0
ファイル: HSocket.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>
        ///   Get the socket descriptor of a socket used by the operating system.
        ///   Instance represents: Socket number.
        /// </summary>
        /// <returns>Socket descriptor used by the operating system.</returns>
        public int GetSocketDescriptor()
        {
            IntPtr proc = HalconAPI.PreCall(338);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            int intValue;
            int procResult = HalconAPI.LoadI(proc, 0, err, out intValue);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(intValue);
        }
コード例 #21
0
ファイル: HSystem.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>Query of used modules and the module key.</summary>
        /// <param name="moduleKey">Key for license manager.</param>
        /// <returns>Names of used modules.</returns>
        public static HTuple GetModules(out int moduleKey)
        {
            IntPtr proc = HalconAPI.PreCall(345);

            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int    err1 = HalconAPI.CallProcedure(proc);
            HTuple tuple;
            int    err2       = HTuple.LoadNew(proc, 0, err1, out tuple);
            int    procResult = HalconAPI.LoadI(proc, 1, err2, out moduleKey);

            HalconAPI.PostCall(proc, procResult);
            return(tuple);
        }
コード例 #22
0
ファイル: HLexicon.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>
        ///   Check if a word is contained in a lexicon.
        ///   Instance represents: Handle of the lexicon.
        /// </summary>
        /// <param name="word">Word to be looked up. Default: "word"</param>
        /// <returns>Result of the search.</returns>
        public int LookupLexicon(string word)
        {
            IntPtr proc = HalconAPI.PreCall(668);

            this.Store(proc, 0);
            HalconAPI.StoreS(proc, 1, word);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            int intValue;
            int procResult = HalconAPI.LoadI(proc, 0, err, out intValue);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(intValue);
        }
コード例 #23
0
ファイル: HXLDPara.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>
        ///   Compare image objects regarding equality.
        ///   Instance represents: Test objects.
        /// </summary>
        /// <param name="objects2">Comparative objects.</param>
        /// <returns>boolean result value.</returns>
        public int TestEqualObj(HXLDPara objects2)
        {
            IntPtr proc = HalconAPI.PreCall(591);

            this.Store(proc, 1);
            HalconAPI.Store(proc, 2, (HObjectBase)objects2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            int intValue;
            int procResult = HalconAPI.LoadI(proc, 0, err, out intValue);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)objects2);
            return(intValue);
        }
コード例 #24
0
        /// <summary>
        ///   Return the number of support vectors of a support vector machine.
        ///   Instance represents: SVM handle.
        /// </summary>
        /// <param name="numSVPerSVM">Number of SV of each sub-SVM.</param>
        /// <returns>Total number of support vectors.</returns>
        public int GetSupportVectorNumClassSvm(out HTuple numSVPerSVM)
        {
            IntPtr proc = HalconAPI.PreCall(1855);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int err1 = HalconAPI.CallProcedure(proc);
            int intValue;
            int err2       = HalconAPI.LoadI(proc, 0, err1, out intValue);
            int procResult = HTuple.LoadNew(proc, 1, HTupleType.INTEGER, err2, out numSVPerSVM);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(intValue);
        }
コード例 #25
0
ファイル: HFile.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>
        ///   Read strings from a file.
        ///   Instance represents: File handle.
        /// </summary>
        /// <param name="isEOF">Reached end of file.</param>
        /// <returns>Read character sequence.</returns>
        public string FreadString(out int isEOF)
        {
            IntPtr proc = HalconAPI.PreCall(1662);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int    err1 = HalconAPI.CallProcedure(proc);
            string stringValue;
            int    err2       = HalconAPI.LoadS(proc, 0, err1, out stringValue);
            int    procResult = HalconAPI.LoadI(proc, 1, err2, out isEOF);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(stringValue);
        }
コード例 #26
0
        /// <summary>
        ///   Access the data pointer of a serialized item.
        ///   Instance represents: Handle of the serialized item.
        /// </summary>
        /// <param name="size">Size of the serialized item.</param>
        /// <returns>Data pointer of the serialized item.</returns>
        public IntPtr GetSerializedItemPtr(out int size)
        {
            IntPtr proc = HalconAPI.PreCall(409);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int    err1 = HalconAPI.CallProcedure(proc);
            IntPtr intPtrValue;
            int    err2       = HalconAPI.LoadIP(proc, 0, err1, out intPtrValue);
            int    procResult = HalconAPI.LoadI(proc, 1, err2, out size);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(intPtrValue);
        }
コード例 #27
0
ファイル: HFunction1D.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>
        ///   Number of control points of the function.
        ///   Instance represents: Input function.
        /// </summary>
        /// <returns>Number of control points.</returns>
        public int NumPointsFunct1d()
        {
            IntPtr proc = HalconAPI.PreCall(1387);

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

            this.UnpinTuple();
            int intValue;
            int procResult = HalconAPI.LoadI(proc, 0, err, out intValue);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(intValue);
        }
コード例 #28
0
ファイル: HSystem.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>Returns the extended error information for the calling thread's last HALCON error.</summary>
        /// <param name="errorCode">Extended error code.</param>
        /// <param name="errorMessage">Extended error message.</param>
        /// <returns>Operator that set the error code.</returns>
        public static string GetExtendedErrorInfo(out int errorCode, out string errorMessage)
        {
            IntPtr proc = HalconAPI.PreCall(344);

            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            int    err1 = HalconAPI.CallProcedure(proc);
            string stringValue;
            int    err2       = HalconAPI.LoadS(proc, 0, err1, out stringValue);
            int    err3       = HalconAPI.LoadI(proc, 1, err2, out errorCode);
            int    procResult = HalconAPI.LoadS(proc, 2, err3, out errorMessage);

            HalconAPI.PostCall(proc, procResult);
            return(stringValue);
        }
コード例 #29
0
ファイル: HLexicon.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>
        ///   Find a similar word in a lexicon.
        ///   Instance represents: Handle of the lexicon.
        /// </summary>
        /// <param name="word">Word to be looked up. Default: "word"</param>
        /// <param name="numCorrections">Difference between the words in edit operations.</param>
        /// <returns>Most similar word found in the lexicon.</returns>
        public string SuggestLexicon(string word, out int numCorrections)
        {
            IntPtr proc = HalconAPI.PreCall(667);

            this.Store(proc, 0);
            HalconAPI.StoreS(proc, 1, word);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int    err1 = HalconAPI.CallProcedure(proc);
            string stringValue;
            int    err2       = HalconAPI.LoadS(proc, 0, err1, out stringValue);
            int    procResult = HalconAPI.LoadI(proc, 1, err2, out numCorrections);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(stringValue);
        }
コード例 #30
0
ファイル: HXLDPoly.cs プロジェクト: zshankang/OpenHalcon
        /// <summary>
        ///   Compare iconic objects regarding equality.
        ///   Instance represents: Reference objects.
        /// </summary>
        /// <param name="objects2">Test objects.</param>
        /// <param name="epsilon">Maximum allowed difference between two gray values or  coordinates etc. Default: 0.0</param>
        /// <returns>Boolean result value.</returns>
        public int CompareObj(HXLDPoly objects2, double epsilon)
        {
            IntPtr proc = HalconAPI.PreCall(588);

            this.Store(proc, 1);
            HalconAPI.Store(proc, 2, (HObjectBase)objects2);
            HalconAPI.StoreD(proc, 0, epsilon);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            int intValue;
            int procResult = HalconAPI.LoadI(proc, 0, err, out intValue);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)objects2);
            return(intValue);
        }