Web cam not working

import cv2
cap = cv2.VideoCapture(1,cv2.CAP_DSHOW)
cap.set(3 , 700)
cap.set(4 , 600)
while True:
success,img = cap.read()
cv2.imshow(“Image”,img)
if cv2.waitKey(1) & 0xFF == ord(‘q’):
break

cap.release()
cv2.destroyAllWindows()

Hi,
Please indent your code.
What does it mean “not working”? Have you got any error message?

do this modified code works for you?

import cv2

cap = cv2.VideoCapture(0, cv2.CAP_DSHOW) // if you have second camera you can set first parameter as 1
cap.set(cv2.CAP_PROP_FRAME_WIDTH , 320) // you should chose a value that the camera supports
cap.set(cv2.CAP_PROP_FRAME_HEIGHT , 240) // you should chose a value that the camera supports

while True:
    success,img = cap.read()
    cv2.imshow('Image',img)
    if cv2.waitKey(1) & 0xFF == ord('q'):
        break

cap.release()
cv2.destroyAllWindows()