-
Notifications
You must be signed in to change notification settings - Fork 293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jetcam library doesn't work every time, so using OpenCV to open camera #4
base: master
Are you sure you want to change the base?
Conversation
awesome!!! |
Hi@SarthakGarg13 , ################################################################### import torch import cv2 from trt_pose.draw_objects import DrawObjects WIDTH = 1280 with open('human_pose.json', 'r') as f: topology = trt_pose.coco.coco_category_to_topology(human_pose) num_parts = len(human_pose['keypoints']) print("Reading TensorRT model.......") print("TensorRT model loaded") mean = torch.Tensor([0.485, 0.456, 0.406]).cuda() def preprocess(image): parse_objects = ParseObjects(topology) def execute(change): def gstreamer_pipeline( ): def main(): |
@SarthakGarg19 @lbq779660843 i am getting error in this line ""frame = cv2.resize(frame,(224,224))"". |
@SijinJohn I believe there might be some problem with your camera as the 'frame' object is empty and therefore is not able to resize, hence this error. Please try running the following code and kindly confirm if the 'frame' is empty or not. cam = cv2.VideoCapture(gstreamer_pipeline(flip_method=2), cv2.CAP_GSTREAMER) Also refer to stack overflow : https://stackoverflow.com/questions/58242990/cv2-image-error-error-215assertion-failed-ssize-empty-in-function-cv |
def main():
if name == "main": This gives error:-
|
here i am getting frame value as None. |
@SarthakGarg19 @lbq779660843 @kedaya1999 import cv2 cam = cv2.VideoCapture(gstreamer_pipeline(flip_method=2), cv2.CAP_GSTREAMER)cam = cv2.VideoCapture(0) print(frame)
cam.release() OUTPUT shape1is (1080, 1920, 3) But here i am getting ootput for frame. Do you know why is this?? |
ah it worked. Thanks |
I was going to suggest that! Glad you figured out on your own! 😃👍 |
nice work,but I tried it on jetson nano 2GB,got only 12FPS.I thought it could be 22FPS... |
@liubob-0 even i got 11-12 fps. |
|
@SijinJohn Hi,I ran this code on jetson nano 2GB,can you tell me how to check FPS? |
Using OpenCV to open camera instead of jetcam because many a times jetcam faces issues with USB camera and fails to initialise the camera.
Also adding a python script named live_demo.py, which can be directly run for inference by typing "python3 live_demo.py"