Page 264 - AI Ver 1.0 Class 10
P. 264
print(“Blue colour code at this pixel :”,blue)
print(“Green colour code at this pixel :”,green)
print(“Red colour code at this pixel :”,red)
th
th
It will display the Blue, Green, Red colour code between 0 to 255 pixel at 25 row and 40 column of an
rd
image using 3 parameter as 0,1,2.
Let us now see how the above discussed functions will affect the code of displaying an image:
Cropping an Image
Sometimes we need to remove the unwanted parts of the image to make it appear in a frame and help us focus
on certain areas of the image. This can be done by cropping an image.
In OpenCV we first need to draw a bounding box around a certain area known as ‘region of interest (ROI)’. After
this we will extract the image of that ROI only which will help us to create a cropped image.
roi = img[20:230,120:372] #img[range of y, range of x]
• Let us now try this in getting the face of the dog:
262 Touchpad Artificial Intelligence-X

