Jovian
⭐️
Sign In

Code for First Problem

In [1]:
import cv2
import numpy as np
import matplotlib.pyplot as plt

In [2]:
import jovian
In [3]:
img = cv2.imread('C:\\Users\\vsneh\\OneDrive\\Desktop\\cap1.jpg')
In [4]:
img = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
plt.imshow(img,'gray')
Out[4]:
<matplotlib.image.AxesImage at 0x1f31fbfd348>
Notebook Image
In [5]:
roi = img[290:350,200:370]
plt.imshow(roi,cmap='gray')
Out[5]:
<matplotlib.image.AxesImage at 0x1f321cf9048>
Notebook Image
In [6]:
roi.shape
Out[6]:
(60, 170)
In [7]:
img2 = np.zeros((60,170),np.uint8)
In [8]:
plt.imshow(img2,'gray')
Out[8]:
<matplotlib.image.AxesImage at 0x1f321d7bd88>
Notebook Image
In [9]:
img[290:350,200:370] = img2
In [10]:
plt.imshow(img,cmap='gray')
Out[10]:
<matplotlib.image.AxesImage at 0x1f321dd6d08>
Notebook Image
In [ ]:
jovian.commit()
[jovian] Saving notebook..
In [ ]:
 
In [ ]: