Comments (4)
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.
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.
I had the same error from videoio when using cv::videocapture.
I fixed it by turning on libv4l lib when building opencv.
from buildopencvtx2.
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)
- Build Error HOT 2
- Build Error - OpenGL Support
- Example Error - Python is missing OpenCV HOT 2
- OpenCV not compatible with YOLO HOT 3
- opencv build error HOT 2
- How to configure environment variables HOT 3
- #error Please include the appropriate gl headers before including cuda_gl_interop.h HOT 4
- Building OpenCV with Python3
- How to install opencv-contrib on jetson tx2 HOT 7
- missing opencv.pc HOT 13
- Can it be used with TX1 ?
- opencv run error
- Jetson freezes when more than one videocapture is running. HOT 5
- How to activate OpenCV on python3 HOT 7
- Installing OpenCV version 3.4.2 and above raise a python checking error
- can I build OpenCVTX2 with ROS for running the code in GPU not CPU?
- opencv‘s dnn moudle is now support for Nvidia cuda。 HOT 1
- Can it be used in Jetson Nano? HOT 1
- build error
- skipping incompatible /usr/local/cuda/lib64/libcudnn.so when searching for -lcudnn
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from buildopencvtx2.