Пример #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>
        ///   Compare image objects regarding equality.
        ///   Instance represents: Test objects.
        /// </summary>
        /// <param name="objects2">Comparative objects.</param>
        /// <returns>boolean result value.</returns>
        public int TestEqualObj(HXLDPara objects2)
        {
            IntPtr proc = HalconAPI.PreCall(591);

            this.Store(proc, 1);
            HalconAPI.Store(proc, 2, (HObjectBase)objects2);
            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);
            GC.KeepAlive((object)objects2);
            return(intValue);
        }
Пример #7
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);
        }
Пример #8
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);
        }
Пример #9
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);
        }
Пример #10
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);
        }
Пример #11
0
        /// <summary>
        ///   Compare iconic objects regarding equality.
        ///   Instance represents: Reference objects.
        /// </summary>
        /// <param name="objects2">Test objects.</param>
        /// <param name="epsilon">Maximum allowed difference between two gray values or  coordinates etc. Default: 0.0</param>
        /// <returns>Boolean result value.</returns>
        public int CompareObj(HXLDPara objects2, HTuple epsilon)
        {
            IntPtr proc = HalconAPI.PreCall(588);

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

            HalconAPI.UnpinTuple(epsilon);
            int intValue;
            int procResult = HalconAPI.LoadI(proc, 0, err, out intValue);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)objects2);
            return(intValue);
        }
Пример #12
0
 public static int LoadNew(IntPtr proc, int parIndex, int err, out HXLDPara obj)
 {
     obj = new HXLDPara(HObjectBase.UNDEF);
     return(obj.Load(proc, parIndex, err));
 }