You are on page 1of 6

Digital Image Processing

Ma’am Amna Waheed


LAB NO 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:

The main objective of this Lab :

 To display information to user and accepting user inputs from keyboards

 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

You might also like