public void NearestWindowTest()
        {
            const int w = 640;
            const int h = 480;
            const int minSize = 128;
            const int maxSize = 256;
            var testee = new SlidingWindow(w, h, minSize, maxSize, 3, 7);
            var prevIndex = -1;

            for (var rectSize = minSize - 1; rectSize <= maxSize; rectSize++ )
            {
                var temp = testee.GetNearestWindow(0, 0, rectSize, rectSize);
                if (temp <= prevIndex) continue;
                for (var y = 0; y < h - rectSize; y++)
                {
                    temp = testee.GetNearestWindow(0, y, rectSize, rectSize);
                    if (temp <= prevIndex) continue;
                    for (var x = 0; x < w - rectSize; x++)
                    {
                        var index = testee.GetNearestWindow(x, y, rectSize, rectSize);
                        if (index >= 0)
                        {
                            double xout, yout, wout, hout;
                            testee.GetWindowDimensions(index, out xout, out yout, out wout, out hout);
                            Assert.IsTrue(Contains(xout, yout, wout, hout, x, y, rectSize, rectSize),
                                x + "-" + (x + rectSize) + ", " + y + "-" + (y + rectSize) + " not in " + xout + "-" +
                                (xout + wout) + ", " + yout + "-" + (yout + hout));
                            prevIndex = index;
                        }
                    }
                }
            }
        }
        public void NearestWindowTest()
        {
            const int w = 640;
            const int h = 480;
            const int minSize = 128;
            const int maxSize = 256;
            var testee = new SlidingWindow(w, h, minSize, maxSize, 3, 7);
            int prevIndex = -1;

            for (int rectSize = minSize - 1; rectSize <= maxSize; rectSize++ )
            {
                var temp = testee.getNearestWindow(0, 0, rectSize, rectSize);
                if (temp <= prevIndex) continue;
                for (int y = 0; y < h - rectSize; y++)
                {
                    temp = testee.getNearestWindow(0, y, rectSize, rectSize);
                    if (temp <= prevIndex) continue;
                    for (int x = 0; x < w - rectSize; x++)
                    {
                        int index = testee.getNearestWindow(x, y, rectSize, rectSize);
                        if (index >= 0)
                        {
                            double xout, yout, wout, hout;
                            Assert.IsTrue(testee.getWindowDimensions(index, out xout, out yout, out wout, out hout));
                            Assert.IsTrue(contains(xout, yout, wout, hout, x, y, rectSize, rectSize));
                            prevIndex = index;
                        }
                    }
                }
            }
        }
Beispiel #3
0
 internal ImageSample(string fileName, int windowIndex, SlidingWindow windowManager)
 {
     FileName = fileName;
     WindowIndex = windowIndex;
     WindowManager = windowManager;
 }
Beispiel #4
0
 internal FileEntry(string file, List<Rectangle> rectangles, int width, int height, int startSize, int endSize, int stepSize, int offsetStepSize)
 {
     _fileName = file;
     _rectangles = rectangles;
     _window = new SlidingWindow(width, height, startSize, endSize, stepSize, offsetStepSize);
 }
Beispiel #5
0
 internal ImageSample(string fileName, int windowIndex, SlidingWindow windowManager)
 {
     FileName      = fileName;
     WindowIndex   = windowIndex;
     WindowManager = windowManager;
 }
Beispiel #6
0
 internal FileEntry(string file, List <Rectangle> rectangles, int width, int height, int startSize, int endSize, int stepSize, int offsetStepSize)
 {
     _fileName   = file;
     _rectangles = rectangles;
     _window     = new SlidingWindow(width, height, startSize, endSize, stepSize, offsetStepSize);
 }