예제 #1
0
        /// <summary>
        ///   Serialize a descriptor model.
        ///   Instance represents: Handle of a model to be saved.
        /// </summary>
        /// <returns>Handle of the serialized item.</returns>
        public HSerializedItem SerializeDescriptorModel()
        {
            IntPtr proc = HalconAPI.PreCall(945);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            int             err = HalconAPI.CallProcedure(proc);
            HSerializedItem hserializedItem;
            int             procResult = HSerializedItem.LoadNew(proc, 0, err, out hserializedItem);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hserializedItem);
        }
예제 #2
0
        /// <summary>
        ///   Return the origin of a descriptor model.
        ///   Instance represents: Handle of a descriptor model.
        /// </summary>
        /// <param name="row">Position of origin in row direction.</param>
        /// <param name="column">Position of origin in column direction.</param>
        public void GetDescriptorModelOrigin(out HTuple row, out HTuple column)
        {
            IntPtr proc = HalconAPI.PreCall(955);

            this.Store(proc, 0);
            HalconAPI.InitOCT(proc, 0);
            HalconAPI.InitOCT(proc, 1);
            int err1       = HalconAPI.CallProcedure(proc);
            int err2       = HTuple.LoadNew(proc, 0, err1, out row);
            int procResult = HTuple.LoadNew(proc, 1, err2, out column);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
예제 #3
0
        /// <summary>
        ///   Deserialize a descriptor model.
        ///   Modified instance represents: Handle of the model.
        /// </summary>
        /// <param name="serializedItemHandle">Handle of the serialized item.</param>
        public void DeserializeDescriptorModel(HSerializedItem serializedItemHandle)
        {
            this.Dispose();
            IntPtr proc = HalconAPI.PreCall(944);

            HalconAPI.Store(proc, 0, (HTool)serializedItemHandle);
            HalconAPI.InitOCT(proc, 0);
            int err        = HalconAPI.CallProcedure(proc);
            int procResult = this.Load(proc, 0, err);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)serializedItemHandle);
        }
예제 #4
0
        /// <summary>
        ///   Prepare a 3D object model for matching.
        ///   Modified instance represents: Handle of the 3D shape model.
        /// </summary>
        /// <param name="objectModel3D">Handle of the 3D object model.</param>
        /// <param name="camParam">Internal camera parameters.</param>
        /// <param name="refRotX">Reference orientation: Rotation around x-axis or x component of the Rodriguez vector (in radians or without unit). Default: 0</param>
        /// <param name="refRotY">Reference orientation: Rotation around y-axis or y component of the Rodriguez vector (in radians or without unit). Default: 0</param>
        /// <param name="refRotZ">Reference orientation: Rotation around z-axis or z component of the Rodriguez vector (in radians or without unit). Default: 0</param>
        /// <param name="orderOfRotation">Meaning of the rotation values of the reference orientation. Default: "gba"</param>
        /// <param name="longitudeMin">Minimum longitude of the model views. Default: -0.35</param>
        /// <param name="longitudeMax">Maximum longitude of the model views. Default: 0.35</param>
        /// <param name="latitudeMin">Minimum latitude of the model views. Default: -0.35</param>
        /// <param name="latitudeMax">Maximum latitude of the model views. Default: 0.35</param>
        /// <param name="camRollMin">Minimum camera roll angle of the model views. Default: -3.1416</param>
        /// <param name="camRollMax">Maximum camera roll angle of the model views. Default: 3.1416</param>
        /// <param name="distMin">Minimum camera-object-distance of the model views. Default: 0.3</param>
        /// <param name="distMax">Maximum camera-object-distance of the model views. Default: 0.4</param>
        /// <param name="minContrast">Minimum contrast of the objects in the search images. Default: 10</param>
        /// <param name="genParamName">Names of (optional) parameters for controlling the behavior of the operator. Default: []</param>
        /// <param name="genParamValue">Values of the optional generic parameters. Default: []</param>
        public void CreateShapeModel3d(
            HObjectModel3D objectModel3D,
            HCamPar camParam,
            double refRotX,
            double refRotY,
            double refRotZ,
            string orderOfRotation,
            double longitudeMin,
            double longitudeMax,
            double latitudeMin,
            double latitudeMax,
            double camRollMin,
            double camRollMax,
            double distMin,
            double distMax,
            int minContrast,
            string genParamName,
            int genParamValue)
        {
            this.Dispose();
            IntPtr proc = HalconAPI.PreCall(1059);

            HalconAPI.Store(proc, 0, (HTool)objectModel3D);
            HalconAPI.Store(proc, 1, (HData)camParam);
            HalconAPI.StoreD(proc, 2, refRotX);
            HalconAPI.StoreD(proc, 3, refRotY);
            HalconAPI.StoreD(proc, 4, refRotZ);
            HalconAPI.StoreS(proc, 5, orderOfRotation);
            HalconAPI.StoreD(proc, 6, longitudeMin);
            HalconAPI.StoreD(proc, 7, longitudeMax);
            HalconAPI.StoreD(proc, 8, latitudeMin);
            HalconAPI.StoreD(proc, 9, latitudeMax);
            HalconAPI.StoreD(proc, 10, camRollMin);
            HalconAPI.StoreD(proc, 11, camRollMax);
            HalconAPI.StoreD(proc, 12, distMin);
            HalconAPI.StoreD(proc, 13, distMax);
            HalconAPI.StoreI(proc, 14, minContrast);
            HalconAPI.StoreS(proc, 15, genParamName);
            HalconAPI.StoreI(proc, 16, genParamValue);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple((HTuple)((HData)camParam));
            int procResult = this.Load(proc, 0, err);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)objectModel3D);
        }
