Ejemplo n.º 1
0
 private static void AssertDefaults(WhiteboardScript script)
 {
     ColorAssert.AreEqual(new MagickColor("white"), script.BackgroundColor);
     Assert.AreEqual(WhiteboardEnhancements.Stretch, script.Enhance);
     Assert.AreEqual((Percentage)5, script.FilterOffset);
     Assert.AreEqual(15, script.FilterSize);
     Assert.AreEqual((Percentage)200, script.Saturation);
     Assert.AreEqual((Percentage)0.01, script.WhiteBalance);
 }
Ejemplo n.º 2
0
 private static void AssertSetCoordinates(string paramName, PointD topLeft, PointD topRight, PointD bottomLeft, PointD bottomRight)
 {
     ExceptionAssert.ThrowsArgumentException <ArgumentOutOfRangeException>(paramName, () =>
     {
         using (var logo = Images.Logo)
         {
             var script = new WhiteboardScript();
             script.SetCoordinates(topLeft, topRight, bottomLeft, bottomRight);
             script.Execute(logo);
         }
     });
 }
Ejemplo n.º 3
0
 private static void AssertDimensions(int width, int height)
 {
     ExceptionAssert.Throws <InvalidOperationException>(() =>
     {
         using (var logo = Images.Logo)
         {
             var script        = new WhiteboardScript();
             script.Dimensions = new MagickGeometry(width, height);
             script.Execute(logo);
         }
     });
 }
Ejemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        //doorAnim = Door.GetComponent<Animator>();
        spwn         = SpwnMark.GetComponent <SpawnScript>();
        wBoard       = WhiteBoard.GetComponent <WhiteboardScript>();
        customerAnim = this.GetComponent <Animator>();

        target = SpawnScript.chairNo;

        if (Boss)
        {
            timeLeft /= 3f;
        }
    }
Ejemplo n.º 5
0
        public void Reset_AllSettingsChanged_RestoredToDefault()
        {
            var script = new WhiteboardScript();

            script.BackgroundColor = new MagickColor("purple");
            script.Enhance         = WhiteboardEnhancements.None;
            script.FilterOffset    = (Percentage)5;
            script.FilterSize      = 10;
            script.Saturation      = (Percentage)100;
            script.WhiteBalance    = (Percentage)0.1;

            script.Reset();

            AssertDefaults(script);
        }
        private void Test_Execute(string input, Action <WhiteboardScript> action, string output)
        {
            string inputFile = GetInputFile(input);

            using (var image = new MagickImage(inputFile))
            {
                var script = new WhiteboardScript();
                action(script);

                using (var scriptOutput = script.Execute(image))
                {
                    TestOutput(scriptOutput, output);
                }
            }
        }
Ejemplo n.º 7
0
        private void AssertExecute(string input, string methodName, Action <WhiteboardScript> action)
        {
            string inputFile = GetInputFile(input);

            using (var image = new MagickImage(inputFile))
            {
                var script = new WhiteboardScript();
                action(script);

                using (var scriptOutput = script.Execute(image))
                {
                    string outputFile = GetOutputFile(input, methodName);
                    AssertOutput(scriptOutput, outputFile);
                }
            }
        }
        public void Test_Defaults()
        {
            var script = new WhiteboardScript();

            Test_Defaults(script);

            script.BackgroundColor = new MagickColor("purple");
            script.Enhance         = WhiteboardEnhancements.None;
            script.FilterOffset    = (Percentage)5;
            script.FilterSize      = 10;
            script.Saturation      = (Percentage)100;
            script.WhiteBalance    = (Percentage)0.1;

            script.Reset();
            Test_Defaults(script);
        }
Ejemplo n.º 9
0
    // Update is called once per frame
    void Update()
    {
        float   tipHeight = transform.Find("Tip").transform.localScale.y;
        Vector3 tip       = transform.Find("Tip").transform.position;

        if (lastTouch)
        {
            tipHeight *= 1.1f;
        }

        if (Physics.Raycast(tip, transform.up, out touch, tipHeight))
        {
            if (!(touch.collider.tag == "Whiteboard"))
            {
                return;
            }

            this.WB = touch.collider.GetComponent <WhiteboardScript>();
            controllerActions.TriggerHapticPulse(0.05f);

            this.WB.SetColor(Color.blue);
            this.WB.SetTouchPosition(touch.textureCoord.x, touch.textureCoord.y);
            this.WB.ToggleTouch(true);

            if (!lastTouch)
            {
                lastTouch = true;

                lastAngle = transform.rotation;
            }
        }
        else
        {
            this.WB.ToggleTouch(false);
            lastTouch = false;
        }

        if (lastTouch)
        {
            transform.rotation = lastAngle;
        }
    }
Ejemplo n.º 10
0
        public void Constructor_SettingsSetToDefaults()
        {
            var script = new WhiteboardScript();

            AssertDefaults(script);
        }
