public Learner( IObjectModel objectModel, IDetector detector, PositivePatchSynthesisInfo initPositivePatchSysthesisInfo, NegativePatchPickingInfo initNegativePatchPickingInfo, PositivePatchSynthesisInfo runtimePositivePatchSysthesisInfo, NegativePatchPickingInfo runtimeNegativePatchPickingInfo, float sameSimilarityThreshold, float validConservativeSimilarityThreshold ) { _objectModel = objectModel; _detector = detector; _initPositivePatchSynthesisInfo = initPositivePatchSysthesisInfo; _initNegativePatchPickingInfo = initNegativePatchPickingInfo; _runtimePosPatchSynthesisInfo = runtimePositivePatchSysthesisInfo; _runtimeNegativePatchPickingInfo = runtimeNegativePatchPickingInfo; _sameSimilarityThreshold = sameSimilarityThreshold; _validConservativeSimilarityThreshold = validConservativeSimilarityThreshold; _varianceClassifier = ((_detector as Detector).CascadedClassifier as CascadedClassifier).VarianceClassifier as VarianceClassifier; _ensembleClassifier = ((_detector as Detector).CascadedClassifier as CascadedClassifier).EnsembleClassifier as EnsembleClassifier; _nnClassifier = ((_detector as Detector).CascadedClassifier as CascadedClassifier).NnClassifier as NnClassifier; }
private List <Image <Gray, byte> > PickNegativePatches(Image <Gray, byte> frame, List <IBoundingBox> negativeScanningWindows, NegativePatchPickingInfo pickingInfo) { List <Image <Gray, byte> > patches = new List <Image <Gray, byte> >(); float step = negativeScanningWindows.Count / pickingInfo.EnsembleCount; for (int i = 0; i < pickingInfo.EnsembleCount; i++) { int index = (int)(i * step); IBoundingBox bb = negativeScanningWindows[index]; Image <Gray, byte> patch = frame.GetPatch(bb.Center, Size.Round(bb.Size)); patches.Add(patch); } return(patches); }