Enabling camera on Jetson TX1 board

Hello,
As to Jetson TX1 on-board camera in openCV, would you please refer to [url]https://devtalk.nvidia.com/default/topic/943129/jetson-tx1/highgui-error-v4l-v4l2-while-opening-camera-with-opencv4tegra-l4t-r24/post/4921383/#4921383[/url]

If there’s still any problem, please set GST_DEBUG=3 and run your program to capture some GST log.

br
ChenJian

I tried the command from the terminal it opens the camera, but when i run it in the code below it simply does not work. below is my code :

include <opencv2/imgproc/imgproc.hpp>
include <opencv2/highgui/highgui.hpp>
include <opencv2/opencv.hpp>
include

int main()
{
cv::Mat img = cv::imread(“aru.jpg”);

cv::VideoCapture cap("gst-launch-1.0 nvcamerasrc ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080,format=(string)I420, framerate=(fraction)30/1' ! nvtee ! nvoverlaysink -e");


for (;;)
{
	if(!cap.read(img))
		break;

	cv::imshow("img", img);
	char c = cv::waitKey(30);
	
	if(c =='c')
	{
		cap.release();		   
		break;
	}
}

}

I’d appreciate too a simplest possible example of code in C++ with OpenCV that would use the on-board camera.

I just flashed my TX1 board with the latest Jetpack 2.3.1 and it seems the OpenCV is 2.4.13 according to /usr/lib/libopencv* files. Nothing custom, all is out of the box, the Jetpack 2.3.1. Gstreamer pipe started with gst-launch-1.0 as suggested above works perfectly. So the hardware is good and gstreamer works I suppose. However when I try to create a cv::VideoCapture object with the pipe string as Ankit tried above I can’t connect to the camera (cap.isOpened() returns false). If I give it a 0 (zero) as the parameter it opens OK and can even read an image which is huge (I guess it’s 2592 x 1458) but completely black - all color zero I’d say.

I build and run C++ code following the tutorials at Tutorials | NVIDIA Developer

A simple hello-world example engaging the camera would be a great help for me and a good starting point for many fellow developers. Something like the one at the very end of this video: NVIDIA Jetson OpenCV Tutorials - Episode 2 - YouTube - just a simple piece of code that was tested to work with the CSI camera that comes with the TX1 board. Please.

Thank you!

==========================

below are the version details ::::::::::::::::::::::

R23 (release), REVISION: 1.1, GCID: 6258892, BOARD: t210ref, EABI: hard, DATE: Mon Nov 9 21:23:18 UTC 2015

when i connected a USB webcam able to view in cheese webcam booth.
but unable to open the camera using Opencv Object.

cv::VideoCapture(0);

Please advice !

Hello,
the sample code is provided in URL of #41.
Please read that reply carefully.
note that the on-board camera is a raw-sensor, and it needs openCV-3.x and access the camera through GST pipeline.

br
Chenjian

Hi
Chenjian,
why I am not able to open web camera using “cv::VideoCapture(0)” in my program (using opencv4tegra).

As you said I am installing opencv 3.1.0!
but worrier about the FPS performance with haarcascades!(If you know the performance please post the results)

Will updating to recent jetpack will solve camera my onboard or USB camera problems ?

Hello, hitesh_303:
Current opencv4tegra is 2.4.xx, and it does not support GST-pipeline.

“cv::VideoCapture(0)” can only open USB camera (make sure that /dev/video0 is the right device node the corresponding USB camera.)

For on-board camera, you must use GST-pipeline, as the sample code. (Also, make sure that it link against correct opencv 3-x-x libs.)

As an alternative, you may take a look at Visionworks and check whether it can meet your requirements.

br
Chenjian

I have the same problem
Ctl-C doesn’t work.

The newest version of L4T 28.1 doesn’t open camera with this command:

gst-launch-1.0 nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! nvtee ! nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! nvoverlaysink -e

any solutions?

Thanks!

I am on Jetson Tx1
JetPack 3.1

The following command doesn’t work for me as well:

gst-launch-1.0 nvcamerasrc fpsRange="30.0 30.0" ! 'video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1' ! nvtee ! nvvidconv flip-method=2 ! 'video/x-raw(memory:NVMM), format=(string)I420' ! nvoverlaysink -e

I am afraid if shifting to OpenCV3 will start breaking other pieces.

Will appreciate some advice.

@ShaktiD
Did you use reference board sensor ov5693? There’s no problem for this command on my device by using JetPack 3.1
Please check the sensor driver by v4l2-ctl --list-devices

VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device
VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device
vi-output, imx274 30-001a (platform:15700000.vi:0):
        /dev/video0
        /dev/v4l-subdev1
        /dev/v4l-subdev0

@ShaneCCC

When I use the command, I get the error:
Failed to open /dev/video0

I submitted details on another thread and it seems the issues has been reproduced.

[url]https://devtalk.nvidia.com/default/topic/1019986/jetson-tx1/getting-errors-in-using-onboard-camera-jetpack-3-1-/post/5195290/#5195290[/url]

Did you use reference camera sensor ov5693?

Is there any special command I need to execute?

Mine is the Jetson TX1 development board kit. And the camera I am using is the one there by default.

If there is a need to change the camera sensor, please advice how can I do that?

Shaktid
There’s no special command need to do, in your case seems camera board have problem to be enable.
Did your camera ever working before?

There is something wrong with the L4T 28.1 build the OV5693 camera does not show up on the TX1 development kit. I purchased the TX2 and and TX1 se kit recently. I moved the camera from the TX2 to the TX1 and it does not come up. The TX1 will function with the camera board if you roll back the release to l4t-r24.2.1. I did not try l4t 27.1

hello ShaktiD,

may i have your confirmation about your latest status?
are you able to get your camera sensor works following [url]https://devtalk.nvidia.com/default/topic/1019986/jetson-tx1/getting-errors-in-using-onboard-camera-jetpack-3-1-/post/5203796/#5203796[/url]
thanks

When I run this pipeline, the screen become green, what’s the problem, how to solve it, Thanks!

I flash Jetson TX1 using JetPack 3.1(the newest version), but there is not /dev/video0, What’s the problem? Thanks!

hello liuhuit2006,

may i know which sensor module you’re using?
had you get the sensor works with previous JetPack release?
thanks