Example #1
0
        public void AspectRatioTest()
        {
            var passFolder = "PicassoUnitTest/PreprocessingTest/AspectRatioTest";
            var failFolder = "PicassoUnitTest/PreprocessingTest/AspectRatioFailTest";


            var passFolderPath = Path.Combine(Drive.GetDriveRoot(), passFolder);
            var failFolderPath = Path.Combine(Drive.GetDriveRoot(), failFolder);

            var passDrive = new Drive(passFolderPath, Drive.Reason.Read);
            var failDrive = new Drive(failFolderPath, Drive.Reason.Read);

            var pass = passDrive.GetAllMatching("image");
            var fail = failDrive.GetAllMatching("image");

            foreach (var image in pass)
            {
                Bitmap mask = new Bitmap(image);
                Assert.IsTrue(Preprocessing.AspectRatioFilter(mask));
            }

            foreach (var image in fail)
            {
                Bitmap mask = new Bitmap(image);
                Assert.IsFalse(Preprocessing.AspectRatioFilter(mask));
            }
        }