Example #1
0
        public static ChipStatusMediator Signal(this ChipStatusMediator src)
        {
            if (src.pixel == null)
            {
                return(src);
            }

            var p = src.pixel;

            double[] ave = new double[p.BayerSizeX * p.BayerSizeY];
            double[] dev = new double[p.BayerSizeX * p.BayerSizeY];

            //Ave
            for (int by = 0; by < p.BayerSizeY; by++)
            {
                for (int bx = 0; bx < p.BayerSizeX; bx++)
                {
                    p.BayerX = bx;
                    p.BayerY = by;
                    ref double buf = ref ave[bx + by * p.BayerSizeX];
                    int        c   = 0;
                    for (int y = 0; y < p.BayerHeight; y++)
                    {
                        for (int x = 0; x < p.BayerWidth; x++)
                        {
                            buf += p.Bayer(x, y);
                            c++;
                        }
                    }
                    buf /= c;
                }
            }
Example #2
0
        public static ChipStatusMediator Intermediate(this ChipStatusMediator src, Func <Pixel <float>, Pixel <float> > action)
        {
            if (src.pixel == null)
            {
                return(src);
            }
            src.pixelfilter = action(src.pixel);

            return(src);
        }
Example #3
0
        public static ChipStatusMediator Filter(this ChipStatusMediator src, Action <Pixel <float> > action)
        {
            if (src.pixel == null)
            {
                return(src);
            }
            action(src.pixel);

            return(src);
        }
Example #4
0
        public static void Output(this ChipStatusMediator src, string key, string value)
        {
            Console.WriteLine($"{key} : {value}");

            using (var sw = new StreamWriter("log.txt", true))
            {
                sw.WriteLine($"{src.LotNo}_{src.WfNo}_{src.ChipNo}, {key}, {value}");
            }
            src.AddResult(key, value);
        }
Example #5
0
        static void Main(string[] args)
        {
            //Test.RunSingle();
            //テストコード
            Test.Run();

            return;

            try
            {
                var Seq   = PixelSeqParam.Create("Config.yaml");
                var chips = Seq.CheckedChips(@"D:\200CFT\");//Mono
                //スクリプト読み込み,コンパイル

                var ssr    = ScriptSourceResolver.Default.WithBaseDirectory(Environment.CurrentDirectory);
                var script = CSharpScript.Create(
                    File.ReadAllText("Script.csx"),
                    ScriptOptions.Default.WithImports(new string[]
                {
                    "System",
                    "System.Math",
                    "FTTest",
                    "Pixels",
                    "Pixels.Extend",
                    "Pixels.Math"
                })
                    .WithSourceResolver(ssr)
                    .WithReferences(System.Reflection.Assembly.GetEntryAssembly()),
                    typeof(Globals));

                //実行

                var serializer = new YamlDotNet.Serialization.Serializer();
                var globals    = new Globals();
                foreach (var chip in chips)
                {
                    globals.Chip = ChipStatusMediator.Create(chip);
                    var state = script.RunAsync(globals).Result;

                    foreach (var variable in state.Variables)
                    {
                        Console.WriteLine($"{variable.Name} = {variable.Value} of type {variable.Type}");
                    }

                    globals.Chip.OutputFile("output.yaml");


                    //using (var sw = new StreamWriter("output.yaml"))
                    //{
                    //    //シリアライズ
                    //    sw.WriteLine(serializer.Serialize(chip));
                    //}
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
                Console.ReadKey();
            }
            Console.WriteLine("-----end-----");
            Console.ReadKey();
        }
Example #6
0
        public static void Run()
        {
            //Console.WriteLine($"{Chip.LotNo}_{Chip.WfNo}_{Chip.ChipNo}");
            //sw.WriteLine($"{Chip.LotNo}_{Chip.WfNo}_{Chip.ChipNo}, {A}, {B}, {C}, {D}, {E}, {F}, {G}, {H}, {I}");

            var Seq   = PixelSeqParam.Create("Config.yaml");
            var chips = Seq.CheckedChips(@"D:\200CFT\");


            ChipStatusMediator Chip;

            foreach (var _Chip in chips)
            {
                Chip = ChipStatusMediator.Create(_Chip);

                //Chip["Dark60", "Ave"]
                //    .Intermediate(x => x.FilterMedianBayer()["Normal"].StaggerR())
                //    .Filter(x => x["Normal"].StaggerR())
                //    ["Active"]
                //    .Labeling();

                Chip["Dark60", "Ave"]
                .Intermediate(x => x.FilterMedianBayer()["Normal"].StaggerR())
                .Filter(x => x["Normal"].StaggerR())
                ["Active"]
                .Defect(255)
                .Defect(125)
                .Defect(64);

                //Chip["Dark", "Ave"]
                //    .Filter(x =>
                //    {
                //        x["Normal"].StaggerR();
                //        x["Active"].SubSelf(255).ToColorBG().Labling();
                //    });

                //using (var sw = new StreamWriter("vfpn.txt", true))
                //{
                //    var j = Chip["VNtest1", "Ave"].pixel?["Active"]?.AverageBayer(0, 1) ?? null;

                //    var A = Chip["VNtest1", "Ave"].pixel?["Active"]?.VDeviationBayer(0, 1) ?? null;
                //    var B = Chip["VNtest2", "Ave"].pixel?["Active"]?.VDeviationBayer(0, 1) ?? null;
                //    var C = Chip["VNtest3", "Ave"].pixel?["Active"]?.VDeviationBayer(0, 1) ?? null;
                //    var D = Chip["VNtest4", "Ave"].pixel?["Active"]?.VDeviationBayer(0, 1) ?? null;
                //    var E = Chip["VNtest5", "Ave"].pixel?["Active"]?.VDeviationBayer(0, 1) ?? null;
                //    var F = Chip["VNtest6", "Ave"].pixel?["Active"]?.VDeviationBayer(0, 1) ?? null;
                //    var G = Chip["VNtest7", "Ave"].pixel?["Active"]?.VDeviationBayer(0, 1) ?? null;
                //    var H = Chip["VNtest8", "Ave"].pixel?["Active"]?.VDeviationBayer(0, 1) ?? null;
                //    var I = Chip["VNtest9", "Ave"].pixel?["Active"]?.VDeviationBayer(0, 1) ?? null;



                //    Console.WriteLine($"{Chip.LotNo}_{Chip.WfNo}_{Chip.ChipNo}");
                //    sw.WriteLine($"{Chip.LotNo}_{Chip.WfNo}_{Chip.ChipNo}, {j}, {A}, {B}, {C}, {D}, {E}, {F}, {G}, {H}, {I}");
                //}

                //平均・偏差

                //Chip["Dark", "Ave"]
                //    .Intermediate(x => x.FilterMedianBayer()["Normal"].StaggerR())
                //    .Filter(x => x["Normal"].StaggerR())
                //    ["Active"]
                //    .Signal()
                //    .Defect(255)
                //    .Defect(125)
                //    .Defect(64);

                //Chip["L50", "Ave"]
                //    .Filter(x =>
                //    {
                //        var i = x.FilterMedianBayer();
                //        return i["Normal"].StaggerR();
                //    })
                //    .Convert(x => x["Normal"].StaggerR())
                //    ["Active"].Signal2();


                //平均(中央値フィルタ後)
                //Chip["Dark", "Ave"]
                //    .Convert(x => x["Normal"].StaggerR())
                //    ["Active"].Signal();


                //chip単位の結果出力, 追記
                Chip.OutputFile("output.yaml");
            }
        }