public SimpleBVHTree(GroupingMethod gm, int num_per_group, string name) : base(name) { box = new BBox(); grouping = gm; n = num_per_group; }
public static object CreateSalesReportForAllCategoriesAndAllSalespeople( DateTime startDate, DateTime endDate, GroupingMethod groupBy, SortMethod sortBy, bool includeReturnedOrders = true, bool includeUnshippedOrders = false) { // Imaginary report-generating code goes here return(new object()); }
public static object CreateSalesReport( DateTime startDate, DateTime endDate, List <int> categoryIDsToInclude, List <int> salespersonIDsToInclude, GroupingMethod groupBy, SortMethod sortBy, bool includeReturnedOrders = true, bool includeUnshippedOrders = false) { // Imaginary report-generating code goes here return(new object()); }
/// <summary> /// Find groups of Extremal Regions that are organized as text blocks. /// </summary> /// <param name="image">The image where ER grouping is to be perform on</param> /// <param name="channels">Array of single channel images from which the regions were extracted</param> /// <param name="erstats">Vector of ER’s retrieved from the ERFilter algorithm from each channel</param> /// <param name="groupingTrainedFileName">The XML or YAML file with the classifier model (e.g. trained_classifier_erGrouping.xml)</param> /// <param name="minProbability">The minimum probability for accepting a group.</param> /// <param name="groupMethods">The grouping methods</param> /// <returns>The output of the algorithm that indicates the text regions</returns> public static System.Drawing.Rectangle[] ERGrouping(IInputArray image, IInputArrayOfArrays channels, VectorOfERStat[] erstats, GroupingMethod groupMethods = GroupingMethod.OrientationHoriz, String groupingTrainedFileName = null, float minProbability = 0.5f) { IntPtr[] erstatPtrs = new IntPtr[erstats.Length]; for (int i = 0; i < erstatPtrs.Length; i++) { erstatPtrs[i] = erstats[i].Ptr; } using (VectorOfVectorOfPoint regionGroups = new VectorOfVectorOfPoint()) using (VectorOfRect groupsBoxes = new VectorOfRect()) using (InputArray iaImage = image.GetInputArray()) using (InputArray iaChannels = channels.GetInputArray()) using (CvString s = (groupingTrainedFileName == null ? new CvString() : new CvString(groupingTrainedFileName))) { GCHandle erstatsHandle = GCHandle.Alloc(erstatPtrs, GCHandleType.Pinned); ContribInvoke.CvERGrouping( iaImage, iaChannels, erstatsHandle.AddrOfPinnedObject(), erstatPtrs.Length, regionGroups, groupsBoxes, groupMethods, s, minProbability); erstatsHandle.Free(); return(groupsBoxes.ToArray()); } }
internal static extern void CvERGrouping( IntPtr image, IntPtr channels, IntPtr regions, int count, IntPtr groups, IntPtr groupRects, GroupingMethod method, IntPtr fileName, float minProbability);
public ICanSetSortBy GroupBy(GroupingMethod groupBy) { _groupBy = groupBy; return(this); }
static private void Grouping(GroupingMethod groupingMethod, int groupsize) { Function.ConsoleWriteLine("Grouping:" + groupsize); switch (groupingMethod) { case GroupingMethod.Seperate: //组数 GroupVariable.AnnotatorGroups = new IList <Annotator> [Variable.NumberOfAnnotationsPerSentence / groupsize]; for (int i = 0; i < GroupVariable.AnnotatorGroups.Length; ++i) { GroupVariable.AnnotatorGroups[i] = new List <Annotator>(); } //每组人数 Variable.NumberOfAnnotationsPerSentenceAfterGrouping = groupsize; foreach (Sentence sentence in Variable.Sentences) { //这个sentence在每组中的标注 sentence.AnnotaitonGroups = new AnnotationGroup[GroupVariable.AnnotatorGroups.Length]; for (int i = 0; i < GroupVariable.AnnotatorGroups.Length; ++i) { sentence.AnnotaitonGroups[i] = new AnnotationGroup(); } int n = 0; foreach (Annotator annotator in Variable.Annotators) { if (Variable.Data[annotator].ContainsKey(sentence)) { foreach (Annotation annotation in Variable.Data[annotator][sentence]) { sentence.AnnotaitonGroups[n / groupsize].AnnotatorAnnotationDic.Add(annotator, annotation); //每人只有一个标注(手动修改标注文件,去掉一人同时标几句的情况) if (!GroupVariable.AnnotatorGroups[n / groupsize].Contains(annotator)) { GroupVariable.AnnotatorGroups[n / groupsize].Add(annotator); } ++n; } } } } break; case GroupingMethod.Overlap: //太慢,废弃 int[] temp = new int[groupsize]; IList <Annotator[]> list = new List <Annotator[]>(); getCombination(ref list, Variable.Annotators, Variable.Annotators.Count, groupsize, temp, groupsize); //全匹配 GroupVariable.AnnotatorGroups = new IList <Annotator> [list.Count]; for (int i = 0; i < list.Count; ++i) { GroupVariable.AnnotatorGroups[i] = new List <Annotator>(); foreach (Annotator annotator in list[i]) { GroupVariable.AnnotatorGroups[i].Add(annotator); } } Variable.NumberOfAnnotationsPerSentenceAfterGrouping = groupsize; foreach (Sentence sentence in Variable.Sentences) { sentence.AnnotaitonGroups = new AnnotationGroup[GroupVariable.AnnotatorGroups.Length]; for (int i = 0; i < GroupVariable.AnnotatorGroups.Length; ++i) { sentence.AnnotaitonGroups[i] = new AnnotationGroup(); foreach (Annotator annotator in GroupVariable.AnnotatorGroups[i]) { foreach (Annotation annotation in Variable.Data[annotator][sentence]) { sentence.AnnotaitonGroups[i].AnnotatorAnnotationDic.Add(annotator, annotation); } } } } break; } }
/// <summary> /// Find groups of Extremal Regions that are organized as text blocks. /// </summary> /// <param name="image">The image where ER grouping is to be perform on</param> /// <param name="channels">Array of single channel images from which the regions were extracted</param> /// <param name="erstats">Vector of ER’s retrieved from the ERFilter algorithm from each channel</param> /// <param name="groupingTrainedFileName">The XML or YAML file with the classifier model (e.g. trained_classifier_erGrouping.xml)</param> /// <param name="minProbability">The minimum probability for accepting a group.</param> /// <param name="groupMethods">The grouping methods</param> /// <returns>The output of the algorithm that indicates the text regions</returns> public static System.Drawing.Rectangle[] ERGrouping(IInputArray image, IInputArrayOfArrays channels, VectorOfERStat[] erstats, GroupingMethod groupMethods = GroupingMethod.OrientationHoriz, String groupingTrainedFileName = null, float minProbability = 0.5f) { IntPtr[] erstatPtrs = new IntPtr[erstats.Length]; for (int i = 0; i < erstatPtrs.Length; i++) { erstatPtrs[i] = erstats[i].Ptr; } using (VectorOfVectorOfPoint regionGroups = new VectorOfVectorOfPoint()) using (VectorOfRect groupsBoxes = new VectorOfRect()) using (InputArray iaImage = image.GetInputArray()) using (InputArray iaChannels = channels.GetInputArray()) using (CvString s = (groupingTrainedFileName == null ? new CvString() : new CvString(groupingTrainedFileName))) { GCHandle erstatsHandle = GCHandle.Alloc(erstatPtrs, GCHandleType.Pinned); CvERGrouping( iaImage, iaChannels, erstatsHandle.AddrOfPinnedObject(), erstatPtrs.Length, regionGroups, groupsBoxes, groupMethods, s, minProbability); erstatsHandle.Free(); return groupsBoxes.ToArray(); } }