/// <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);
        }
        /// <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);
        }
        /// <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);
        }
        /// <summary>
        ///   Add a sample deformation to a deformable surface model
        ///   Instance represents: Handle of the deformable surface model.
        /// </summary>
        /// <param name="objectModel3D">Handle of the deformed 3D object model.</param>
        public void AddDeformableSurfaceModelSample(HObjectModel3D objectModel3D)
        {
            IntPtr proc = HalconAPI.PreCall(1030);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, (HTool)objectModel3D);
            int procResult = HalconAPI.CallProcedure(proc);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)objectModel3D);
        }
Exemple #5
0
        /// <summary>
        ///   Prepare a 3D object model for matching.
        ///   Modified instance represents: Handle of the 3D shape model.
        /// </summary>
        /// <param name="objectModel3D">Handle of the 3D object model.</param>
        /// <param name="camParam">Internal camera parameters.</param>
        /// <param name="refRotX">Reference orientation: Rotation around x-axis or x component of the Rodriguez vector (in radians or without unit). Default: 0</param>
        /// <param name="refRotY">Reference orientation: Rotation around y-axis or y component of the Rodriguez vector (in radians or without unit). Default: 0</param>
        /// <param name="refRotZ">Reference orientation: Rotation around z-axis or z component of the Rodriguez vector (in radians or without unit). Default: 0</param>
        /// <param name="orderOfRotation">Meaning of the rotation values of the reference orientation. Default: "gba"</param>
        /// <param name="longitudeMin">Minimum longitude of the model views. Default: -0.35</param>
        /// <param name="longitudeMax">Maximum longitude of the model views. Default: 0.35</param>
        /// <param name="latitudeMin">Minimum latitude of the model views. Default: -0.35</param>
        /// <param name="latitudeMax">Maximum latitude of the model views. Default: 0.35</param>
        /// <param name="camRollMin">Minimum camera roll angle of the model views. Default: -3.1416</param>
        /// <param name="camRollMax">Maximum camera roll angle of the model views. Default: 3.1416</param>
        /// <param name="distMin">Minimum camera-object-distance of the model views. Default: 0.3</param>
        /// <param name="distMax">Maximum camera-object-distance of the model views. Default: 0.4</param>
        /// <param name="minContrast">Minimum contrast of the objects in the search images. Default: 10</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>
        public void CreateShapeModel3d(
            HObjectModel3D objectModel3D,
            HCamPar camParam,
            double refRotX,
            double refRotY,
            double refRotZ,
            string orderOfRotation,
            double longitudeMin,
            double longitudeMax,
            double latitudeMin,
            double latitudeMax,
            double camRollMin,
            double camRollMax,
            double distMin,
            double distMax,
            int minContrast,
            HTuple genParamName,
            HTuple genParamValue)
        {
            this.Dispose();
            IntPtr proc = HalconAPI.PreCall(1059);

            HalconAPI.Store(proc, 0, (HTool)objectModel3D);
            HalconAPI.Store(proc, 1, (HData)camParam);
            HalconAPI.StoreD(proc, 2, refRotX);
            HalconAPI.StoreD(proc, 3, refRotY);
            HalconAPI.StoreD(proc, 4, refRotZ);
            HalconAPI.StoreS(proc, 5, orderOfRotation);
            HalconAPI.StoreD(proc, 6, longitudeMin);
            HalconAPI.StoreD(proc, 7, longitudeMax);
            HalconAPI.StoreD(proc, 8, latitudeMin);
            HalconAPI.StoreD(proc, 9, latitudeMax);
            HalconAPI.StoreD(proc, 10, camRollMin);
            HalconAPI.StoreD(proc, 11, camRollMax);
            HalconAPI.StoreD(proc, 12, distMin);
            HalconAPI.StoreD(proc, 13, distMax);
            HalconAPI.StoreI(proc, 14, minContrast);
            HalconAPI.Store(proc, 15, genParamName);
            HalconAPI.Store(proc, 16, genParamValue);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple((HTuple)((HData)camParam));
            HalconAPI.UnpinTuple(genParamName);
            HalconAPI.UnpinTuple(genParamValue);
            int procResult = this.Load(proc, 0, err);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)objectModel3D);
        }
