Hi! :-)
I am sorry and I am new here.
This question may have been asked for many times but I still can’t piece them together well.
I have installed OpenCV-3.1.0 on my TX1 following the link below.
https://devtalk.nvidia.com/default/topic/917386/jetson-tx1/usb-3-0-port-unstable-on-jetson-tx1-/post/4835793/#4835793
I successfully compiled my test C++ code as the entire code below
#include "opencv2/opencv.hpp"
#include <iostream>
using namespace std;
using namespace cv;
int main(int, char**)
{
putenv("GST_DEBUG=*:3");
VideoCapture cap("nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1280, height=(int)720,format=(string)I420, framerate=(fraction)24/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink"); //open the default camera
if(!cap.isOpened()) { // check if we succeeded
cerr << "Fail to open camera " << endl;
return -1;
}
for(;;)
{
Mat frame;
cap >> frame; // get a new frame from camera
imshow("original", frame);
waitKey(1);
}
// the camera will be deinitialized automatically in VideoCapture destructor
cap.release();
}
This is how I compiled the code:
g++ -o test -I /home/ubuntu/opencv-3.1.0/include -O2 -g -Wall test.cpp -L /home/ubuntu/opencv-3.1.0/lib -lopencv_core -lopencv_imgproc -l opencv_flann -l opencv_imgcodecs -lopencv_videoio -lopencv_highgui -lopencv_ml -lopencv_video -lopencv_objdetect -lopencv_photo -lopencv_features2d -lopencv_calib3d -lopencv_stitching -lopencv_videostab -lopencv_shape -lopencv_cudaobjdetect -lopencv_cudawarping -lopencv_cudaimgproc
I only got a warning:
test.cpp: In function ‘int main(int, char**)’:
test.cpp:10:24: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
putenv("GST_DEBUG=*:3");
^
Furthermore, I can execute following command successfully:
gst-launch-1.0 nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! nvtee ! nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! nvoverlaysink -e
Nevertheless, when I execute it, it failed to open the on-board camera…/_\
I don’t know why and I’ve done so much research…
Could anyone help, please?