Exemplo n.º 1
0
        /// <summary>
        ///   Get the training data of a k-nearest neighbors (k-NN) classifier.
        ///   Instance represents: Handle of the k-NN classifier  that contains training data.
        /// </summary>
        /// <returns>Handle of the training data of the classifier.</returns>
        public HClassTrainData GetClassTrainDataKnn()
        {
            IntPtr proc = HalconAPI.PreCall(1789);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int             err = HalconAPI.CallProcedure(proc);
            HClassTrainData hclassTrainData;
            int             procResult = HClassTrainData.LoadNew(proc, 0, err, out hclassTrainData);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hclassTrainData);
        }
Exemplo n.º 2
0
        /// <summary>
        ///   Select certain features from training data to create  training data containing less features.
        ///   Instance represents: Handle of the training data.
        /// </summary>
        /// <param name="subFeatureIndices">Indices or names to select the subfeatures or columns.</param>
        /// <returns>Handle of the reduced training data.</returns>
        public HClassTrainData SelectSubFeatureClassTrainData(HTuple subFeatureIndices)
        {
            IntPtr proc = HalconAPI.PreCall(1783);

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

            HalconAPI.UnpinTuple(subFeatureIndices);
            HClassTrainData hclassTrainData;
            int             procResult = HClassTrainData.LoadNew(proc, 0, err, out hclassTrainData);

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