3experiment Writeup DPCOE
3experiment Writeup DPCOE
CLASS: TE SEMESTER : 6
(a) Implement Gray level slicing (intensity level slicing) in to read the ‘cameraman’
image.
(b) Read an 8-bit image, and see the effect of each bit on the image.
(c) Read an image and extract 8 different planes i.e. ‘bit plane slicing.”
THEORY:
Point Operations: The operations that are performed on individual pixels of the image are called
point operations. Different point operations in the spatial domain are:
1)Inverting the image 2) Log and antilog of image 3) Power low and inverse power low 4) Gray-
level slicing 5) Bit-level Slicing and 6) contrast stretching
Gray Level slicing
Gray-level slicing is also known as intensity slicing. It is used to highlight a particular part of the
image. There are two methods -
a) Without a background: This technique is used to select a specific range of gray levels from
an image and reduces all other intensities to lower level
b) With background: This technique is used to select a specific range of gray levels from an
image and preserves all other intensity levels.
DPCOE/E&TC DIP 1
s= output gray level, r= Input gray level, L-1= maximum gray level
Example: Apply bit plane slicing on the following image size (3X3)
DPCOE/E&TC DIP 2
Bit plane slicing of above:
Bit Plane Slicing is a method of representing an image with one or more-bit planes of the image. The
main goal of Bit Plane Slicing are as follows:
• Converting grey level image to binary image.
• Representing an image with fewer bits.
• Enhancing an image by focusing
DPCOE/E&TC DIP 3
numpy.binary_repr(num, width=None)
Return the binary representation of the input number as a string.
Example:
>>> np.binary_repr(3)
'11'
>>> np.binary_repr(3, width=4)
'0011'
ALGORITHMS:
1. Gray Level Slicing
i. Load the image.
ii. Find the width and height of the image.
iii. Create an array of zeros to store the sliced image
iv. Specify the min and max range of the slice.
v. Loop over the input image and if the pixel value lies in the desired range set it
to 255 otherwise set it to 0(Without a background) or keep unchanged (with a
background)
vi. Display the gray-level sliced image
RESULTS:
See the attachment
DPCOE/E&TC DIP 4
CONCLUSION:
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
REFERENCES:
1. Rafael C. Gonzalez and Richard E. Woods, “Digital Image Processing”, 3rd Edition,
Pearson Education.
2. S Sridhar, “Digital Image Processing”, Oxford University Press.
3. Rafael C. Gonzalez, Richard E. Woods, and Steven L. Eddins, “Digital Image Processing
using MATLAB”, 2nd Edition, Tata McGraw Hill Publication.
DPCOE/E&TC DIP 5