In this tutorial you will see the effects of applying various image feature extraction and processing algorithms.
Project structure
You will see the effects of applying various image feture extraction and processing algorithms for the following topics or algorithms:
Point operators:
Group operators:
The code of my library is organised as it is depicted below:
Point operators
- Brightness operator
q(x,y) = contrast*p(x,y) + bright
brightnessForGrayImage(imageData, contrast, bright)
Located in: ife/basic/operators.pyBrightness
In this case it is interesting to look into histograms:
Generally, when you change brightness, unchanged histogram is shifted left or right. In the second case it seems to be changed. It's not precise. If you look closer you will notice that shape is exactly the same, but scaled down. This is because values from red box:
shifted rigth by 50 exceded upper limit of 255 and took value equall to 255. Other words, all values below 205 stays untouched and values from interval [206, 255] takes value 255. This explains why in the second case you can observe high bar at value 255.Contrast
Look at histogram in this case:
Look at histogram in this case:
- Histogram normalization
histogramNormalizationForGrayImage(imageData, outputLevelMin=0, outputLevelMax=255)
Located in: ife/basic/operators.py
Histogram normalization should stretch histogram in full range, by default from 0 to 255:
In case of the first image it seems that normalisation doesn't take any effect - it is not stretched in full range as you can obsrve in second case. It's not true. If you look carefully into histogram, you will notice that there is a small bar at 255:
which means that in original image there are some pixels of the value 255. If value 255 is reached, you can't stretch histogram to this end (because it is in this end right now). - Treshold
tresholdForGrayImage(imageData, treshold)
treshold2ForGrayImage(imageData, tresholdMin, tresholdMax)
Located in: ife/basic/operators.py
Left: Treshold for tresholdMin=25 and tresholdMax=75. Right: Treshold for tresholdMin=100 and tresholdMax=150.
- Histogram equalisation
histogramEqualisationForGrayImage(imageData)
Located in: ife/basic/operators.py
Group operators
- Gaussian averaging operator (blur Gaussian)
blurGaussianForGrayImage(imageData, windowSize, sigma)
Located in: ife/basic/filters.py
Left: Blur for windowSize=9 and sigma=0.5. Middle: Blur for windowSize=9 and sigma=2. Right: Blur for windowSize=9 and sigma=5.
Left: Blur for windowSize=9 and sigma=0.5. Middle: Blur for windowSize=9 and sigma=2. Right: Blur for windowSize=9 and sigma=5.
- Mode filter
filterModeForGrayImage(imageData, windowSize, numberOfIterations = 1)
Located in: ife/basic/filters.py
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
To be described in near future: ============================== ife/basic/filters.py 1. Averaging operator blurAvg(imageData, size) 3. Median filter filterMedian(imageData, size) 5. Nonlocal means operator 6. Bilateral filter ============================== ife/basic/structural.py 1. Morphology operator: erosion (reduction) 2. Morphology operator: dilation (increase) ============================== ife/basic/tools.py 1. addNoiseRandom(imageData, fillPercentage) 2. addNoiseSaltAndPaper(fillPercentage) 3. cutPart(image, x, y, width, height) 4. pastePart(imageData, imageDataToPaste, x, y) 5. diff(imageData1, imageData2) 6. convolution(imageData, kernel, calculateForBorder = true) |