/// <summary> /// Project an affine 3D transformation matrix to a 2D projective transformation matrix. /// Instance represents: 3x4 3D transformation matrix. /// </summary> /// <param name="principalPointRow">Row coordinate of the principal point. Default: 256</param> /// <param name="principalPointCol">Column coordinate of the principal point. Default: 256</param> /// <param name="focus">Focal length in pixels. Default: 256</param> /// <returns>Homogeneous projective transformation matrix.</returns> public HHomMat2D HomMat3dProject( HTuple principalPointRow, HTuple principalPointCol, HTuple focus) { IntPtr proc = HalconAPI.PreCall(254); this.Store(proc, 0); HalconAPI.Store(proc, 1, principalPointRow); HalconAPI.Store(proc, 2, principalPointCol); HalconAPI.Store(proc, 3, focus); HalconAPI.InitOCT(proc, 0); int err = HalconAPI.CallProcedure(proc); this.UnpinTuple(); HalconAPI.UnpinTuple(principalPointRow); HalconAPI.UnpinTuple(principalPointCol); HalconAPI.UnpinTuple(focus); HHomMat2D hhomMat2D; int procResult = HHomMat2D.LoadNew(proc, 0, err, out hhomMat2D); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)this); return(hhomMat2D); }
/// <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, double minScore, int numMatches, string scoreType, out double 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.StoreD(proc, 5, minScore); HalconAPI.StoreI(proc, 6, numMatches); HalconAPI.StoreS(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); HHomMat2D hhomMat2D; int err2 = HHomMat2D.LoadNew(proc, 0, err1, out hhomMat2D); int procResult = HalconAPI.LoadD(proc, 1, err2, out score); HalconAPI.PostCall(proc, procResult); GC.KeepAlive((object)this); GC.KeepAlive((object)image); return(hhomMat2D); }