示例#1
0
        public static int GetLuminance <TPixel>(TPixel sourcePixel)
            where TPixel : struct, IPixel <TPixel>
        {
            var vector = sourcePixel.ToVector4();

            return(ImageMaths.GetBT709Luminance(ref vector, 256));
        }
 private void RemovePixelsFromHistogram(ref Vector4 greyValuesBase, ref int histogramBase, int luminanceLevels, int length)
 {
     for (int idx = 0; idx < length; idx++)
     {
         int luminance = ImageMaths.GetBT709Luminance(ref Unsafe.Add(ref greyValuesBase, idx), luminanceLevels);
         Unsafe.Add(ref histogramBase, luminance)--;
     }
 }
示例#3
0
        public void GetBT709Luminance_WithVector4(float x, float y, float z, int luminanceLevels, int expected)
        {
            // arrange
            var vector = new Vector4(x, y, z, 0.0f);

            // act
            int actual = ImageMaths.GetBT709Luminance(ref vector, luminanceLevels);

            // assert
            Assert.Equal(expected, actual);
        }