//火点可信度 private int ComputeFirReliability(int pixelIdx, UInt16[] bandValues, PixelFeature fet) { float pvMidIfr = bandValues[_midIfrBandIdx] / _bandZoom; float pvFarIfr = bandValues[_farIfrBandIdx] / _bandZoom; float pvVis = _isNight ? float.MinValue : bandValues[_visBandIdx] / _bandZoom; if (pvMidIfr - fet.MidIfrAvgValue > _midIfr_FirReliability && pvMidIfr - pvFarIfr - fet.MidIfr_FarIfr_Diff_AvgValue > _midIfr_farInfr_FirReliability && (_isNight || pvVis <= _vis_FirReliability)) { return(200); } else if (_cloudCount > 0) { return(100); } else if (pvMidIfr - fet.MidIfrAvgValue < _midIfr_FirReliability && pvMidIfr - pvFarIfr - fet.MidIfr_FarIfr_Diff_AvgValue < _midIfr_farInfr_FirReliability && (_isNight || pvVis < _vis_FirReliability)) { return(50); } else if (Math.Abs(_res - 0.01) < 0.00000001) { return(20); } return(0); }
//计算火点强度 private double ComputeFirIntensity(int pixelIdx, ushort[] bandValues, out int intensityGrade) { PixelFeature fet = _features[pixelIdx]; double powerConst = 5.6693 * Math.Pow(10, -8); double firIntensity = fet.SecondPixelArea / 100f * powerConst * Math.Pow(_firIntensityFactor, 4); intensityGrade = Grade(firIntensity); return(firIntensity); }
private void CorrectStdDev(int pixelIdx, PixelFeature fet) { fet.MidIfr_StdDev = Math.Min(_correctedLocalBackTmpMax, fet.MidIfr_StdDev); fet.MidIfr_StdDev = Math.Max(_correctedLocalBackTmpMin, fet.MidIfr_StdDev); // fet.FarIfr_StdDev = Math.Min(_correctedLocalBackTmpMax, fet.FarIfr_StdDev); fet.FarIfr_StdDev = Math.Max(_correctedLocalBackTmpMin, fet.FarIfr_StdDev); // fet.MidIfr_FarIfr_Diff_StdDev = Math.Min(_correctedLocalBackTmpMax, fet.MidIfr_FarIfr_Diff_StdDev); fet.MidIfr_FarIfr_Diff_StdDev = Math.Max(_correctedLocalBackTmpMin, fet.MidIfr_FarIfr_Diff_StdDev); }
private FireAreaFeature GetFireAreaInfo(PixelFeature pixelFeature, int fAreaNum, IRasterDataProvider prd) { FireAreaFeature faf = new FireAreaFeature(); int row = pixelFeature.PixelIndex / prd.Width; int col = pixelFeature.PixelIndex - row * prd.Width; faf.FireReaIndex = fAreaNum; faf.Longitude = (float)(prd.CoordEnvelope.MinX + col * prd.ResolutionX); faf.Latitude = (float)(prd.CoordEnvelope.MaxY - row * prd.ResolutionY); faf.FireArea = pixelFeature.PixelArea; faf.SecondryFireArea = pixelFeature.SecondPixelArea; faf.XJName = _xianJieDictionary.GetPixelName(faf.Longitude, faf.Latitude); faf.FireCount = 1; string solidType = _landTypeDictionary.GetPixelName(faf.Longitude, faf.Latitude); if (solidType.IndexOf("草地") != -1) { faf.GrasslandCount = 1; } else if (solidType.IndexOf("林地") != -1) { faf.WoodlandCount = 1; } else if (solidType.IndexOf("耕地") != -1) { faf.FarmlandCount = 1; } else { faf.OtherCount = 1; } faf.FarmlandPercent = (float)faf.FarmlandCount / faf.FireCount; faf.WoodlandPercent = (float)faf.WoodlandCount / faf.FireCount; faf.GrasslandPercent = (float)faf.GrasslandCount / faf.FireCount; faf.OtherPercent = (float)faf.OtherCount / faf.FireCount; //环保部新增字段 if (faf.FireIndeies == null) { faf.FireIndeies = new List <int>(); } if (!faf.FireIndeies.Contains(pixelFeature.PixelIndex)) { faf.FireIndeies.Add(pixelFeature.PixelIndex); } int code = _xianJieDictionary.GetCode(faf.Longitude, faf.Latitude); faf.SJName = _xianJieDictionary.GetPixelName((int)(Math.Floor(code / 10000f) * 10000)); faf.ShiName = _xianJieDictionary.GetPixelName((int)(Math.Floor(code / 100f) * 100)); if (!string.IsNullOrEmpty(faf.ShiName)) { faf.ShiName = string.IsNullOrEmpty(faf.SJName) ? faf.ShiName : faf.ShiName.Replace(faf.SJName, ""); } return(faf); }
private void CreateAndInitFeatures(int[] aoi) { _features = new Dictionary <int, PixelFeature>(aoi.Length); for (int i = 0; i < aoi.Length; i++) { PixelFeature fet = new PixelFeature(); fet.PixelIndex = aoi[i]; fet.IsDoubtFirPixel = true; _features.Add(aoi[i], fet); } _featrueIndex = new List <int>(); }
private void CorrectLocalBackTmpMinMaxValue(int pixelIdx, PixelFeature fet) { _correctedLocalBackTmpMax = _localBackTmpMax; _correctedLocalBackTmpMin = _localBackTmpMin; if (_solarZenithProvider == null) { return; } if (_solarZenithProvider.GetSolarZenith(pixelIdx) > _minSolarZenithValue) { _correctedLocalBackTmpMax = _localBackTmpMax - 5; _correctedLocalBackTmpMin = _localBackTmpMin - 5; } }
private void Compute(int hitedPixelCount, int pixelIdx, UInt16[] bandValues, UInt16[][] wndValues, int[] hitedIndexes) { _featrueIndex.Add(pixelIdx); float pvVis = _isNight ? float.MinValue : bandValues[_visBandIdx]; PixelFeature fet = _features[pixelIdx]; fet.MidIfrAvgValue = Avg(_midIfrBandIdx, wndValues, hitedPixelCount, hitedIndexes); fet.FarIfrAvgValue = Avg(_farIfrBandIdx, wndValues, hitedPixelCount, hitedIndexes); fet.MidIfr_FarIfr_Diff_AvgValue = DiffAvg(_midIfrBandIdx, _farIfrBandIdx, wndValues, hitedPixelCount, hitedIndexes); fet.MidIfr_StdDev = GetStdDev(fet.MidIfrAvgValue, _midIfrBandIdx, wndValues, hitedPixelCount, hitedIndexes); fet.FarIfr_StdDev = GetStdDev(fet.FarIfrAvgValue, _midIfrBandIdx, wndValues, hitedPixelCount, hitedIndexes); fet.MidIfr_FarIfr_Diff_StdDev = GetStdDev(fet.MidIfr_FarIfr_Diff_AvgValue, _midIfrBandIdx, _farIfrBandIdx, wndValues, hitedPixelCount, hitedIndexes); CorrectLocalBackTmpMinMaxValue(pixelIdx, fet); CorrectStdDev(pixelIdx, fet); if (_solarZenithProvider != null) { if (_solarZenithProvider.GetSolarZenith(pixelIdx) > _minSolarZenithValue && _solarZenithProvider.GetSolarZenith(pixelIdx) < _maxSolarZenithValue && (!_isNight && pvVis > _glaringVIRR)) { fet.MidIfr_StdDev = Math.Min(35, fet.MidIfr_StdDev); fet.MidIfr_StdDev = Math.Max(40, fet.MidIfr_StdDev); // fet.MidIfr_FarIfr_Diff_StdDev = Math.Min(35, fet.MidIfr_FarIfr_Diff_StdDev); fet.MidIfr_FarIfr_Diff_StdDev = Math.Max(40, fet.MidIfr_FarIfr_Diff_StdDev); } } if (!_isNight && pvVis > Avg(_visBandIdx, wndValues, hitedPixelCount, hitedIndexes) + _wildernessCorrect) { fet.MidIfr_StdDev = Math.Min(40, fet.MidIfr_StdDev); fet.MidIfr_StdDev = Math.Max(45, fet.MidIfr_StdDev); // fet.MidIfr_FarIfr_Diff_StdDev = Math.Min(40, fet.MidIfr_FarIfr_Diff_StdDev); fet.MidIfr_FarIfr_Diff_StdDev = Math.Max(45, fet.MidIfr_FarIfr_Diff_StdDev); } // if (_midIfrCenterWaveNum > float.Epsilon && _farIfrCenterWaveNum > float.Epsilon) { float pixelArea = 0f; //计算亚像元面积 fet.SecondPixelArea = (float)ComputeSecondPixelArea(pixelIdx, bandValues, out pixelArea); fet.PixelArea = pixelArea; int intensityGrade = 0; //火点强度 fet.FirIntensity = (float)ComputeFirIntensity(pixelIdx, bandValues, out intensityGrade); fet.FireIntensityGrade = intensityGrade; } //火点可信度 fet.FirReliability = ComputeFirReliability(pixelIdx, bandValues, fet); }
//计算亚像元面积 private double ComputeSecondPixelArea(int pixelIdx, ushort[] bandValues, out float pixelArea) { int row = pixelIdx / _width; pixelArea = (float)RasterOperator <UInt16> .ComputePixelArea(row, _maxLat, _res); PixelFeature fet = _features[pixelIdx]; float pvMidIfr = bandValues[_midIfrBandIdx] / _bandZoom; float pvFarIfr = bandValues[_farIfrBandIdx] / _bandZoom; double factor = 0; if (pvMidIfr < _maxMidIfrValue) { factor = 1.438833f * _midIfrCenterWaveNum / pvMidIfr * 10f; double n3Mix = (1.1910659 * Math.Pow(10, -5) * Math.Pow(_midIfrCenterWaveNum, 3)) / (Math.Pow(Math.E, factor) - 1f); factor = 1.438833f * _midIfrCenterWaveNum / _firComputeFactor; double n3bf = (1.1910659 * Math.Pow(10, -5) * Math.Pow(_midIfrCenterWaveNum, 3)) / (Math.Pow(Math.E, factor) - 1f); factor = 1.438833f * _midIfrCenterWaveNum / fet.MidIfrAvgValue * 10; double n3bt = (1.1910659 * Math.Pow(10, -5) * Math.Pow(_midIfrCenterWaveNum, 3)) / (Math.Pow(Math.E, factor) - 1f); return(pixelArea * (n3Mix - n3bt) / (n3bf - n3bt) * 100f); } else { if (pvFarIfr < fet.FarIfrAvgValue) { factor = 1.438833f * _farIfrCenterWaveNum / (fet.FarIfrAvgValue + 3) * 10f; } else { factor = 1.438833f * _farIfrCenterWaveNum / pvFarIfr * 10f; } double n4Mix = (1.1910659 * Math.Pow(10, -5) * Math.Pow(_farIfrCenterWaveNum, 3)) / (Math.Pow(Math.E, factor) - 1f); factor = 1.438833f * _farIfrCenterWaveNum / _firComputeFactor; double n4bf = (1.1910659 * Math.Pow(10, -5) * Math.Pow(_farIfrCenterWaveNum, 3)) / (Math.Pow(Math.E, factor) - 1f); factor = 1.438833f * _farIfrCenterWaveNum / fet.FarIfrAvgValue * 10f; double n4bt = (1.1910659 * Math.Pow(10, -5) * Math.Pow(_farIfrCenterWaveNum, 3)) / (Math.Pow(Math.E, factor) - 1f); if (n4Mix - n4bt < 0) { n4Mix = n4bt + 2f; } return(pixelArea * (n4Mix - n4bt) / (n4bf - n4bt) * 100f); } }
public int[] Filter(IArgumentProvider argProvider, Dictionary <int, PixelFeature> features) { using (IRasterPixelsVisitor <UInt16> vistor = new RasterPixelsVisitor <UInt16>(argProvider)) { int[] bandNos = new int[] { _visibleBandNo, _midInfraredBandNo, _farInfraredBandNo }; _visibleBandIndex = 0; _midInfraredBandIndex = 1; _farInfraredBandIndex = 2; // int[] aoi = GetAOI(features, (fet) => { return(fet.IsDoubtFirPixel); }); if (aoi == null) { return(null); } Rectangle aoiRect = AOIHelper.ComputeAOIRect(aoi, new System.Drawing.Size(argProvider.DataProvider.Width, argProvider.DataProvider.Height)); vistor.VisitPixel(aoiRect, aoi, bandNos, (idx, values) => { float pvFarIfr = values[_farInfraredBandIndex] / _bandZoom; float pvMidIfr = values[_midInfraredBandIndex] / _bandZoom; float pvVis = values[_visibleBandIndex] / _bandZoom; float pvMidIfr_FarIfr = values[_midInfraredBandIndex] - values[_farInfraredBandIndex]; //by chennan 20120821 一期火点确认错误代码 if (pvFarIfr < _maxFarIfrValue_fir || pvVis > _minVisValue_fir) { return; } PixelFeature fet = features[idx]; if (pvMidIfr > _secondMidIfrValue_fir) { //if (pvMidIfr > fet.MidIfrAvgValue + fet.MidIfr_StdDev) if (pvMidIfr > fet.MidIfrAvgValue + _backTmpFactor_fir * fet.MidIfr_StdDev) { fet.IsVertified = true; } } else { if ( (pvMidIfr > fet.MidIfrAvgValue + _backTmpFactor_fir * fet.MidIfr_StdDev) && (pvMidIfr_FarIfr > fet.MidIfr_FarIfr_Diff_AvgValue + _backTmpFactor_fir * fet.MidIfr_FarIfr_Diff_StdDev) ) { fet.IsVertified = true; } } //by chennan 20120821 增加中红外偏移量与远红外偏移量比值火点确认条件 if (fet.IsVertified == true && _isUsedMidFar) { float bzCH4 = (pvFarIfr - fet.FarIfrAvgValue); if (bzCH4 <= 0) { bzCH4 = _defaultPercent; } //bzCH4 = 0.2f; if ((pvMidIfr - fet.MidIfrAvgValue) / bzCH4 < _midFarRatio) { fet.IsVertified = false; return; } } }); } return(GetAOI(features, (fet) => { return fet.IsVertified; })); }