Example #1
0
        private IExtractResult FRILAlgorithm()
        {
            int    VisibleCH        = Obj2Int(_argumentProvider.GetArg("Visible"));
            int    NearInfraredCH   = Obj2Int(_argumentProvider.GetArg("NearInfrared"));
            int    MiddleInfraredCH = Obj2Int(_argumentProvider.GetArg("MiddleInfrared"));
            int    FarInfraredCH    = Obj2Int(_argumentProvider.GetArg("FarInfrared"));
            string currRaster       = Obj2String(_argumentProvider.GetArg("CurrentRasterFile"));
            string currDBLV         = Obj2String(_argumentProvider.GetArg("DBLVFile"));

            if (VisibleCH == -1 || FarInfraredCH == -1 || NearInfraredCH == -1 || MiddleInfraredCH == -1)
            {
                PrintInfo("获取波段序号失败,可能是波段映射表配置错误。");
                return(null);
            }
            if (string.IsNullOrEmpty(currRaster) || string.IsNullOrEmpty(currDBLV))
            {
                PrintInfo("获取算法所用文件失败。");
                return(null);
            }

            List <int>        vertifyIndexiex = null;
            IPixelIndexMapper result          = CreataPixelMapper(currDBLV, out vertifyIndexiex);

            if (result == null || result.Indexes.ToArray().Length == 0)
            {
                PrintInfo("当前判识结果中无火点信息。");
                return(null);
            }
            int[] filteredAOI = result.Indexes.ToArray();
            Size  size        = new Size(_argumentProvider.DataProvider.Width, _argumentProvider.DataProvider.Height);
            DoubtFirPixelFilter doubtFilter = CreateArgument.CreateDoubtFilter(_argumentProvider, _contextMessage);

            if (doubtFilter == null)
            {
                return(null);
            }
            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);
            Dictionary <int, PixelFeature> curFeatures = backTmpComputer.Compute(_argumentProvider, aoiRect, filteredAOI);

            VertifyFirPixel(ref curFeatures, vertifyIndexiex, ref result);
            return(GetOtherExtractResult.GetExtractResult(_argumentProvider, curFeatures, result, _contextMessage, _progressTracker));
        }
Example #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);
        }
Example #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, "[完成]火点确认。");
        }