Ask Your Question

Revision history [back]

Unable to see and take the picture in second time

import cv2

def method_webcam_trigger() key = cv2. waitKey(1) webcam = cv2.VideoCapture(0) while True: try: check, frame = webcam.read() cv2.imshow("Capturing", frame) key = cv2.waitKey(1) if key == ord('s'): cv2.imwrite(filename='saved_img.jpg', img=frame) webcam.release() cv2.waitKey(1650) cv2.destroyAllWindows() print("Image saved!") elif key == ord('q'): webcam.release() cv2.destroyAllWindows() break

Abouve the code which am using. I wrote the code to take the picture in a function and the function will activate in a button click. If i click on a button then the button will call this particular function(method_webcam_trigger) and save the picture. The problem is that if i click on that button again then it wont work. if i click the button on second time then the execution will stop on below line. cv2.imshow("Capturing", frame)

Can anybody help to solve this? Below is another link which i saw asking the same question, but did't find the answer. https://stackoverflow.com/questions/27461227/doesnt-work-videocapture-in-opencv-second-time Please help. Thankyou

Unable to see and take the picture in second time

Code:

import cv2

cv2 def method_webcam_trigger() key = cv2. waitKey(1) webcam = cv2.VideoCapture(0) while True: try: check, frame = webcam.read() cv2.imshow("Capturing", frame) key = cv2.waitKey(1) if key == ord('s'): cv2.imwrite(filename='saved_img.jpg', img=frame) webcam.release() cv2.waitKey(1650) cv2.destroyAllWindows() print("Image saved!") elif key == ord('q'): webcam.release() cv2.destroyAllWindows() break

break

Abouve the code which am using. I wrote the code to take the picture in a function and the function will activate in a button click. If i click on a button then the button will call this particular function(method_webcam_trigger) and save the picture. The problem is that if i click on that button again then it wont work. if i click the button on second time then the execution will stop on below line. cv2.imshow("Capturing", frame)

Can anybody help to solve this? Below is another link which i saw asking the same question, but did't find the answer. https://stackoverflow.com/questions/27461227/doesnt-work-videocapture-in-opencv-second-time Please help. Thankyou

click to hide/show revision 3
None

updated 2019-12-02 04:21:20 -0600

berak gravatar image

Unable to see and take the picture in second time

Code:.

import cv2

def method_webcam_trigger()
    key = cv2. waitKey(1)
    webcam = cv2.VideoCapture(0)
    while True:
        try:
            check, frame = webcam.read()
            cv2.imshow("Capturing", frame)
            key = cv2.waitKey(1)
            if key == ord('s'): 
                cv2.imwrite(filename='saved_img.jpg', img=frame)
                webcam.release()
                cv2.waitKey(1650)
                cv2.destroyAllWindows()
                print("Image saved!")
            elif key == ord('q'):
                webcam.release()
                cv2.destroyAllWindows()
                break

Abouve Above the code which am using. I wrote the code to take the picture in a function and the function will activate in a button click. If i click on a button then the button will call this particular function(method_webcam_trigger) and save the picture. The problem is that if i click on that button again then it wont work. if i click the button on second time then the execution will stop on below line. cv2.imshow("Capturing", frame)

Can anybody help to solve this? Below is another link which i saw asking the same question, but did't find the answer. https://stackoverflow.com/questions/27461227/doesnt-work-videocapture-in-opencv-second-time Please help. Thankyou

Unable to see and take the picture in second time

.

import cv2

def method_webcam_trigger()
    key = cv2. waitKey(1)
    webcam = cv2.VideoCapture(0)
    while True:
        try:
            check, frame = webcam.read()
            cv2.imshow("Capturing", frame)
            key = cv2.waitKey(1)
            if key == ord('s'): 
                cv2.imwrite(filename='saved_img.jpg', img=frame)
                webcam.release()
                cv2.waitKey(1650)
                cv2.destroyAllWindows()
                print("Image saved!")
            elif key == ord('q'):
                webcam.release()
                cv2.destroyAllWindows()
                break

Above the code which am using. I wrote the code to take the picture in a function and the function will activate in a button click. If i click on a button then the button will call this particular function(method_webcam_trigger) function(method_webcam_trigger) and save the picture. The problem is that if i click on that button again then it wont work. if i click the button on second time then the execution will stop on below line. line.

cv2.imshow("Capturing", frame)

frame)

Can anybody help to solve this? Below is another link which i saw asking the same question, but did't find the answer. https://stackoverflow.com/questions/27461227/doesnt-work-videocapture-in-opencv-second-time Please help. Thankyou

Unable to see and take the picture in second time

.import cv2

def method_webcam_trigger()

import cv2

