Exemplo n.º 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 HXLDExtPara 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);
            HXLDExtPara hxldExtPara;
            int         procResult = HXLDExtPara.LoadNew(proc, 1, err, out hxldExtPara);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hxldExtPara);
        }
Exemplo n.º 2
0
        /// <summary>
        ///   Extract parallel XLD polygons enclosing a homogeneous area.
        ///   Instance represents: Input XLD parallels.
        /// </summary>
        /// <param name="image">Corresponding gray value image.</param>
        /// <param name="extParallels">Extended XLD parallels.</param>
        /// <param name="quality">Minimum quality factor (measure of parallelism). Default: 0.4</param>
        /// <param name="minGray">Minimum mean gray value. Default: 160</param>
        /// <param name="maxGray">Maximum mean gray value. Default: 220</param>
        /// <param name="maxStandard">Maximum allowed standard deviation. Default: 10.0</param>
        /// <returns>Modified XLD parallels.</returns>
        public HXLDModPara ModParallelsXld(
            HImage image,
            out HXLDExtPara extParallels,
            HTuple quality,
            int minGray,
            int maxGray,
            HTuple maxStandard)
        {
            IntPtr proc = HalconAPI.PreCall(39);

            this.Store(proc, 1);
            HalconAPI.Store(proc, 2, (HObjectBase)image);
            HalconAPI.Store(proc, 0, quality);
            HalconAPI.StoreI(proc, 1, minGray);
            HalconAPI.StoreI(proc, 2, maxGray);
            HalconAPI.Store(proc, 3, maxStandard);
            HalconAPI.InitOCT(proc, 1);
            HalconAPI.InitOCT(proc, 2);
            int err1 = HalconAPI.CallProcedure(proc);

            HalconAPI.UnpinTuple(quality);
            HalconAPI.UnpinTuple(maxStandard);
            HXLDModPara hxldModPara;
            int         err2       = HXLDModPara.LoadNew(proc, 1, err1, out hxldModPara);
            int         procResult = HXLDExtPara.LoadNew(proc, 2, err2, out extParallels);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)image);
            return(hxldModPara);
        }
Exemplo n.º 3
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 HXLDExtPara 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 = HXLDExtPara.LoadNew(proc, 2, err2, out meshes);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)image);
            return(himage);
        }
Exemplo n.º 4
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 HXLDExtPara 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);
            HXLDExtPara hxldExtPara;
            int         procResult = HXLDExtPara.LoadNew(proc, 1, err, out hxldExtPara);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hxldExtPara);
        }
Exemplo n.º 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 HXLDExtPara 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);
            HXLDExtPara hxldExtPara;
            int         procResult = HXLDExtPara.LoadNew(proc, 1, err, out hxldExtPara);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hxldExtPara);
        }
Exemplo n.º 6
0
        /// <summary>
        ///   Calculate the difference of two object tuples.
        ///   Instance represents: Object tuple 1.
        /// </summary>
        /// <param name="objectsSub">Object tuple 2.</param>
        /// <returns>Objects from Objects that are not part of ObjectsSub.</returns>
        public HXLDExtPara ObjDiff(HXLDExtPara objectsSub)
        {
            IntPtr proc = HalconAPI.PreCall(573);

            this.Store(proc, 1);
            HalconAPI.Store(proc, 2, (HObjectBase)objectsSub);
            HalconAPI.InitOCT(proc, 1);
            int         err = HalconAPI.CallProcedure(proc);
            HXLDExtPara hxldExtPara;
            int         procResult = HXLDExtPara.LoadNew(proc, 1, err, out hxldExtPara);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            GC.KeepAlive((object)objectsSub);
            return(hxldExtPara);
        }
Exemplo n.º 7
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 HXLDExtPara 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);
            HXLDExtPara hxldExtPara;
            int         procResult = HXLDExtPara.LoadNew(proc, 1, err, out hxldExtPara);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hxldExtPara);
        }
Exemplo n.º 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 HXLDExtPara 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);
            HXLDExtPara hxldExtPara;
            int         procResult = HXLDExtPara.LoadNew(proc, 1, err, out hxldExtPara);

            HalconAPI.PostCall(proc, procResult);
            GC.KeepAlive((object)this);
            return(hxldExtPara);
        }
Exemplo n.º 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 HXLDExtPara ReplaceObj(HXLDExtPara 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);
            HXLDExtPara hxldExtPara;
            int         procResult = HXLDExtPara.LoadNew(proc, 1, err, out hxldExtPara);

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