I am using OpenCV 3.1 with CUDA enabled on the Tegra K1 with the OV5640 CSI Camera.
I tried for a long time to get Gstreamer working with VideoCapture to no avail. I tried multiple different pipelines and not one of them managed to open the camera so I used the default VideoCapture constructor. My code is as follows:
cv::VideoCapture cap(0);
if (!cap.isOpened()){
printf("Camera not opened \n");
return -1;
}
// View video
cv::Mat frame;
for(int i = 0; i < 1500; i++) {
cap >> frame;
imshow("Display window", frame);
cv::waitKey(1);
}
and my output is as follows:
At first, I thought it was the Bayer output but after some investigating the image stream has the following properties: 640x480 resolution
3-channel image
CV_16U3 - 16 bit encoding
Since I do not know the colorspace the image is in, I tried to convert to every possible colorspace with cvtColor() and every transformation ended up making the image worse.
Any help would be greatly appreciated. I was initially trying to get the images in YUV or YCrCb colorspace but HSV or LAB would also work just fine.