internal static int LoadNew( IntPtr proc, int parIndex, int err, out HSurfaceMatchingResult obj) { obj = new HSurfaceMatchingResult(HTool.UNDEF); return(obj.Load(proc, parIndex, err)); }
internal static int LoadNew( IntPtr proc, int parIndex, int err, out HSurfaceMatchingResult[] obj) { HTuple tuple; err = HTuple.LoadNew(proc, parIndex, err, out tuple); obj = new HSurfaceMatchingResult[tuple.Length]; for (int index = 0; index < tuple.Length; ++index) { obj[index] = new HSurfaceMatchingResult(tuple[index].IP); } return(err); }
/// <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); }
/// <summary> /// Refine the pose of a surface model in a 3D scene and in images. /// Instance represents: Handle of the surface model. /// </summary> /// <param name="image">Images of the scene.</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 HPose RefineSurfaceModelPoseImage( HImage image, HObjectModel3D objectModel3D, HPose initialPose, double minScore, string returnResultHandle, HTuple genParamName, HTuple genParamValue, out HTuple score, out HSurfaceMatchingResult surfaceMatchingResultID) { IntPtr proc = HalconAPI.PreCall(2084); this.Store(proc, 0); HalconAPI.Store(proc, 1, (HObjectBase)image); 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, 0); HalconAPI.InitOCT(proc, 1); HalconAPI.InitOCT(proc, 2); int err1 = HalconAPI.CallProcedure(proc); HalconAPI.UnpinTuple((HTuple)((HData)initialPose)); HalconAPI.UnpinTuple(genParamName); HalconAPI.UnpinTuple(genParamValue); HPose hpose; int err2 = HPose.LoadNew(proc, 0, err1, out hpose); int err3 = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, err2, out score); int procResult = HSurfaceMatchingResult.LoadNew(proc, 2, err3, out surfaceMatchingResultID); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)this); GC.KeepAlive((object)image); GC.KeepAlive((object)objectModel3D); return(hpose); }
/// <summary> /// Find the best matches of a surface model in a 3D scene. /// Instance represents: Handle of the 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="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 HPose FindSurfaceModel( HObjectModel3D objectModel3D, double relSamplingDistance, double keyPointFraction, double minScore, string returnResultHandle, HTuple genParamName, HTuple genParamValue, out HTuple score, out HSurfaceMatchingResult surfaceMatchingResultID) { IntPtr proc = HalconAPI.PreCall(1042); this.Store(proc, 0); 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, 0); HalconAPI.InitOCT(proc, 1); HalconAPI.InitOCT(proc, 2); int err1 = HalconAPI.CallProcedure(proc); HalconAPI.UnpinTuple(genParamName); HalconAPI.UnpinTuple(genParamValue); HPose hpose; int err2 = HPose.LoadNew(proc, 0, err1, out hpose); int err3 = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, err2, out score); int procResult = HSurfaceMatchingResult.LoadNew(proc, 2, err3, out surfaceMatchingResultID); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)this); GC.KeepAlive((object)objectModel3D); return(hpose); }