コード例 #1
0
        /// <summary>
        ///   Find the best matches of a descriptor model in an image.
        ///   Instance represents: The handle to the descriptor model.
        /// </summary>
        /// <param name="image">Input image where the model should be found.</param>
        /// <param name="detectorParamName">The detector's parameter names. Default: []</param>
        /// <param name="detectorParamValue">Values of the detector's parameters. Default: []</param>
        /// <param name="descriptorParamName">The descriptor's parameter names. Default: []</param>
        /// <param name="descriptorParamValue">Values of the descriptor's parameters. Default: []</param>
        /// <param name="minScore">Minimum score of the instances of the models to be found. Default: 0.2</param>
        /// <param name="numMatches">Maximal number of found instances. Default: 1</param>
        /// <param name="scoreType">Score type to be evaluated in Score. Default: "num_points"</param>
        /// <param name="score">Score of the found instances according to the ScoreType input.</param>
        /// <returns>Homography between model and found instance.</returns>
        public HHomMat2D[] FindUncalibDescriptorModel(
            HImage image,
            HTuple detectorParamName,
            HTuple detectorParamValue,
            HTuple descriptorParamName,
            HTuple descriptorParamValue,
            HTuple minScore,
            int numMatches,
            HTuple scoreType,
            out HTuple score)
        {
            IntPtr proc = HalconAPI.PreCall(949);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, (HObjectBase)image);
            HalconAPI.Store(proc, 1, detectorParamName);
            HalconAPI.Store(proc, 2, detectorParamValue);
            HalconAPI.Store(proc, 3, descriptorParamName);
            HalconAPI.Store(proc, 4, descriptorParamValue);
            HalconAPI.Store(proc, 5, minScore);
            HalconAPI.StoreI(proc, 6, numMatches);
            HalconAPI.Store(proc, 7, scoreType);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int err1 = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(detectorParamName);
            HalconAPI.UnpinTuple(detectorParamValue);
            HalconAPI.UnpinTuple(descriptorParamName);
            HalconAPI.UnpinTuple(descriptorParamValue);
            HalconAPI.UnpinTuple(minScore);
            HalconAPI.UnpinTuple(scoreType);
            HTuple tuple;
            int    err2       = HTuple.LoadNew(proc, 0, err1, out tuple);
            int    procResult = HTuple.LoadNew(proc, 1, err2, out score);

            HalconAPI.PostCall(proc, procResult);
            HHomMat2D[] hhomMat2DArray = HHomMat2D.SplitArray(tuple);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)image);
            return(hhomMat2DArray);
        }