public void RunLBPCalculateBatch_MRE_png_EqualsReference() { var runlbp = new RunLBP(load + @"\Test5", save + @"\Test5"); Directory.CreateDirectory(@"C:\temp\test\load\Test5"); Directory.CreateDirectory(@"C:\temp\test\save\Test5"); runlbp.param.Mre = true; runlbp.param.Scale = false; runlbp.param.W_stand = new int[] { 5, 3, 2, 1 }; testImg.New("Quarters", new int[] { 28, 28 }); Functions.Save(load + @"\Test5\Test1.png", testImg.Image.ToDouble(), false); Functions.Save(load + @"\Test5\Test2.png", testImg.Image.ToDouble(), false); Functions.Save(load + @"\Test5\Test3.png", testImg.Image.ToDouble(), false); runlbp.CalculateBatch(); float[,] result1 = Functions.Load(save + @"\Test5\Test1_small.png"); float[,] result2 = Functions.Load(save + @"\Test5\Test2_small.png"); float[,] result3 = Functions.Load(save + @"\Test5\Test3_small.png"); float[,] refIS = new float[6, 6] { { 9, 7, 6, 6, 6, 1 }, { 8, 1, 9, 6, 6, 1 }, { 6, 2, 3, 6, 3, 1 }, { 7, 5, 2, 5, 6, 2 }, { 7, 2, 2, 9, 7, 8 }, { 7, 2, 2, 2, 1, 9 } }; Assert.Equal(refIS, result1); Assert.Equal(refIS, result2); Assert.Equal(refIS, result3); }
public static void Batch(Parameters param) { // Initialize paths string path = "", savepath = ""; // Select load path var fbd = new FolderBrowserDialog() { Description = "Select the directory to load images" }; if (fbd.ShowDialog() == DialogResult.OK) { path = fbd.SelectedPath; } else { Console.WriteLine("No directory selected.\n"); return; } // Select save path fbd = new FolderBrowserDialog() { Description = "Select the directory to save results" }; if (fbd.ShowDialog() == DialogResult.OK) { savepath = fbd.SelectedPath; } else { Console.WriteLine("No directory selected.\n"); return; } // Calculate batch of LBP images RunLBP run = new RunLBP() { path = path, // image path and result path savepath = savepath, param = param, // pipeline parameters }; run.CalculateBatch(); }
public void RunLBPCalculateBatch_LBP_dat_EqualsReference() { var runlbp = new RunLBP(load + @"\Test1", save + @"\Test1"); Directory.CreateDirectory(@"C:\temp\test\load\Test1"); Directory.CreateDirectory(@"C:\temp\test\save\Test1"); runlbp.param.Mre = false; runlbp.param.Scale = false; runlbp.param.W_stand = new int[] { 5, 3, 2, 1 }; runlbp.param.ImageType = ".dat"; // save images testImg.New("Quarters", new int[] { 12, 12 }); var bin = new BinaryWriterApp() { filename = load + @"\Test1\Test4.dat" }; bin.SaveBinary(testImg.Image.ToDouble()); bin.filename = load + @"\Test1\Test5.dat"; bin.SaveBinary(testImg.Image.ToDouble()); bin.filename = load + @"\Test1\Test6.dat"; bin.SaveBinary(testImg.Image.ToDouble()); runlbp.CalculateBatch(); float[,] result1 = Functions.Load(save + @"\Test1\Test4_LBP.png"); float[,] result2 = Functions.Load(save + @"\Test1\Test5_LBP.png"); float[,] result3 = Functions.Load(save + @"\Test1\Test6_LBP.png"); float[,] refIS = new float[6, 6] { { 8, 8, 8, 5, 5, 5 }, { 8, 8, 8, 5, 5, 6 }, { 8, 8, 8, 5, 5, 6 }, { 5, 6, 6, 3, 3, 3 }, { 5, 6, 6, 3, 3, 3 }, { 6, 6, 6, 3, 3, 3 } }; Assert.Equal(refIS, result1); Assert.Equal(refIS, result2); Assert.Equal(refIS, result3); }