hello,
I have followed this link "http://petermoran.org/csi-cameras-on-tx2/ " to install OpenCV3.3 on my Jetson TX2 and also on my computer Host.
Then I tryed to compile the following example on nsight:
/*
Example code for displaying gstreamer video from the CSI port of the Nvidia Jetson in OpenCV.
Created by Peter Moran on 7/29/17.
https://gist.github.com/peter-moran/742998d893cd013edf6d0c86cc86ff7f
*/
#include <opencv2/opencv.hpp>
template <typename T>
std::string to_string(T value)
{
std::ostringstream os ;
os << value ;
return os.str() ;
}
std::string get_tegra_pipeline(int width, int height, int fps) {
return "nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)" + to_string(width) + ", height=(int)" +
to_string(height) + ", format=(string)I420, framerate=(fraction)" + to_string(fps) +
"/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink";
}
int main() {
// Options
int WIDTH = 1920;
int HEIGHT = 1080;
int FPS = 30;
// Define the gstream pipeline
std::string pipeline = get_tegra_pipeline(WIDTH, HEIGHT, FPS);
std::cout << "Using pipeline: \n\t" << pipeline << "\n";
// Create OpenCV capture object, ensure it works.
cv::VideoCapture cap(pipeline, cv::CAP_GSTREAMER);
if (!cap.isOpened()) {
std::cout << "Connection failed";
return -1;
}
// View video
cv::Mat frame;
while (1) {
cap >> frame; // Get a new frame from camera
// Display frame
imshow("Display window", frame);
cv::waitKey(1); //needed to show frame
}
}
So, the build failed and show me these messages:
Description Resource Path Location Type
make: *** [alpha] Error 1 alpha C/C++ Problem
undefined reference to cv::VideoCapture::~VideoCapture()' alpha line 35, external location: /home/nvidia/alpha/alpha.cpp C/C++ Problem undefined reference to
cv::VideoCapture::VideoCapture(cv::String const&, int)’ alpha line 35, external location: /home/nvidia/alpha/alpha.cpp C/C++ Problem
undefined reference to cv::VideoCapture::isOpened() const' alpha line 36, external location: /home/nvidia/alpha/alpha.cpp C/C++ Problem undefined reference to
cv::VideoCapture::operator>>(cv::Mat&)’ alpha line 44, external location: /home/nvidia/alpha/alpha.cpp C/C++ Problem
undefined reference to cv::imshow(cv::String const&, cv::_InputArray const&)' alpha line 47, external location: /home/nvidia/alpha/alpha.cpp C/C++ Problem undefined reference to
cv::waitKey(int)’ alpha line 48, external location: /home/nvidia/alpha/alpha.cpp C/C++ Problem
undefined reference to cv::VideoCapture::~VideoCapture()' alpha line 50, external location: /home/nvidia/alpha/alpha.cpp C/C++ Problem recipe for target 'alpha' failed makefile /alpha/Debug line 58 C/C++ Problem undefined reference to
cv::String::allocate(unsigned long)’ alpha line 601, external location: /usr/include/opencv2/core/cvstd.hpp C/C++ Problem
undefined reference to cv::String::deallocate()' alpha line 647, external location: /usr/include/opencv2/core/cvstd.hpp C/C++ Problem undefined reference to
cv::String::deallocate()’ alpha line 655, external location: /usr/include/opencv2/core/cvstd.hpp C/C++ Problem
undefined reference to cv::fastFree(void*)' alpha line 692, external location: /usr/include/opencv2/core/mat.inl.hpp C/C++ Problem undefined reference to
cv::Mat::deallocate()’ alpha line 804, external location: /usr/include/opencv2/core/mat.inl.hpp C/C++ Problem
undefined reference to `cv::String::allocate(unsigned long)’ alpha line 83, external location: /usr/include/opencv2/core/cvstd.inl.hpp C/C++ Problem
can anyone help me to fix it?
Best,
Danilo