Histogram is a graph that shows frequency of anything. Histograms usually have bars that represent frequency of occuring of data. Histogram is a graph that shows frequency of anything. Histograms usually have bars that represent frequency of occuring of data. Histogram has two axis: x and y. The x axis contains the event whose frequency we count. The y axis contains frequency.
Example of a typical histogram. Example of a typical histogram.
Consider some students with their marks. Consider some students with their marks.
Image histogram shows frequency of pixel intensity values. Image histogram shows frequency of pixel intensity values. y axis shows the frequency of intensities.
Brightness is a relative term. It can be defined as the amount of energy output by a source of light relative to the source we are comparing to. Brightness is a relative term. It can be defined as the amount of energy output by a source of light relative to the source we are comparing to.
Brightness can be easily increased or decreased by simple addition or subtraction to the image matrix Brightness can be easily increased or decreased by simple addition or subtraction to the image matrix
The contrast of the image can be defined as the difference between maximum pixel intensity and minimum pixel intensity. The contrast of the image can be defined as the difference between maximum pixel intensity and minimum pixel intensity.
Transformation is a function. It maps one set to another set after performing some operations. Transformation is a function. It maps one set to another set after performing some operations.
Consider the equation g(x,y)=T(f(x,y)) f(x,y) – input image, transformation is applied to this image. g(x,y) – output image (processed image). T is a transformation function.
The transformation can be also represented as The transformation can be also represented as s=T(r) r – pixel value of the input image f(x,y) s – pixel value of the output image g(x,y)
Brightness is changed by shifting the histogram to left or right. Brightness is changed by shifting the histogram to left or right.
Contrast can be increased using: Contrast can be increased using: 2. Histogram equalization
This formula doesn’t work always. If there is 1 pixel with intensity 255: This formula doesn’t work always. If there is 1 pixel with intensity 255:
PMF and CDF are both related to probability. They will be used in Histogram Equalization. PMF and CDF are both related to probability. They will be used in Histogram Equalization. PMF – Probability Mass Function. It gives the probability of each number in the data set (frequency of each element).
Calculating PMF from image matrix Calculating PMF from image matrix
Calculating PMF from histogram
CDF – Cumulative Distributed Function CDF – Cumulative Distributed Function
CDF will be calculated using the histogram CDF will be calculated using the histogram CDF makes the PDF grow monotonically Monotonical growth is necessary for histogram equalization.
Histogram equalization is used for enhancing the contrast of the images. Histogram equalization is used for enhancing the contrast of the images. The first two steps are calculating the PDF and CDF. All pixel values of the image will be equalized.
Small image (values)
min = 52
g(x,y) = h(x,y) * f(x,y) mask convolved with an image g(x,y) = h(x,y) * f(x,y) mask convolved with an image The convolution operator (*) is commutative, h(x,y) is the mask or filter.
Mask is a matrix, usually of size 1x1, 3x3, 5x5 or 7x7 (odd number). Mask is a matrix, usually of size 1x1, 3x3, 5x5 or 7x7 (odd number). Convolution steps: - Flip the mask horizontally and vertically
- Slide the mask onto the image
- Multiply the corresponding elements and add them
- Repeat this until all image values are calculated
Mask:
Image matrix
Red – mask, black – image Red – mask, black – image
A mask is a filter. Concept of masking is a concept of spatial filtering. A mask is a filter. Concept of masking is a concept of spatial filtering. Sample mask
Filters are used for: Filters are used for: - blurring - image sharpening - edge detection
Dostları ilə paylaş: |