Exemple #6
0
        /// <summary>
        ///   Get the result of a calibrated measurement performed with the  sheet-of-light technique as a 3D object model.
        ///   Instance represents: Handle for accessing the sheet-of-light model.
        /// </summary>
        /// <returns>Handle of the resulting 3D object model.</returns>
        public HObjectModel3D GetSheetOfLightResultObjectModel3d()
        {
            IntPtr proc = HalconAPI.PreCall(380);

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

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hobjectModel3D);
        }
Exemple #7
0
        /// <summary>
        ///   Get intermediate 3D object model of a stereo reconstruction
        ///   Instance represents: Handle des Stereomodells.
        /// </summary>
        /// <param name="genParamName">Namen der Modellparameter.</param>
        /// <returns>Werte der Modellparameter.</returns>
        public HObjectModel3D GetStereoModelObjectModel3d(string genParamName)
        {
            IntPtr proc = HalconAPI.PreCall(2074);

            this.Store(proc, 0);
            HalconAPI.StoreS(proc, 1, genParamName);
            HalconAPI.InitOCT(proc, 0);
            int            err = HalconAPI.CallProcedure(proc);
            HObjectModel3D hobjectModel3D;
            int            procResult = HObjectModel3D.LoadNew(proc, 0, err, out hobjectModel3D);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hobjectModel3D);
        }
