public static void ReadWrite_Sample() { //rgb24 using (BmpRgb24 rgb24 = new BmpRgb24()) { rgb24.ReadImage("Sample/570_544_24.bmp"); Console.WriteLine(rgb24.TransToString()); rgb24.WriteImage("bin/Debug/net5.0/570_544_24.bmp"); } //rgb8 using (BmpRgb8 rgb8 = new BmpRgb8()) { rgb8.ReadImage("Sample/637_475_8.bmp"); Console.WriteLine(rgb8.TransToString()); rgb8.WriteImage("bin/Debug/net5.0/637_475_8.bmp"); } // Bin using (BmpRgb1 bin = new BmpRgb1()) { bin.ReadImage("Sample/637_475_1.bmp"); Console.WriteLine(bin.TransToString()); bin.WriteImage("bin/Debug/net5.0/637_475_1.bmp"); } //rgb24 copy using (BmpRgb24 source = new BmpRgb24()) { source.ReadImage("Sample/570_544_24.bmp"); BmpRgb24 copy = new BmpRgb24(570, 544, source.Scan0); Console.WriteLine(copy.TransToString()); copy.WriteImage("bin/Debug/net5.0/570_544_24_copy.bmp"); copy.Dispose(); } //rgb8 copy using (BmpRgb8 source = new BmpRgb8()) { source.ReadImage("Sample/637_475_8.bmp"); BmpRgb8 copy = new BmpRgb8(637, 475, source.Scan0); copy.WriteImage("bin/Debug/net5.0/637_475_8_copy.bmp"); source.WriteImage("bin/Debug/net5.0/637_475_8.bmp"); copy.Dispose(); } // rgb1 copy using (BmpRgb1 source = new BmpRgb1()) { source.ReadImage("Sample/637_475_1.bmp"); BmpRgb1 copy = new BmpRgb1(637, 475, source.Scan0); Console.WriteLine(source.TransToString()); Console.WriteLine(copy.TransToString()); copy.WriteImage("bin/Debug/net5.0/637_475_1_copy.bmp"); copy.Dispose(); } ShowFileDifrence("Sample/637_475_1.bmp", "bin/Debug/net5.0/637_475_1_copy.bmp"); }
public static void PreProcess_Sample() { ImageCore bmp = new BmpRgb24(); BmpGray8 r, g, b, gray, region, region1; RLC_NodeList <byte> rlc; //24位 bmp.ReadImage("Sample/570_544_24.bmp"); bmp.WriteImage("bin/Debug/net5.0/570_544_24_copy.bmp"); IOperatorSet <byte> .Decompose3(bmp, out r, out g, out b); IOperatorSet <byte> .Rgb3ToGray(r, g, b, out gray); IOperatorSet <byte> .Threshold(gray, out region, 200, 255); IOperatorSet <byte> .Threshold(gray, out rlc, 200, 255); region1 = BmpExtention.RLCListToImage(rlc, gray.Width, gray.Height); region1.WriteImage("bin/Debug/net5.0/570_554_24_region1.bmp"); region.WriteImage("bin/Debug/net5.0/570_554_24_region.bmp"); ShowFileDifrence("bin/Debug/net5.0/570_554_24_region.bmp", "bin/Debug/net5.0/570_554_24_region1.bmp"); gray.WriteImage("bin/Debug/net5.0/570_554_24_gray.bmp"); r.WriteImage("bin/Debug/net5.0/570_554_24_r.bmp"); g.WriteImage("bin/Debug/net5.0/570_554_24_g.bmp"); b.WriteImage("bin/Debug/net5.0/570_554_24_b.bmp"); b.Dispose(); g.Dispose(); r.Dispose(); gray.Dispose(); region.Dispose(); bmp.Dispose(); Console.WriteLine("End Decompose3 Test"); // // //8位rgb // ImageCore rgb8 = new BmpRgb24(); // rgb8.ReadImage("Sample/637_475_8.bmp"); // IOperatorSet<byte>.Decompose3(rgb8,out r,out g,out b); // r.WriteImage("bin/Debug/net5.0/637_475_8_r.bmp"); // g.WriteImage("bin/Debug/net5.0/637_475_8_g.bmp"); // b.WriteImage("bin/Debug/net5.0/637_475_8_b.bmp"); }