ImageProcessing (Finished, version 2.0)

I finished all this program finally.
A long time journey, I used about 14 week to finished all this program.
However, this program still have some little bug which I am not confident. As I will use this program to finish some research, I think I will find them and recovery.

Surrounding

Warning: As I did nothing of compatibility, DO Not using this program on Windows system. You can use this program on UNIX You should install some package before using it, and I will give you the installation function with pip3
STEP 1: Install Python3
For Linux Ubuntu and Debain system

    sudo apt upgrade
    sudo apt update
    sudo apt install python3 python3-pip ipython3

For Fedora and Red-hat system

    sudo yum upgrade
    sudo yum update
    sudo yum install python3 python3-pip ipython3

For Mac OS
You should insttall brew first

    /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

And install python3

    brew update
    brew upgrade
    brew install python3 python3-pip ipython3

STEP 2: Install python package

    pip3 install Pillow
    pip3 install matplotlib
    pip3 install PyWavelets

You should also install opev-cv, however, as the installation of open-cv is so different, I cannot give you some confident method to install it. Here I will give you a reference of open-cv installation.
For Linux
https://docs.opencv.org/trunk/d7/d9f/tutorial_linux_install.html
For Mac OS
https://www.pyimagesearch.com/2016/12/19/install-opencv-3-on-macos-with-homebrew-the-easy-way/

STEP 3: Download the program
You can download this program with git, and I will show you how to use it.

    git clone https://github.com/KazukiAmakawa/ImageProcessing_in_USTB/

Usage

This program will read all jpg, png and bmp figures in the program folders without /Output. If you want to using a figure, you need just put it in the root folders, or build a folder which have name you like and not /Output.
You can begin all the program with the command

    python3 Main.py

First in first, you need to choose the figure you want to use. Print the code of figure and press ENTER.
image Here, you can choose you need using this figure for a long time or just one case. If you input n or N, after algorithm, you need choose a new figure, else, you can use this figure for a long time.
image After that, you can choose the algorithm you need, or input 0 to exit and -1 to choose another figure.
image If you used any algorithm, the system will ask you if you need save this figure or not, all the figure will be saved in folder /Output (Thats why all figure in /Output will not be read).
image The system will also ask you if you need using this figure or not. If you input y or Y, you can use other tools working on the figure after algorithm.

Functions

  1. Gray level linear transformation.
    Some Basic Functions, include:
    (1) Negative operation
    (2) Thresholding
    (3) Gray level linear transformation.
    (4) Logarithmic Transformation
    (5) Exponential transformation
    (6) Linear Treatment
  2. Gamma(power) transformation.
  3. Contrast-Stretching Transformations.
  4. Histogram Equalization
  5. Maximum entropy for thresholding
  6. Get Gradient of figure
  7. Thresholding with Gradient
  8. Statistic the figure
    This function have some bug, which I am not confident.
  9. Auto algorithm!
    Do not using this program, this is the function I try to build a Auto Monte Carlo algorithm, It's failed.
  10. Monte Carlo Average Constrast
    Do not using this program, this is the function I try to build a Auto Monte Carlo algorithm, It's failed.
  11. Convolution
    You can choose the kernel of convolution, you can also add some kernel in /Convolution.py
  12. Histogram Equalization with Monte Carlo
    Do not using this program, this is the function I try to build a Auto Monte Carlo algorithm, It's failed.
  13. Gradient transformation Algorithm (GTA!)
    Do not using this program, this is the function I try to build a Auto Monte Carlo algorithm, It's failed.
  14. 2 Side Gradient Treasholding with DFS
    Do not using this program, this is the function I try to build a Auto Monte Carlo algorithm, It's failed.
  15. Median Filtering
  16. Sobel 3 * 3 cross edge detection operator
  17. Roberts cross edge detection operator
  18. Gradient Treasholding with Convolution
  19. The smallest variance smoothing filter
  20. Canny edge detector
  21. Random Walk Algorithm
    Do not using this program. It's failed.
    Here I will give you the Random Walk Image Edge Algorithm(RWIEA) which is a part of CRIEA program.
    https://github.com/KazukiAmakawa/CRIEA
  22. Unsharp masking
  23. Block Algorithm
    Do not using this program. It's failed. You can get the block algorithm with the Toboggan Algorithm below.
  24. Toboggan Algorithm
  25. Linear PDE method
  26. Non-linear PDE method
  27. Bilateral Filter Smoothing
  28. Least square estimation
  29. Iterative solution
  30. Fourier Transform
  31. Histogram Fourier Transform
  32. Entropy Analysis
  33. Wavelet Algorithm
    For last test.
  34. Gauss Random
    For last test.
  35. ADMM Algorithm
    For last test.

Others

The main program which I am working on is based on the function 21) Random Walk Algorithm. It is called as criea(CNN and Random walk Image Edge Algorithm). Here is the main page of this program (Chinese):
http://www.criea.info/index.php/%E9%A6%96%E9%A1%B5
And the code of this program is over here:
https://github.com/KazukiAmakawa/CRIEA


## History version This program is the code I had written or I will write during my Image Processing course in USTB.
As usual I will still use Python, which is the most beautiful program language (just a joke).
And if you are my friend or student in my school, you can also use these code during this class.
By the way, my class is teaching with both Chinese and English. So don't care about why I often using English during the program


Kazuki Amakawa


By the way, you may need to install these packages
pip3 install Pillow
pip3 install matplotlib
You may also need install opencv if you want to run these code normally. As the installing of opencv in different system are different, I cannot tell you all the method you need. However, if you are macos, you can install it with the method below
https://www.pyimagesearch.com/2016/12/19/install-opencv-3-on-macos-with-homebrew-the-easy-way/

And, it is confident that these can work without bug in the MacOS or Linux(or all Unix). Although it is can be compiled in Windows, I still not confident if they have any bug in Windows System, espacelly Windows10 (or Bug10)

WARNING: Althrough homeworks can work in the Windows System, The main program with paper CANNOT working even compiling on Windows System!!



Ver 1.00


New Functions:
1 Gray level linear transformation.
2 Gamma(power) transformation.
3 Contrast-Stretching Transformations.
4 Histogram Equalization
5 Maximum entropy for thresholding

Ver 1.01


New Functions:
1 Get Gradient of figure
2 Thresholding with Gradient
3 Statistic the figure

Ver 1.02


New Functions:
1 Convolution Function with fft and ifft algorithm
2 Two Monte Carlo Algorithm for the paritical of figure (Actually not very ideal)

Ver 1.03


New Functions:
1 Add some kernel of convolution
2 Add another kind of Gradient transformation Algorithm
3 Add the 2 Side Gradient Treasholding with DFS
4 Repair some of bugs

Ver 1.04


New Functions:
1 Median Filtering
2 Sobel 3 * 3 cross edge detection operator
3 Roberts cross edge detection operator
4 Gradient Treasholding with Convolution
5 The smallest variance smoothing filter
6 Add the norma Convolution method
Waring: We found a new bug about FFT-IFFT Convolution. Up to now, we still cannot understand why the result of FFT-IFFT Convolution is different from Normal Convolution.

Ver 1.05


New Functions:
1 Some new kernel and algoritm
2 Compeleted some algorithm and repaired some bug
3 Added a algorithm called Toboggan Algorithm(Not compeleted, just finished the part of part. Yes, the part of part)

Ver 2.00


Finished all item in my class, especially last test