Exemple #8
0
        /// <summary>
        ///   Reconstruct surface from calibrated multi-view stereo images.
        ///   Instance represents: Handle of the stereo model.
        /// </summary>
        /// <param name="images">An image array acquired by the camera setup associated with the stereo model.</param>
        /// <returns>Handle to the resulting surface.</returns>
        public HObjectModel3D ReconstructSurfaceStereo(HImage images)
        {
            IntPtr proc = HalconAPI.PreCall(521);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, (HObjectBase)images);
            HalconAPI.InitOCT(proc, 0);
            int            err = HalconAPI.CallProcedure(proc);
            HObjectModel3D hobjectModel3D;
            int            procResult = HObjectModel3D.LoadNew(proc, 0, err, out hobjectModel3D);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)images);
            return(hobjectModel3D);
        }
        /// <summary>Refine the pose of a surface model in a 3D scene and in images.</summary>
        /// <param name="image">Images of the scene.</param>
        /// <param name="surfaceModelID">Handle of the surface model.</param>
        /// <param name="objectModel3D">Handle of the 3D object model containing the scene.</param>
        /// <param name="initialPose">Initial pose of the surface model in the scene.</param>
        /// <param name="minScore">Minimum score of the returned poses. Default: 0</param>
        /// <param name="returnResultHandle">Enable returning a result handle in SurfaceMatchingResultID. Default: "false"</param>
        /// <param name="genParamName">Names of the generic parameters. Default: []</param>
        /// <param name="genParamValue">Values of the generic parameters. Default: []</param>
        /// <param name="score">Score of the found instances of the model.</param>
        /// <param name="surfaceMatchingResultID">Handle of the matching result, if enabled in ReturnResultHandle.</param>
        /// <returns>3D pose of the surface model in the scene.</returns>
        public static HPose[] RefineSurfaceModelPoseImage(
            HImage image,
            HSurfaceModel surfaceModelID,
            HObjectModel3D objectModel3D,
            HPose[] initialPose,
            HTuple minScore,
            string returnResultHandle,
            HTuple genParamName,
            HTuple genParamValue,
            out HTuple score,
            out HSurfaceMatchingResult[] surfaceMatchingResultID)
        {
            HTuple htuple = HData.ConcatArray((HData[])initialPose);
            IntPtr proc   = HalconAPI.PreCall(2084);

            HalconAPI.Store(proc, 1, (HObjectBase)image);
            HalconAPI.Store(proc, 0, (HTool)surfaceModelID);
            HalconAPI.Store(proc, 1, (HTool)objectModel3D);
            HalconAPI.Store(proc, 2, htuple);
            HalconAPI.Store(proc, 3, minScore);
            HalconAPI.StoreS(proc, 4, returnResultHandle);
            HalconAPI.Store(proc, 5, genParamName);
            HalconAPI.Store(proc, 6, genParamValue);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            int err1 = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(htuple);
            HalconAPI.UnpinTuple(minScore);
            HalconAPI.UnpinTuple(genParamName);
            HalconAPI.UnpinTuple(genParamValue);
            HTuple tuple;
            int    err2       = HTuple.LoadNew(proc, 0, err1, out tuple);
            int    err3       = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, err2, out score);
            int    procResult = HSurfaceMatchingResult.LoadNew(proc, 2, err3, out surfaceMatchingResultID);

            HalconAPI.PostCall(proc, procResult);
            HPose[] hposeArray = HPose.SplitArray(tuple);
            GC.KeepAlive((object)image);
            GC.KeepAlive((object)surfaceModelID);
            GC.KeepAlive((object)objectModel3D);
            return(hposeArray);
        }
        /// <summary>Find the best matches of a surface model in a 3D scene and images.</summary>
        /// <param name="image">Images of the scene.</param>
        /// <param name="surfaceModelID">Handle of the 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="keyPointFraction">Fraction of sampled scene points used as key points. Default: 0.2</param>
        /// <param name="minScore">Minimum score of the returned poses. Default: 0</param>
        /// <param name="returnResultHandle">Enable returning a result handle in SurfaceMatchingResultID. Default: "false"</param>
        /// <param name="genParamName">Names of the generic parameters. Default: []</param>
        /// <param name="genParamValue">Values of the generic parameters. Default: []</param>
        /// <param name="score">Score of the found instances of the surface model.</param>
        /// <param name="surfaceMatchingResultID">Handle of the matching result, if enabled in ReturnResultHandle.</param>
        /// <returns>3D pose of the surface model in the scene.</returns>
        public static HPose[] FindSurfaceModelImage(
            HImage image,
            HSurfaceModel surfaceModelID,
            HObjectModel3D objectModel3D,
            double relSamplingDistance,
            double keyPointFraction,
            HTuple minScore,
            string returnResultHandle,
            HTuple genParamName,
            HTuple genParamValue,
            out HTuple score,
            out HSurfaceMatchingResult[] surfaceMatchingResultID)
        {
            IntPtr proc = HalconAPI.PreCall(2069);

            HalconAPI.Store(proc, 1, (HObjectBase)image);
            HalconAPI.Store(proc, 0, (HTool)surfaceModelID);
            HalconAPI.Store(proc, 1, (HTool)objectModel3D);
            HalconAPI.StoreD(proc, 2, relSamplingDistance);
            HalconAPI.StoreD(proc, 3, keyPointFraction);
            HalconAPI.Store(proc, 4, minScore);
            HalconAPI.StoreS(proc, 5, returnResultHandle);
            HalconAPI.Store(proc, 6, genParamName);
            HalconAPI.Store(proc, 7, genParamValue);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            int err1 = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(minScore);
            HalconAPI.UnpinTuple(genParamName);
            HalconAPI.UnpinTuple(genParamValue);
            HTuple tuple;
            int    err2       = HTuple.LoadNew(proc, 0, err1, out tuple);
            int    err3       = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, err2, out score);
            int    procResult = HSurfaceMatchingResult.LoadNew(proc, 2, err3, out surfaceMatchingResultID);

            HalconAPI.PostCall(proc, procResult);
            HPose[] hposeArray = HPose.SplitArray(tuple);
            GC.KeepAlive((object)image);
            GC.KeepAlive((object)surfaceModelID);
            GC.KeepAlive((object)objectModel3D);
            return(hposeArray);
        }
