/// <summary> /// 拉伸 /// </summary> /// <param name="data">图像</param> /// <param name="band">波段:1~n</param> public Stretch(byte[,,] data, int band) { _posibilities = new double[256]; _bandData = new byte[data.GetLength(1), data.GetLength(2)]; for (int i = 0; i < data.GetLength(1); i++) { for (int j = 0; j < data.GetLength(2); j++) { _bandData[i, j] = data[band, i, j]; } } HistoData hd = new HistoData(_bandData); // 累计直方图255处为总像素数 long totalPixel = hd.GetAccHistogramData()[255]; for (int i = 0; i < _posibilities.Length; i++) { // 乘100化为百分比的值 _posibilities[i] = (100.0) * (hd.GetAccHistogramData()[i]) / (totalPixel * 1.0); } StretchImg(); }
private void PrepStretch() { _posibilities = new double[256]; HistoData hd = new HistoData(_bandData); // 累计直方图255处为总像素数 long totalPixel = hd.GetAccHistogramData()[255]; for (int i = 0; i < _posibilities.Length; i++) { // 乘100化为百分比的值 _posibilities[i] = (100.0) * (hd.GetAccHistogramData()[i]) / (totalPixel * 1.0); } StretchImg(); }
private void PrepStretch() { _posibilities = new double[256]; HistoData hd = new HistoData(_bandData); // 累计直方图255处为总像素数 long totalPixel = hd.GetAccHistogramData()[255]; for (int i = 0; i < _posibilities.Length; i++) { // 乘100化为百分比的值 _posibilities[i] = (100.0)*(hd.GetAccHistogramData()[i])/(totalPixel*1.0); } StretchImg(); }
/// <summary> /// 按照波段号画图 /// </summary> /// <param name="band">波段号</param> private void DrawByBand(int band) { chart1.Series.Clear(); chart1.Titles.Clear(); HistoData histo = new HistoData(_image, band); if (_type == 1) { chart1.ChartAreas[0].AxisY.Maximum = histo.GetHistogramData().Max() + 1000; MadeChart(chart1, band, histo.GetHistogramData()); } else { chart1.ChartAreas[0].AxisY.Maximum = histo.GetAccHistogramData().Max() + 1000; MadeChart(chart1, band, histo.GetAccHistogramData()); } }
public HistoEqualization(RsImage img, int band) { _bandData = img.GetPicData(band); HistoData hd = new HistoData(img, band); _accData = hd.GetAccHistogramData(); StartEqualization(); }