Digital Image Processing Lab 4
Digital Image Processing Lab 4
NAME::Irfan Haider
CLASS: BCE-7
ENROLLMENT NO: 01-132182-035
DEPARTMENT OF COMPUTER ENGINEERING
BAHRIA UNIVERSITY | ISLAMABAD CAMPUS
Lab 4
Title
Binarization Resizing of Images and Introduction to GUI in Python
OBJECTIVES:
To deal with GUIs for performing basic functions in Python for Digital Image Processing.
SOFTWARE USED:
Jupyter Notebook
Introduction
Image resizing refers to the scaling of images. Scaling comes in handy in many
image processing as well as machine learning applications. It helps in reducing
the number of pixels from an image and that has several advantages e.g. It can
reduce the time of training of a neural network as the more the number of pixels
in an image more is the number of input nodes that in turn increases the
complexity of the model.
Task 1:
Design a Python GUI, as shown below, to implement following operations: 1) Load: loads image and
display it in the label ‘Original Image’ 2) Binarize: Binarizes the image and then inverts it (Use im
=Image.open("../images/parrot.png") im_t = im.point(lambda x: 255 - x) im_t.show() to binarize the
image). Once binarzied display the image in the panel ‘Processed Image’.
Code
OUTPUT
Task 2:
Design a Python GUI, as shown below, to implement following operations: 1. Browse Image: loads
image and display it in the label ‘Original Image’ 2. Resize image and display using cv2. cv2.resize(img,
(nw,nh),interpolation=cv2.INTER_AREA) .
CODE
OUTPUT
Conclusion
In this lab I have learnt how to select image in python through GUI and how to resize through load the
image through button to resize the image