コード例 #1
0
        /// <summary>
        ///   Find the best match of a deformable surface model in a 3D scene.
        ///   Instance represents: Handle of the deformable surface model.
        /// </summary>
        /// <param name="objectModel3D">Handle of the 3D object model containing the scene.</param>
        /// <param name="relSamplingDistance">Scene sampling distance relative to the diameter of the surface model. Default: 0.05</param>
        /// <param name="minScore">Minimum score of the returned match. Default: 0</param>
        /// <param name="genParamName">Names of the generic parameters. Default: []</param>
        /// <param name="genParamValue">Values of the generic parameters. Default: []</param>
        /// <param name="deformableSurfaceMatchingResult">Handle of the matching result.</param>
        /// <returns>Score of the found instances of the surface model.</returns>
        public double FindDeformableSurfaceModel(
            HObjectModel3D objectModel3D,
            double relSamplingDistance,
            double minScore,
            HTuple genParamName,
            HTuple genParamValue,
            out HDeformableSurfaceMatchingResult deformableSurfaceMatchingResult)
        {
            IntPtr proc = HalconAPI.PreCall(1027);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, (HTool)objectModel3D);
            HalconAPI.StoreD(proc, 2, relSamplingDistance);
            HalconAPI.StoreD(proc, 3, minScore);
            HalconAPI.Store(proc, 4, genParamName);
            HalconAPI.Store(proc, 5, genParamValue);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int err1 = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(genParamName);
            HalconAPI.UnpinTuple(genParamValue);
            double doubleValue;
            int    err2       = HalconAPI.LoadD(proc, 0, err1, out doubleValue);
            int    procResult = HDeformableSurfaceMatchingResult.LoadNew(proc, 1, err2, out deformableSurfaceMatchingResult);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)objectModel3D);
            return(doubleValue);
        }
コード例 #2
0
        /// <summary>
        ///   Refine the position and deformation of a deformable surface model in a 3D scene.
        ///   Instance represents: Handle of the deformable surface model.
        /// </summary>
        /// <param name="objectModel3D">Handle of the 3D object model containing the scene.</param>
        /// <param name="relSamplingDistance">Relative sampling distance of the scene. Default: 0.05</param>
        /// <param name="initialDeformationObjectModel3D">Initial deformation of the 3D object model</param>
        /// <param name="genParamName">Names of the generic parameters. Default: []</param>
        /// <param name="genParamValue">Values of the generic parameters. Default: []</param>
        /// <param name="deformableSurfaceMatchingResult">Handle of the matching result.</param>
        /// <returns>Score of the refined model.</returns>
        public double RefineDeformableSurfaceModel(
            HObjectModel3D objectModel3D,
            double relSamplingDistance,
            HObjectModel3D initialDeformationObjectModel3D,
            string genParamName,
            string genParamValue,
            out HDeformableSurfaceMatchingResult deformableSurfaceMatchingResult)
        {
            IntPtr proc = HalconAPI.PreCall(1026);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, (HTool)objectModel3D);
            HalconAPI.StoreD(proc, 2, relSamplingDistance);
            HalconAPI.Store(proc, 3, (HTool)initialDeformationObjectModel3D);
            HalconAPI.StoreS(proc, 4, genParamName);
            HalconAPI.StoreS(proc, 5, genParamValue);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int    err1 = HalconAPI.CallProcedure(proc);
            double doubleValue;
            int    err2       = HalconAPI.LoadD(proc, 0, err1, out doubleValue);
            int    procResult = HDeformableSurfaceMatchingResult.LoadNew(proc, 1, err2, out deformableSurfaceMatchingResult);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)objectModel3D);
            GC.KeepAlive((object)initialDeformationObjectModel3D);
            return(doubleValue);
        }
コード例 #3
0
        /// <summary>Find the best match of a deformable surface model in a 3D scene.</summary>
        /// <param name="deformableSurfaceModel">Handle of the deformable surface model.</param>
        /// <param name="objectModel3D">Handle of the 3D object model containing the scene.</param>
        /// <param name="relSamplingDistance">Scene sampling distance relative to the diameter of the surface model. Default: 0.05</param>
        /// <param name="minScore">Minimum score of the returned match. Default: 0</param>
        /// <param name="genParamName">Names of the generic parameters. Default: []</param>
        /// <param name="genParamValue">Values of the generic parameters. Default: []</param>
        /// <param name="deformableSurfaceMatchingResult">Handle of the matching result.</param>
        /// <returns>Score of the found instances of the surface model.</returns>
        public static HTuple FindDeformableSurfaceModel(
            HDeformableSurfaceModel deformableSurfaceModel,
            HObjectModel3D objectModel3D,
            double relSamplingDistance,
            HTuple minScore,
            HTuple genParamName,
            HTuple genParamValue,
            out HDeformableSurfaceMatchingResult[] deformableSurfaceMatchingResult)
        {
            IntPtr proc = HalconAPI.PreCall(1027);

            HalconAPI.Store(proc, 0, (HTool)deformableSurfaceModel);
            HalconAPI.Store(proc, 1, (HTool)objectModel3D);
            HalconAPI.StoreD(proc, 2, relSamplingDistance);
            HalconAPI.Store(proc, 3, minScore);
            HalconAPI.Store(proc, 4, genParamName);
            HalconAPI.Store(proc, 5, genParamValue);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int err1 = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(minScore);
            HalconAPI.UnpinTuple(genParamName);
            HalconAPI.UnpinTuple(genParamValue);
            HTuple tuple;
            int    err2       = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err1, out tuple);
            int    procResult = HDeformableSurfaceMatchingResult.LoadNew(proc, 1, err2, out deformableSurfaceMatchingResult);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)deformableSurfaceModel);
            GC.KeepAlive((object)objectModel3D);
            return(tuple);
        }
コード例 #4
0
 internal static int LoadNew(
     IntPtr proc,
     int parIndex,
     int err,
     out HDeformableSurfaceMatchingResult obj)
 {
     obj = new HDeformableSurfaceMatchingResult(HTool.UNDEF);
     return(obj.Load(proc, parIndex, err));
 }
コード例 #5
0
        internal static int LoadNew(
            IntPtr proc,
            int parIndex,
            int err,
            out HDeformableSurfaceMatchingResult[] obj)
        {
            HTuple tuple;

            err = HTuple.LoadNew(proc, parIndex, err, out tuple);
            obj = new HDeformableSurfaceMatchingResult[tuple.Length];
            for (int index = 0; index < tuple.Length; ++index)
            {
                obj[index] = new HDeformableSurfaceMatchingResult(tuple[index].IP);
            }
            return(err);
        }