Camera Live Stream has Weird Output with OpenCV

System:

  • TK1 with Ubuntu 16.04
  • OpenCV 3.0 built from source
  • OV5640 camera

I want to use OpenCV to open the camera and have a clear video stream so I can do some processing on it. The problem is when I use the default constructor to open the camera stream,

cv::VideoCapture cap(0)

the output is the following picture:
https://imgur.com/cdUGxUK

I have tried to open the video stream with a gstreamer pipeline within but I get nowhere with that even though gstreamer will open a clear video stream when I run it in the terminal.

Does anyone have any recommendations or ideas about why my image stream is so poor?

If OV5640 is a bayer sensor based on CSI interface, then openCV videocapture is not able to get it.
It seems using v4l2 framework to get the usb cam only.

I have tried to open the video stream with a gstreamer pipeline within but I get nowhere with that even though gstreamer will open a clear video stream when I run it in the terminal.

You could use gstreamer + openCV. Just notice that you have to enable gstreamer support in openCV.
There are many topics for such usage on this forum (maybe in TX2/TX1 board).