Ejemplo n.º 11
0
        public static void EnhanceImageQuality(string ImageDirectory)
        {
            // do image Enhance then call Do OCR
            // convert - density 600 input.pdf output.tif;
            //System.Drawing.Image SelectedImage = new System.Drawing.Image();
            DirectoryInfo EnhancedImageDir = new DirectoryInfo(@"C:\OCR\EnhancedImage\");
            Bitmap        orgimg           = (Bitmap)Bitmap.FromFile(ImageDirectory);
            Bitmap        bitmap           = (Bitmap)Bitmap.FromFile(ImageDirectory);
            Bitmap        image2           = Grayscale.CommonAlgorithms.BT709.Apply(bitmap);


            Rectangle  rec        = new Rectangle(0, 0, bitmap.Width, bitmap.Height);
            BitmapData bitmapdata = bitmap.LockBits(rec, ImageLockMode.ReadWrite, PixelFormat.Format8bppIndexed);
            // create instance of skew checker
            DocumentSkewChecker skewChecker = new DocumentSkewChecker();
            // get documents skew angle
            double angle = skewChecker.GetSkewAngle(bitmapdata);
            // create rotation filter
            RotateBilinear rotationFilter = new RotateBilinear(-angle);

            rotationFilter.FillColor = Color.White;
            // rotate image applying the filter
            bitmap.UnlockBits(bitmapdata);

            Bitmap rotatedImage = rotationFilter.Apply(orgimg);

            rotatedImage.Save(ImageDirectory + ".tif");

            using (MagickImage image = new MagickImage(ImageDirectory))
            {
                TextCleanerScript Cleaner = new TextCleanerScript();

                // Cleaner.FilterSize = 12; // filter to clean up background;
                // Cleaner.FilterOffset = (Percentage)3; //filter in percent to reduce noise
                // Cleaner.Saturation = (Percentage)200;  // high value to Saturation
                //// Cleaner.Unrotate = true;
                // var newImage1 = Cleaner.Execute(image);
                // //newImage1.CannyEdge(); selcet the inner objects in the image

                // newImage1.Density = new PointD(600, 600);
                // newImage1.Write(EnhancedImageDir + Path.GetFileName(ImageDirectory)
                //     + ".tif");

                AutotrimScript WhiteB = new AutotrimScript();
                // WhiteB.InnerTrim = true;
                var a = WhiteB.GetLargestAreaP(image);

                WhiteboardScript AoutoTrim = new WhiteboardScript();
                //AoutoTrim.SetCoordinates(new Coordinate(01, 53), new Coordinate(313, 31),
                //new Coordinate(331, 218), new Coordinate(218, 200));
                //AoutoTrim.Enhance = WhiteboardEnhancements.Both;
                //AoutoTrim.FilterSize = 25; // filter to clean up background;
                //AoutoTrim.FilterOffset = (Percentage)3; //filter in percent to reduce noise
                //AoutoTrim.Saturation = (Percentage)200;  // high value to Saturation
                //AoutoTrim.SetCoordinates(new Coordinate(a[0].X, a[0].Y), new Coordinate(a[1].X, a[1].Y),
                //new Coordinate(a[2].X, a[2].Y), new Coordinate(a[3].X, a[3].Y));
                var new2mage2 = AoutoTrim.Execute(image);
                //  new2mage2.Deskew((Percentage)2);
                AoutoTrim.SetCoordinates(new Coordinate(13, 3), new Coordinate(342, 6),
                                         new Coordinate(331, 467), new Coordinate(38, 482));
                AoutoTrim.Enhance = WhiteboardEnhancements.Both;


                //  new2mage2.Density= new PointD(300, 300);
                new2mage2 = WhiteB.Execute(new2mage2);
                new2mage2 = Cleaner.Execute(new2mage2);

                new2mage2.Density = new PointD(600, 600);
                new2mage2.Write(EnhancedImageDir + Path.GetFileName(ImageDirectory)
                                + "2" + ".tif");
                string dir12 = (EnhancedImageDir + Path.GetFileName(ImageDirectory)
                                + "2" + ".tif");
                Bitmap     imageTobeDeske = new Bitmap(dir12);
                gmseDeskew deskew         = new gmseDeskew();
                deskew.New(imageTobeDeske);
                double angel = deskew.GetSkewAngle();
                if (angel > 0)
                {
                    angel = angel * -1;
                }



                WhiteB.BorderColorLocation = new Coordinate(10, 10);


                //AoutoTrim.SetCoordinates(ad);

                //WhiteB.ColorFuzz = (Percentage)20;
                //var new2mage3 = WhiteB.Execute(image);
                //new2mage3 = Cleaner.Execute(new2mage3);

                //new2mage3.Write(EnhancedImageDir + Path.GetFileName(ImageDirectory)
                //    + "3" + ".tif");
            }
        }
Ejemplo n.º 12
0
 // Use this for initialization
 void Start()
 {
     this.WB = GameObject.Find("Whiteboard").GetComponent <WhiteboardScript>();
 }