Exemple #11
0
        /// <summary>
        ///   Add an instance of a 3D object model to a 3D scene.
        ///   Instance represents: Handle of the 3D scene.
        /// </summary>
        /// <param name="objectModel3D">Handle of the 3D object model.</param>
        /// <param name="pose">Pose of the 3D object model.</param>
        /// <returns>Index of the new instance in the 3D scene.</returns>
        public int AddScene3dInstance(HObjectModel3D objectModel3D, HPose pose)
        {
            IntPtr proc = HalconAPI.PreCall(1217);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, (HTool)objectModel3D);
            HalconAPI.Store(proc, 2, (HData)pose);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

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

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)objectModel3D);
            return(intValue);
        }
        /// <summary>
        ///   Refine the pose of a surface model in a 3D scene and in images.
        ///   Modified instance represents: Handle of the matching result, if enabled in ReturnResultHandle.
        /// </summary>
        /// <param name="image">Images of the scene.</param>
        /// <param name="surfaceModelID">Handle of the surface model.</param>
        /// <param name="objectModel3D">Handle of the 3D object model containing the scene.</param>
        /// <param name="initialPose">Initial pose of the surface model in the scene.</param>
        /// <param name="minScore">Minimum score of the returned poses. Default: 0</param>
        /// <param name="returnResultHandle">Enable returning a result handle in SurfaceMatchingResultID. Default: "false"</param>
        /// <param name="genParamName">Names of the generic parameters. Default: []</param>
        /// <param name="genParamValue">Values of the generic parameters. Default: []</param>
        /// <param name="score">Score of the found instances of the model.</param>
        /// <returns>3D pose of the surface model in the scene.</returns>
        public HPose RefineSurfaceModelPoseImage(
            HImage image,
            HSurfaceModel surfaceModelID,
            HObjectModel3D objectModel3D,
            HPose initialPose,
            double minScore,
            string returnResultHandle,
            HTuple genParamName,
            HTuple genParamValue,
            out HTuple score)
        {
            this.Dispose();
            IntPtr proc = HalconAPI.PreCall(2084);

            HalconAPI.Store(proc, 1, (HObjectBase)image);
            HalconAPI.Store(proc, 0, (HTool)surfaceModelID);
            HalconAPI.Store(proc, 1, (HTool)objectModel3D);
            HalconAPI.Store(proc, 2, (HData)initialPose);
            HalconAPI.StoreD(proc, 3, minScore);
            HalconAPI.StoreS(proc, 4, returnResultHandle);
            HalconAPI.Store(proc, 5, genParamName);
            HalconAPI.Store(proc, 6, genParamValue);
            HalconAPI.InitOCT(proc, 2);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int err1 = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple((HTuple)((HData)initialPose));
            HalconAPI.UnpinTuple(genParamName);
            HalconAPI.UnpinTuple(genParamValue);
            int   err2 = this.Load(proc, 2, err1);
            HPose hpose;
            int   err3       = HPose.LoadNew(proc, 0, err2, out hpose);
            int   procResult = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, err3, out score);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)image);
            GC.KeepAlive((object)surfaceModelID);
            GC.KeepAlive((object)objectModel3D);
            return(hpose);
        }
