Exemple #1
0
 private int[] GetAOI(IRasterDataProvider prd)
 {
     using (VectorAOITemplate v = VectorAOITemplateFactory.GetAOITemplate("太湖"))
     {
         Size     size;
         Envelope evp = GetEnvelope(out size, out prd);
         return(v.GetAOI(evp, size));
     }
 }
Exemple #2
0
 private int[] GetAOI(IRasterDataProvider prd, bool isLand)
 {
     using (VectorAOITemplate v = VectorAOITemplateFactory.GetAOITemplate("海陆模版"))
     {
         Size     size;
         Envelope evp        = GetEnvelope(out size, prd);
         int[]    landAoi    = v.GetAOI(evp, size);              //陆地
         int[]    reverseAOI = AOIHelper.Reverse(landAoi, size); //海洋
         return(isLand ? landAoi : reverseAOI);
     }
 }
Exemple #3
0
        private int[] GetAOI()
        {
            VectorAOITemplate template = VectorAOITemplateFactory.GetAOITemplate("洞庭湖");
            Size size;
            IRasterDataProvider prd;
            Envelope            evp = GetEnvelope(out size, out prd);

            aoi = template.GetAOI(evp, size);
            //
            int[] reverseAOI = AOIHelper.Reverse(aoi, size);
            return(reverseAOI);
        }
Exemple #4
0
 private void button16_Click(object sender, EventArgs e)
 {
     using (VectorAOITemplate v = VectorAOITemplateFactory.GetAOITemplate("贝尔湖")) //贝尔湖
     {
         Size size;
         IRasterDataProvider prd;
         Envelope            evp = GetEnvelope(out size, out prd);
         Stopwatch           sw  = new Stopwatch();
         sw.Start();
         aoi = v.GetAOI(evp, size);
         //
         int[] reverseAOI       = AOIHelper.Reverse(aoi, size);
         IBinaryBitmapBuilder b = new BinaryBitmapBuilder();
         Bitmap bm = b.CreateBinaryBitmap(size, Color.Red, Color.Black);
         b.Fill(reverseAOI, size, ref bm);
         //
         string express = "NDVI(band1,band2)";
         int[]  bandNos = new int[] { 1, 2 };
         //构造栅格计算判识器
         ArgumentProvider argprd = new ArgumentProvider(prd, null);
         argprd.AOI = aoi;
         IRasterExtracter <UInt16, float> extracter = new SimpleRasterExtracter <UInt16, float>();
         extracter.Reset(argprd, bandNos, express);
         //判识
         resultNDVI = new MemPixelFeatureMapper <float>("NDVI", 1000, new Size(prd.Width, prd.Height), prd.CoordEnvelope, prd.SpatialRef);
         extracter.Extract(resultNDVI);
         //
         RasterIdentify id = new RasterIdentify();
         id.ThemeIdentify      = "CMA";
         id.ProductIdentify    = "FIR";
         id.SubProductIdentify = "NDVI";
         id.Satellite          = "FY3A";
         id.Sensor             = "MERSI";
         id.Resolution         = "250M";
         id.OrbitDateTime      = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0));
         id.GenerateDateTime   = DateTime.Now;
         IInterestedRaster <float> iir = new InterestedRaster <float>(id, new Size(prd.Width, prd.Height), prd.CoordEnvelope.Clone());
         iir.Put(resultNDVI);
         iir.Dispose();
     }
 }
