public override bool Instantiate() { try { _logger = LogManager.GetCurrentClassLogger(); _logger?.Info("--------------------------------------------------------------------------------------------------------------------------------------"); bool show = false; IImageReader imageReader = new FactoryDoubleLight8BitImageReader().Factory(_logger, _width, _height, show); //string inputFolder = @"d:\WaferOrientationCheck\MCI_Images\Diamond_Mono_0degree_U5\"; if (_inputPaths == null) { return(false); } IDirectoryReader dirReader = new Factory_DirectoryReader().Factory(_logger, _inputPaths[_pathIndex], "raw", imageReader); IWaferOrientationDetector det = new WaferOrientationDetector(null, 4096, 4096, 1024, 3072); ISawmarkDeterminer sawmarkDeterminer = new Factory_DetermineSawmarkOrientation().Factory(_logger, det); _evaluationProcessor = new EvaluationProcessor2(_logger, dirReader, sawmarkDeterminer); } catch (Exception ex) { _logger?.Error($"Exception during MethodManager2 Instantiation: {ex.Message}"); return(false); } return(true); }
public override bool Instantiate() { try { _logger = LogManager.GetCurrentClassLogger(); _logger?.Info("--------------------------------------------------------------------------------------------------------------------------------------"); bool show = false; IImageReader imageReader = new Factory_DoubleLight16bitImageReader().Factory(_logger, _width, _height, show); IDirectoryReader dirReader = new Factory_DirectoryReader().Factory(_logger, _inputPaths[_pathIndex], "raw", imageReader); int histogramRange = 4096; IHistogramThresholdCalculator histcalculator = new FactoryHistogramThresholdCalculatorEmgu1().Factory(_logger, histogramRange); BeltCoordinates beltCoords = new BeltCoordinates { LeftBeltStart = 425, LeftBeltEnd = 565, RightBeltStart = 1500, RightBeltEnd = 1640 }; IImagePreProcessor preProcessor = new FactoryImagePreProcessor().Factory(_logger, histogramRange, _width, _height, histcalculator, show, beltCoords); IBorderSearcher borderSearcher = new FactoryBorderSearcherEmgu1().Factory(_logger, 10, _width, _height, show); IColumnDataCalculator columnDataCalculator = new FactoryCalculateColumnDataEmgu1().Factory(_logger, _width, _height); string outputFolder = Path.Combine(_inputPaths[_pathIndex], "output"); IResultSaver saver = new FactoryCsvColumnResultSaver().Factory(outputFolder, "StatCalc", _logger); Dictionary <SearchOrientations, Rectangle> calcareas = new Dictionary <SearchOrientations, Rectangle>(); calcareas.Add(SearchOrientations.TopToBottom, new Rectangle(1000, 50, 2000, 450)); calcareas.Add(SearchOrientations.LeftToRight, new Rectangle(50, 1000, 450, 2000)); calcareas.Add(SearchOrientations.BottomToTop, new Rectangle(1000, _height - 501, 2000, 500)); calcareas.Add(SearchOrientations.RightToLeft, new Rectangle(_width - 501, 1000, 500, 2000)); IEdgeLineFinder finder = new FactoryEdgeLineFinderCSharp1().Factory(_logger, _width, _height, calcareas); IEdgeLineFitter fitter = new Factory_EdgeLineFitter_Emgu1().Factory(_logger); _evaluationProcessor = new EvaluationProcessor1(_logger, dirReader, preProcessor, borderSearcher, columnDataCalculator, saver, finder, fitter); } catch (Exception ex) { _logger?.Error($"Exception during MethodManager1 Instantiation: {ex.Message}"); return(false); } return(true); }
public override bool Instantiate() { try { _logger = LogManager.GetCurrentClassLogger(); _logger?.Info("--------------------------------------------------------------------------------------------------------------------------------------"); bool show = true; IImageReader imageReader = new FactorySimpleLight8BitImageReader().Factory(_logger, _width, _height, show); IDirectoryReader dirReader = new Factory_DirectoryReader().Factory(_logger, _inputPaths[_pathIndex], "raw", imageReader); int histogramRange = 256; //IHistogramThresholdCalculator histcalculator = new FactoryHistogramThresholdCalculatorCSharp1().Factory(_logger, 256, 40); IHistogramThresholdCalculator histcalculator = new FactoryHistogramThresholdCalculatorCSharp1().Factory(_logger, histogramRange, 30); BeltCoordinates beltCoords = new BeltCoordinates { LeftBeltStart = 425, LeftBeltEnd = 565, RightBeltStart = 1500, RightBeltEnd = 1640 }; IImagePreProcessor preProcessor = new FactoryImagePreProcessor().Factory(_logger, histogramRange, _width, _height, histcalculator, show, beltCoords); IBorderSearcher borderSearcher = new FactoryBorderSearcherEmgu2().Factory(_logger, 10, _width, _height, show); IColumnDataCalculator columnDataCalculator1 = new FactoryCalculateColumnDataEmgu1().Factory(_logger, _width, _height); IColumnDataCalculator columnDataCalculator2 = new FactoryCalculateColumnDataEmgu3().Factory(_logger, _width, _height); string outputFolder = Path.Combine(_inputPaths[_pathIndex], "output"); IResultSaver saver1 = new FactoryCsvColumnStatisticalResultSaver().Factory(outputFolder, "StatCalc", _logger); IResultSaver saver2 = new FactoryCsvColumnResultSaver().Factory(outputFolder, "Mean", _logger); IEdgeLineFinder finder = new FactoryEdgeLineFinderEmgu1().Factory(_logger, _width, _height); IEdgeLineFitter fitter = new Factory_EdgeLineFitter_Emgu1().Factory(_logger); _evaluationProcessor = new EvaluationProcessor3(_logger, dirReader, preProcessor, borderSearcher, columnDataCalculator1, columnDataCalculator2, saver1, saver2, finder); } catch (Exception ex) { _logger?.Error($"Exception during MethodManager1 Instantiation: {ex.Message}"); return(false); } return(true); }