Estimating the light pollution
Now that we have roughly classified non-star pixels, we can fit our model for light pollution to the remaining background pixels. As mentioned before, we model light pollution within small patches of pixels as a linear gradient. Such a gradient has three parameters: Its brightness, its x-slope and its y-slope. Our goal now is to estimate these parameters so that the linear gradient best matches the input image.
This problem is best known as Weighted Least Squares and is well-studied. We can write the optimal fit in terms of a set of linear equations (XTWX)β=XTWy,
where y is the vector of input pixels, β are the parameters of our model, X is the feature matrix (pixel positions + a column of constant 1s) and W
is a diagonal matrix containing our image mask. This will not make much sense unless you are familiar with linear regression (I won't go into the details), but just assume that this allows us to compute the optimal parameters. Arbitrary sized matrix math is inconvenient to implement, and I've opted to use the excellent Eigen matrix library to solve this system of equations.
Once we have estimated the parameters β
, we can go in the reverse direction: Evaluating Xβ retrieves the value of the model for all pixels in the patch.
视频信息
答案文本
视频字幕
Light pollution estimation begins after we have classified non-star pixels in our astronomical images. We model light pollution within small patches of pixels as a linear gradient. This gradient is characterized by three key parameters: its overall brightness level, its slope in the x-direction, and its slope in the y-direction. By estimating these parameters accurately, we can effectively model and remove light pollution from our images.
To estimate the optimal parameters for our light pollution model, we use the Weighted Least Squares method. This is a well-established technique in linear regression. The problem is formulated as solving the linear system X transpose W X times beta equals X transpose W y. Here, y represents the vector of input pixel values, beta contains our three parameters we want to estimate, X is the feature matrix containing pixel positions and a column of ones, and W is a diagonal matrix containing our image mask weights. This mathematical framework allows us to find the best-fitting linear gradient for each patch.
Now let's break down each component of our matrix equation. The feature matrix X contains pixel coordinates along with a column of ones for the constant brightness term. The weight matrix W is diagonal, with ones for background pixels that we want to include in our fit, and zeros for star pixels that we want to exclude. The vector y contains the actual intensity values of each pixel. Finally, beta contains the three parameters we're solving for: the overall brightness, x-slope, and y-slope of our linear gradient model. This weighted approach ensures that only the background pixels contribute to our light pollution estimate.
After solving the weighted least squares system, we obtain the optimal parameters beta. These parameters define our linear gradient model for light pollution. We can then evaluate X times beta to get the estimated light pollution value for every pixel in the patch. This creates a smooth gradient pattern that represents the light pollution contribution. The final step is to subtract this estimated light pollution from the original image, effectively removing the unwanted background illumination and revealing the true astronomical signals underneath.
This completes our light pollution estimation and removal process. We start with an astronomical image contaminated by light pollution, classify the pixels to separate stars from background, model the light pollution as a linear gradient using weighted least squares, and finally subtract the estimated pollution pattern from the original image. The result is a clean astronomical image where the light pollution has been effectively removed while preserving all the important stellar information. This technique is essential for modern astronomical image processing and enables scientists to extract accurate photometric measurements from ground-based observations.