This cod is showing error

import numpy as np
import cv2

eye=cv2.CascadeClassifier(r"C:\Users\Dibakar Chaudhary\Desktop\Practice\Computer-Vision-Tutorial-master\Haarcascades\eye.xml")
gl=cv2.imread(r"C:\Users\Dibakar Chaudhary\Desktop\Electro\glasses.png")
img=cv2.imread(r"C:\Users\Dibakar Chaudhary\Desktop\Electro\Before.png")

ey=eye.detectMultiScale(img,1.3,4)
x,y,w,h=ey[0]
cv2.rectangle(img,(x,y),(x+w,y+h),(255,0,0),2)
gl1=cv2.resize(gl,(h,w))
for i in range (gl1.shape[0]):
for j in range(gl.shape[1]):
if(gl1[i,j,3]>0):
img[y+i,x+j,:]=gl1[i,j,:-1]

cv2.imshow(“Frame”,img)
cv2.waitKey(0)
cv2.destroyAllWindows()

error :

IndexError Traceback (most recent call last)
in
12 for i in range (gl1.shape[0]):
13 for j in range(gl.shape[1]):
—> 14 if(gl1[i,j,3]>0):
15 img[y+i,x+j,:]=gl1[i,j,:-1]
16

IndexError: index 3 is out of bounds for axis 2 with size 3

Hey @dibakarchaudhary58, print(gl1.shape) and check it. If you are still unable to figure out the error, than share your ipynb notebook by uploading it on google drive and sharing the link here.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.