Пример #1
0
 public static void Store(IntPtr proc, int parIndex, HData[] data)
 {
     if (data == null)
     {
         data = new HData[0];
     }
     HalconAPI.Store(proc, parIndex, HData.ConcatArray(data));
 }
Пример #2
0
 public static void Store(IntPtr proc, int parIndex, HData data)
 {
     if (data == null)
     {
         data = new HData();
     }
     data.Store(proc, parIndex);
 }
Пример #3
0
        /// <summary>
        ///   Set the pose of an instance in a 3D scene.
        ///   Instance represents: Handle of the 3D scene.
        /// </summary>
        /// <param name="instanceIndex">Index of the instance.</param>
        /// <param name="pose">New pose of the instance.</param>
        public void SetScene3dInstancePose(HTuple instanceIndex, HPose[] pose)
        {
            HTuple htuple = HData.ConcatArray((HData[])pose);
            IntPtr proc   = HalconAPI.PreCall(1208);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, instanceIndex);
            HalconAPI.Store(proc, 2, htuple);
            int procResult = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(instanceIndex);
            HalconAPI.UnpinTuple(htuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
Пример #4
0
        /// <summary>Convert a 3D pose to a unit dual quaternion.</summary>
        /// <param name="pose">3D pose.</param>
        /// <returns>Unit dual quaternion.</returns>
        public static HDualQuaternion[] PoseToDualQuat(HPose[] pose)
        {
            HTuple htuple = HData.ConcatArray((HData[])pose);
            IntPtr proc   = HalconAPI.PreCall(2080);

            HalconAPI.Store(proc, 0, htuple);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(htuple);
            HTuple tuple;
            int    procResult = HTuple.LoadNew(proc, 0, err, out tuple);

            HalconAPI.PostCall(proc, procResult);
            return(HDualQuaternion.SplitArray(tuple));
        }
        /// <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);
        }
Пример #6
0
        /// <summary>Multiply two dual quaternions.</summary>
        /// <param name="dualQuaternionLeft">Left dual quaternion.</param>
        /// <param name="dualQuaternionRight">Right dual quaternion.</param>
        /// <returns>Product of the dual quaternions.</returns>
        public static HDualQuaternion[] DualQuatCompose(
            HDualQuaternion[] dualQuaternionLeft,
            HDualQuaternion[] dualQuaternionRight)
        {
            HTuple htuple1 = HData.ConcatArray((HData[])dualQuaternionLeft);
            HTuple htuple2 = HData.ConcatArray((HData[])dualQuaternionRight);
            IntPtr proc    = HalconAPI.PreCall(2059);

            HalconAPI.Store(proc, 0, htuple1);
            HalconAPI.Store(proc, 1, htuple2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(htuple1);
            HalconAPI.UnpinTuple(htuple2);
            HTuple tuple;
            int    procResult = HTuple.LoadNew(proc, 0, err, out tuple);

            HalconAPI.PostCall(proc, procResult);
            return(HDualQuaternion.SplitArray(tuple));
        }
Пример #7
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)
        {
            HTuple htuple1 = HTool.ConcatArray((HTool[])objectModel3D);
            HTuple htuple2 = HData.ConcatArray((HData[])pose);
            IntPtr proc    = HalconAPI.PreCall(1217);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, htuple1);
            HalconAPI.Store(proc, 2, htuple2);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(htuple1);
            HalconAPI.UnpinTuple(htuple2);
            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);
        }
Пример #8
0
 internal HHomMat3D(HData data)
     : base(data)
 {
 }
Пример #9
0
 internal HDualQuaternion(HData data)
     : base(data)
 {
 }
Пример #10
0
 internal HData(HData data)
 {
     this.tuple = data.tuple;
 }
Пример #11
0
 internal HFunction1D(HData data)
     : base(data)
 {
 }