VisualizeChamfers() public method

Plots a trace of the Chamfering
public VisualizeChamfers ( Direction direction, Orientation orientation = Orientation.Regular ) : void
direction Direction Direction to be traced
orientation Orientation Orientation to be traced
return void
Exemplo n.º 1
0
 public static void ShredFactory(string filepath)
 {
     Shred shred = new Shred(filepath, false);
     shred.VisualizeChamfers(Direction.FromLeft);
     shred.VisualizeChamfers(Direction.FromRight);
     shred.VisualizeChamfers(Direction.FromTop);
     shred.VisualizeChamfers(Direction.FromBottom);
 }
Exemplo n.º 2
0
        public static void DisplayTestShred()
        {
            //Create original Square
            Point[] patch1 = new Point[4];
            patch1[0] = new Point(0, 0);
            patch1[1] = new Point(0, 10);
            patch1[2] = new Point(99, 10);
            patch1[3] = new Point(99, 0);

            Point[] patch2 = new Point[4];
            patch2[0] = new Point(0, 50);
            patch2[1] = new Point(0, 60);
            patch2[2] = new Point(99, 60);
            patch2[3] = new Point(99, 50);

            // Create a Tester Square to compare
            Point[] patch3 = new Point[4];
            patch3[0] = new Point(0, 110);
            patch3[1] = new Point(0, 120);
            patch3[2] = new Point(99, 120);
            patch3[3] = new Point(99, 110);

            Point[] patch4 = new Point[4];
            patch4[0] = new Point(0, 160);
            patch4[1] = new Point(0, 170);
            patch4[2] = new Point(99, 170);
            patch4[3] = new Point(99, 160);

            // Create an Original Image
            var original = new Image<Bgr, Byte>(100, 100, new Bgr(Color.HotPink));
            original.FillConvexPoly(patch1, new Bgr(Color.Gray));
            original.FillConvexPoly(patch2, new Bgr(Color.Gray));

            //Create Image to compare with
            var tester = new Image<Bgr, Byte>(100, 200, new Bgr(Color.HotPink));
            tester.FillConvexPoly(patch3, new Bgr(Color.Gray));
            tester.FillConvexPoly(patch4, new Bgr(Color.Gray));

            //ImageViewer display = new ImageViewer(original, "TestBitmap");
            //display.ShowDialog();
            //ImageViewer display2 = new ImageViewer(tester, "Test Image");
            //display2.ShowDialog();

            const string filepath = "originalshrd.bmp";
            const string filepath2 = "testshred.bmp";

            if (File.Exists(filepath))
            {
                File.Delete(filepath);
            }

            if (File.Exists(filepath2))
            {
                File.Delete(filepath2);
            }
            original.ToBitmap().Save(filepath);
            tester.ToBitmap().Save(filepath2);
            Shred originalshred = new Shred(filepath);
            Shred testershred = new Shred(filepath2);
            originalshred.VisualizeLuminousity(Direction.FromLeft);
            originalshred.VisualizeThresholded(Direction.FromLeft);
            originalshred.VisualizeChamfers(Direction.FromLeft);
            testershred.VisualizeThresholded(Direction.FromLeft);
            testershred.VisualizeLuminousity(Direction.FromLeft);
            testershred.VisualizeChamfers(Direction.FromRight);
        }