DMPT 2025 Lecture08 ENG ContextFreeOperations
DMPT 2025 Lecture08 ENG ContextFreeOperations
PROCESSING TECHNIQUES
– Lecture 08
Definition:
context free operation in image processing is an operation on an
individual pixel and the environment, i.e., neighbor pixels of the
processed pixel have no effect on this operation.
The consequence:
all pixels of the same values are identically processed.
• Binarization
• Image negative
• Histogram changes (equalizations)
• Color changes
• Arithmetic operation on images
(addition, subtraction, multiplication, raising to a power)
• Image merging (cross dissolve transitions in video editing)
• Gamma correction
• Adding a constant to the image
• Logical operations
• Look-up table
• Image normalization
Image addition
Two images are added as per the equation below:
I’(x,y) = If1(x,y) + If2(x,y)
Image merging (blending) – mixing of two input images (of some parts of
two images) of the same size. This operation is similar to pixel addition. The
value of each pixel in the output image is a linear combination of the
corresponding pixel values of two input images. The coefficients defines how
great is the impact of each input pixel on the merged image. These
proportions ensured that the output pixel values do not exceed the
maximum pixel value.
Mathematical definition:
I’(x,y) = (1 - α) If1(x,y) + α If2(x,y)
By varying α from 0 to 1, we can perform a cool transition between one
image to another.
Such a transformation is used in different video effects, first of all in video
cross dissolve transitions.
It also gives a feeling of blending or transparency.
https://inf.ed.ac.uk/ 1) 2)
Example
1) text is not well visible because it has been badly illuminated during
scanning, there is a strong illumination gradient across the image
2) simple thresholding fails due to the illumination gradient
KCH – DMPT Lecture08 2025 15/25
Elimination of the variation in the
background intensity (continued)
3) 4) 5)
I’(x,y) = I(x,y)γ
Input values of the image I(x,y) are raised to the power γ (gamma).
I(x,y) – intensity of the pixel with the coordinates x and y
Logical AND/NAND
The AND and NAND operators take two binary, grayscale or color
(intensity values) images as input, and outputs a third image whose pixel
values are just those of the first image ANDed with the corresponding pixels
from the second.
This operator can be used also on a single input image. Each pixel is
processed with a specified constant value in order to produce the output.
All the input pixel values should have the same number of bits. Where the
pixel values in the input images are not simple 1-bit numbers, the
AND/NAND operation is carried out individually on each corresponding bit
in the pixel values, in bitwise fashion.
In general, applying the AND operator (or other logical operators) to two
images in order to detect differences or similarities between them is most
appropriate if they are binary or can be converted into binary format using
thresholding.
The most obvious application of AND is to compute the intersection of two
images.
AND and NAND are often used as sub-components of more complex image
processing tasks. One of the common uses for AND is masking.
Special array specifies the value of the pixel after the operation.
1 v2
2 v3
255 vn