/// <summary> /// Convert a homogeneous transformation matrix into a 3D pose. /// Instance represents: Homogeneous transformation matrix. /// </summary> /// <returns>Equivalent 3D pose.</returns> public HPose HomMat3dToPose() { IntPtr proc = HalconAPI.PreCall(1934); this.Store(proc, 0); HalconAPI.InitOCT(proc, 0); int err = HalconAPI.CallProcedure(proc); this.UnpinTuple(); HPose hpose; int procResult = HPose.LoadNew(proc, 0, err, out hpose); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)this); return(hpose); }
/// <summary> /// Get observed calibration object poses from a calibration data model. /// Instance represents: Handle of a calibration data model. /// </summary> /// <param name="cameraIdx">Index of the observing camera. Default: 0</param> /// <param name="calibObjIdx">Index of the observed calibration object. Default: 0</param> /// <param name="calibObjPoseIdx">Index of the observed calibration object pose. Default: 0</param> /// <returns>Stored observed calibration object pose relative to the observing camera.</returns> public HPose GetCalibDataObservPose(int cameraIdx, int calibObjIdx, int calibObjPoseIdx) { IntPtr proc = HalconAPI.PreCall(1972); this.Store(proc, 0); HalconAPI.StoreI(proc, 1, cameraIdx); HalconAPI.StoreI(proc, 2, calibObjIdx); HalconAPI.StoreI(proc, 3, calibObjPoseIdx); HalconAPI.InitOCT(proc, 0); int err = HalconAPI.CallProcedure(proc); HPose hpose; int procResult = HPose.LoadNew(proc, 0, err, out hpose); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)this); return(hpose); }
/// <summary> /// Return the contour representation of a 3D shape model view. /// Instance represents: Handle of the 3D shape model. /// </summary> /// <param name="level">Pyramid level for which the contour representation should be returned. Default: 1</param> /// <param name="view">View for which the contour representation should be returned. Default: 1</param> /// <param name="viewPose">3D pose of the 3D shape model at the current view.</param> /// <returns>Contour representation of the model view.</returns> public HXLDCont GetShapeModel3dContours(int level, int view, out HPose viewPose) { IntPtr proc = HalconAPI.PreCall(1056); this.Store(proc, 0); HalconAPI.StoreI(proc, 1, level); HalconAPI.StoreI(proc, 2, view); HalconAPI.InitOCT(proc, 1); HalconAPI.InitOCT(proc, 0); int err1 = HalconAPI.CallProcedure(proc); HXLDCont hxldCont; int err2 = HXLDCont.LoadNew(proc, 1, err1, out hxldCont); int procResult = HPose.LoadNew(proc, 0, err2, out viewPose); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)this); return(hxldCont); }
/// <summary> /// Transform a pose that refers to the coordinate system of a 3D object model to a pose that refers to the reference coordinate system of a 3D shape model and vice versa. /// Instance represents: Handle of the 3D shape model. /// </summary> /// <param name="poseIn">Pose to be transformed in the source system.</param> /// <param name="transformation">Direction of the transformation. Default: "ref_to_model"</param> /// <returns>Transformed 3D pose in the target system.</returns> public HPose TransPoseShapeModel3d(HPose poseIn, string transformation) { IntPtr proc = HalconAPI.PreCall(1054); this.Store(proc, 0); HalconAPI.Store(proc, 1, (HData)poseIn); HalconAPI.StoreS(proc, 2, transformation); HalconAPI.InitOCT(proc, 0); int err = HalconAPI.CallProcedure(proc); HalconAPI.UnpinTuple((HTuple)((HData)poseIn)); HPose hpose; int procResult = HPose.LoadNew(proc, 0, err, out hpose); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)this); return(hpose); }
/// <summary> /// Find the best matches of a surface model in a 3D scene and 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="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 FindSurfaceModelImage( HImage image, 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(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.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)image); GC.KeepAlive((object)surfaceModelID); GC.KeepAlive((object)objectModel3D); return(hpose); }
/// <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); }
/// <summary> /// Find the best matches of a calibrated descriptor model in an image and return their 3D pose. /// 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="camParam">Camera parameter (inner orientation) obtained from camera calibration.</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>3D pose of the object.</returns> public HPose FindCalibDescriptorModel( HImage image, HTuple detectorParamName, HTuple detectorParamValue, HTuple descriptorParamName, HTuple descriptorParamValue, double minScore, int numMatches, HCamPar camParam, string scoreType, out double score) { IntPtr proc = HalconAPI.PreCall(948); 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.StoreD(proc, 5, minScore); HalconAPI.StoreI(proc, 6, numMatches); HalconAPI.Store(proc, 7, (HData)camParam); HalconAPI.StoreS(proc, 8, 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((HTuple)((HData)camParam)); HPose hpose; int err2 = HPose.LoadNew(proc, 0, err1, out hpose); int procResult = HalconAPI.LoadD(proc, 1, err2, out score); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)this); GC.KeepAlive((object)image); return(hpose); }