예제 #5
0
        /// <summary>
        ///   Transform the shape of contours or polygons.
        ///   Instance represents: Contours or polygons to be transformed.
        /// </summary>
        /// <param name="type">Type of transformation. Default: "convex"</param>
        /// <returns>Transformed contours respectively polygons.</returns>
        public HXLDPara ShapeTransXld(string type)
        {
            IntPtr proc = HalconAPI.PreCall(1689);

            this.Store(proc, 1);
            HalconAPI.StoreS(proc, 0, type);
            HalconAPI.InitOCT(proc, 1);
            int      err = HalconAPI.CallProcedure(proc);
            HXLDPara hxldPara;
            int      procResult = HXLDPara.LoadNew(proc, 1, err, out hxldPara);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hxldPara);
        }
예제 #6
0
        /// <summary>
        ///   Set generic camera setup model parameters.
        ///   Instance represents: Handle to the camera setup model.
        /// </summary>
        /// <param name="cameraIdx">Unique index of the camera in the setup. Default: 0</param>
        /// <param name="genParamName">Names of the generic parameters to be set.</param>
        /// <param name="genParamValue">Values of the generic parameters to be set.</param>
        public void SetCameraSetupParam(HTuple cameraIdx, string genParamName, HTuple genParamValue)
        {
            IntPtr proc = HalconAPI.PreCall(1956);

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

            HalconAPI.UnpinTuple(cameraIdx);
            HalconAPI.UnpinTuple(genParamValue);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
예제 #7
0
        /// <summary>
        ///   Find text in an image.
        ///   Modified instance represents: Result of the segmentation.
        /// </summary>
        /// <param name="image">Input image.</param>
        /// <param name="textModel">Text model specifying the text to be segmented.</param>
        public HTextResult(HImage image, HTextModel textModel)
        {
            IntPtr proc = HalconAPI.PreCall(417);

            HalconAPI.Store(proc, 1, (HObjectBase)image);
            HalconAPI.Store(proc, 0, (HTool)textModel);
            HalconAPI.InitOCT(proc, 0);
            int err        = HalconAPI.CallProcedure(proc);
            int procResult = this.Load(proc, 0, err);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)image);
            GC.KeepAlive((object)textModel);
        }
예제 #8
0
        /// <summary>
        ///   Create a variation model for image comparison.
        ///   Modified instance represents: ID of the variation model.
        /// </summary>
        /// <param name="width">Width of the images to be compared. Default: 640</param>
        /// <param name="height">Height of the images to be compared. Default: 480</param>
        /// <param name="type">Type of the images to be compared. Default: "byte"</param>
        /// <param name="mode">Method used for computing the variation model. Default: "standard"</param>
        public HVariationModel(int width, int height, string type, string mode)
        {
            IntPtr proc = HalconAPI.PreCall(95);

            HalconAPI.StoreI(proc, 0, width);
            HalconAPI.StoreI(proc, 1, height);
            HalconAPI.StoreS(proc, 2, type);
            HalconAPI.StoreS(proc, 3, mode);
            HalconAPI.InitOCT(proc, 0);
            int err        = HalconAPI.CallProcedure(proc);
            int procResult = this.Load(proc, 0, err);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
예제 #9
0
        /// <summary>
        ///   Check if a word is contained in a lexicon.
        ///   Instance represents: Handle of the lexicon.
        /// </summary>
        /// <param name="word">Word to be looked up. Default: "word"</param>
        /// <returns>Result of the search.</returns>
        public int LookupLexicon(string word)
        {
            IntPtr proc = HalconAPI.PreCall(668);

            this.Store(proc, 0);
            HalconAPI.StoreS(proc, 1, word);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);
            int intValue;
            int procResult = HalconAPI.LoadI(proc, 0, err, out intValue);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(intValue);
        }
예제 #10
0
        /// <summary>
        ///   Retrieve an object associated with the key from the message.
        ///   Instance represents: Message handle.
        /// </summary>
        /// <param name="key">Key string.</param>
        /// <returns>Tuple value retrieved from the message.</returns>
        public HObject GetMessageObj(string key)
        {
            IntPtr proc = HalconAPI.PreCall(536);

            this.Store(proc, 0);
            HalconAPI.StoreS(proc, 1, key);
            HalconAPI.InitOCT(proc, 1);
            int     err = HalconAPI.CallProcedure(proc);
            HObject hobject;
            int     procResult = HObject.LoadNew(proc, 1, err, out hobject);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hobject);
        }
