Skip to content
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

Can't use it twice if it crashes #43

Open
xrstokes opened this issue May 20, 2021 · 1 comment
Open

Can't use it twice if it crashes #43

xrstokes opened this issue May 20, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@xrstokes
Copy link

xrstokes commented May 20, 2021

Hi, I'm trying to use the code with some other features. When my code crashes though. I have to reboot my nano before i can use the camera again. Here is what i'm using. Thanks in advance.

def gstreamer_pipeline(
    capture_width=1920,
    capture_height=1080,
    display_width=960,
    display_height=540,
    framerate=30,
    flip_method=0,
    ):
    return (
        "nvarguscamerasrc exposurecompensation=-2 ! "
        "video/x-raw(memory:NVMM), "
        "width=(int)%d, height=(int)%d, "
        "format=(string)NV12, framerate=(fraction)%d/1 ! "
        "nvvidconv flip-method=%d ! "
        "video/x-raw, width=(int)%d, height=(int)%d, format=(string)BGRx ! "
        "videoconvert ! "
        "video/x-raw, format=(string)BGR ! appsink"
        % (
            capture_width,
            capture_height,
            framerate,
            flip_method,
            display_width,
            display_height,
        )
    )

cap = cv2.VideoCapture(gstreamer_pipeline(flip_method=0), cv2.CAP_GSTREAMER)

while True:
    ret_val, img = cap.read()
    print(ret_val)
    if ret_val:
        send_img(img)
        break
    else:
        break
        
cap.release()
@xrstokes xrstokes added the bug Something isn't working label May 20, 2021
@CodeColdCook
Copy link

me too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants