Esempio n. 1
0
 public Coord2D(XYCoord xy) : this(VisionLabPINVOKE.new_Coord2D__SWIG_3(XYCoord.getCPtr(xy)), true)
 {
     if (VisionLabPINVOKE.SWIGPendingException.Pending)
     {
         throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public LineXY(XYCoord s, XYCoord e) : this(VisionLabPINVOKE.new_LineXY__SWIG_1(XYCoord.getCPtr(s), XYCoord.getCPtr(e)), true)
 {
     if (VisionLabPINVOKE.SWIGPendingException.Pending)
     {
         throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
     }
 }
 public static void Main()
 {
     XYCoord t1 = new XYCoord();
     XYCoord t2 = new XYCoord(8, 9);
     XYCoord t3 = new XYCoord(t2);
     Console.WriteLine("t1.x, t1.y: " + t1.x + ", " + t1.y);
     Console.WriteLine("t2.x, t2.y: " + t2.x + ", " + t2.y);
     Console.WriteLine("t3.x, t3.y: " + t3.x + ", " + t3.y);
 }
Esempio n. 4
0
    public bool CheckCoord(XYCoord xy)
    {
        bool ret = VisionLabPINVOKE.__NumYUV161616Image_CheckCoord__SWIG_1(swigCPtr, XYCoord.getCPtr(xy));

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 5
0
    public XYCoord GetXYCoord(YUV161616Pixel ptr)
    {
        XYCoord ret = new XYCoord(VisionLabPINVOKE.__NumYUV161616Image_GetXYCoord(swigCPtr, YUV161616Pixel.getCPtr(ptr)), true);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
    public XYCoord Add_Op(XYCoord c)
    {
        XYCoord ret = new XYCoord(VisionLabPINVOKE.XYCoord_Add_Op(swigCPtr, XYCoord.getCPtr(c)), true);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
    public XYCoord Divide(double f)
    {
        XYCoord ret = new XYCoord(VisionLabPINVOKE.XYCoord_Divide(swigCPtr, f), true);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
    public bool SmallerThan(XYCoord arg0)
    {
        bool ret = VisionLabPINVOKE.XYCoord_SmallerThan(swigCPtr, XYCoord.getCPtr(arg0));

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 9
0
    public string GetPixelPtr(XYCoord xy)
    {
        string ret = VisionLabPINVOKE.NumInt8Pixel_GetPixelPtr__SWIG_1(swigCPtr, XYCoord.getCPtr(xy));

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 10
0
    public XYCoord GetXYCoord(string ptr)
    {
        XYCoord ret = new XYCoord(VisionLabPINVOKE.NumInt8Pixel_GetXYCoord(swigCPtr, ptr), true);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
    public XYCoord GetXYCoord(SWIGTYPE_p_std__complexT_double_t ptr)
    {
        XYCoord ret = new XYCoord(VisionLabPINVOKE.__NumComplexDoubleImage_GetXYCoord(swigCPtr, SWIGTYPE_p_std__complexT_double_t.getCPtr(ptr)), true);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 12
0
    public XYCoord GetXYCoord(SWIGTYPE_p_short ptr)
    {
        XYCoord ret = new XYCoord(VisionLabPINVOKE.__NumInt16Image_GetXYCoord(swigCPtr, SWIGTYPE_p_short.getCPtr(ptr)), true);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
    public bool Not(XYCoord c)
    {
        bool ret = VisionLabPINVOKE.XYCoord_Not(swigCPtr, XYCoord.getCPtr(c));

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
    public XYCoord GetXYCoord(SWIGTYPE_p_unsigned_char ptr)
    {
        XYCoord ret = new XYCoord(VisionLabPINVOKE.NumByteImage_GetXYCoord(swigCPtr, SWIGTYPE_p_unsigned_char.getCPtr(ptr)), true);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
    public SWIGTYPE_p_std__complexT_double_t GetPixelPtr(XYCoord xy)
    {
        IntPtr cPtr = VisionLabPINVOKE.__NumComplexDoubleImage_GetPixelPtr__SWIG_1(swigCPtr, XYCoord.getCPtr(xy));
        SWIGTYPE_p_std__complexT_double_t ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_std__complexT_double_t(cPtr, false);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 16
0
    public YUV161616Pixel GetPixelPtr(XYCoord xy)
    {
        IntPtr         cPtr = VisionLabPINVOKE.__NumYUV161616Image_GetPixelPtr__SWIG_1(swigCPtr, XYCoord.getCPtr(xy));
        YUV161616Pixel ret  = (cPtr == IntPtr.Zero) ? null : new YUV161616Pixel(cPtr, false);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 17
0
    public SWIGTYPE_p_short GetPixelPtr(XYCoord xy)
    {
        global::System.IntPtr cPtr = VisionLabPINVOKE.__NumInt16Image_GetPixelPtr__SWIG_1(swigCPtr, XYCoord.getCPtr(xy));
        SWIGTYPE_p_short      ret  = (cPtr == global::System.IntPtr.Zero) ? null : new SWIGTYPE_p_short(cPtr, false);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
Esempio n. 18
0
        /*  Description:
         *      Locates the characters of the license plate
         *              - Warp image (Rectify)
         *              - Segment characters
         *              - Remove blobs which are to small (Lines between characters)
         *  Input:
         *          //Original image
         *          RGB888Image plateImage
         *          //Segmented license plate
         *          Int32Image binaryPlateImage
         *  Output:
         *          //Image containing binary six characters
         *          ref Int32Image binaryCharacterImage
         *  Return:
         *          //Function executed successfully
         *          bool
         */
        public static bool FindCharacters(RGB888Image plateImage, Int32Image binaryPlateImage, ref Int32Image binaryCharacterImage)
        {
            //Constants
            const int c_height           = 100;
            const int c_width            = 470;
            const int c_remove_blobs_min = 1;
            const int c_remove_blobs_max = 400;

            XYCoord leftTop     = new XYCoord();
            XYCoord rightTop    = new XYCoord();
            XYCoord leftBottom  = new XYCoord();
            XYCoord rightBottom = new XYCoord();


            //Find licenseplate
            VisionLab.FindCornersRectangle(binaryPlateImage, Connected.EightConnected, 0.5, Orientation.Landscape, leftTop, rightTop, leftBottom, rightBottom);

            Int32Image plateImageGray = new Int32Image();

            VisionLab.Convert(plateImage, plateImageGray);

            try
            {
                //Rectify plate
                VisionLab.Warp(plateImageGray, binaryCharacterImage, TransformDirection.ForwardT, new Coord2D(leftTop), new Coord2D(rightTop), new Coord2D(leftBottom), new Coord2D(rightBottom), c_height, c_width, 0);
            }
            catch (Exception)
            {
                //Warp, 3 coords on one line
                return(false);
            }
            plateImageGray.Dispose();

            //*******************************//
            //** Exercise:                 **//
            //**   adjust licenseplate     **//
            //**   segmentation            **//
            //*******************************//

            //Find dark text on bright licenseplate using ThresholdISOData
            VisionLab.ThresholdIsoData(binaryCharacterImage, ObjectBrightness.DarkObject);

            //Remove blobs connected to the border
            VisionLab.RemoveBorderBlobs(binaryCharacterImage, Connected.EightConnected, Border.AllBorders);
            //Remove small blobs
            VisionLab.RemoveBlobs(binaryCharacterImage, Connected.EightConnected, BlobAnalyse.BA_Area, c_remove_blobs_min, c_remove_blobs_max);

            leftTop.Dispose();
            rightTop.Dispose();
            leftBottom.Dispose();
            rightBottom.Dispose();
            //GC.Collect();
            return(true);
        }
Esempio n. 19
0
    public HSV888Pixel GetPixelPtr(XYCoord xy)
    {
        global::System.IntPtr cPtr = VisionLabPINVOKE.__NumHSV888Image_GetPixelPtr__SWIG_1(swigCPtr, XYCoord.getCPtr(xy));
        HSV888Pixel           ret  = (cPtr == global::System.IntPtr.Zero) ? null : new HSV888Pixel(cPtr, false);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
    public SWIGTYPE_p_unsigned_char GetPixelPtr(XYCoord xy)
    {
        IntPtr cPtr = VisionLabPINVOKE.NumByteImage_GetPixelPtr__SWIG_1(swigCPtr, XYCoord.getCPtr(xy));
        SWIGTYPE_p_unsigned_char ret = (cPtr == IntPtr.Zero) ? null : new SWIGTYPE_p_unsigned_char(cPtr, false);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
 public static void BlockPattern(YUV888Image image, XYCoord leftTop, int height, int width, YUV888Pixel value, int repeatx, int repeaty, ZeroOrOriginal zorg) {
   VisionLabPINVOKE.BlockPattern__SWIG_22(YUV888Image.getCPtr(image), XYCoord.getCPtr(leftTop), height, width, YUV888Pixel.getCPtr(value), repeatx, repeaty, (int)zorg);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static void BlockPattern(YUV161616Image image, XYCoord leftTop, int height, int width, YUV161616Pixel value, int repeatx, int repeaty) {
   VisionLabPINVOKE.BlockPattern__SWIG_25(YUV161616Image.getCPtr(image), XYCoord.getCPtr(leftTop), height, width, YUV161616Pixel.getCPtr(value), repeatx, repeaty);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
        /*
         *  Description:
         *      Locates the characters of the license plate
         *      - Warp image (Rectify)
         *      - Segment characters
         *      - Remove blobs which are to small (Lines between characters)
         *  Input:
         *      //Original image
         *      RGB888Image plateImage
         *      //Segmented license plate
         *      Int32Image binaryPlateImage
         *      Output:
         *      //Image containing binary six characters
         *      ref Int32Image binaryCharacterImage
         *  Return:
         *      //Function executed successfully
         *      bool
         */
        public static bool FindCharacters(RGB888Image plateImage, Int32Image binaryPlateImage, ref Int32Image binaryCharacterImage)
        {
            try
            {
                //Constants
                const int c_height           = 100;
                const int c_width            = 470;
                const int c_remove_blobs_min = 1;
                const int c_remove_blobs_max = 450;

                XYCoord leftTop     = new XYCoord();
                XYCoord rightTop    = new XYCoord();
                XYCoord leftBottom  = new XYCoord();
                XYCoord rightBottom = new XYCoord();


                //Find licenseplate
                VisionLab.FindCornersRectangle(binaryPlateImage, Connected.EightConnected, 0.5, Orientation.Landscape, leftTop, rightTop, leftBottom, rightBottom);
                if (!VisionLab.WarpCoordsValid(new Coord2D(leftTop), new Coord2D(rightTop), new Coord2D(leftBottom), new Coord2D(rightBottom)))
                {
                    VisionLab.FindCornersRectangleSq(binaryPlateImage, Connected.EightConnected, leftTop, rightTop, leftBottom, rightBottom);
                    if (!VisionLab.WarpCoordsValid(new Coord2D(leftTop), new Coord2D(rightTop), new Coord2D(leftBottom), new Coord2D(rightBottom)))
                    {
                        return(false);
                    }
                }

                Int32Image plateImageGray = new Int32Image();
                VisionLab.Convert(plateImage, plateImageGray);

                //Rectify plate
                VisionLab.Warp(plateImageGray, binaryCharacterImage, TransformDirection.ForwardT, new Coord2D(leftTop), new Coord2D(rightTop), new Coord2D(leftBottom), new Coord2D(rightBottom), c_height, c_width, 0);


                plateImageGray.Dispose();

                //*******************************//
                //** Exercise:                 **//
                //**   adjust licenseplate     **//
                //**   segmentation            **//
                //*******************************//


                //Find dark text on bright licenseplate using ThresholdISOData
                VisionLab.ThresholdIsoData(binaryCharacterImage, ObjectBrightness.DarkObject);

                //Remove small blobs and noise
                Int32Image binaryCharacterImageCopy = new Int32Image(binaryCharacterImage);
                VisionLab.Opening(binaryCharacterImageCopy, binaryCharacterImage, new Mask_Int32(5, 1, 1));

                //Remove blobs connected to the border
                VisionLab.RemoveBorderBlobs(binaryCharacterImage, Connected.EightConnected, Border.AllBorders);
                //Remove small blobs
                VisionLab.RemoveBlobs(binaryCharacterImage, Connected.EightConnected, BlobAnalyse.BA_Area, c_remove_blobs_min, c_remove_blobs_max);

                leftTop.Dispose();
                rightTop.Dispose();
                leftBottom.Dispose();
                rightBottom.Dispose();

                return(true);
            }
            catch (System.Exception ex)
            {
                throw new Exception("FindCharacters: " + ex.Message);
            }
        }
Esempio n. 24
0
        public void ProcessReceive()
        {
            LogFiler.Log(Category.Info, MethodBase.GetCurrentMethod().DeclaringType.Name + "_" + MethodBase.GetCurrentMethod().Name + ": started receiving data.");

            try
            {
                while (!IsStopped)
                {
                    var watch = new System.Diagnostics.Stopwatch();
                    watch.Start();
                    Task <byte[]> receive = TReceive();
                    ScannerDecode Info    = new ScannerDecode().Decode(receive.Result);

                    if (Info.ID == 1)
                    {
                        RefreshScanner(Info);
                        Tuple <float, float> angleinfo = ScannerFunctionality.GetAngleId1(receive.Result);
                        Degree          = angleinfo.Item1;
                        AngleDifference = angleinfo.Item2;
                    }
                    else if (Info.ID == 6)
                    {
                        if (BlockOrderCorrect(Info.Block))
                        {
                            ExpandScanner(Info, receive.Result);

                            // if the id6 telegramblocks are finished - split the distance based on the scannergap information (not visible area)
                            // if its not getting split, the averaging will create datapoints where the scanner couldnt be able to see at all - leads to consequential errors
                            if (Id6Complete())
                            {
                                Distance = ScannerFunc.GetProcessedDistance(Id6Distance.ToList());

                                if (Mainframe.IsNormalizedbyMedian[Tag])
                                {
                                    Distance = ScannerFunc.GetMedianAverageArray(Distance.ToList());
                                }

                                XYCoord = ScannerFunc.GetXYCoordinate(Distance.ToList(), this);

                                XYCoordinate = ScannerFunctionality.MergeXYArray(XYCoord.ToList());
                                OnScannerRaw(this, XYCoordinate.ToList());

                                List <List <Tuple <int, int, int> > > Normalizer = new List <List <Tuple <int, int, int> > >();
                                List <Tuple <int, int, int> >         Normalized = new List <Tuple <int, int, int> >();

                                // try to accomplish the necessary kinds of averaging the distance sent by the scanner
                                // data averaged by time
                                if (Mainframe.IsNormalizedbyTime[Tag])
                                {
                                    List <Tuple <int, int, int> > xycollection = new List <Tuple <int, int, int> >(XYCoordinate);
                                    XYCollection[RingBufferCount] = xycollection;

                                    List <List <Tuple <int, int, int> > > xycolle = new List <List <Tuple <int, int, int> > >(XYCoord);
                                    XYColl[RingBufferCount] = xycolle;

                                    RingBufferCount++;
                                    CountTimeAverage++;

                                    if (RingBufferCount == Mainframe.NormalizebyTimeCountStoredData[Tag])
                                    {
                                        RingBufferCount = 0;
                                    }

                                    if (CountTimeAverage == Mainframe.NormalizebyTimeCountDataAverage[Tag])
                                    {
                                        Normalizer       = ScannerFunc.NormalizationByTime(RingBufferCount, XYColl);
                                        CountTimeAverage = 0;
                                    }
                                }
                                else
                                {
                                    Normalizer = XYCoord;
                                }

                                if (Normalizer.Count != 0)
                                {
                                    if (Mainframe.IsNormalizedbyTriangle[Tag])
                                    {
                                        Normalizer = ScannerFunc.Normalization(Normalizer.ToList());
                                    }

                                    Normalized = ScannerFunctionality.MergeNormalizeArray(Normalizer.ToList());

                                    Normalized = ScannerFunc.ChangePositionOfXY(Normalized.ToList());

                                    NormalizedData = Normalized;
                                    OnScannerNormalized(this, new List <Tuple <int, int, int> >(NormalizedData));

                                    List <Tuple <int, int, int> > Analyser = new List <Tuple <int, int, int> >(Normalized);
                                    AnalyseData = Analyser;
                                }

                                if (watch.IsRunning)
                                {
                                    watch.Stop();
                                    LogFiler.Log(Category.Info, "normalise" + watch.ElapsedMilliseconds.ToString());
                                }
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                LogFiler.Log(Category.Error, MethodBase.GetCurrentMethod().DeclaringType.Name + "_" + MethodBase.GetCurrentMethod().Name + ": " + ex.Message);
            }
        }
 public static void RotateCoord(XYCoord xy, XYCoord centre, double phi) {
   VisionLabPINVOKE.RotateCoord__SWIG_0(XYCoord.getCPtr(xy), XYCoord.getCPtr(centre), phi);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static double Angle(XYCoord m, XYCoord c1, XYCoord c2) {
   double ret = VisionLabPINVOKE.Angle(XYCoord.getCPtr(m), XYCoord.getCPtr(c1), XYCoord.getCPtr(c2));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public bool CheckCoord(XYCoord xy) {
   bool ret = VisionLabPINVOKE.__NumHSV161616Image_CheckCoord__SWIG_1(swigCPtr, XYCoord.getCPtr(xy));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static void CircleShape(FloatImage image, XYCoord centre, int r, float value) {
   VisionLabPINVOKE.CircleShape__SWIG_11(FloatImage.getCPtr(image), XYCoord.getCPtr(centre), r, value);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static HeightWidth RotateFullHW(Image src, double phi, XYCoord trans) {
   HeightWidth ret = new HeightWidth(VisionLabPINVOKE.RotateFullHW(Image.getCPtr(src), phi, XYCoord.getCPtr(trans)), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static int SnapOnSoftTrigger(__Camera_Byte cam, XYCoord c1, XYCoord c2, float low, float high, int minPixels, FloatImage image, int maxSnapShots) {
   int ret = VisionLabPINVOKE.SnapOnSoftTrigger__SWIG_12(__Camera_Byte.getCPtr(cam), XYCoord.getCPtr(c1), XYCoord.getCPtr(c2), low, high, minPixels, FloatImage.getCPtr(image), maxSnapShots);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static bool CheckXYCoordInImage(Image image, XYCoord xy) {
   bool ret = VisionLabPINVOKE.CheckXYCoordInImage(Image.getCPtr(image), XYCoord.getCPtr(xy));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static bool FindCornersRectangleSq(Int32Image image, Connected connected, XYCoord leftTop, XYCoord rigthTop, XYCoord leftBottom, XYCoord rightBottom) {
   bool ret = VisionLabPINVOKE.FindCornersRectangleSq__SWIG_4(Int32Image.getCPtr(image), (int)connected, XYCoord.getCPtr(leftTop), XYCoord.getCPtr(rigthTop), XYCoord.getCPtr(leftBottom), XYCoord.getCPtr(rightBottom));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static bool FindCornersRectangle(Int16Image image, Connected connected, double deltaPhi, Orientation orient, XYCoord leftTop, XYCoord rigthTop, XYCoord leftBottom, XYCoord rightBottom) {
   bool ret = VisionLabPINVOKE.FindCornersRectangle__SWIG_3(Int16Image.getCPtr(image), (int)connected, deltaPhi, (int)orient, XYCoord.getCPtr(leftTop), XYCoord.getCPtr(rigthTop), XYCoord.getCPtr(leftBottom), XYCoord.getCPtr(rightBottom));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static void BlockPattern(ComplexFloatImage image, XYCoord leftTop, int height, int width, SWIGTYPE_p_std__complexT_float_t value, int repeatx, int repeaty, ZeroOrOriginal zorg) {
   VisionLabPINVOKE.BlockPattern__SWIG_26(ComplexFloatImage.getCPtr(image), XYCoord.getCPtr(leftTop), height, width, SWIGTYPE_p_std__complexT_float_t.getCPtr(value), repeatx, repeaty, (int)zorg);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public XYCoord GetXYCoord(HSV161616Pixel ptr) {
   XYCoord ret = new XYCoord(VisionLabPINVOKE.__NumHSV161616Image_GetXYCoord(swigCPtr, HSV161616Pixel.getCPtr(ptr)), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static void BlockPattern(ComplexDoubleImage image, XYCoord leftTop, int height, int width, SWIGTYPE_p_std__complexT_double_t value, int repeatx, int repeaty) {
   VisionLabPINVOKE.BlockPattern__SWIG_29(ComplexDoubleImage.getCPtr(image), XYCoord.getCPtr(leftTop), height, width, SWIGTYPE_p_std__complexT_double_t.getCPtr(value), repeatx, repeaty);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static void CircleShape(YUV161616Image image, XYCoord centre, int r, YUV161616Pixel value) {
   VisionLabPINVOKE.CircleShape__SWIG_25(YUV161616Image.getCPtr(image), XYCoord.getCPtr(centre), r, YUV161616Pixel.getCPtr(value));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static void CircleShape(DoubleImage image, XYCoord centre, int r, double value, ZeroOrOriginal zorg) {
   VisionLabPINVOKE.CircleShape__SWIG_12(DoubleImage.getCPtr(image), XYCoord.getCPtr(centre), r, value, (int)zorg);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static void CircleShape(ComplexDoubleImage image, XYCoord centre, int r, SWIGTYPE_p_std__complexT_double_t value) {
   VisionLabPINVOKE.CircleShape__SWIG_29(ComplexDoubleImage.getCPtr(image), XYCoord.getCPtr(centre), r, SWIGTYPE_p_std__complexT_double_t.getCPtr(value));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static void CircleShape(YUV888Image image, XYCoord centre, int r, YUV888Pixel value, ZeroOrOriginal zorg) {
   VisionLabPINVOKE.CircleShape__SWIG_22(YUV888Image.getCPtr(image), XYCoord.getCPtr(centre), r, YUV888Pixel.getCPtr(value), (int)zorg);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static XYCoord StrToXYCoord(string str) {
   XYCoord ret = new XYCoord(VisionLabPINVOKE.StrToXYCoord(str), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static void CircleShape(ComplexFloatImage image, XYCoord centre, int r, SWIGTYPE_p_std__complexT_float_t value, ZeroOrOriginal zorg) {
   VisionLabPINVOKE.CircleShape__SWIG_26(ComplexFloatImage.getCPtr(image), XYCoord.getCPtr(centre), r, SWIGTYPE_p_std__complexT_float_t.getCPtr(value), (int)zorg);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static void DiskShape(DoubleImage image, XYCoord centre, double r, double value) {
   VisionLabPINVOKE.DiskShape__SWIG_13(DoubleImage.getCPtr(image), XYCoord.getCPtr(centre), r, value);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static void DiskShape(Int32Image image, XYCoord centre, double r, int value, ZeroOrOriginal zorg) {
   VisionLabPINVOKE.DiskShape__SWIG_8(Int32Image.getCPtr(image), XYCoord.getCPtr(centre), r, value, (int)zorg);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public XYCoord(XYCoord obj)
     : this(obj.x, obj.y)
 {
     Console.WriteLine("Внутри конструктора XYCoord(obj)");
 }
 public static void DiskShape(RGB888Image image, XYCoord centre, double r, RGB888Pixel value, ZeroOrOriginal zorg) {
   VisionLabPINVOKE.DiskShape__SWIG_14(RGB888Image.getCPtr(image), XYCoord.getCPtr(centre), r, RGB888Pixel.getCPtr(value), (int)zorg);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static double Distance(XYCoord p1, XYCoord p2) {
   double ret = VisionLabPINVOKE.Distance__SWIG_2(XYCoord.getCPtr(p1), XYCoord.getCPtr(p2));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static void BlockPattern(DoubleImage image, XYCoord leftTop, int height, int width, double value, int repeatx, int repeaty) {
   VisionLabPINVOKE.BlockPattern__SWIG_13(DoubleImage.getCPtr(image), XYCoord.getCPtr(leftTop), height, width, value, repeatx, repeaty);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(XYCoord obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
 public HSV161616Pixel GetPixelPtr(XYCoord xy) {
   IntPtr cPtr = VisionLabPINVOKE.__NumHSV161616Image_GetPixelPtr__SWIG_1(swigCPtr, XYCoord.getCPtr(xy));
   HSV161616Pixel ret = (cPtr == IntPtr.Zero) ? null : new HSV161616Pixel(cPtr, false);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static double Distance(LineXY line, XYCoord p) {
   double ret = VisionLabPINVOKE.Distance__SWIG_1(LineXY.getCPtr(line), XYCoord.getCPtr(p));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Esempio n. 52
0
 public XYCoord(XYCoord obj)
     : this(obj.x, obj.y)
 {
     Console.WriteLine("Inside XYCoord(obj)");
 }
 public static int FindEdgeLine(DoubleImage image, XYCoord middle, XYCoord endLine, XYCoord endBox, int lineDistance, double outlierDistance, int nrIterations, Line2D line) {
   int ret = VisionLabPINVOKE.FindEdgeLine__SWIG_6(DoubleImage.getCPtr(image), XYCoord.getCPtr(middle), XYCoord.getCPtr(endLine), XYCoord.getCPtr(endBox), lineDistance, outlierDistance, nrIterations, Line2D.getCPtr(line));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static int SnapOnSoftTrigger(__Camera_Byte cam, XYCoord c1, XYCoord c2, double low, double high, int minPixels, DoubleImage image) {
   int ret = VisionLabPINVOKE.SnapOnSoftTrigger__SWIG_15(__Camera_Byte.getCPtr(cam), XYCoord.getCPtr(c1), XYCoord.getCPtr(c2), low, high, minPixels, DoubleImage.getCPtr(image));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
Esempio n. 55
0
 internal static HandleRef getCPtr(XYCoord obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
 public static void TrackBoundary(Int32Image image, int label, XYCoord tml, ChainCode cc) {
   VisionLabPINVOKE.TrackBoundary__SWIG_4(Int32Image.getCPtr(image), label, XYCoord.getCPtr(tml), ChainCode.getCPtr(cc));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
        /*  Description:
         *      Locates the characters of the license plate
         *              - Warp image (Rectify)
         *              - Segment characters
         *              - Remove blobs which are to small (Lines between characters)
         *  Input:
         *          //Original image
         *          RGB888Image plateImage
         *          //Segmented license plate
         *          Int16Image binaryPlateImage
         *  Output:
         *          //Image containing binary six characters
         *          ref Int16Image binaryCharacterImage
         *  Return:
         *          //Function executed successfully
         *          bool
         */
        public static bool FindCharacters(RGB888Image plateImage, Int16Image binaryPlateImage, ref Int16Image binaryCharacterImage)
        {
            //Constants
            const int c_height           = 100;
            const int c_width            = 470;
            const int c_remove_blobs_min = 0;
            const int c_remove_blobs_max = 400;

            XYCoord leftTop     = new XYCoord();
            XYCoord rightTop    = new XYCoord();
            XYCoord leftBottom  = new XYCoord();
            XYCoord rightBottom = new XYCoord();

            // 2de set coordinaten:
            // NIEUW
            XYCoord leftTop2     = new XYCoord();
            XYCoord rightTop2    = new XYCoord();
            XYCoord leftBottom2  = new XYCoord();
            XYCoord rightBottom2 = new XYCoord();

            //Find licenseplate
            Int32Image binaryPlateImage32 = new Int32Image();

            VisionLab.Convert(binaryPlateImage, binaryPlateImage32);

            VisionLab.FindCornersRectangle(
                binaryPlateImage32,
                Connected.EightConnected,
                0.5,
                Orientation.Landscape,
                leftTop,
                rightTop,
                leftBottom,
                rightBottom
                );

            // NIEUW
            // Coordinaten bepalen voor deze functie
            VisionLab.FindCornersRectangleSq(
                binaryPlateImage32,
                Connected.EightConnected,
                leftTop2,
                rightTop2,
                leftBottom2,
                rightBottom2
                );

            binaryPlateImage32.Dispose();

            Int16Image plateImageGray = new Int16Image();

            VisionLab.Convert(plateImage, plateImageGray);
            binaryCharacterImage.Assign_Op(plateImageGray);

            // Eerst de standaard wrap proberen
            try
            {
                //Rectify plate
                VisionLab.Warp(
                    plateImageGray,
                    binaryCharacterImage,
                    TransformDirection.ForwardT,
                    new Coord2D(leftTop),
                    new Coord2D(rightTop),
                    new Coord2D(leftBottom),
                    new Coord2D(rightBottom),
                    c_height,
                    c_width,
                    0
                    );
            }
            catch (Exception)
            {
                // NIEUW
                // Als dat mislukt dan de andere gebruiken
                try
                {
                    VisionLab.Warp(plateImageGray,
                                   binaryCharacterImage,
                                   TransformDirection.ForwardT,
                                   new Coord2D(leftTop2),
                                   new Coord2D(rightTop2),
                                   new Coord2D(leftBottom2),
                                   new Coord2D(rightBottom2),
                                   c_height,
                                   c_width,
                                   0
                                   );
                }
                catch (Exception)
                {
                    return(false);
                }
            }

            plateImageGray.Dispose();

            //*******************************//
            //** Exercise:                 **//
            //**   adjust licenseplate     **//
            //**   segmentation            **//
            //*******************************//
            // NIEUW
            Int16Image MaxMin  = new Int16Image();
            Int16Image MaxMin2 = new Int16Image();

            // NIEUW
            //2 x max rondje ding
            //dan 2 x min rondje ding
            //dan van elkaar aftrekken
            //(zoeken op heldere object)
            Mask_Int32 mask = new Mask_Int32(11, 11, 5, 5);

            VisionLab.MaximumFilter(binaryCharacterImage, MaxMin, FixEdge.EdgeExtend, mask);
            VisionLab.MaximumFilter(MaxMin, MaxMin2, FixEdge.EdgeExtend, mask);

            VisionLab.MinimumFilter(MaxMin2, MaxMin, FixEdge.EdgeExtend, mask);
            VisionLab.MinimumFilter(MaxMin, MaxMin2, FixEdge.EdgeExtend, mask);
            // Maxmin2 holds the result now of the filter oparations
            // Get the difference between both
            VisionLab.Subtract(binaryCharacterImage, MaxMin2);

            MaxMin2.Dispose();
            MaxMin.Dispose();

            //Find dark text on bright licenseplate using ThresholdISOData
            VisionLab.ThresholdIsoData(binaryCharacterImage, ObjectBrightness.DarkObject);

            Int16Image bin = new Int16Image();

            // NIEUW
            // Recreate images that are corralated / deformed
            VisionLab.Opening(binaryCharacterImage, bin, new Mask_Int32(2, 2, 1));


            // Convert to a 32 bit format
            Int32Image binaryCharacterImage32 = new Int32Image();

            // Int32Image binCharImg32 = new Int32Image();
            VisionLab.Convert(bin, binaryCharacterImage32);
            bin.Dispose();
            // Remove blobs connected to the border
            VisionLab.RemoveBorderBlobs(binaryCharacterImage32, Connected.EightConnected, Border.AllBorders);
            // Remove small blobs
            VisionLab.RemoveBlobs(binaryCharacterImage32, Connected.EightConnected, BlobAnalyse.BA_Area, c_remove_blobs_min, c_remove_blobs_max);

            //Convert to a 16 bit format
            VisionLab.Convert(binaryCharacterImage32, binaryCharacterImage);

            binaryCharacterImage32.Dispose();
            leftTop.Dispose();
            rightTop.Dispose();
            leftBottom.Dispose();
            rightBottom.Dispose();
            GC.Collect();
            // NIEUW
            // Check if 6 characters/blobs have been found and label image.
            if (VisionLab.LabelBlobs(binaryCharacterImage, Connected.EightConnected) != 6)
            {
                return(false);
            }
            return(true);
        }