Esempio n. 1
0
        //----------------------------------------

        #region Public Methods
        public override object[] Compute(params object[] input)
        {
            object[] output;


            try // Apply preprocessing (input filtering)
            {
                Preprocess.Apply(input);
            }
            catch (Exception exception)
            {
                throw new Exception(
                          "Exception ocurred while appling Input processing", exception);
            }


            // Prepare for network calculation
            double[] doubleInput = Array.ConvertAll <object, double>(input,
                                                                     delegate(object o) { return((double)o); });


            // Calculate Network Answers
            double[] doubleOutput = Network.Compute(doubleInput);


            // Prepare for output post processing
            output = Array.ConvertAll <double, object>(doubleOutput,
                                                       delegate(double o) { return((object)o); });


            try // Apply postprocessing (output filtering)
            {
                Postprocess.Apply(output);
            }
            catch (Exception exception)
            {
                throw new Exception(
                          "Exception ocurred while appling Output processing", exception);
            }


            // Return final result
            return(output);
        }
        public Maybe <List <ExResult> > Start(string imgpath, string procpath, string configpath)
        {
            var img = LoadImage(imgpath);
            Func <Rectangle, double> boxsum = FnSumInsideBox(img.Data);     //여기서 에버리지로 할건지, 합으로 할껀지 정할 수 있다.

            var inspectrecipe = ToInspctRecipe(configpath);
            var poseq         = EstedChipPosAndEq(inspectrecipe);
            var esetedindex   = ToEstedIndex(poseq);

            var doproc = RunProcessing.Apply(img);

            var recp = File.ReadAllText(procpath);


            var resimg = Just(recp)
                         .Bind(RemoveHeadTail)
                         .Bind(ToFuncRecipeList)
                         .Bind(ToPreProcFuncs)
                         .Bind(Preprocess.Apply(img));

            if (!resimg.isJust)
            {
                return(None);
            }


            var resisp1 = ToBoxList(inspectrecipe, resimg.Value);
            // 컨투어 찾고, 소팅후 박스로 (끝)


            var resGenerator = ToExResult(inspectrecipe, boxsum, poseq, resisp1.Value);
            // 박스 리스트에 대해 대응되는 인덱싱 리스트 (끝) 여기까지 체크 완료.

            var exresults = ResultInitializer(inspectrecipe) // 인덱싱 초기화만 되있음.
                            .Map(resGenerator)
                            .Flatten()
                            .ToList();     // 끝 여기서 모든 결과를 만들었다. (끝)\

            //var counter = exresults.Where(x => x.OKNG == "OK").Count();

            return(Just(exresults));
        }