i have this problem where my webcam is not showing using Tkinter,i want to make a GUI where the person click the webcam button and start detecting sign languague, works only when the function "mostrarWebcam" is in the while loop, but in that condition, the webcam dont show up. I hope you can help me whit this issue.
def mostrarWebcam(): global cap sequence = [] sentence = [] predictions = [] threshold = 0.5 while cap is not None: ret,frame = cap.read() if ret == True: frame=imutils.resize(frame,width=700,height=1200) frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA) frame,results = mediapipe_detection(frame,holistic) frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) draw_styled_landmarks(frame,results) keypoints = extract_keypoints(results) sequence.append(keypoints) sequence = sequence[-50:] if len(sequence) == 50: res = modelo_cargado.predict(np.expand_dims(sequence, axis=0))[0] print(actions[np.argmax(res)]) predictions.append(np.argmax(res)) #3. Viz logic if np.unique(predictions[-10:])[0]==np.argmax(res): if res[np.argmax(res)] > threshold: if len(sentence) > 0: if actions[np.argmax(res)] != sentence[-1]: sentence.append(actions[np.argmax(res)]) else: sentence.append(actions[np.argmax(res)]) if len(sentence) > 5: sentence = sentence[-5:] # Viz probabilities frame = prob_viz(res, actions, frame, colors) frame = cv2.rectangle(frame, (0,0), (640, 40), (245, 117, 16), -1) framex = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) im = Image.fromarray(framex) img = ImageTk.PhotoImage(image = im) lblVid.configure(image=img) lblVid.image = img lblVid.after(10, mostrarWebcam) else: lblVid.image="" cap.release()