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

EYRCPlus-PS1#2271 Image Processing PDF

The document provides details about an image processing task for a robotics competition. It includes: 1) Information about the test images used, including their resolutions of 1050*516 and 1050*511 pixels. 2) An explanation that thresholding is used to extract pixels within a certain value range and create a binary image. 3) A description of the algorithm used which first converts the image to binary by thresholding and then draws contours according to the specified area range.

Uploaded by

Amit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views

EYRCPlus-PS1#2271 Image Processing PDF

The document provides details about an image processing task for a robotics competition. It includes: 1) Information about the test images used, including their resolutions of 1050*516 and 1050*511 pixels. 2) An explanation that thresholding is used to extract pixels within a certain value range and create a binary image. 3) A description of the algorithm used which first converts the image to binary by thresholding and then draws contours according to the specified area range.

Uploaded by

Amit
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

e-Yantra Robotics Competition Plus

(eYRC+ Pilot)
<Please enter your team id here>
Team leader name
College
e-mail
Date

Nirlesh Singh
USICT
[email protected]
29/11/2015

Image Processing

(8)

Write down the answers to the following questions.


1. What is the resolution(size) of the test image assigned in the task?
2. What is the use of thresholding an image?
<
1. Resolution of test_image1 is 1050*516 and of test_image2 is 1050*511.
#Syntax used to obtain the resolution is print img.shape.
2.Thresholding is used when we know the range in which the pixels values we need exist and
want to cut out the rest of the image . It can be used to obtain a binary image.
>
Explain the algorithm used to perform the task given in practice_test folder.
<
Answer format: Bulleted form
1. First we are converting the image into binary image by thresholding . We have set the
thresholding intensity such that upper contours should not take effect on the output.
2.We are drawing the counters according to the area given in the specific range.

>

Software used

(7)

Write down the answers to the following questions.


1. Write a function in python to open a color image and convert the image into grayscale. You
are required to write a function color_grayscale(filename,g) which takes two arguments:
a. filename: a color image (Test color image is in folder Task1_Practice/test_images.
Pick first image to perform the experiment.)
b. g: an integer
Output of program should be a grayscale image if g = 1 and a color image otherwise.
<
Code for question 1
#importing the libraries
import numpy
import cv2

img = cv2.imread('test_image1.jpg')
g1=input("enter the value of g")

#reading a coloured image


#taking the value of g from user

#defining function
def color_grayscale(img,g): #taking the argument from the calling function. Img is coloured
if g==1:
#image and g is an integer
img2= cv2.cvtColor(img,cv2.COLOR_BGR2GRAY) # converting the coloured image into
else:
#grayscale
img2=img
return(img2)
#returning the image
img1=color_grayscale(img,g1)
cv2.imshow('image',img1)

cv2.waitKey(0)

#passing the arguments


#getting the output according to the value of g

cv2.destroyAllWindows()>

You might also like