Revision: 71924
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at March 28, 2017 00:43 by markt22
Initial Code
UMat umat = new UMat(); byte mostCommonValue; fixed (byte* buffer = umat.Bytes) { byte* end = buffer + umat.Bytes.Length; int[] counters = new int[256]; for (byte* pointer = buffer; pointer != end; pointer++) { counters[*pointer]++; } mostCommonValue = (byte)Array.IndexOf(counters, counters.Max()); }
Initial URL
Initial Description
Given a UMat we sometimes need to find the most common value in that UMat. This code does it the unsafe (fast) way.
Initial Title
EMGU Finding the most common value in a UMat
Initial Tags
Initial Language
C#