Пример #1
0
        private unsafe IPixelIndexMapper CreataPixelMapper(string currDBLV, out List <int> vertifyIndexiex)
        {
            IPixelIndexMapper dblvInfo = null;

            vertifyIndexiex = new List <int>();
            using (IRasterDataProvider gd = GeoDataDriver.Open(currDBLV) as IRasterDataProvider)
            {
                string fiifFile = GetFirePointIndeiex.GetFireIndexiexFilename(currDBLV);
                dblvInfo = PixelIndexMapperFactory.CreatePixelIndexMapper("FIR", gd.Width, gd.Height, gd.CoordEnvelope, gd.SpatialRef);
                int[] indexiex = null;
                if (!string.IsNullOrEmpty(fiifFile))
                {
                    GetFirePointIndeiex.ReadFireIndexiexFilename(_argumentProvider, out indexiex);
                    dblvInfo.Put(indexiex);
                }
                Int16[]     dataBlock = new Int16[gd.Width * gd.Height];
                IRasterBand band      = gd.GetRasterBand(1);
                fixed(Int16 *buffer = dataBlock)
                {
                    IntPtr ptr = new IntPtr(buffer);

                    band.Read(0, 0, gd.Width, gd.Height, ptr, enumDataType.Int16, gd.Width, gd.Height);
                }

                int length = dataBlock.Length;
                if (string.IsNullOrEmpty(fiifFile))
                {
                    for (int i = 0; i < length; i++)
                    {
                        if (dataBlock[i] == (Int16)1)
                        {
                            dblvInfo.Put(i);
                            vertifyIndexiex.Add(i);
                        }
                    }
                }
                else
                {
                    for (int i = 0; i < length; i++)
                    {
                        if (dataBlock[i] == (Int16)1)
                        {
                            vertifyIndexiex.Add(i);
                        }
                    }
                }
            }
            return(dblvInfo);
        }
Пример #2
0
        private IPixelIndexMapper CalcBackTmp(IPixelIndexMapper result)
        {
            int[] filteredAOI = result.Indexes.ToArray();
            if (filteredAOI == null || filteredAOI.Length == 0)
            {
                return(result);
            }
            int[] firePoints = GetPreExtractIndex();

            Size size = new Size(_argumentProvider.DataProvider.Width, _argumentProvider.DataProvider.Height);
            DoubtFirPixelFilter doubtFilter = CreateArgument.CreateDoubtFilter(_argumentProvider, _contextMessage);

            if (doubtFilter == null)
            {
                return(result);
            }

            filteredAOI = MergeFirePoints(result, firePoints, filteredAOI);
            Rectangle aoiRect = AOIHelper.ComputeAOIRect(filteredAOI, size);

            //背景温度计算
            PrintInfo("[开始]背景亮温计算...");
            BackTmpComputer backTmpComputer = CreateArgument.CreateBackTmpComputer(_argumentProvider, doubtFilter as IBackTmpComputerHelper, _contextMessage);

            if (backTmpComputer == null)
            {
                return(null);
            }
            aoiRect      = AOIHelper.ComputeAOIRect(filteredAOI, size);
            _curFeatures = backTmpComputer.ComputeNight(_argumentProvider, aoiRect, filteredAOI);
            VertifyFirPixel(ref _curFeatures);
            if (_curFeatures.Count != 0)
            {
                GetFirePointIndeiex.WriteFireIndexiexFilename(_argumentProvider, _curFeatures.Keys.ToArray());
            }
            return(result);
        }
