Digital-Image-Processing
This repo is used to learn the course digital image processing, I will try to realize different image processing algorithm, and make a comparison with standard Library.
While the code is realized in very inefficient way under python, it may run very slow. Further optimization on calculation could be modified.
Process :
- OpenCV version
- My version
- Result
- Docs
The histogram, describes the distribution of pixels in an image. Use
- the relative partial order before and after
$T(r)$ is the same - the distribution of
$s(r)$ is approximate an uniform distribution
A valid mapping function is
Results :
Gray images (raw, raw histogram, equalized, equalized histogram)
Color (raw, RGB, HSI)
Laplacian operator is used to extract the sharpen part of an image, and $$ \begin{align} \nabla^2{f}&=\frac{\partial^2 f}{\partial x^2}+\frac{\partial^2 f}{\partial y^2} \ \frac{\partial^2 f}{\partial x^2} &= f(x+1, y)+f(x-1,y)-2f(x,y) \ \frac{\partial^2 f}{\partial y^2} &= f(x, y+1)+f(x,y-1)-2f(x,y) \ \nabla^2{f}&=[f(x+1,y)+f(x-1,y)+f(x,y+1)+f(x,y-1)]-4f(x,y). \end{align} $$ Then, substract the raw image with the laplacian operator,
Also, other laplacian operator could be used, $$ \begin{align} \nabla^2{f}&=[f(x+1,y)+f(x-1,y)+f(x,y+1)+f(x,y-1) \ &+f(x+1, y+1)+f(x+1,y-1)+f(x-1,y+1)+f(x-1,y-1)]-8f(x,y). \end{align} $$
Result (raw, laplacian, normalized laplacian, sharpen)
Different noise function :
Image restoration :
The principle is to reduce the noise by mathematical functions. With different noise, different filters will have different performance.
There is no filter performs best for all kinds of noises.
Mean filter :
Mean filter is good for gaussian noise.
Arithmetic mean filter and geometric mean filter $$ \begin{align} \hat{f}(x, y)&=\frac{1}{mn}\sum_{(s,t)\in S_{xy}}g(s,t), \ \hat{f}(x, y)&=(\Pi_{(s,t)\in S_{xy}}g(s,t))^{\frac{1}{mn}}. \end{align} $$ Adaptive mean filter. It requires known the noise size, and use different weight of filter according to local noise variance towards global noise variance.
Define