import numpy as np import cv2 import argparse from collections import deque from pathlib import Path #c_path = Path.cwd() / Path("chromedriver") #print('c_path',c_path) c_path='chromedriver.exe' from agora_community_sdk import AgoraRTC client = AgoraRTC.create_watcher("49c2343ef91c4517a6c6a93a445e0a43", str(c_path)) client.join_channel("gesture") users = client.get_users() # Gets references to everyone participating in the call for i in range(len(users)): user1 = users[i] # Can reference users in a list print('-----user1------',user1) #cap=cv2.VideoCapture(0) binary_image = user1.frame.convert("RGB") # Gets the latest frame from the stream as a PIL image binary_image.save("test.jpeg", "jpeg") pts = deque(maxlen=64) Lower_green = np.array([24,50,50]) Upper_green = np.array([42,255,255])
from agora_community_sdk import AgoraRTC import imutils import os import cv2 import numpy as np import rect client = AgoraRTC.create_watcher('4970dca4fd784a8683966e33bb37cb72', '\chromedriver.exe') client.join_channel("test") users = client.get_users() # Gets references to everyone participating in the call user1 = users[0] # Can reference users in a list binary_image = user1.frame # Gets the latest frame from the stream as a PIL image binary_image.save("test.png") #Replace test.png with your file name # image = cv2.imread("test.png") # image = cv2.resize(image, (1500, 880)) # orig = image.copy() # gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) # blurred = cv2.GaussianBlur(gray, (5, 5), 0) # edged = cv2.Canny(blurred, 0, 50) # orig_edged = edged.copy() # (contours, _) = cv2.findContours(edged, cv2.RETR_LIST, cv2.CHAIN_APPROX_NONE) # contours = sorted(contours, key=cv2.contourArea, reverse=True)
from agora_community_sdk import AgoraRTC from imageai.Prediction.Custom import CustomImagePrediction import os client = AgoraRTC.create_watcher("<insert app id here>", "chromedriver.exe") client.join_channel("naynika") users = client.get_users( ) # Gets references to everyone participating in the call user1 = users[0] # Can reference users in a list binary_image = user1.frame # Gets the latest frame from the stream as a PIL image #with open("test.jpg") as f: # f.write(str(binary_image)) # Can write to file binary_image.save("in.png") #Replace test.png with your file name execution_path = os.getcwd() #Returns current working directory of the project prediction = CustomImagePrediction() prediction.setModelTypeAsResNet() prediction.setModelPath( os.path.join(execution_path, "model_ex-068_acc-0.900000.h5")) prediction.setJsonPath(os.path.join(execution_path, "model_class.json")) prediction.loadModel(num_objects=3) predictions, probabilities = prediction.predictImage( os.path.join(execution_path, "in.png")) for eachPrediction, eachProbability in zip(predictions, probabilities): print(eachPrediction, " : ", eachProbability)
from agora_community_sdk import AgoraRTC from imageai.Detection import ObjectDetection import os client = AgoraRTC.create_watcher("dc96e5c14025414ea38980c9b1b1fbe4", "chromedriver.exe") client.join_channel("meher") users = client.get_users( ) # Gets references to everyone participating in the call user1 = users[0] # Can reference users in a list binary_image = user1.frame # Gets the latest frame from the stream as a PIL image #with open("test.jpg") as f: # f.write(str(binary_image)) # Can write to file binary_image.save("in.png") #Replace test.png with your file name execution_path = os.getcwd() #Returns current working directory of the project detector = ObjectDetection( ) #Calls the object detection function from the library ImageAI detector.setModelTypeAsRetinaNet() detector.setModelPath( os.path.join(execution_path, "resnet50_coco_best_v2.0.1.h5") ) #make sure that you have downloaded resnet50_coco_best_v2.0.1.h5 to your main folder detector.loadModel() #detections = detector.detectObjectsFromImage(input_image=os.path.join(execution_path , "test.png"), output_image_path=os.path.join(execution_path , "test_output.png")) detections, extracted_images = detector.detectObjectsFromImage( input_image=os.path.join(execution_path, "in.png"),
json_file = open('model.json', 'r') loaded_model_json = json_file.read() json_file.close() loaded_model = model_from_json(loaded_model_json) # load weights into new model loaded_model.load_weights("classifier.h5") print("Loaded model from disk") # Part 3 - Making new predictions import numpy as np from keras.preprocessing import image from agora_community_sdk import AgoraRTC # from imageai.Detection import ObjectDetection import os client = AgoraRTC.create_watcher("6297937a41ff430690344df869d6e273", "chromedriver.exe") client.join_channel("demoChannel1") [] users = client.get_users( ) # Gets references to everyone participating in the call print(len(users)) user1 = users[0] # Can reference users in a list print("Hello") print("Arnav") print("Here") print(user1) # binary_image = user1.frame # Gets the latest frame from the stream as a PIL image # with open("test.jpg") as f: # f.write(str(binary_image)) # Can write to file
json_file = open('model.json', 'r') loaded_model_json = json_file.read() json_file.close() loaded_model = model_from_json(loaded_model_json) # load weights into new model loaded_model.load_weights("classifier.h5") print("Loaded model from disk") # Part 3 - Making new predictions import numpy as np from keras.preprocessing import image from agora_community_sdk import AgoraRTC # from imageai.Detection import ObjectDetection import os client = AgoraRTC.create_watcher("48f74ecd63554e2b844ca47b20c84116", "chromedriver.exe") client.join_channel("viren") [] users = client.get_users( ) # Gets references to everyone participating in the call print(len(users)) user1 = users[0] # Can reference users in a list print("Hello") print("Arnav") print("Here") print(user1) # binary_image = user1.frame # Gets the latest frame from the stream as a PIL image # with open("test.jpg") as f: # f.write(str(binary_image)) # Can write to file