Example #1
11
File: LUT.cs Project: thegodi/Gygax
        public static void ApplyColormap(ref double[,] source, out Emgu.CV.Image <Bgr, Byte> destination, ColorMapType colorMapType)
        {
            double max = 0;

            for (int y = 0; y < source.GetLength(1); y++)
            {
                for (int x = 0; x < source.GetLength(0); x++)
                {
                    if (source[y, x] > max)
                    {
                        max = source[y, x];
                    }
                }
            }

            Image <Gray, byte> buffer = new Image <Gray, Byte>(source.GetLength(0), source.GetLength(1));

            for (int y = 0; y < source.GetLength(1); y++)
            {
                for (int x = 0; x < source.GetLength(0); x++)
                {
                    buffer[y, x] = new Gray(source[y, x] * 255 / max);
                }
            }

            destination = new Image <Bgr, Byte>(source.GetLength(0), source.GetLength(1));
            CvInvoke.ApplyColorMap(buffer, destination, colorMapType);
        }
Example #2
0
        private static Image <Bgr, byte> Map(IImage image, ColorMapType palette)
        {
            var output = new Image <Bgr, byte>(image.Size);

            CvInvoke.ApplyColorMap(image, output, palette);

            return(output);
        }
Example #3
0
 public FractColorSetupValues(ColorMapType mt, double minHue, double maxHue,
                              double minSat, double maxSat, double minVal, double maxVal,
                              bool reverseColors, bool blackFill)
 {
     MapType       = mt;
     MinHue        = minHue;
     MaxHue        = maxHue;
     MinSat        = minSat;
     MaxSat        = maxSat;
     MinVal        = minVal;
     MaxVal        = maxVal;
     ReverseColors = reverseColors;
     BlackFill     = blackFill;
 }
Example #4
0
 /// <summary>
 /// Sets the ColorMapType property, available only to objects in the same assembly as TargaHeader.
 /// </summary>
 /// <param name="eColorMapType">One of the ColorMapType enumeration values.</param>
 protected internal void SetColorMapType(ColorMapType eColorMapType)
 {
     this.eColorMapType = eColorMapType;
 }
Example #5
0
File: LUT.cs Project: Ruodan/Gygax
        public static void ApplyColormap(ref Emgu.CV.Image<Gray, double> source, out Emgu.CV.Image<Bgr, Byte> destination, ColorMapType colorMapType, bool invert = false)
        {
            destination = new Image<Bgr, Byte>(source.Width, source.Height);

            var max = 0.0;

            for (int y = 0; y < source.Height; y++)
            {
                for (int x = 0; x < source.Width; x++)
                {
                    if (source[y, x].Intensity > max)
                    {
                        max = source[y, x].Intensity;
                    }
                }
            }

            Image<Gray, byte> bufferImage = new Image<Gray, Byte>(source.Width, source.Height);

            for (int y = 0; y < source.Height; y++)
            {
                for (int x = 0; x < source.Width; x++)
                {
                    if (invert)
                    {
                        bufferImage[y, x] = new Gray(255 - source[y, x].Intensity * 255 / max);
                    }
                    else
                    {
                        bufferImage[y, x] = new Gray(source[y, x].Intensity * 255 / max);
                    }
                }
            }

            CvInvoke.ApplyColorMap(bufferImage, destination, colorMapType);
        }
Example #6
0
File: LUT.cs Project: Ruodan/Gygax
        public static void ApplyColormap(ref double[,] source, out Emgu.CV.Image<Bgr, Byte> destination, ColorMapType colorMapType)
        {
            double max = 0;

            for (int y = 0; y < source.GetLength(1); y++)
            {
                for (int x = 0; x < source.GetLength(0); x++)
                {
                    if (source[y, x] > max)
                    {
                        max = source[y, x];
                    }
                }
            }

            Image<Gray, byte> buffer = new Image<Gray, Byte>(source.GetLength(0), source.GetLength(1));

            for (int y = 0; y < source.GetLength(1); y++)
            {
                for (int x = 0; x < source.GetLength(0); x++)
                {
                    buffer[y, x] = new Gray(source[y, x] * 255 / max);
                }
            }

            destination = new Image<Bgr, Byte>(source.GetLength(0), source.GetLength(1));
            CvInvoke.ApplyColorMap(buffer, destination, colorMapType);
        }
        private int GetPixelDepth(TgaHeader header)
        {
            ColorMapType colorMapType = (ColorMapType)header.colorMapType;

            return((colorMapType == ColorMapType.ColorMapPresent) ? header.colorMapDepth : header.bitsPerPixel);
        }
 /// <summary>
 /// Sets the ColorMapType property, available only to objects in the same assembly as TargaHeader.
 /// </summary>
 /// <param name="eColorMapType">One of the ColorMapType enumeration values.</param>
 protected internal void SetColorMapType(ColorMapType eColorMapType)
 {
     ColorMapType = eColorMapType;
 }
Example #9
0
 internal protected void SetColorMapType(ColorMapType eColorMapType)
 {
     this.eColorMapType = eColorMapType;
 }
Example #10
0
File: LUT.cs Project: thegodi/Gygax
        public static void ApplyColormap(ref Emgu.CV.Image <Gray, double> source, out Emgu.CV.Image <Bgr, Byte> destination, ColorMapType colorMapType, bool invert = false)
        {
            destination = new Image <Bgr, Byte>(source.Width, source.Height);

            var max = 0.0;

            for (int y = 0; y < source.Height; y++)
            {
                for (int x = 0; x < source.Width; x++)
                {
                    if (source[y, x].Intensity > max)
                    {
                        max = source[y, x].Intensity;
                    }
                }
            }

            Image <Gray, byte> bufferImage = new Image <Gray, Byte>(source.Width, source.Height);

            for (int y = 0; y < source.Height; y++)
            {
                for (int x = 0; x < source.Width; x++)
                {
                    if (invert)
                    {
                        bufferImage[y, x] = new Gray(255 - source[y, x].Intensity * 255 / max);
                    }
                    else
                    {
                        bufferImage[y, x] = new Gray(source[y, x].Intensity * 255 / max);
                    }
                }
            }

            CvInvoke.ApplyColorMap(bufferImage, destination, colorMapType);
        }