Пример #3
0
        private void DoFilters(IArgumentProvider argProvider, out Dictionary <int, PixelFeature> features, Action <int, string> progressTracker)
        {
            features = null;
            ICandidatePixelFilter filter = null;

            int[]     aoi     = argProvider.AOI;
            Size      size    = new Size(argProvider.DataProvider.Width, argProvider.DataProvider.Height);
            Rectangle aoiRect = AOIHelper.ComputeAOIRect(aoi, size);

            int[] filteredAOI = null;
            if (progressTracker != null)
            {
                progressTracker.Invoke(5, "正在过滤高温象元,请稍候...");
            }
            //4% 高温像元(中红外通道)
            CreateArgument.PrintInfo(_contextMessage, "[开始]x%高温像元过滤...");
            filter = CreateArgument.CreateHighTmpXPercentFilter(argProvider, _contextMessage);
            if (filter == null)
            {
                return;
            }
            filteredAOI = filter.Filter(argProvider.DataProvider, aoiRect, aoi);
            //by chennan 20130402 感兴趣内计算
            UpdateFilteredAOIByAOI(ref filteredAOI, argProvider.AOI);
            if (filteredAOI != null)
            {
                _waitingFirPixels.Put(filteredAOI);
                CreateArgument.PrintInfo(_contextMessage, "     x%高温点个数:" + filteredAOI.Length.ToString());
            }
            CreateArgument.PrintInfo(_contextMessage, "[完成]x%高温像元过滤。");
            if (progressTracker != null)
            {
                progressTracker.Invoke(10, "正在提取陆地高温点,请稍候...");
            }
            //陆地高温点判识
            CreateArgument.PrintInfo(_contextMessage, "[开始]陆地高温点过滤...");
            filter = CreateArgument.CreateLandHighTmpFilter(argProvider, _contextMessage);
            //by chennan 20130402 感兴趣内计算
            UpdateFilteredAOIByAOI(ref filteredAOI, argProvider.AOI);
            if (filter != null)
            {
                aoiRect     = AOIHelper.ComputeAOIRect(filteredAOI, size);
                filteredAOI = filter.Filter(argProvider.DataProvider, aoiRect, filteredAOI);
                if (filteredAOI != null)
                {
                    _candidateFirPixels.Put(filteredAOI);
                    _waitingFirPixels.Remove(filteredAOI);
                    CreateArgument.PrintInfo(_contextMessage, "     陆地高温点个数:" + filteredAOI.Length.ToString() + ",候选像元个数:" + _candidateFirPixels.Indexes.Count().ToString());
                }
            }
            CreateArgument.PrintInfo(_contextMessage, "[完成]陆地高温点过滤。");
            if (progressTracker != null)
            {
                progressTracker.Invoke(20, "正在提取异常高温点,请稍候...");
            }
            //异常高温点判识
            CreateArgument.PrintInfo(_contextMessage, "[开始]邻域内异常高温点过滤...");
            filter = CreateArgument.CreateAbnormalHighTmpFile(argProvider, _contextMessage);
            //by chennan 20130402 感兴趣内计算
            UpdateFilteredAOIByAOI(ref filteredAOI, argProvider.AOI);
            if (filter != null)
            {
                filteredAOI = _waitingFirPixels.Indexes.ToArray();
                aoiRect     = AOIHelper.ComputeAOIRect(filteredAOI, size);
                filteredAOI = filter.Filter(argProvider.DataProvider, aoiRect, filteredAOI);
                //by chennan 20130402 感兴趣内计算
                UpdateFilteredAOIByAOI(ref filteredAOI, argProvider.AOI);
                if (filteredAOI != null)
                {
                    _candidateFirPixels.Put(filteredAOI);
                    _waitingFirPixels.Remove(filteredAOI);
                    CreateArgument.PrintInfo(_contextMessage, "     异常高温点个数:" + filteredAOI.Length.ToString() + ",候选像元个数:" + _candidateFirPixels.Indexes.Count().ToString());
                }
            }
            CreateArgument.PrintInfo(_contextMessage, "[完成]邻域内异常高温点过滤。");
            if (progressTracker != null)
            {
                progressTracker.Invoke(30, "正在提取疑似高温点,请稍候...");
            }
            //疑似火点判识
            CreateArgument.PrintInfo(_contextMessage, "[开始]疑似火点判识...");
            DoubtFirPixelFilter doubtFilter = CreateArgument.CreateDoubtFilter(argProvider, _contextMessage);

            if (doubtFilter == null)
            {
                return;
            }
            filteredAOI = _candidateFirPixels.Indexes.ToArray();
            aoiRect     = AOIHelper.ComputeAOIRect(filteredAOI, size);
            filteredAOI = doubtFilter.Filter(argProvider, aoiRect, filteredAOI);
            //by chennan 20130402 感兴趣内计算
            UpdateFilteredAOIByAOI(ref filteredAOI, argProvider.AOI);
            if (filteredAOI == null)
            {
                CreateArgument.PrintInfo(_contextMessage, "     没有监测出疑似火点");
                _candidateFirPixels.Reset();
                return;
            }
            _candidateFirPixels.Reset();
            _candidateFirPixels.Put(filteredAOI);
            CreateArgument.PrintInfo(_contextMessage, "[完成]疑似火点判识。");
            CreateArgument.PrintInfo(_contextMessage, "     监测出疑似火点:" + filteredAOI.Length.ToString());
            if (progressTracker != null)
            {
                progressTracker.Invoke(50, "正在计算背景温度,请稍候...");
            }
            //背景温度计算
            CreateArgument.PrintInfo(_contextMessage, "[开始]背景亮温计算...");
            BackTmpComputer backTmpComputer = CreateArgument.CreateBackTmpComputer(argProvider, doubtFilter as IBackTmpComputerHelper, _contextMessage);

            if (backTmpComputer == null)
            {
                return;
            }
            aoiRect  = AOIHelper.ComputeAOIRect(filteredAOI, size);
            features = backTmpComputer.Compute(argProvider, aoiRect, filteredAOI);
            //记录火点特征集合
            _candidateFirPixels.Tag = new FirFeatureCollection("火点像元特征", features);
            CreateArgument.PrintInfo(_contextMessage, "     为" + features.Count.ToString() + "个疑似火点计算了背景亮温");
            CreateArgument.PrintInfo(_contextMessage, "[完成]背景亮温计算。");
            if (progressTracker != null)
            {
                progressTracker.Invoke(70, "正在进行火点确认,请稍候...");
            }
            //火点确认
            CreateArgument.PrintInfo(_contextMessage, "[开始]火点确认...");
            VertifyFirPixelFiter vertifyFilter = CreateArgument.CreateVertifyFilter(argProvider, _contextMessage);

            if (vertifyFilter == null)
            {
                return;
            }
            filteredAOI = vertifyFilter.Filter(argProvider, features);
            _candidateFirPixels.Reset();
            if (filteredAOI != null && filteredAOI.Length > 0)
            {
                _candidateFirPixels.Put(filteredAOI);
                CreateArgument.PrintInfo(_contextMessage, "     确认火点数:" + filteredAOI.Length.ToString());
                GetFirePointIndeiex.WriteFireIndexiexFilename(argProvider, features.Keys.ToArray());
            }
            CreateArgument.PrintInfo(_contextMessage, "[完成]火点确认。");
        }