The camera is not stopping when i press q , it stopping when i close the terminal

just to confirm can you check that it reaching that condition of breaking the loop.

print something in that , and see if it is getting printed or not

Yes, tried that but not printing anything

it means that you are not able to reach that point.
so , for that just print key_pressed , and while actually clicking key q , but is it actually q or not.

key_pressed = cv2.waitKey(1) & 0xFF
print(key_pressed)

This is continuously printing 255 without me giving any input key.

and does it changes when you press something ?

No, It keeps on printing 255

just once try ,
cv2.waitkey(0)

cv2.waitKey(0) is not working, when i do this it is not even showing the video frame it is just showing the first image captured

okay , i don’t why it is not working like this in your system.
i guess we need to connect at some time to workaround this tomorrow.

Can you ping me in whatsapp

Sure sir, Where do i get your number from?

pinged you on whatsapp , check there

I am also having the same error how was it resolved ?

@prashant_ml please help

change this to
key_pressed = cv2.waitKey(1)

and run , it will work.

@prashant_ml you mean this

if cv2.waitKey(1)==ord(‘q’):
break

yes correct and see if this works for you or not.

no this is not working for me

share me a screenshot and debug that , by just printing cv2.waitkey() , what does it returns actually

by doing this it is not displaying any image from camera.the frame appears black