Exemple #13
0
        /// <summary>
        ///   Create the data structure needed to perform surface-based matching.
        ///   Modified instance represents: Handle of the surface model.
        /// </summary>
        /// <param name="objectModel3D">Handle of the 3D object model.</param>
        /// <param name="relSamplingDistance">Sampling distance relative to the object's diameter Default: 0.03</param>
        /// <param name="genParamName">Names of the generic parameters. Default: []</param>
        /// <param name="genParamValue">Values of the generic parameters. Default: []</param>
        public HSurfaceModel(
            HObjectModel3D objectModel3D,
            double relSamplingDistance,
            string genParamName,
            string genParamValue)
        {
            IntPtr proc = HalconAPI.PreCall(1044);

            HalconAPI.Store(proc, 0, (HTool)objectModel3D);
            HalconAPI.StoreD(proc, 1, relSamplingDistance);
            HalconAPI.StoreS(proc, 2, genParamName);
            HalconAPI.StoreS(proc, 3, genParamValue);
            HalconAPI.InitOCT(proc, 0);
            int err        = HalconAPI.CallProcedure(proc);
            int procResult = this.Load(proc, 0, err);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)objectModel3D);
        }
        /// <summary>
        ///   Find the best matches of a surface model in a 3D scene.
        ///   Modified instance represents: Handle of the matching result, if enabled in ReturnResultHandle.
        /// </summary>
        /// <param name="surfaceModelID">Handle of the 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="keyPointFraction">Fraction of sampled scene points used as key points. Default: 0.2</param>
        /// <param name="minScore">Minimum score of the returned poses. Default: 0</param>
        /// <param name="returnResultHandle">Enable returning a result handle in SurfaceMatchingResultID. Default: "false"</param>
        /// <param name="genParamName">Names of the generic parameters. Default: []</param>
        /// <param name="genParamValue">Values of the generic parameters. Default: []</param>
        /// <param name="score">Score of the found instances of the surface model.</param>
        /// <returns>3D pose of the surface model in the scene.</returns>
        public HPose FindSurfaceModel(
            HSurfaceModel surfaceModelID,
            HObjectModel3D objectModel3D,
            double relSamplingDistance,
            double keyPointFraction,
            double minScore,
            string returnResultHandle,
            HTuple genParamName,
            HTuple genParamValue,
            out HTuple score)
        {
            this.Dispose();
            IntPtr proc = HalconAPI.PreCall(1042);

            HalconAPI.Store(proc, 0, (HTool)surfaceModelID);
            HalconAPI.Store(proc, 1, (HTool)objectModel3D);
            HalconAPI.StoreD(proc, 2, relSamplingDistance);
            HalconAPI.StoreD(proc, 3, keyPointFraction);
            HalconAPI.StoreD(proc, 4, minScore);
            HalconAPI.StoreS(proc, 5, returnResultHandle);
            HalconAPI.Store(proc, 6, genParamName);
            HalconAPI.Store(proc, 7, genParamValue);
            HalconAPI.InitOCT(proc, 2);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int err1 = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(genParamName);
            HalconAPI.UnpinTuple(genParamValue);
            int   err2 = this.Load(proc, 2, err1);
            HPose hpose;
            int   err3       = HPose.LoadNew(proc, 0, err2, out hpose);
            int   procResult = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, err3, out score);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)surfaceModelID);
            GC.KeepAlive((object)objectModel3D);
            return(hpose);
        }
        /// <summary>
        ///   Create the data structure needed to perform deformable surface-based matching.
        ///   Modified instance represents: Handle of the deformable surface model.
        /// </summary>
        /// <param name="objectModel3D">Handle of the 3D object model.</param>
        /// <param name="relSamplingDistance">Sampling distance relative to the object's diameter Default: 0.05</param>
        /// <param name="genParamName">Names of the generic parameters. Default: []</param>
        /// <param name="genParamValue">Values of the generic parameters. Default: []</param>
        public void CreateDeformableSurfaceModel(
            HObjectModel3D objectModel3D,
            double relSamplingDistance,
            HTuple genParamName,
            HTuple genParamValue)
        {
            this.Dispose();
            IntPtr proc = HalconAPI.PreCall(1031);

            HalconAPI.Store(proc, 0, (HTool)objectModel3D);
            HalconAPI.StoreD(proc, 1, relSamplingDistance);
            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 procResult = this.Load(proc, 0, err);

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