예제 #1
0
        public static HClassBox Deserialize(Stream stream)
        {
            HClassBox hclassBox = new HClassBox();

            hclassBox.DeserializeClassBox(HSerializedItem.Deserialize(stream));
            return(hclassBox);
        }
예제 #2
0
        public HClassBox Clone()
        {
            HSerializedItem serializedItemHandle = this.SerializeClassBox();
            HClassBox       hclassBox            = new HClassBox();

            hclassBox.DeserializeClassBox(serializedItemHandle);
            serializedItemHandle.Dispose();
            return(hclassBox);
        }
예제 #3
0
        internal static int LoadNew(IntPtr proc, int parIndex, int err, out HClassBox[] obj)
        {
            HTuple tuple;

            err = HTuple.LoadNew(proc, parIndex, err, out tuple);
            obj = new HClassBox[tuple.Length];
            for (int index = 0; index < tuple.Length; ++index)
            {
                obj[index] = new HClassBox(tuple[index].IP);
            }
            return(err);
        }
예제 #4
0
        /// <summary>
        ///   Classify a set of arrays.
        ///   Instance represents: Key of the test data.
        /// </summary>
        /// <param name="classifHandle">Handle of the classifier.</param>
        /// <returns>Error during the assignment.</returns>
        public double TestSampsetBox(HClassBox classifHandle)
        {
            IntPtr proc = HalconAPI.PreCall(1897);

            this.Store(proc, 1);
            HalconAPI.Store(proc, 0, (HTool)classifHandle);
            HalconAPI.InitOCT(proc, 0);
            int    err = HalconAPI.CallProcedure(proc);
            double doubleValue;
            int    procResult = HalconAPI.LoadD(proc, 0, err, out doubleValue);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)classifHandle);
            return(doubleValue);
        }
예제 #5
0
        /// <summary>
        ///   Train the classifier with one data set.
        ///   Instance represents: Number of the data set to train.
        /// </summary>
        /// <param name="classifHandle">Handle of the classifier.</param>
        /// <param name="outfile">Name of the protocol file. Default: "training_prot"</param>
        /// <param name="NSamples">Number of arrays of attributes to learn. Default: 500</param>
        /// <param name="stopError">Classification error for termination. Default: 0.05</param>
        /// <param name="errorN">Error during the assignment. Default: 100</param>
        public void LearnSampsetBox(
            HClassBox classifHandle,
            string outfile,
            int NSamples,
            double stopError,
            int errorN)
        {
            IntPtr proc = HalconAPI.PreCall(1890);

            this.Store(proc, 1);
            HalconAPI.Store(proc, 0, (HTool)classifHandle);
            HalconAPI.StoreS(proc, 2, outfile);
            HalconAPI.StoreI(proc, 3, NSamples);
            HalconAPI.StoreD(proc, 4, stopError);
            HalconAPI.StoreI(proc, 5, errorN);
            int procResult = HalconAPI.CallProcedure(proc);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)classifHandle);
        }
예제 #6
0
 internal static int LoadNew(IntPtr proc, int parIndex, int err, out HClassBox obj)
 {
     obj = new HClassBox(HTool.UNDEF);
     return(obj.Load(proc, parIndex, err));
 }