Exemplo n.º 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));
        }
Exemplo n.º 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);
        }
Exemplo n.º 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, "[完成]火点确认。");
        }
Exemplo n.º 4
0
        public static DoubtFirPixelFilter CreateDoubtFilter(IArgumentProvider argProvider, IContextMessage contextMessage)
        {
            int             minWndSize     = Obj2Int(argProvider.GetArg("BackWndMin"));
            int             maxWndSize     = Obj2Int(argProvider.GetArg("BackWndMax"));
            IBandNameRaster bandNameRaster = argProvider.DataProvider as IBandNameRaster;
            int             visBandNo      = TryGetBandNo(argProvider, bandNameRaster, "Visible");
            int             nearIfrBandNo  = TryGetBandNo(argProvider, bandNameRaster, "NearInfrared");
            int             midIfrBandNo   = TryGetBandNo(argProvider, bandNameRaster, "MiddleInfrared");
            int             farIfrBandNo   = TryGetBandNo(argProvider, bandNameRaster, "FarInfrared");
            bool            isNight        = bool.Parse(argProvider.GetArg("IsNight").ToString());

            if (!isNight && (visBandNo < 1 || midIfrBandNo < 1 || farIfrBandNo < 1 || nearIfrBandNo < 1))
            {
                PrintInfo(contextMessage, "     获取波段序号(可见光、近红外、中红外、远红外)时发生错误。");
                return(null);
            }
            else if (isNight && (farIfrBandNo < 1 || midIfrBandNo < 1))
            {
                PrintInfo(contextMessage, "     获取波段序号(可见光、近红外、中红外、远红外)时发生错误。");
                return(null);
            }
            float bandZoom        = Obj2Float(argProvider.GetArg("MiddleInfrared_Zoom"));
            int   hitedPixelCount = Obj2Int(argProvider.GetArg("HitedPixelCount"));
            ISolarZenithProvider solarZentihProvider = null;
            float minSolarZentih = Obj2Float(argProvider.GetArg("BackTSolarZenith"));

            if (bandZoom < float.Epsilon)
            {
                PrintInfo(contextMessage, "     波段数值缩放参数设置错误,使用缺省值1。");
            }
            //water
            int minMidInfraredValue_water       = Obj2Int(argProvider.GetArg("Water_MinMidIfr"));
            int minNearInfraredValue_water      = Obj2Int(argProvider.GetArg("Water_MinNearIfr"));
            int nearInfrared_visibleValue_water = Obj2Int(argProvider.GetArg("Water_NearIfr_Vis"));
            //cloud
            int minVisibleValue_cloud  = Obj2Int(argProvider.GetArg("Cloud_MinVis"));
            int farInfraredValue_cloud = Obj2Int(argProvider.GetArg("Cloud_FarIfr"));
            //doubt
            int midInfraredValue_DoubtFir        = Obj2Int(argProvider.GetArg("Doubt_MidIfr"));
            int dltMidInfraredValue_DoubtFir     = Obj2Int(argProvider.GetArg("Doubt_MidIfr_Diff"));
            int midInfrared_farInfrared_DoubtFir = Obj2Int(argProvider.GetArg("Doubt_MidIfr_FarIfr"));
            int minMidInfraredValue_DoubtFir     = Obj2Int(argProvider.GetArg("Doubt_MinMidIfr"));
            int maxHTmpPixelCount_DoubtFir       = Obj2Int(argProvider.GetArg("Doubt_MaxHTmpPixelCount"));
            int midInfraredAvg_DoubtFir          = Obj2Int(argProvider.GetArg("Doubt_MidIfrAvg"));
            //
            DoubtFirPixelFilter filter = new DoubtFirPixelFilter
                                         (
                //wnd size
                minWndSize, maxWndSize,
                //bandNo
                farIfrBandNo, midIfrBandNo, nearIfrBandNo, visBandNo,
                //zoom
                bandZoom,
                solarZentihProvider,
                //
                hitedPixelCount,
                minSolarZentih,
                //water
                minMidInfraredValue_water,
                minNearInfraredValue_water,
                nearInfrared_visibleValue_water,
                //cloud
                minVisibleValue_cloud,
                farInfraredValue_cloud,
                //doubt fir
                midInfraredValue_DoubtFir,
                dltMidInfraredValue_DoubtFir,
                midInfrared_farInfrared_DoubtFir,
                minMidInfraredValue_DoubtFir,
                maxHTmpPixelCount_DoubtFir,
                midInfraredAvg_DoubtFir
                                         );

            return(filter);
        }