/// <summary>
 /// Creates an instance initially managing zero open windows
 /// </summary>
 /// <param name="windows">List of existing HALCON windows</param>
 public HDevOpMultiWindowImpl(params HWindow[] windows)
     : this(new HTuple[1]
 {
     HTool.ConcatArray((HTool[])windows)
 })
 {
 }
示例#2
0
 public static void Store(IntPtr proc, int parIndex, HTool[] tools)
 {
     if (tools == null)
     {
         tools = new HTool[0];
     }
     HalconAPI.Store(proc, parIndex, HTool.ConcatArray(tools));
 }
示例#3
0
 public static void Store(IntPtr proc, int parIndex, HTool toolValue)
 {
     if (toolValue == null)
     {
         HalconAPI.StoreIP(proc, parIndex, HTool.UNDEF);
     }
     else
     {
         toolValue.Store(proc, parIndex);
     }
 }
示例#4
0
        /// <summary>Clear the training data of a Gaussian Mixture Model.</summary>
        /// <param name="GMMHandle">GMM handle.</param>
        public static void ClearSamplesClassGmm(HClassGmm[] GMMHandle)
        {
            HTuple htuple = HTool.ConcatArray((HTool[])GMMHandle);
            IntPtr proc   = HalconAPI.PreCall(1825);

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

            HalconAPI.UnpinTuple(htuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)GMMHandle);
        }
示例#5
0
        /// <summary>Find the best matches of multiple NCC models.</summary>
        /// <param name="image">Input image in which the model should be found.</param>
        /// <param name="modelIDs">Handle of the models.</param>
        /// <param name="angleStart">Smallest rotation of the models. Default: -0.39</param>
        /// <param name="angleExtent">Extent of the rotation angles. Default: 0.79</param>
        /// <param name="minScore">Minimum score of the instances of the models to be found. Default: 0.8</param>
        /// <param name="numMatches">Number of instances of the models to be found (or 0 for all matches). Default: 1</param>
        /// <param name="maxOverlap">Maximum overlap of the instances of the models to be found. Default: 0.5</param>
        /// <param name="subPixel">Subpixel accuracy if not equal to 'none'. Default: "true"</param>
        /// <param name="numLevels">Number of pyramid levels used in the matching (and lowest pyramid level to use if $|NumLevels| = 2$). Default: 0</param>
        /// <param name="row">Row coordinate of the found instances of the models.</param>
        /// <param name="column">Column coordinate of the found instances of the models.</param>
        /// <param name="angle">Rotation angle of the found instances of the models.</param>
        /// <param name="score">Score of the found instances of the models.</param>
        /// <param name="model">Index of the found instances of the models.</param>
        public static void FindNccModels(
            HImage image,
            HNCCModel[] modelIDs,
            HTuple angleStart,
            HTuple angleExtent,
            HTuple minScore,
            HTuple numMatches,
            HTuple maxOverlap,
            HTuple subPixel,
            HTuple numLevels,
            out HTuple row,
            out HTuple column,
            out HTuple angle,
            out HTuple score,
            out HTuple model)
        {
            HTuple htuple = HTool.ConcatArray((HTool[])modelIDs);
            IntPtr proc   = HalconAPI.PreCall(2068);

            HalconAPI.Store(proc, 1, (HObjectBase)image);
            HalconAPI.Store(proc, 0, htuple);
            HalconAPI.Store(proc, 1, angleStart);
            HalconAPI.Store(proc, 2, angleExtent);
            HalconAPI.Store(proc, 3, minScore);
            HalconAPI.Store(proc, 4, numMatches);
            HalconAPI.Store(proc, 5, maxOverlap);
            HalconAPI.Store(proc, 6, subPixel);
            HalconAPI.Store(proc, 7, numLevels);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            HalconAPI.InitOCT(proc, 3);
            HalconAPI.InitOCT(proc, 4);
            int err1 = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(htuple);
            HalconAPI.UnpinTuple(angleStart);
            HalconAPI.UnpinTuple(angleExtent);
            HalconAPI.UnpinTuple(minScore);
            HalconAPI.UnpinTuple(numMatches);
            HalconAPI.UnpinTuple(maxOverlap);
            HalconAPI.UnpinTuple(subPixel);
            HalconAPI.UnpinTuple(numLevels);
            int err2       = HTuple.LoadNew(proc, 0, HTupleType.DOUBLE, err1, out row);
            int err3       = HTuple.LoadNew(proc, 1, HTupleType.DOUBLE, err2, out column);
            int err4       = HTuple.LoadNew(proc, 2, HTupleType.DOUBLE, err3, out angle);
            int err5       = HTuple.LoadNew(proc, 3, HTupleType.DOUBLE, err4, out score);
            int procResult = HTuple.LoadNew(proc, 4, HTupleType.INTEGER, err5, out model);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)image);
            GC.KeepAlive((object)modelIDs);
        }
        /// <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)
        {
            HTuple htuple = HTool.ConcatArray((HTool[])objectModel3D);
            IntPtr proc   = HalconAPI.PreCall(1030);

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

            HalconAPI.UnpinTuple(htuple);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)objectModel3D);
        }
