private UnmanagedImage FilterFloor(UnmanagedImage unmanImg, byte[] textData) { //data would come in from SurfaceReceiver const int width = 256; const int height = 2552; const int xRes = 221000; const int yRes = 39180; const int xSize = xRes * width; const int ySize = yRes * height; const float res = xSize / (float)ySize; // //index for remapping colors int index = 0; //remap colors to look better, save as HSL color for (int i = 0; i < unmanImg.Height; i++) { for (int j = 0; j < unmanImg.Width; j++) { //filter out floor if (BitConverter.ToUInt16(textData, index * 6) < min + filterHeight) { unmanImg.SetPixel(j, i, Color.Black); } else { HSLColor colorHeight = new HSLColor(HSLColor.RemapColors(BitConverter.ToUInt16(textData, index * 6), (int)(min + filterHeight), max, 0, 300), 240.0, 120.0); unmanImg.SetPixel(j, i, colorHeight); } index++; } } return unmanImg; }
private static double GetTemp2(HSLColor hslColor) { double temp2; if (hslColor.luminosity < 0.5) //<=?? temp2 = hslColor.luminosity * (1.0 + hslColor.saturation); else temp2 = hslColor.luminosity + hslColor.saturation - (hslColor.luminosity * hslColor.saturation); return temp2; }