Category : opencv

the following code plays a given video file on a tkinter window: from tkinter import * from PIL import ImageTk, Image import cv2 root = Tk() main_label = Label(root) main_label.grid() # Capture from camera cap = cv2.VideoCapture("video.mp4") # function for video streaming def video_stream(): ret, frame = cap.read() cv2image = cv2.cvtColor(frame, cv2.COLOR_BGR2RGBA) img = Image.fromarray(cv2image) ..

Read more

I am trying to detect human hand pose using OpenPose just like given in this video https://github.com/CMU-Perceptual-Computing-Lab/openpose/blob/master/.github/media/pose_face_hands.gif for hand part. I have downloaded the caffe model and prototxt file. Below is my code to implement the model. import cv2 import numpy as np import matplotlib.pyplot as plt %matplotlib inline frame = cv2.imread("6.jpg") frame_rgb=cv2.cvtColor(frame,cv2.COLOR_BGR2RGB) plt.imshow(frame_rgb) threshold ..

Read more

#error: im not able to convert my images from bgr to rgb images = [] path = ‘E:subjectsAIFace-Mask-Detection-masterwithout-mask-detections’ listimages=os.listdir(path) encode_list = [] for img in listimages: images.append(img) img = cv2.cvtColor(img, cv2.COLOR_RGB2GRAY) encode = face_recognition.face_encodings(img) encode_list.append(encode) print(images) #encodeListKnown= find_encoding(images) #print(len(encodeListKnown)) Source: Python..

Read more

I keep getting an error when running the code below import cv2 import urllib3 as urllib import requests import numpy as np url = "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fwallup.net%2Fwp-content%2Fuploads%2F2016%2F03%2F10%2F343179-landscape-nature.jpg" r = requests.get(url) imgar = np.array(bytearray(r.text,’utf-8′),dtype=np.uint8) img = cv2.imdecode(imgar,-1) cv2.imshow(‘img’,img) cv2.waitKey() Error: cv2.imshow(‘img’,img) cv2.error: OpenCV(4.5.1) C:UsersappveyorAppDataLocalTemppip-req-build-kh7iq4w7opencvmoduleshighguisrcwindow.cpp:376: error: (-215:Assertion failed) size.width>0 && size.height>0 in function ‘cv::imshow’ This error keeps happening no ..

Read more