Exemple #5
0
        private void 海陆模板_Click(object sender, EventArgs e)
        {
            using (VectorAOITemplate v = VectorAOITemplateFactory.GetAOITemplate("海陆模版")) //贝尔湖
            {
                Size size;
                IRasterDataProvider prd;
                Envelope            evp = GetEnvelope(out size, out prd);
                Stopwatch           sw  = new Stopwatch();
                sw.Start();
                landAoi = v.GetAOI(evp, size);
                //
                int[] reverseAOI = AOIHelper.Reverse(landAoi, size);
                //IBinaryBitmapBuilder b = new BinaryBitmapBuilder();
                //Bitmap bm = b.CreateBinaryBitmap(size, Color.Red, Color.Black);
                //b.Fill(reverseAOI, size, ref bm);
                //对陆地区域使用陆地判识算法
                Dictionary <string, object> args = new Dictionary <string, object>();
                //args.Add("a", 28);
                //args.Add("b", 78);
                //args.Add("c", 245);
                //args.Add("d", 293);
                //args.Add("f", 28);
                //args.Add("g", 0);
                //args.Add("h", 15);
                //args.Add("i", 250);
                //构造判识表达式
                //string express = "((band2/10f) > var_a) && (band2/10f < var_b) && (band5/10f > var_c) && (band5/10f < var_d) && "
                //               + "(band6/10f > var_f) && ((band6 - band2)>var_g)  && ((band6/10f - band5/10f + var_i)>var_h)";
                ////band2:可见光,0.525~0.575(波长范围)
                ////band5:远红外,10.3~11.55
                ////band6:短波红外,1.60~1.69
                //int[] bandNos = new int[] { 2, 5, 6 };
                ////构造栅格计算判识器
                //ArgumentsProvider argprd = new ArgumentsProvider(prd, args);
                //argprd.AOI = reverseAOI;
                //IThresholdExtracter<UInt16> extracter = new SimpleThresholdExtracter<UInt16>();
                //extracter.Reset(argprd, bandNos, express);
                ////判识
                //landResult = new MemPixelIndexMapper("SAND", 1000);
                //extracter.Extract(landResult);
                //landInd = landResult.Indexes.ToArray();

                //对海洋区域使用海洋判识算法
                args.Clear();
                args.Add("a", 8);
                args.Add("b", 26);
                args.Add("c", 265);
                args.Add("d", 283);
                args.Add("e", -10);
                args.Add("f", 0);
                string express = "(band2/10f > var_a) && (band2/10f < var_b) && (band5/10f > var_c) && (band5/10f < var_d) && "
                                 + "(band6/10f > var_a)&& ((band6/10f - band4/10f)>var_e) &&((band2/10f - band4/10f )>var_f)";
                int[]            bandNos = new int[] { 2, 5, 6, 4 };
                ArgumentProvider argprd  = new ArgumentProvider(prd, args);
                argprd.AOI = reverseAOI;
                IThresholdExtracter <UInt16> extracter = new SimpleThresholdExtracter <UInt16>();
                extracter.Reset(argprd, bandNos, express);
                //判识
                seaResult = PixelIndexMapperFactory.CreatePixelIndexMapper("DST", prd.Width, prd.Height, prd.CoordEnvelope, prd.SpatialRef);
                extracter.Extract(seaResult);
                seaIdx = seaResult.Indexes.ToArray();

                //
                IBinaryBitmapBuilder builder = new BinaryBitmapBuilder();
                Size   bmSize = new Size(prd.Width / 2, prd.Height / 2);
                Bitmap bitmap = builder.CreateBinaryBitmap(bmSize, Color.Red, Color.White);
                builder.Fill(landInd, new Size(prd.Width, prd.Height), ref bitmap);
                bitmap.Save("h:\\陆地沙尘.png", ImageFormat.Png);
                builder.Fill(seaIdx, new Size(prd.Width, prd.Height), ref bitmap);
                bitmap.Save("h:\\海洋沙尘.png", ImageFormat.Png);
                //
                RasterIdentify id = new RasterIdentify();
                id.ThemeIdentify      = "CMA";
                id.ProductIdentify    = "SAND";
                id.SubProductIdentify = "2VAL";
                id.Satellite          = "FY3A";
                id.Sensor             = "MERSI";
                id.Resolution         = "1000M";
                id.OrbitDateTime      = DateTime.Now.Subtract(new TimeSpan(1, 0, 0, 0, 0));
                id.GenerateDateTime   = DateTime.Now;
                IInterestedRaster <UInt16> iir = new InterestedRaster <UInt16>(id, new Size(prd.Width, prd.Height), prd.CoordEnvelope.Clone());
                iir.Put(landInd, 1);
                iir.Put(seaIdx, 1);
                sw.Stop();
                Text = sw.ElapsedMilliseconds.ToString();
                iir.Dispose();
            }


            ////取海洋矢量作为AOI,使用海洋的判识算法
            //Dictionary<string, object> seaargs = new Dictionary<string, object>();
            //seaargs.Add("sa", 8);
            //seaargs.Add("sb", 26);
            //seaargs.Add("sc", 265);
            //seaargs.Add("sd", 283);
            //seaargs.Add("se", -10);
            //seaargs.Add("sf", 0);
            //string seaExpress = "(band2/10f > var_sa) && (band2/10f < var_sb) && (band5/10f > var_sc) && (band5/10f < var_sd) && "
            //                  + "(band6/10f > var_sa)&& ((band6/10f - band4/10f)>var_se) &&((band2/10f - band4/10f )>var_sf)";
            //int[] seabandNos = new int[] { 2, 5, 6, 4 };
            //ArgumentsProvider seaargprd = new ArgumentsProvider(prd, seaargs);
            ////构造判识表达式
            ////构造基于阈值的判识器
            //IThresholdExtracter<UInt16> seaextracter = new SimpleThresholdExtracter<UInt16>();
            //seaextracter.Reset(seaargprd, seabandNos, seaExpress);
            ////判识
            //IPixelIndexMapper searesult = new MemPixelIndexMapper("SAND", 1000);
            //seaextracter.Extract(searesult);
            //int[] seaidxs = searesult.Indexes.ToArray();


            //将两者判识的idex合并
        }