Hello everybody,
I’m using Nsight and I’m trying to open TX2 on-board camera.
If I use the code (part of code) posted below I can open the camera with no problems, but I would like to use nvgstcapture-1.0 and not nvcamerasrc. How can I change the code so I can do it?
...
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=4 ! video/x-raw, format=(string)BGRx ! videoconvert ! video/x-raw, format=(string)BGR ! appsink";
}
int main() {
// Options
int WIDTH = 640;
int HEIGHT = 480;
int FPS = 60;
// 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);
...