Digital Image Processing Lab Manual# 3
Digital Image Processing Lab Manual# 3
Digital Image Processing Lab Manual# 3
Objective:
The objective of this lab is to introduce further OpenCV functions especially with respect to
image processing.
Theory:
Flip:
Basic Syntax is :
Value is 1 for horizontal flipping. Value is 0 for verticl flipping. Value is -1 for both axis.
Rotate:
Concatenation of images:
To concatenate images vertically and horizontally with Python, cv2 library comes with two
functions as:
1. hconcat(): It is used as cv2.hconcat() to concatenate images horizontally. Here h means
horizontal. cv2.hconcat() is used to combine images of same height horizontally.
2. vconcat(): It is used as cv2.vconcat() to concatenate images vertically. Here v means
vertical. cv2.vconcat() is used to combine images of same width vertically.
1. Addition
Syntax: cv2.add(img1, img2)
But adding the pixels is not an ideal situation. So, we use cv2.addweighted(). Remember, both
images should be of equal size and depth.
Parameters:
Just like addition, we can subtract the pixel values in two images and merge them with the help
of cv2.subtract(). The images should be of equal size and depth.
3. AND: A bitwise AND is true if and only if both pixels are greater than zero.
4. OR: A bitwise OR is true if either of the two pixels is greater than zero.
5. XOR: A bitwise XOR is true if and only if one of the two pixels is greater than zero, but not
both.
6. NOT: A bitwise NOT inverts the “on” and “off” pixels in an image.
Syntax:
bitwiseNot = cv2.bitwise_not(circle)
Lab tasks:
Task#1 : Use the given below images as your input images and perform all arithmetic and
logical operations. Show your show and also state your observations for each.
Task#2: Capture your own image through webcam and save it.
Task#3 Perform all the types of flipping on the captured image. Show the flipped images.
Task#4 Perform all the types of rotations on the captured image. Show the rotated images.
Task#5 Concatenate the original and flipped images into 1 image. Similarly concatenate all the
rotated images into 1 images.