For the second problem, I used linear scaling to expand the full dynamic range, but the result is not good. Why?
If you check the histogram of the original image, you will find the gray level of most pixels are zero, this is because the background is black. Consequently, when you expand the dynamic range from 0, the original image is not effectively extended, hence the result is not satisfying. It is better to ignore the background while doing image enhancement.