Exemple #1
0
        private void ProcessPlane(ImagePlane plane, ProcessingBounds bounds)
        {
            int byteCounter = 0;

            byte[] sortedBytes;

            unsafe
            {
                if (UseAOI)
                {
                    if (Mode == SortMode.Ascending)
                    {
                        sortedBytes = plane.GetAllPixelsIn(AOI).Select(p => *(byte *)p).OrderBy(i => i).ToArray();
                    }
                    else
                    {
                        sortedBytes = plane.GetAllPixelsIn(AOI).Select(p => *(byte *)p).OrderByDescending(i => i).ToArray();
                    }
                }
                else
                {
                    if (Mode == SortMode.Ascending)
                    {
                        sortedBytes = plane.AllPixels.Select(p => *(byte *)p).OrderBy(i => i).ToArray();
                    }
                    else
                    {
                        sortedBytes = plane.AllPixels.Select(p => *(byte *)p).OrderByDescending(i => i).ToArray();
                    }
                }
            }

            ProcessingHelper.ProcessMono(plane, bounds, (b) =>
            {
                return(sortedBytes[byteCounter++]);
            }, PixelFilter);
        }
Exemple #2
0
        private void ProcessPlane(ImagePlane plane, ProcessingBounds bounds)
        {
            var rnd         = new Random(DateTime.Now.Ticks.GetHashCode());
            int byteCounter = 0;

            byte[] shuffledBytes;

            unsafe
            {
                if (UseAOI)
                {
                    shuffledBytes = plane.GetAllPixelsIn(AOI).Select(p => *(byte *)p).OrderBy(i => rnd.Next()).ToArray();
                }
                else
                {
                    shuffledBytes = plane.AllPixels.Select(p => *(byte *)p).OrderBy(i => rnd.Next()).ToArray();
                }
            }

            ProcessingHelper.ProcessMono(plane, bounds, (b) =>
            {
                return(shuffledBytes[byteCounter++]);
            }, PixelFilter);
        }