static void SubtractNoiseDisp(CImage<double> DImg, double sigma, double X0, CImage<double> img) { CImage<double> noiseDisp = new CImage<double>(DImg.GetW, DImg.GetH); for (int i = 0; i < DImg.GetW; i++) { for (int j = 0; j < DImg.GetH; j++) { double buf = DImg[i, j] - GetNoiseDispersion(i, j, img, sigma, X0); //if (buf < 0) // DImg[i, j] = 0; //else DImg[i, j] = buf; //img[i, j] = buf < 0 ? 0 : buf; } } double min = DImg.GetMin(); if (min < 0) { for (int i = 0; i < DImg.GetH; i++) { for (int j = 0; j < DImg.GetW; j++) { DImg[i, j] -= min; } } } }