예제 #1
0
 public Mask_Int32(Mask_Int32 mask) : this(VisionLabPINVOKE.new_Mask_Int32__SWIG_1(Mask_Int32.getCPtr(mask)), true)
 {
     if (VisionLabPINVOKE.SWIGPendingException.Pending)
     {
         throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
     }
 }
예제 #2
0
    public Mask_Int32 Assign_Op(Mask_Int32 mask)
    {
        Mask_Int32 ret = new Mask_Int32(VisionLabPINVOKE.Mask_Int32_Assign_Op(swigCPtr, Mask_Int32.getCPtr(mask)), false);

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
예제 #3
0
    public bool IsEqual_Op(Mask_Int32 mask)
    {
        bool ret = VisionLabPINVOKE.Mask_Int32_IsEqual_Op(swigCPtr, Mask_Int32.getCPtr(mask));

        if (VisionLabPINVOKE.SWIGPendingException.Pending)
        {
            throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
        }
        return(ret);
    }
        /*  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;
        }
 public static string MaskToStr(Mask_Int32 mask) {
   string ret = VisionLabPINVOKE.MaskToStr__SWIG_4(Mask_Int32.getCPtr(mask));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public static void SigmaFilter(FloatImage src, FloatImage dest, float deviation, FixEdge edge, Mask_Int32 mask) {
   VisionLabPINVOKE.SigmaFilter__SWIG_5(FloatImage.getCPtr(src), FloatImage.getCPtr(dest), deviation, (int)edge, Mask_Int32.getCPtr(mask));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static void NthFilter(Int16Image src, Int16Image dest, int nth, FixEdge edge, Mask_Int32 mask) {
   VisionLabPINVOKE.NthFilter__SWIG_3(Int16Image.getCPtr(src), Int16Image.getCPtr(dest), nth, (int)edge, Mask_Int32.getCPtr(mask));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static void LocalMinFilter(DoubleImage src, DoubleImage dest, double backGround, FixEdge edge, Mask_Int32 mask) {
   VisionLabPINVOKE.LocalMinFilter__SWIG_6(DoubleImage.getCPtr(src), DoubleImage.getCPtr(dest), backGround, (int)edge, Mask_Int32.getCPtr(mask));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 public static void Dilation(ByteImage src, ByteImage dest, Mask_Int32 mask) {
   VisionLabPINVOKE.Dilation__SWIG_3(ByteImage.getCPtr(src), ByteImage.getCPtr(dest), Mask_Int32.getCPtr(mask));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #10
0
 public static void DistanceT(Int32Image image, Mask_Int32 downMaskOrg, Mask_Int32 upMaskOrg) {
   VisionLabPINVOKE.DistanceT__SWIG_9(Int32Image.getCPtr(image), Mask_Int32.getCPtr(downMaskOrg), Mask_Int32.getCPtr(upMaskOrg));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #11
0
 internal static global::System.Runtime.InteropServices.HandleRef getCPtr(Mask_Int32 obj)
 {
     return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr);
 }
 public Mask_Int32 Assign_Op(Mask_Int32 mask) {
   Mask_Int32 ret = new Mask_Int32(VisionLabPINVOKE.Mask_Int32_Assign_Op(swigCPtr, Mask_Int32.getCPtr(mask)), false);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public bool Not(Mask_Int32 mask) {
   bool ret = VisionLabPINVOKE.Mask_Int32_Not(swigCPtr, Mask_Int32.getCPtr(mask));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
 public Mask_Int32(Mask_Int32 mask) : this(VisionLabPINVOKE.new_Mask_Int32__SWIG_1(Mask_Int32.getCPtr(mask)), true) {
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
 internal static HandleRef getCPtr(Mask_Int32 obj) {
   return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
 }
예제 #16
0
 public static void Convolution(DoubleImage src, DoubleImage dest, int divideFactor, FixEdge edge, Mask_Int32 mask) {
   VisionLabPINVOKE.Convolution__SWIG_12(DoubleImage.getCPtr(src), DoubleImage.getCPtr(dest), divideFactor, (int)edge, Mask_Int32.getCPtr(mask));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #17
0
 public static void LocalMaxFilter(FloatImage src, FloatImage dest, float backGround, FixEdge edge, Mask_Int32 mask) {
   VisionLabPINVOKE.LocalMaxFilter__SWIG_5(FloatImage.getCPtr(src), FloatImage.getCPtr(dest), backGround, (int)edge, Mask_Int32.getCPtr(mask));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #18
0
 public static void Erosion(Int32Image src, Int32Image dest, Mask_Int32 mask) {
   VisionLabPINVOKE.Erosion__SWIG_9(Int32Image.getCPtr(src), Int32Image.getCPtr(dest), Mask_Int32.getCPtr(mask));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #19
0
 public static void MinimumFilter(ByteImage src, ByteImage dest, FixEdge edge, Mask_Int32 mask) {
   VisionLabPINVOKE.MinimumFilter__SWIG_1(ByteImage.getCPtr(src), ByteImage.getCPtr(dest), (int)edge, Mask_Int32.getCPtr(mask));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #20
0
 public static void HitAndMiss(Int16Image src, Int16Image dest, Mask_Int32 hitMask, Mask_Int32 missMask) {
   VisionLabPINVOKE.HitAndMiss__SWIG_3(Int16Image.getCPtr(src), Int16Image.getCPtr(dest), Mask_Int32.getCPtr(hitMask), Mask_Int32.getCPtr(missMask));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #21
0
 public static void RangeFilter(Int32Image src, Int32Image dest, FixEdge edge, Mask_Int32 mask) {
   VisionLabPINVOKE.RangeFilter__SWIG_4(Int32Image.getCPtr(src), Int32Image.getCPtr(dest), (int)edge, Mask_Int32.getCPtr(mask));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #22
0
 public static void Opening(Int16Image src, Int16Image dest, Mask_Int32 mask) {
   VisionLabPINVOKE.Opening__SWIG_3(Int16Image.getCPtr(src), Int16Image.getCPtr(dest), Mask_Int32.getCPtr(mask));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #23
0
 public static void VarianceFilter(DoubleImage src, DoubleImage dest, FixEdge edge, Mask_Int32 mask) {
   VisionLabPINVOKE.VarianceFilter__SWIG_6(DoubleImage.getCPtr(src), DoubleImage.getCPtr(dest), (int)edge, Mask_Int32.getCPtr(mask));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #24
0
 public static void Thinning(Int32Image src, Int32Image dest, Mask_Int32 hitMask, Mask_Int32 missMask) {
   VisionLabPINVOKE.Thinning__SWIG_4(Int32Image.getCPtr(src), Int32Image.getCPtr(dest), Mask_Int32.getCPtr(hitMask), Mask_Int32.getCPtr(missMask));
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #25
0
 public static Mask_Int32 StrToMask_Int32(string str) {
   Mask_Int32 ret = new Mask_Int32(VisionLabPINVOKE.StrToMask_Int32(str), true);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
예제 #26
0
 public static void DGEdgeDetection(DoubleImage src, DoubleImage destMag, DoubleImage destDir, Mask_Int32 mask1, int div1, Mask_Int32 mask2, int div2, Gradient grad, double dirScale) {
   VisionLabPINVOKE.DGEdgeDetection__SWIG_13(DoubleImage.getCPtr(src), DoubleImage.getCPtr(destMag), DoubleImage.getCPtr(destDir), Mask_Int32.getCPtr(mask1), div1, Mask_Int32.getCPtr(mask2), div2, (int)grad, dirScale);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #27
0
 internal static HandleRef getCPtr(Mask_Int32 obj)
 {
     return((obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr);
 }
예제 #28
0
 public static void TMEdgeDetection(Int8Image src, Int8Image destMag, Int8Image destDir, int nrMasks, Mask_Int32 maskTab, string alfaTab, Gradient grad) {
   VisionLabPINVOKE.TMEdgeDetection__SWIG_2(Int8Image.getCPtr(src), Int8Image.getCPtr(destMag), Int8Image.getCPtr(destDir), nrMasks, Mask_Int32.getCPtr(maskTab), alfaTab, (int)grad);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
예제 #29
0
 public static void TMEdgeDetection(DoubleImage src, DoubleImage destMag, DoubleImage destDir, int nrMasks, Mask_Int32 maskTab, SWIGTYPE_p_double alfaTab, Gradient grad) {
   VisionLabPINVOKE.TMEdgeDetection__SWIG_6(DoubleImage.getCPtr(src), DoubleImage.getCPtr(destMag), DoubleImage.getCPtr(destDir), nrMasks, Mask_Int32.getCPtr(maskTab), SWIGTYPE_p_double.getCPtr(alfaTab), (int)grad);
   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);
        }