Talk:Jetson/Cameras

From eLinux.org
Jump to: navigation, search

Contents

Thread titleRepliesLast modified
How to do I change the USB camera resolution?118:07, 21 August 2016
Re: (please explain why did you undo this edit?)015:39, 21 October 2014
which CSI-2 MIPI cameras are supported?113:26, 9 July 2014

How to do I change the USB camera resolution?

At the recommendation of this wiki, I purchased a Logitech C615 USB web cam to use with my NVIDIA TK1. My TK1 has Ubuntu 14.04.1 LTS

The camera is capable of 1920x1080, which I have verified using Cheese, as well as: sudo apt-get install luvcview luvcview -d /dev/video0 -L

However, when I run my Python code using OpenCV, the most I can get is 800 x 448. I've tried using the embedded OpenCV that comes with L4T (2.4.13), but several websites specifically indicate that the resolution is fixed at 640 x 480 and that since Feb 1, 2016 NVIDIA is still "working on a fix". https://devtalk.nvidia.com/default/topic/913233/jetson-tk1/-opencv4tegra-changing-camera-resolution-solved-/

Next, I tried a native compile of OpenCV (2.4.8) but I still can't get higher resolutions. http://elinux.org/Jetson/Installing_OpenCV

I tried enabling USB 3.0, but that didn't make a difference. I bought a USB 3.0 hub <-- no luck either. I also tried adding usbcore.usbfs_memory_mb=1000 to the end of extlinux.conf <-- no luck. I also tried adding vmalloc=384M to the end of extlinux.conf <-- no luck. I also tried patching lib4vl as described at this site <-- no luck! https://www.e-consystems.com/Articles/Camera/opencv-jetson-using-13MP-MIPI-camera.asp

I'm running out of options. Has anyone figured out a way to get max resolution out of a USB webcam plugged into the TK1 so that it can be used with Python / OpenCV? I'm a bit disappointed that NVIDIA has all the hype of being the "go-to" platform for computer vision, yet a simple plug-and-play webcam doesn't work right out of the box.

Thanks in advance for your help!

X92127 (talk)09:26, 21 August 2016

Hi, you should ask your question on NVIDIA's devtalk forum, since this page only really gets viewed by me and Bill.

Anyway since you're obviously trying many things about your camera resolution problem, there are several things that can effect camera resolution, but since you didn't mention it I'll mention that you should try setting the resolution at runtime in OpenCV, in case that works:

#include <stdio.h>
// Include OpenCV's C++ Interface
#include "opencv2/opencv.hpp"
using namespace cv;
using namespace std;

int main() {
   VideoCapture camera;
   printf("Accessing camera 0 ...\n");
   camera.open(0);
   if ( !camera.isOpened() ) {
       cerr << "ERROR: Could not access camera " << 0 << " !" << endl;
       exit(1);
   }
   
   // Try to set the camera resolution. Note that this only works for some cameras on
   // some computers and only for some drivers, so don't rely on it to work!
   camera.set(CV_CAP_PROP_FRAME_WIDTH, 1920);
   camera.set(CV_CAP_PROP_FRAME_HEIGHT, 1080);
   
   processImages(camera);
   return 0;
}

If that doesn't work, it might be because USB2.0 doesn't normally support 1920x1080 video unless if the video is compressed by the webcam hardware, and so the driver and/or your code needs to grab compressed video frames and decompress them. Ideally V4L2 does that for you seemlessly, but sometimes it needs some configuration for it to work. Some sample commands for setting resolution on command-line before running your OpenCV program:

   v4l2-ctl --set-fmt-video=width=1920,height=1080,pixelformat=YUYV
   v4l2-ctl --set-fmt-video=width=1920,height=1088,pixelformat=4   # For Raspberry Pi Cam
   v4l2-ctl -v width=1280,height=720,pixelformat=BGR3

Or you can try building Gstreamer into your OpenCV library then use Gstreamer to grab the camera frame and pass it to OpenCV. It actually just needs changing 1 line of your code if you do it that way, but takes some time playing with Gstreamer for it to work.

If you have any issues, post them on the devtalk Jetson TK1 forum.

Good luck! - Shervin.

shervin.emami (talk)18:07, 21 August 2016
 

Re: (please explain why did you undo this edit?)

Hi Peepo,

Sorry to undo your edit, but it looks like while doing your 1 small change, you removed all the changes I did in a previous edit a few days ago. So I undone your edit yesterday to bring back all of my changes (eg: adding many photos to the page). If you look at "http://elinux.org/index.php?title=Jetson/Cameras&action=history", your "minor" edit removed 516 characters, even if you only wanted to make a minor edit. But it looks like it is all fixed now, it currently has my 516 characters of changes as well as your 8 characters of changes so it is good now :-)

Cheers, Shervin.

shervin.emami (talk)15:39, 21 October 2014

which CSI-2 MIPI cameras are supported?


Please could we have a list of supported cameras? with links to suppliers would be handy...

I've bought into a few boards over the years, which had CSI-2 MIPI connectors, but no cameras were supported.

it seems clear that currently not one CSI-mipi camera is known to work with Jetson,

Peepo.com (talk)13:19, 9 July 2014

Hi, I've asked people at NVIDIA if anyone has used a CSI camera yet on Jetson TK1. I know we have used various CSI MIPI cameras with the chip (Tegra K1) since that is what we having been using for our Tegra K1 based smartphones, tablets and automotive systems. But I'll check about Jetson TK1 specifically.

shervin.emami (talk)13:26, 9 July 2014