Giter VIP home page Giter VIP logo

Comments (4)

peter-moran avatar peter-moran commented on May 30, 2024 2

FYI, I've put together a guide for using gstreamer with OpenCV on the TX2. Just scroll down to the OpenCV section to see how to compile with gstreamer support and some example code.

from buildopencvtx2.

HoneyPatouceul avatar HoneyPatouceul commented on May 30, 2024

You are trying to access the camera with v4l2 interface, but your camera doesn't provide the expected format for opencv (gray8 or BGR). The onboard camera is a bayer sensor.
You can use gstreamer interface, if you've configured opencv with gstreamer-1.0 support, for making a pipeline that converts into BGR.

from buildopencvtx2.

gigimushroom avatar gigimushroom commented on May 30, 2024

I had the same error from videoio when using cv::videocapture.
I fixed it by turning on libv4l lib when building opencv.

from buildopencvtx2.

Alro10 avatar Alro10 commented on May 30, 2024

Can you try to run this code?

import numpy as np
import cv2

cap = cv2.VideoCapture("nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)300, height=(int)300,format=(string)I420, framerate=(fraction)20/1 ! nvvidconv flip-method=0 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink")

while(True):
# Capture frame-by-frame
ret, frame = cap.read()

# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)

# Display the resulting frame
cv2.imshow('frame',gray)
cv2.imshow('fram2',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
    break

cap.release()
cv2.destroyAllWindows()

It worked for me!

from buildopencvtx2.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.