예제 #1
0
        /// <summary>
        ///   Select contours or polygons using shape features.
        ///   Instance represents: Contours or polygons to be examined.
        /// </summary>
        /// <param name="features">Shape features to be checked. Default: "area"</param>
        /// <param name="operation">Operation type between the individual features. Default: "and"</param>
        /// <param name="min">Lower limits of the features or 'min'. Default: 150.0</param>
        /// <param name="max">Upper limits of the features or 'max'. Default: 99999.0</param>
        /// <returns>Contours or polygons fulfilling the condition(s).</returns>
        public HXLDPara SelectShapeXld(
            HTuple features,
            string operation,
            HTuple min,
            HTuple max)
        {
            IntPtr proc = HalconAPI.PreCall(1678);

            this.Store(proc, 1);
            HalconAPI.Store(proc, 0, features);
            HalconAPI.StoreS(proc, 1, operation);
            HalconAPI.Store(proc, 2, min);
            HalconAPI.Store(proc, 3, max);
            HalconAPI.InitOCT(proc, 1);
            int err = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(features);
            HalconAPI.UnpinTuple(min);
            HalconAPI.UnpinTuple(max);
            HXLDPara hxldPara;
            int      procResult = HXLDPara.LoadNew(proc, 1, err, out hxldPara);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hxldPara);
        }
예제 #2
0
        /// <summary>
        ///   Compute the mapping between the distorted image and the rectified image based upon the points of a regular grid.
        ///   Instance represents: Input contours.
        /// </summary>
        /// <param name="image">Input image.</param>
        /// <param name="meshes">Output contours.</param>
        /// <param name="gridSpacing">Distance of the grid points in the rectified image.</param>
        /// <param name="rotation">Rotation to be applied to the point grid. Default: "auto"</param>
        /// <param name="row">Row coordinates of the grid points.</param>
        /// <param name="column">Column coordinates of the grid points.</param>
        /// <param name="mapType">Type of mapping. Default: "bilinear"</param>
        /// <returns>Image containing the mapping data.</returns>
        public HImage GenGridRectificationMap(
            HImage image,
            out HXLDPara meshes,
            int gridSpacing,
            string rotation,
            HTuple row,
            HTuple column,
            string mapType)
        {
            IntPtr proc = HalconAPI.PreCall(1159);

            this.Store(proc, 2);
            HalconAPI.Store(proc, 1, (HObjectBase)image);
            HalconAPI.StoreI(proc, 0, gridSpacing);
            HalconAPI.StoreS(proc, 1, rotation);
            HalconAPI.Store(proc, 2, row);
            HalconAPI.Store(proc, 3, column);
            HalconAPI.StoreS(proc, 4, mapType);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            int err1 = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(row);
            HalconAPI.UnpinTuple(column);
            HImage himage;
            int    err2       = HImage.LoadNew(proc, 1, err1, out himage);
            int    procResult = HXLDPara.LoadNew(proc, 2, err2, out meshes);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)image);
            return(himage);
        }
예제 #3
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);
        }
예제 #4
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);
        }
예제 #5
0
        /// <summary>
        ///   Choose all contours or polygons containing a given point.
        ///   Instance represents: Contours or polygons to be examined.
        /// </summary>
        /// <param name="row">Line coordinate of the test point. Default: 100.0</param>
        /// <param name="column">Column coordinate of the test point. Default: 100.0</param>
        /// <returns>All contours or polygons containing the test point.</returns>
        public HXLDPara SelectXldPoint(double row, double column)
        {
            IntPtr proc = HalconAPI.PreCall(1676);

            this.Store(proc, 1);
            HalconAPI.StoreD(proc, 0, row);
            HalconAPI.StoreD(proc, 1, column);
            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>
        ///   Concatenate two iconic object tuples.
        ///   Instance represents: Object tuple 1.
        /// </summary>
        /// <param name="objects2">Object tuple 2.</param>
        /// <returns>Concatenated objects.</returns>
        public HXLDPara ConcatObj(HXLDPara objects2)
        {
            IntPtr proc = HalconAPI.PreCall(584);

            this.Store(proc, 1);
            HalconAPI.Store(proc, 2, (HObjectBase)objects2);
            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);
            GC.KeepAlive((object)objects2);
            return(hxldPara);
        }
예제 #7
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 HXLDPara SelectObj(HTuple index)
        {
            IntPtr proc = HalconAPI.PreCall(587);

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

            HalconAPI.UnpinTuple(index);
            HXLDPara hxldPara;
            int      procResult = HXLDPara.LoadNew(proc, 1, err, out hxldPara);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hxldPara);
        }
예제 #8
0
        /// <summary>
        ///   Extract parallel XLD polygons.
        ///   Instance represents: Input polygons.
        /// </summary>
        /// <param name="len">Minimum length of the individual polygon segments. Default: 10.0</param>
        /// <param name="dist">Maximum distance between the polygon segments. Default: 30.0</param>
        /// <param name="alpha">Maximum angle difference of the polygon segments. Default: 0.15</param>
        /// <param name="merge">Should adjacent parallel relations be merged? Default: "true"</param>
        /// <returns>Parallel polygons.</returns>
        public HXLDPara GenParallelsXld(double len, double dist, double alpha, string merge)
        {
            IntPtr proc = HalconAPI.PreCall(42);

            this.Store(proc, 1);
            HalconAPI.StoreD(proc, 0, len);
            HalconAPI.StoreD(proc, 1, dist);
            HalconAPI.StoreD(proc, 2, alpha);
            HalconAPI.StoreS(proc, 3, merge);
            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);
        }
예제 #9
0
        /// <summary>
        ///   Replaces one or more elements of an iconic object tuple.
        ///   Instance represents: Iconic Input Object.
        /// </summary>
        /// <param name="objectsReplace">Element(s) to replace.</param>
        /// <param name="index">Index/Indices of elements to be replaced.</param>
        /// <returns>Tuple with replaced elements.</returns>
        public HXLDPara ReplaceObj(HXLDPara objectsReplace, HTuple index)
        {
            IntPtr proc = HalconAPI.PreCall(2125);

            this.Store(proc, 1);
            HalconAPI.Store(proc, 2, (HObjectBase)objectsReplace);
            HalconAPI.Store(proc, 0, index);
            HalconAPI.InitOCT(proc, 1);
            int err = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(index);
            HXLDPara hxldPara;
            int      procResult = HXLDPara.LoadNew(proc, 1, err, out hxldPara);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)objectsReplace);
            return(hxldPara);
        }