Professional Documents
Culture Documents
Registration No:-18BCE2417
There are numerous image file types out there so it can be hard to know which file type best suits your image
needs. Some image types such a TIFF are great for printing while others, like JPG or PNG, are best for web
graphics.
The list below outlines some of the more common file types and provides a brief description, how the file is best
used, and any special attributes the file may have.
Bitmap (.bmp)
BMP or Bitmap Image File is a format developed by Microsoft for Windows. There is no compression or
information loss with BMP files which allow images to have very high quality, but also very large file sizes. Due
to BMP being a proprietary format, it is generally recommended to use TIFF files.
Compression: None
Best For: High quality scans, archival copies
Learn more about BMP file types
GIF (.gif)
GIF or Graphics Interchange Format files are widely used for web graphics, because they are limited to only
256 colors, can allow for transparency, and can be animated. GIF files are typically small is size and are very
portable.
Compression: Lossless - compression without loss of quality
Best For: Web Images
Special Attributes: Can be Animated, Can Save Transparency
Learn more about GIF file types
PNG (.png)
PNG or Portable Network Graphics files are a lossless image format originally designed to improve upon and
replace the gif format. PNG files are able to handle up to 16 million colors, unlike the 256 colors supported by
GIF.
Compression: Lossless - compression without loss of quality
Best For: Web Images
Special Attributes: Save Transparency
Learn more about PNG file types
EPS (.eps)
An EPS or Encapsulated PostScript file is a common vector file type. EPS files can be opened in many
illustration applications such as Adobe Illustrator or CorelDRAW.
Compression: None - uses vector information
Best For: Vector artwork, illustrations
Special Attributes: Saves vector information
Learn more about EPS file types
RAW Image Files (.raw, .cr2, .nef, .orf, .sr2, and more)
RAW images are images that are unprocessed that have been created by a camera or scanner. Many digital
SLR cameras can shoot in RAW, whether it be a .raw, .cr2, or .nef. These RAW images are the equivalent of a
digital negative, meaning that they hold a lot of image information, but still need to be processed in an editor
such as Adobe Photoshop or Lightroom.
Compression: None
Best For: Photography
Special Attributes: Saves metadata, unprocessed, lots of inform
Consider your own recent photo as an input image.
a. Convert input image into gray-scale image.
Code:
import cv2
image = cv2.imread( " Yogesh 21.jpg)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
cv2.imshow("Original image", image)
cv2.imshow("Gray image", gray) cv2.waitKey(0) cv2.destroyAllWindows()
Original Image
Grayscale Image
2. Apply the following intensity transformation functions on the input image.
i. Photographic negative.
Code:
import cv2
img = cv2.imread("Yogesh 21.jpg")
cv2.imshow("Original", img) img_not = cv2.bitwise_not(img)
cv2.imshow("PhotoNegative", img_not) cv2.waitKey(0)
cv2.destroyAllWindows()
Original Image
Photographic Negativity
ii. Gamma transformation for gamma = x and 0.y Where, x and y are two least nonzero
digits in your register number. [For eg. 19BCE0287: x=1 and y=2 ; so gamma = 1 and
0.2]
Code:-
import cv2
import numpy as np # Open the image.
img = cv2.imread("Yogesh 21.jpg")
# x = 1, y=2 so 1 and 0.2 are used for gamma in [0.2, 1.0]:
# Apply gamma correction. gamma_corrected = np.array(255 * (img / 255) ** gamma,
dtype="uint8")
# Save edited images. cv2.imwrite("gamma_transformed" + str(gamma) + ".jpg",
gamma_corrected)
Output: Original Image: Same As before After
Transformation: Gamma = 0.2
# replace as your
image path img =
cv2.imread(
r"C:\\Users\\Saugat\\Desktop\\Semester 5\\Image
processing\\Theory\\Assignment\\Notebook\\ Saugat.jpg",
0,
)
For both values c = 2.0 and 4.0 the code is same and only the values passed to the
function as highlighted above needs to be changed.
For c=2
For c=4
Apply average filtering (3X3 filter) with following two boundary options
Code: import cv2
cv2.waitKey(0) cv2.destroyAllWindows()
i. Zero padding
ii. Replicate
d. Apply any smoothening filter on spatial domain
# Low Pass Spatial Domain Filtering # to observe the blurring effect
# Develop Averaging filter(3, 3) mask mask = np.ones([3, 3], dtype=int) mask = mask / 9
# Convolve the 3X3 mask over the image img_new = np.zeros([m, n])
img_new[i, j] = temp
Soble y
Total Soble
Perwitt:
Perwitt x