0% found this document useful (0 votes)
49 views

Digital Image Processing Lab 4

This document describes a lab assignment on digital image processing using Python. The objectives are to display information to users, accept keyboard input, and perform basic image processing functions using GUIs in Python. Specifically, the tasks involve designing GUIs to load an image, binarize and invert it, and resize images using OpenCV. Code snippets are provided to binarize an image and resize it, with outputs showing the original and processed images. The conclusion states the author learned to select images and resize them using buttons in a Python GUI.

Uploaded by

Irfan Haider
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
49 views

Digital Image Processing Lab 4

This document describes a lab assignment on digital image processing using Python. The objectives are to display information to users, accept keyboard input, and perform basic image processing functions using GUIs in Python. Specifically, the tasks involve designing GUIs to load an image, binarize and invert it, and resize images using OpenCV. Code snippets are provided to binarize an image and resize it, with outputs showing the original and processed images. The conclusion states the author learned to select images and resize them using buttons in a Python GUI.

Uploaded by

Irfan Haider
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 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