Beispiel #1
0
        // compute NDVI
        public byte[] computeNDVI(byte[] b1, byte[] b2)
        {
            byte[] byOutNDVI = new byte[b1.Length];
            for (Int32 i = 0; i < b1.Length; i++)
            {
                if (b1[i] - b2[i] < 0)
                {
                    byOutNDVI[i] = 0;
                }
                else
                {
                    byOutNDVI[i] = (byte)(b1[i] - b2[i]);
                }
            }
            PointMethods minMax = new PointMethods();
            string       mm     = minMax.getMinMax(byOutNDVI);
            int          min    = Convert.ToInt16(mm.Split(',')[0]);
            int          max    = Convert.ToInt16(mm.Split(',')[1]);
            int          diff   = max - min;

            for (Int32 i = 0; i < byOutNDVI.Length; i++)
            {
                byOutNDVI[i] = (byte)(((int)(byOutNDVI[i] - min) / diff) * 255);
            }
            return(byOutNDVI);
        }
Beispiel #2
0
        public CellsPolygon(HashSet <Cell> cells)
        {
            Cells = cells;

            Position = PointMethods.GetCentroid(Cells);
        }