def method_webcam_trigger()
    key = cv2. waitKey(1)
 webcam = cv2.VideoCapture(0)
 while True:
     try:
         check, frame = webcam.read()
         cv2.imshow("Capturing", frame)
         key = cv2.waitKey(1)
         if key == ord('s'): 
             cv2.imwrite(filename='saved_img.jpg', img=frame)
             webcam.release()
             cv2.waitKey(1650)
             cv2.destroyAllWindows()
             print("Image saved!")
         elif key == ord('q'):
             webcam.release()
             cv2.destroyAllWindows()
             break

Above Abouve the code which am using. I wrote the code to take the picture in a function and the function will activate in a button click. If i click on a button then the button will call this particular function(method_webcam_trigger) function(method_webcam_trigger) and save the picture. The problem is that if i click on that button again then it wont work. if i click the button on second time then the execution will stop on below line.line. cv2.imshow("Capturing", frame)

cv2.imshow("Capturing", frame)

Can anybody help to solve this? Below is another link which i saw asking the same question, but did't find the answer. https://stackoverflow.com/questions/27461227/doesnt-work-videocapture-in-opencv-second-time Please help. Thankyou

Unable to see and take the picture in second time

import cv2

def method_webcam_trigger()

key = cv2. waitKey(1)
webcam = cv2.VideoCapture(0)
while True:
    try:
        check, frame = webcam.read()
        cv2.imshow("Capturing", frame)
        key = cv2.waitKey(1)
        if key == ord('s'): 
            cv2.imwrite(filename='saved_img.jpg', img=frame)
            webcam.release()
            cv2.waitKey(1650)
            cv2.destroyAllWindows()
            print("Image saved!")

webcam.release() cv2.destroyAllWindows() break elif key == ord('q'): webcam.release() cv2.destroyAllWindows() break break

Abouve the code which am using. I wrote the code to take the picture in a function and the function will activate in a button click. If i click on a button then the button will call this particular function(method_webcam_trigger) and save the picture. The problem is that if i click on that button again then it wont work. if i click the button on second time then the execution will stop on below line. cv2.imshow("Capturing", frame)

Can anybody help to solve this? Below is another link which i saw asking the same question, but did't find the answer. https://stackoverflow.com/questions/27461227/doesnt-work-videocapture-in-opencv-second-time Please help. Thankyou

Unable to see and take the picture in second time

import cv2

def method_webcam_trigger()

key = cv2. waitKey(1)
webcam = cv2.VideoCapture(0)
while True:
    try:
        check, frame = webcam.read()
        cv2.imshow("Capturing", frame)
        key = cv2.waitKey(1)
        if key == ord('s'): 
            cv2.imwrite(filename='saved_img.jpg', img=frame)
            webcam.release()
            cv2.waitKey(1650)
            cv2.destroyAllWindows()
            print("Image saved!")

webcam.release() cv2.destroyAllWindows() break elif key == ord('q'): webcam.release() cv2.destroyAllWindows() break

break

Abouve the code which am using. I wrote the code to take the picture in a function and the function will activate in a button click. If i click on a button then the button will call this particular function(method_webcam_trigger) and save the picture. The problem is that if i click on that button again then it wont work. if i click the button on second time then the execution will stop on below line. cv2.imshow("Capturing", frame)

Can anybody help to solve this? Below is another link which i saw asking the same question, but did't find the answer. https://stackoverflow.com/questions/27461227/doesnt-work-videocapture-in-opencv-second-time Please help. Thankyou

Unable to see and take the picture in second time

import cv2

def method_webcam_trigger()Code:

import cv2

def method_webcam_trigger()

    key = cv2. waitKey(1)
 webcam = cv2.VideoCapture(0)
 while True:
     try:
         check, frame = webcam.read()
         cv2.imshow("Capturing", frame)
         key = cv2.waitKey(1)
         if key == ord('s'): 
             cv2.imwrite(filename='saved_img.jpg', img=frame)
             webcam.release()
             cv2.waitKey(1650)
             cv2.destroyAllWindows()
             print("Image saved!")
             webcam.release()
             cv2.destroyAllWindows()
             break
         elif key == ord('q'):
             webcam.release()
             cv2.destroyAllWindows()
             break

Abouve the code which am using. I wrote the code to take the picture in a function and the function will activate in a button click. If i click on a button then the button will call this particular function(method_webcam_trigger) function(method_webcam_trigger) and save the picture. The problem is that if i click on that button again then it wont work. if i click the button on second time then the execution will stop on below line. line.

cv2.imshow("Capturing", frame)

frame)

Can anybody help to solve this? Below is another link which i saw asking the same question, but did't find the answer. https://stackoverflow.com/questions/27461227/doesnt-work-videocapture-in-opencv-second-time Please help. Thankyou