-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathsimple_csi_test.sh
More file actions
82 lines (71 loc) · 2.75 KB
/
Copy pathsimple_csi_test.sh
File metadata and controls
82 lines (71 loc) · 2.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#!/bin/bash
# Simple test to verify CSI camera and nvarguscamerasrc work
# Run this on the Jetson HOST (not in Docker)
echo "=== Simple CSI Camera Test ==="
echo ""
# Check if running in Docker
if [ -f /.dockerenv ]; then
echo "ERROR: You are running inside Docker!"
echo "nvarguscamerasrc does not work in Docker containers."
echo "Please exit the container and run this on the Jetson host."
exit 1
fi
# Check if nvarguscamerasrc exists
if ! gst-inspect-1.0 nvarguscamerasrc &> /dev/null; then
echo "ERROR: nvarguscamerasrc not found!"
echo ""
echo "Install required packages:"
echo " sudo apt-get update"
echo " sudo apt-get install -y gstreamer1.0-plugins-nvargus nvidia-l4t-gstreamer"
exit 1
fi
echo "✓ nvarguscamerasrc is available"
echo ""
# Test 1: Basic capture with default settings
echo "Test 1: Capturing with default settings..."
gst-launch-1.0 nvarguscamerasrc sensor_id=0 num-buffers=1 ! \
'video/x-raw(memory:NVMM),width=3264,height=2464,framerate=21/1' ! \
nvvidconv ! jpegenc ! filesink location=/tmp/csi_test_default.jpg
if [ -f /tmp/csi_test_default.jpg ]; then
echo "✓ Success! Image saved to /tmp/csi_test_default.jpg"
ls -lh /tmp/csi_test_default.jpg
else
echo "✗ Failed to capture image"
exit 1
fi
echo ""
# Test 2: Capture with low exposure (should be dark)
echo "Test 2: Capturing with LOW exposure (13000ns) and LOW gain (1)..."
gst-launch-1.0 nvarguscamerasrc sensor_id=0 num-buffers=1 \
exposuretimerange="13000 13000" gainrange="1 1" ! \
'video/x-raw(memory:NVMM),width=3264,height=2464,framerate=21/1' ! \
nvvidconv ! jpegenc ! filesink location=/tmp/csi_test_dark.jpg
if [ -f /tmp/csi_test_dark.jpg ]; then
echo "✓ Success! Image saved to /tmp/csi_test_dark.jpg"
ls -lh /tmp/csi_test_dark.jpg
else
echo "✗ Failed to capture image"
fi
echo ""
# Test 3: Capture with high exposure (should be bright)
echo "Test 3: Capturing with HIGH exposure (500000ns) and HIGH gain (8)..."
gst-launch-1.0 nvarguscamerasrc sensor_id=0 num-buffers=1 \
exposuretimerange="500000 500000" gainrange="8 8" ! \
'video/x-raw(memory:NVMM),width=3264,height=2464,framerate=21/1' ! \
nvvidconv ! jpegenc ! filesink location=/tmp/csi_test_bright.jpg
if [ -f /tmp/csi_test_bright.jpg ]; then
echo "✓ Success! Image saved to /tmp/csi_test_bright.jpg"
ls -lh /tmp/csi_test_bright.jpg
else
echo "✗ Failed to capture image"
fi
echo ""
echo "=== Test Complete ==="
echo ""
echo "Compare the images:"
echo " Default: /tmp/csi_test_default.jpg"
echo " Dark: /tmp/csi_test_dark.jpg"
echo " Bright: /tmp/csi_test_bright.jpg"
echo ""
echo "If the dark and bright images look the same, the camera may be"
echo "ignoring manual exposure/gain settings (auto-exposure is active)."