示例#7
0
        /// <summary>
        ///   Enqueue one or more messages to the message queue.
        ///   Instance represents: Message queue handle.
        /// </summary>
        /// <param name="messageHandle">Handle(s) of message(s) to be enqueued.</param>
        /// <param name="genParamName">Names of optional generic parameters.</param>
        /// <param name="genParamValue">Values of optional generic parameters.</param>
        public void EnqueueMessage(HMessage[] messageHandle, HTuple genParamName, HTuple genParamValue)
        {
            HTuple htuple = HTool.ConcatArray((HTool[])messageHandle);
            IntPtr proc   = HalconAPI.PreCall(531);

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

            HalconAPI.UnpinTuple(htuple);
            HalconAPI.UnpinTuple(genParamName);
            HalconAPI.UnpinTuple(genParamValue);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)messageHandle);
        }
示例#8
0
        /// <summary>Query specific parameters of I/O channels.</summary>
        /// <param name="IOChannelHandle">Handles of the opened I/O channels.</param>
        /// <param name="genParamName">Parameter names. Default: "param_name"</param>
        /// <returns>Parameter values.</returns>
        public static HTuple GetIoChannelParam(HIOChannel[] IOChannelHandle, HTuple genParamName)
        {
            HTuple htuple = HTool.ConcatArray((HTool[])IOChannelHandle);
            IntPtr proc   = HalconAPI.PreCall(2014);

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

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

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)IOChannelHandle);
            return(tuple);
        }
示例#9
0
        /// <summary>Set specific parameters of I/O channels.</summary>
        /// <param name="IOChannelHandle">Handles of the opened I/O channels.</param>
        /// <param name="genParamName">Parameter names. Default: []</param>
        /// <param name="genParamValue">Parameter values to set. Default: []</param>
        public static void SetIoChannelParam(
            HIOChannel[] IOChannelHandle,
            HTuple genParamName,
            HTuple genParamValue)
        {
            HTuple htuple = HTool.ConcatArray((HTool[])IOChannelHandle);
            IntPtr proc   = HalconAPI.PreCall(2013);

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

            HalconAPI.UnpinTuple(htuple);
            HalconAPI.UnpinTuple(genParamName);
            HalconAPI.UnpinTuple(genParamValue);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)IOChannelHandle);
        }
示例#10
0
        /// <summary>Read a value from the specified I/O channels.</summary>
        /// <param name="IOChannelHandle">Handles of the opened I/O channels.</param>
        /// <param name="status">Status of read value.</param>
        /// <returns>Read value.</returns>
        public static HTuple ReadIoChannel(HIOChannel[] IOChannelHandle, out HTuple status)
        {
            HTuple htuple = HTool.ConcatArray((HTool[])IOChannelHandle);
            IntPtr proc   = HalconAPI.PreCall(2012);

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

            HalconAPI.UnpinTuple(htuple);
            HTuple tuple;
            int    err2       = HTuple.LoadNew(proc, 0, err1, out tuple);
            int    procResult = HTuple.LoadNew(proc, 1, HTupleType.INTEGER, err2, out status);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)IOChannelHandle);
            return(tuple);
        }
        /// <summary>Clear all or a user-defined subset of the images of a texture inspection model.</summary>
        /// <param name="textureInspectionModel">Handle of the texture inspection model.</param>
        /// <param name="indices">Indices of the images to be deleted from the texture inspection model.</param>
        /// <returns>Indices of the images that remain in the texture inspection model.</returns>
        public static HTuple RemoveTextureInspectionModelImage(
            HTextureInspectionModel[] textureInspectionModel,
            HTuple indices)
        {
            HTuple htuple = HTool.ConcatArray((HTool[])textureInspectionModel);
            IntPtr proc   = HalconAPI.PreCall(2085);

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

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

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)textureInspectionModel);
            return(tuple);
        }
示例#12
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);
        }
示例#13
0
        /// <summary>Perform an action on I/O channels.</summary>
        /// <param name="IOChannelHandle">Handles of the opened I/O channels.</param>
        /// <param name="paramAction">Name of the action to perform.</param>
        /// <param name="paramArgument">List of arguments for the action. Default: []</param>
        /// <returns>List of values returned by the action.</returns>
        public static HTuple ControlIoChannel(
            HIOChannel[] IOChannelHandle,
            string paramAction,
            HTuple paramArgument)
        {
            HTuple htuple = HTool.ConcatArray((HTool[])IOChannelHandle);
            IntPtr proc   = HalconAPI.PreCall(2010);

            HalconAPI.Store(proc, 0, htuple);
            HalconAPI.StoreS(proc, 1, paramAction);
            HalconAPI.Store(proc, 2, paramArgument);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

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

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)IOChannelHandle);
            return(tuple);
        }