예제 #11
0
        /// <summary>
        ///   Open a socket and connect it to an accepting socket.
        ///   Modified instance represents: Socket number.
        /// </summary>
        /// <param name="hostName">Hostname of the computer to connect to. Default: "localhost"</param>
        /// <param name="port">Port number.</param>
        /// <param name="genParamName">Names of the generic parameters that can be adjusted for the socket. Default: []</param>
        /// <param name="genParamValue">Values of the generic parameters that can be adjusted for the socket. Default: []</param>
        public HSocket(string hostName, int port, string genParamName, string genParamValue)
        {
            IntPtr proc = HalconAPI.PreCall(342);

            HalconAPI.StoreS(proc, 0, hostName);
            HalconAPI.StoreI(proc, 1, port);
            HalconAPI.StoreS(proc, 2, genParamName);
            HalconAPI.StoreS(proc, 3, genParamValue);
            HalconAPI.InitOCT(proc, 0);
            int err        = HalconAPI.CallProcedure(proc);
            int procResult = this.Load(proc, 0, err);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
예제 #12
0
        /// <summary>
        ///   Open a socket that accepts connection requests.
        ///   Modified instance represents: Socket number.
        /// </summary>
        /// <param name="port">Port number. Default: 3000</param>
        /// <param name="genParamName">Names of the generic parameters that can be adjusted for the socket. Default: []</param>
        /// <param name="genParamValue">Values of the generic parameters that can be adjusted for the socket. Default: []</param>
        public void OpenSocketAccept(int port, string genParamName, string genParamValue)
        {
            this.Dispose();
            IntPtr proc = HalconAPI.PreCall(343);

            HalconAPI.StoreI(proc, 0, port);
            HalconAPI.StoreS(proc, 1, genParamName);
            HalconAPI.StoreS(proc, 2, genParamValue);
            HalconAPI.InitOCT(proc, 0);
            int err        = HalconAPI.CallProcedure(proc);
            int procResult = this.Load(proc, 0, err);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
예제 #13
0
        /// <summary>
        ///   Accept a connection request on a listening socket of the protocol type 'HALCON' or 'TCP'/'TCP4'/'TCP6'.
        ///   Instance represents: Socket number of the accepting socket.
        /// </summary>
        /// <param name="wait">Should the operator wait until a connection request arrives? Default: "auto"</param>
        /// <returns>Socket number.</returns>
        public HSocket SocketAcceptConnect(string wait)
        {
            IntPtr proc = HalconAPI.PreCall(341);

            this.Store(proc, 0);
            HalconAPI.StoreS(proc, 1, wait);
            HalconAPI.InitOCT(proc, 0);
            int     err = HalconAPI.CallProcedure(proc);
            HSocket hsocket;
            int     procResult = HSocket.LoadNew(proc, 0, err, out hsocket);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hsocket);
        }
예제 #14
0
        /// <summary>
        ///   Send arbitrary data to external devices or applications using a generic socket communication.
        ///   Instance represents: Socket number.
        /// </summary>
        /// <param name="format">Specification how to convert the data. Default: "z"</param>
        /// <param name="data">Value (or tuple of values) holding the data to send.</param>
        /// <param name="to">IP address or hostname and network port of the communication partner. Default: []</param>
        public void SendData(string format, HTuple data, HTuple to)
        {
            IntPtr proc = HalconAPI.PreCall(334);

            this.Store(proc, 0);
            HalconAPI.StoreS(proc, 1, format);
            HalconAPI.Store(proc, 2, data);
            HalconAPI.Store(proc, 3, to);
            int procResult = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(data);
            HalconAPI.UnpinTuple(to);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
예제 #15
0
        /// <summary>
        ///   Create a barrier synchronization object.
        ///   Modified instance represents: Barrier synchronization object.
        /// </summary>
        /// <param name="attribName">Barrier attribute. Default: []</param>
        /// <param name="attribValue">Barrier attribute value. Default: []</param>
        /// <param name="teamSize">Barrier team size. Default: 1</param>
        public void CreateBarrier(string attribName, string attribValue, int teamSize)
        {
            this.Dispose();
            IntPtr proc = HalconAPI.PreCall(552);

            HalconAPI.StoreS(proc, 0, attribName);
            HalconAPI.StoreS(proc, 1, attribValue);
            HalconAPI.StoreI(proc, 2, teamSize);
            HalconAPI.InitOCT(proc, 0);
            int err        = HalconAPI.CallProcedure(proc);
            int procResult = this.Load(proc, 0, err);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
예제 #16
0
        /// <summary>
        ///   Create a new OCV tool based on gray value projections.
        ///   Modified instance represents: Handle of the created OCV tool.
        /// </summary>
        /// <param name="patternNames">List of names for patterns to be trained. Default: "a"</param>
        public void CreateOcvProj(HTuple patternNames)
        {
            this.Dispose();
            IntPtr proc = HalconAPI.PreCall(646);

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

            HalconAPI.UnpinTuple(patternNames);
            int procResult = this.Load(proc, 0, err);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
예제 #17
0
        /// <summary>
        ///   Set message parameter or invoke commands on the message.
        ///   Instance represents: Message handle.
        /// </summary>
        /// <param name="genParamName">Names of the message parameters or action commands. Default: "remove_key"</param>
        /// <param name="key">Message keys the parameter/command should be applied to.</param>
        /// <param name="genParamValue">Values of the message parameters or action commands.</param>
        public void SetMessageParam(string genParamName, HTuple key, HTuple genParamValue)
        {
            IntPtr proc = HalconAPI.PreCall(535);

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

            HalconAPI.UnpinTuple(key);
            HalconAPI.UnpinTuple(genParamValue);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
예제 #18
0
        /// <summary>
        ///   Select objects from an object tuple.
        ///   Instance represents: Input objects.
        /// </summary>
        /// <param name="index">Indices of the objects to be selected. Default: 1</param>
        /// <returns>Selected objects.</returns>
        public HXLDPoly SelectObj(int index)
        {
            IntPtr proc = HalconAPI.PreCall(587);

            this.Store(proc, 1);
            HalconAPI.StoreI(proc, 0, index);
            HalconAPI.InitOCT(proc, 1);
            int      err = HalconAPI.CallProcedure(proc);
            HXLDPoly hxldPoly;
            int      procResult = HXLDPoly.LoadNew(proc, 1, err, out hxldPoly);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hxldPoly);
        }
예제 #19
0
        /// <summary>
        ///   Retrieve a tuple associated with the key from the message.
        ///   Instance represents: Message handle.
        /// </summary>
        /// <param name="key">Key string.</param>
        /// <returns>Tuple value retrieved from the message.</returns>
        public HTuple GetMessageTuple(string key)
        {
            IntPtr proc = HalconAPI.PreCall(538);

            this.Store(proc, 0);
            HalconAPI.StoreS(proc, 1, key);
            HalconAPI.InitOCT(proc, 0);
            int    err = HalconAPI.CallProcedure(proc);
            HTuple tuple;
            int    procResult = HTuple.LoadNew(proc, 0, err, out tuple);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(tuple);
        }
예제 #20
0
        /// <summary>
        ///   Create a region from an XLD polygon.
        ///   Instance represents: Input polygon(s).
        /// </summary>
        /// <param name="mode">Fill mode of the region(s). Default: "filled"</param>
        /// <returns>Created region(s).</returns>
        public HRegion GenRegionPolygonXld(string mode)
        {
            IntPtr proc = HalconAPI.PreCall(596);

            this.Store(proc, 1);
            HalconAPI.StoreS(proc, 0, mode);
            HalconAPI.InitOCT(proc, 1);
            int     err = HalconAPI.CallProcedure(proc);
            HRegion hregion;
            int     procResult = HRegion.LoadNew(proc, 1, err, out hregion);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hregion);
        }
예제 #21
0
        /// <summary>
        ///   Create a lexicon from a tuple of words.
        ///   Modified instance represents: Handle of the lexicon.
        /// </summary>
        /// <param name="name">Unique name for the new lexicon. Default: "lex1"</param>
        /// <param name="words">Word list for the new lexicon. Default: ["word1","word2","word3"]</param>
        public HLexicon(string name, HTuple words)
        {
            IntPtr proc = HalconAPI.PreCall(671);

            HalconAPI.StoreS(proc, 0, name);
            HalconAPI.Store(proc, 1, words);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(words);
            int procResult = this.Load(proc, 0, err);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
예제 #22
0
        /// <summary>
        ///   Create a text model.
        ///   Modified instance represents: New text model.
        /// </summary>
        /// <param name="mode">The Mode of the text model. Default: "auto"</param>
        /// <param name="OCRClassifier">OCR Classifier. Default: "Universal_Rej.occ"</param>
        public HTextModel(string mode, HTuple OCRClassifier)
        {
            IntPtr proc = HalconAPI.PreCall(422);

            HalconAPI.StoreS(proc, 0, mode);
            HalconAPI.Store(proc, 1, OCRClassifier);
            HalconAPI.InitOCT(proc, 0);
            int err = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(OCRClassifier);
            int procResult = this.Load(proc, 0, err);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
예제 #23
0
        /// <summary>
        ///   Query a control value of a text segmentation result.
        ///   Instance represents: Text result.
        /// </summary>
        /// <param name="resultName">Name of the result to be returned. Default: "class"</param>
        /// <returns>Value of ResultName.</returns>
        public HTuple GetTextResult(string resultName)
        {
            IntPtr proc = HalconAPI.PreCall(416);

            this.Store(proc, 0);
            HalconAPI.StoreS(proc, 1, resultName);
            HalconAPI.InitOCT(proc, 0);
            int    err = HalconAPI.CallProcedure(proc);
            HTuple tuple;
            int    procResult = HTuple.LoadNew(proc, 0, err, out tuple);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(tuple);
        }
예제 #24
0
        /// <summary>
        ///   Query specific parameters of an image acquisition device.
        ///   Instance represents: Handle of the acquisition device to be used.
        /// </summary>
        /// <param name="param">Parameter of interest. Default: "revision"</param>
        /// <returns>Parameter value.</returns>
        public HTuple GetFramegrabberParam(string param)
        {
            IntPtr proc = HalconAPI.PreCall(2025);

            this.Store(proc, 0);
            HalconAPI.StoreS(proc, 1, param);
            HalconAPI.InitOCT(proc, 0);
            int    err = HalconAPI.CallProcedure(proc);
            HTuple tuple;
            int    procResult = HTuple.LoadNew(proc, 0, err, out tuple);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(tuple);
        }
예제 #25
0
        /// <summary>
        ///   Query an iconic value of a text segmentation result.
        ///   Instance represents: Text result.
        /// </summary>
        /// <param name="resultName">Name of the result to be returned. Default: "all_lines"</param>
        /// <returns>Returned result.</returns>
        public HObject GetTextObject(string resultName)
        {
            IntPtr proc = HalconAPI.PreCall(415);

            this.Store(proc, 0);
            HalconAPI.StoreS(proc, 1, resultName);
            HalconAPI.InitOCT(proc, 1);
            int     err = HalconAPI.CallProcedure(proc);
            HObject hobject;
            int     procResult = HObject.LoadNew(proc, 1, err, out hobject);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hobject);
        }
예제 #26
0
        /// <summary>
        ///   Asynchronous grab of an image from the specified image acquisition device.
        ///   Instance represents: Handle of the acquisition device to be used.
        /// </summary>
        /// <param name="maxDelay">Maximum tolerated delay between the start of the asynchronous grab and the delivery of the image [ms]. Default: -1.0</param>
        /// <returns>Grabbed image.</returns>
        public HImage GrabImageAsync(double maxDelay)
        {
            IntPtr proc = HalconAPI.PreCall(2031);

            this.Store(proc, 0);
            HalconAPI.StoreD(proc, 1, maxDelay);
            HalconAPI.InitOCT(proc, 1);
            int    err = HalconAPI.CallProcedure(proc);
            HImage himage;
            int    procResult = HImage.LoadNew(proc, 1, err, out himage);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(himage);
        }
예제 #27
0
        /// <summary>
        ///   Return the parameters the deep-learning-based classifier.
        ///   Instance represents: Handle of the deep-learning-based classifier.
        /// </summary>
        /// <param name="genParamName">Name of the generic parameter. Default: "gpu"</param>
        /// <returns>Value of the generic parameter.</returns>
        public HTuple GetDlClassifierParam(string genParamName)
        {
            IntPtr proc = HalconAPI.PreCall(2114);

            this.Store(proc, 0);
            HalconAPI.StoreS(proc, 1, genParamName);
            HalconAPI.InitOCT(proc, 0);
            int    err = HalconAPI.CallProcedure(proc);
            HTuple tuple;
            int    procResult = HTuple.LoadNew(proc, 0, err, out tuple);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(tuple);
        }
예제 #28
0
        /// <summary>
        ///   Trains an k-NN classifier for an OCR task.
        ///   Instance represents: Handle of the k-NN classifier.
        /// </summary>
        /// <param name="trainingFile">Names of the training files. Default: "ocr.trf"</param>
        /// <param name="genParamName">Names of the generic parameters that can be adjusted for the k-NN classifier creation. Default: []</param>
        /// <param name="genParamValue">Values of the generic parameters that can be adjusted for the k-NN classifier creation. Default: []</param>
        public void TrainfOcrClassKnn(string trainingFile, HTuple genParamName, HTuple genParamValue)
        {
            IntPtr proc = HalconAPI.PreCall(655);

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

            HalconAPI.UnpinTuple(genParamName);
            HalconAPI.UnpinTuple(genParamValue);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
        }
예제 #29
0
        /// <summary>
        ///   Remove objects from an iconic object tuple.
        ///   Instance represents: Input object tuple.
        /// </summary>
        /// <param name="index">Indices of the objects to be removed.</param>
        /// <returns>Remaining object tuple.</returns>
        public HXLDPara RemoveObj(int index)
        {
            IntPtr proc = HalconAPI.PreCall(2124);

            this.Store(proc, 1);
            HalconAPI.StoreI(proc, 0, index);
            HalconAPI.InitOCT(proc, 1);
            int      err = HalconAPI.CallProcedure(proc);
            HXLDPara hxldPara;
            int      procResult = HXLDPara.LoadNew(proc, 1, err, out hxldPara);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hxldPara);
        }
예제 #30
0
        /// <summary>
        ///   Training of an OCV tool.
        ///   Instance represents: Handle of the OCV tool to be trained.
        /// </summary>
        /// <param name="pattern">Pattern to be trained.</param>
        /// <param name="name">Name(s) of the object(s) to analyse. Default: "a"</param>
        /// <param name="mode">Mode for training (only one mode implemented). Default: "single"</param>
        public void TraindOcvProj(HImage pattern, HTuple name, string mode)
        {
            IntPtr proc = HalconAPI.PreCall(639);

            this.Store(proc, 0);
            HalconAPI.Store(proc, 1, (HObjectBase)pattern);
            HalconAPI.Store(proc, 1, name);
            HalconAPI.StoreS(proc, 2, mode);
            int procResult = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(name);
            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)pattern);
        }