Skip to content

Commit 91a8d7a

Browse files
Update README
1 parent 41edce3 commit 91a8d7a

File tree

1 file changed

+39
-23
lines changed

1 file changed

+39
-23
lines changed

README.md

Lines changed: 39 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
# CSI-Camera
2-
Simple example of using a MIPI-CSI(2) Camera (like the Raspberry Pi Version 2 camera) with the NVIDIA Jetson Nano Developer Kit. This is support code for the article on JetsonHacks: https://wp.me/p7ZgI9-19v
2+
Simple example of using a MIPI-CSI(2) Camera (like the Raspberry Pi Version 2 camera) with the NVIDIA Jetson Developer Kits with CSI camera ports. This includes the recent Jetson Nano and Jetson Xavier NX. This is support code for the article on JetsonHacks: https://wp.me/p7ZgI9-19v
33

4-
The camera should be installed in the MIPI-CSI Camera Connector on the carrier board. The pins on the camera ribbon should face the Jetson Nano module, the stripe faces outward.
4+
For the Nanos and Xavier NX, the camera should be installed in the MIPI-CSI Camera Connector on the carrier board. The pins on the camera ribbon should face the Jetson module, the tape stripe faces outward.
55

6-
The new Jetson Nano B01 developer kit has two CSI camera slots. You can use the sensor_mode attribute with nvarguscamerasrc to specify the camera. Valid values are 0 or 1 (the default is 0 if not specified), i.e.
6+
Some Jetson developer kits have two CSI camera slots. You can use the sensor_mode attribute with the GStreamer nvarguscamerasrc element to specify which camera. Valid values are 0 or 1 (the default is 0 if not specified), i.e.
77

88
```
99
nvarguscamerasrc sensor_id=0
@@ -24,20 +24,21 @@ $ gst-launch-1.0 nvarguscamerasrc sensor_id=0 ! \
2424
'video/x-raw(memory:NVMM),width=1920, height=1080, framerate=30/1' ! \
2525
nvvidconv flip-method=0 ! 'video/x-raw,width=960, height=540' ! \
2626
nvvidconv ! nvegltransform ! nveglglessink -e
27+
```
2728

28-
Note: The cameras appear to report differently than show below on some Jetsons. You can use the simple gst-launch example above to determine the camera modes that are reported by the sensor you are using. As an example the same camera from below may report differently on a Jetson Nano B01:
29-
29+
Note: The cameras may report differently than show below. You can use the simple gst-launch example above to determine the camera modes that are reported by the sensor you are using.
30+
```
3031
GST_ARGUS: 1920 x 1080 FR = 29.999999 fps Duration = 33333334 ; Analog Gain range min 1.000000, max 10.625000; Exposure Range min 13000, max 683709000;
32+
```
3133

34+
Also, the display transform may be sensitive to width and height (in the above example, width=960, height=540). If you experience issues, check to see if your display width and height is the same ratio as the camera frame size selected (In the above example, 960x540 is 1/4 the size of 1920x1080).
3235

33-
Also, it's been reported that the display transform is sensitive to width and height (in the above example, width=960, height=540). If you experience issues, check to see if your display width and height is the same ratio as the camera frame size selected (In the above example, 960x540 is 1/4 the size of 1920x1080).
34-
```
3536

36-
There are several examples:
37+
## Samples
3738

3839

3940
### simple_camera.py
40-
simple_camera.py is a Python script which reads from the camera and displays to a window on the screen using OpenCV:
41+
simple_camera.py is a Python script which reads from the camera and displays the frame to a window on the screen using OpenCV:
4142
```
4243
$ python simple_camera.py
4344
```
@@ -52,35 +53,35 @@ Haar Cascades is a machine learning based approach where a cascade function is t
5253
See: https://docs.opencv.org/3.3.1/d7/d8b/tutorial_py_face_detection.html
5354

5455

55-
The third example is a simple C++ program which reads from the camera and displays to a window on the screen using OpenCV:
56-
57-
```
58-
$ g++ -std=c++11 -Wall -I/usr/lib/opencv -I/usr/include/opencv4 simple_camera.cpp -L/usr/lib -lopencv_core -lopencv_highgui -lopencv_videoio -o simple_camera
59-
60-
$ ./simple_camera
61-
```
62-
6356
### dual_camera.py
64-
Note: You will need install numpy for the Dual Camera Python example to work, ie
57+
Note: You will need install numpy for the Dual Camera Python example to work:
6558
```
6659
$ pip3 install numpy
6760
```
68-
The final example is dual_camera.py. This example is for the newer rev B01 of the Jetson Nano type boards (Jetson Nano, Jetson Xavier NX), identifiable by two CSI-MIPI camera ports. This is a simple Python program which reads both CSI cameras and displays them in a window. The window is 1080x540. For performance, the script uses a separate thread for reading each camera image stream. To run the script:
61+
This example is for the newer Jetson boards (Jetson Nano, Jetson Xavier NX) with two CSI-MIPI camera ports. This is a simple Python program which reads both CSI cameras and displays them in one window. The window is 1920x540. For performance, the script uses a separate thread for reading each camera image stream. To run the script:
6962

7063
```
7164
$ python3 dual_camera.py
7265
```
7366

74-
The directory 'instrumented' contains instrumented code which can help adjust performance and frame rates.
67+
### simple_camera.cpp
68+
The last example is a simple C++ program which reads from the camera and displays to a window on the screen using OpenCV:
69+
70+
```
71+
$ g++ -std=c++11 -Wall -I/usr/lib/opencv -I/usr/include/opencv4 simple_camera.cpp -L/usr/lib -lopencv_core -lopencv_highgui -lopencv_videoio -o simple_camera
72+
73+
$ ./simple_camera
74+
```
75+
This program is a simple outline, and does not handle needed error checking well. For better C++ code, use https://github.com/dusty-nv/jetson-utils
7576

7677
<h2>Notes</h2>
7778

7879
<h3>Camera Image Formats</h3>
7980
You can use v4l2-ctl to determine the camera capabilities. v4l2-ctl is in the v4l-utils:
80-
81+
```
8182
$ sudo apt-get install v4l-utils
82-
83-
For the Raspberry Pi V2 camera, typically the output is (assuming the camera is /dev/video0):
83+
```
84+
For the Raspberry Pi V2 camera, a typical output is (assuming the camera is /dev/video0):
8485

8586
```
8687
$ v4l2-ctl --list-formats-ext
@@ -133,6 +134,21 @@ If you can open the camera in GStreamer from the command line, and have issues o
133134

134135
<h2>Release Notes</h2>
135136

137+
v3.2 Release January, 2022
138+
* Add Exception handling to Python code
139+
* Faster GStreamer pipelines, better performance
140+
* Better naming of variables, simplification
141+
* Remove Instrumented examples
142+
* L4T 32.6.1 (JetPack 4.5)
143+
* OpenCV 4.4.1
144+
* Python3
145+
* Tested on Jetson Nano B01, Jetson Xavier NX
146+
* Tested with Raspberry Pi V2 cameras
147+
148+
149+
v3.11 Release April, 2020
150+
* Release both cameras in dual camera example (bug-fix)
151+
136152
v3.1 Release March, 2020
137153
* L4T 32.3.1 (JetPack 4.3)
138154
* OpenCV 4.1.1

0 commit comments

Comments
 (0)