示例#1
0
        /// <summary>
        ///   Combine road hypotheses from two resolution levels.
        ///   Instance represents: XLD polygons to be examined.
        /// </summary>
        /// <param name="modParallels">Modified parallels obtained from EdgePolygons.</param>
        /// <param name="extParallels">Extended parallels obtained from EdgePolygons.</param>
        /// <param name="centerLines">Road-center-line polygons to be examined.</param>
        /// <param name="maxAngleParallel">Maximum angle between two parallel line segments. Default: 0.523598775598</param>
        /// <param name="maxAngleColinear">Maximum angle between two collinear line segments. Default: 0.261799387799</param>
        /// <param name="maxDistanceParallel">Maximum distance between two parallel line segments. Default: 40</param>
        /// <param name="maxDistanceColinear">Maximum distance between two collinear line segments. Default: 40</param>
        /// <returns>Roadsides found.</returns>
        public HXLDPoly CombineRoadsXld(
            HXLDModPara modParallels,
            HXLDExtPara extParallels,
            HXLDPoly centerLines,
            double maxAngleParallel,
            double maxAngleColinear,
            double maxDistanceParallel,
            double maxDistanceColinear)
        {
            IntPtr proc = HalconAPI.PreCall(37);

            this.Store(proc, 1);
            HalconAPI.Store(proc, 2, (HObjectBase)modParallels);
            HalconAPI.Store(proc, 3, (HObjectBase)extParallels);
            HalconAPI.Store(proc, 4, (HObjectBase)centerLines);
            HalconAPI.StoreD(proc, 0, maxAngleParallel);
            HalconAPI.StoreD(proc, 1, maxAngleColinear);
            HalconAPI.StoreD(proc, 2, maxDistanceParallel);
            HalconAPI.StoreD(proc, 3, maxDistanceColinear);
            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);
            GC.KeepAlive((object)modParallels);
            GC.KeepAlive((object)extParallels);
            GC.KeepAlive((object)centerLines);
            return(hxldPoly);
        }
示例#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);
        }
示例#3
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);
        }
示例#4
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);
        }
示例#5
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);
        }
示例#6
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);
        }
示例#7
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);
        }
示例#8
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);
        }
示例#9
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(HXLDExtPara 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);
        }
示例#10
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);
        }
示例#11
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);
        }
示例#12
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(HXLDExtPara 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);
        }
示例#13
0
 public static int LoadNew(IntPtr proc, int parIndex, int err, out HXLDExtPara obj)
 {
     obj = new HXLDExtPara(HObjectBase.UNDEF);
     return(obj.Load(proc, parIndex, err));
 }