jetpack3.1 gstreamer on tx1 won't link to openCV3.3.0

I’m migrating my codes from jetpack 2 to 3, with opencv3.3, the CSI camera won’t work now. I noticed that the gstreamer libs were not linked into the executable.

Although with the same codes, opencv3.3, on jetpack2.4, gstreamer is linked and video capture runs OK.

Below is the codes-----------------------------------

#include <opencv2/core/utility.hpp>
#include <opencv2/video.hpp>
#include <opencv2/tracking/tracker.hpp>
#include <opencv2/videoio.hpp>
#include <opencv2/highgui.hpp>
#include
#include

using namespace std;
using namespace cv;

int main() {
// declares all required variables
//! [vars]
Rect2d roi;
Mat frame;
int sensor_id =0, width =720, height =576;
//! [vars]
char pGstPipelineString[1024];
sprintf(pGstPipelineString,
“nvcamerasrc sensor-id=%d ! video/x-raw(memory:NVMM), width=(int)%d, height=(int)%d,format=(string)I420, framerate=(fraction)60/1 ! nvvidconv flip-method=2 ! video/x-raw, format=(string)BGRx ! videoconvert ! appsink”,
sensor_id, width, height);

VideoCapture cap(pGstPipelineString);

cap >> frame;

printf("Start the process\n");
for (;; ) {
	// get frame from the video
	cap >> frame;

	// stop the program if no more images
	if (frame.rows == 0 || frame.cols == 0)
		break;

	// show image 
	imshow("tracker", frame);
	//! [visualization]
	//quit on ESC button
	if (waitKey(1) == 27)
		break;
}

return 0;

}

gopro.jpeg

It is unclear what fails. You may post the command and the error message.

You may look at this post for a working example https://devtalk.nvidia.com/default/topic/1023186/jetson-tx2/tx2-opencv-tracking-segfault/post/5205930/#5205930.

Additional note: With R28.1, you don’t need flip-method of nvvidconv any longer, as nvcamerasrc sends now the image upside up.

I found the reason. I didn’t install gstreamer_plugin_base_1.0-dev before compiling opencv. thus gstreamer was not enabled in opencv3.3.

Now I rebuild opencv and the issue is gone