星期五, 4月 26, 2019

raw camera image


pybind and python-opencv-gstreamer-examples

C++ 回傳mat 給Python





gst-launch-1.0



gst-launch-1.0 v4l2src device=/dev/video1 ! 'video/x-raw, format=YUY2, width=1280, height=800'
, pixel-aspect-ratio=1/1, interlace-mode=progressive, framerate=15/1' ! xvimagesink -ev




TX2 onboard ok
 gst-launch-1.0 nvcamerasrc ! 'video/x-raw(memory:NVMM),width=640, height=480, framerate=30/1, format=NV12' ! nvvidconv flip-method=2 ! nvegltransform ! nveglglessink -e



  1. custom camera driver with gstreamer v4l2src
    1. https://devtalk.nvidia.com/default/topic/1038169/jetson-tx1/custom-camera-driver-with-gstreamer-v4l2src/
  2. How to use Gstreamer1.0 V4L2src to capture on-board ov5693 sensor
    1. https://devtalk.nvidia.com/default/topic/929493/jetson-tx1/how-to-use-gstreamer1-0-v4l2src-to-capture-on-board-ov5693-sensor/

星期四, 4月 25, 2019

python call C

https://www.zhihu.com/question/23003213

如何实现 C/C++ 与 Python 的通信?

GST rtsp server





  1. sudo apt-get install libgstrtspserver-1.0 libgstreamer1.0-dev
  2. test-launch.c @ https://github.com/GStreamer/gst-rtsp-server/blob/master/examples/test-launch.c
  3. gcc test-launch.c -o test-launch $(pkg-config --cflags --libs gstreamer-1.0 gstreamer-rtsp-server-1.0)
onboard:
  1. ./test-launch "videotestsrc ! omxh265enc ! rtph265pay name=pay0 pt=96"
  2. ./test-launch "nvcamerasrc ! video/x-raw(memory:NVMM), format=I420, framerate=30/1, width=1920, height=1080 ! omxh265enc bitrate=30000000 ! rtph265pay name=pay0 pt=96 "
  3. # H264
    1. ./test-launch "( nvcamerasrc ! video/x-raw(memory:NVMM), width=(int)1920, height=(int)1080, format=(string)I420, framerate=(fraction)30/1 ! omxh264enc bitrate=20000000 ! video/x-h264, profile=baseline ! rtph264pay name=pay0 pt=96 )"

usb:
  1. ./test-launch "v4l2src device=/dev/video1 ! video/x-raw,format=YUY2 ! nvvidconv ! video/x-raw(memory:NVMM),width=2560,height=720,format=I420 ! omxh265enc ! rtph265pay name=pay0 pt=96"



Reference:

星期二, 4月 16, 2019

tx2 powerup and unblank

https://elinux.org/Jetson_TX2/r28_Display_debug
#sudo nvpmodel -m0
#sudo /home/nvidia/jetson_clocks.sh

echo 0 > /sys/class/graphics/fb0/blank

tx2 bootloader mmc interface

 ls mmc 0:1 /etc/sudoers.d/
ext4write mmc 0:1 0 /etc/sudoers.d/www-data
ext4ls mmc 0:1 0 /etc/sudoers.d/www-data
ext4ls mmc 0:1 /etc/sudoers.d/
ext4write mmc 0:1 0 /etc/sudoers.d/www-data 0

星期五, 4月 12, 2019

TX2 wifi wireless env setting

https://askubuntu.com/questions/412325/automatically-connect-to-a-wireless-network-using-cli
https://unix.stackexchange.com/questions/383338/configuring-devices-wifi-settings-through-ssh

/etc/network/interfaces
auto wlan0
iface wlan0 inet static
address ASSIGNED_IP
netmask 255.255.255.0
gateway THE_GATEWAY
wireless-essid YOURSSID
wireless-key WIRELESSKEY_HERE
auto lo
iface lo inet loopback

auto wlan0
iface wlan0 inet static
address 192.168.1.150
netmask 255.255.255.0
gateway 192.168.1.1
wpa-essid SSID_Name
wpa-psk XXXXX
dns-nameservers 8.8.8.8 192.168.1.1

new TX2 storage


new TX2 storage



nvidia@tegra-ubuntu:~$ df
Filesystem     1K-blocks    Used Available Use% Mounted on
/dev/root       28768380 5936116  21347876  22% /
devtmpfs         7972328       0   7972328   0% /dev
tmpfs            8039124       0   8039124   0% /dev/shm
tmpfs            8039124   17472   8021652   1% /run
tmpfs               5120       4      5116   1% /run/lock
tmpfs            8039124       0   8039124   0% /sys/fs/cgroup
tmpfs             803916       0    803916   0% /run/user/1001



Disk /dev/mmcblk0: 29.1 GiB, 31268536320 bytes, 61071360 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: 00000000-0000-0000-0000-000000000000

Device             Start      End  Sectors   Size Type
/dev/mmcblk0p1      4097 58724352 58720256    28G Microsoft basic data
/dev/mmcblk0p2  58724353 58732544     8192     4M Microsoft basic data
/dev/mmcblk0p3  58732545 58733056      512   256K Microsoft basic data
/dev/mmcblk0p4  58733057 58734080     1024   512K Microsoft basic data
/dev/mmcblk0p5  58734081 58740224     6144     3M Microsoft basic data
/dev/mmcblk0p6  58740225 58740228        4     2K Microsoft basic data
/dev/mmcblk0p7  58740229 58741436     1208   604K Microsoft basic data
/dev/mmcblk0p8  58741437 58742436     1000   500K Microsoft basic data
/dev/mmcblk0p9  58742437 58746532     4096     2M Microsoft basic data
/dev/mmcblk0p10 58746533 58758820    12288     6M Microsoft basic data
/dev/mmcblk0p11 58758821 58762916     4096     2M Microsoft basic data
/dev/mmcblk0p12 58762917 59025060   262144   128M Microsoft basic data
/dev/mmcblk0p13 59025061 59090596    65536    32M Microsoft basic data
/dev/mmcblk0p14 59090597 59221668   131072    64M Microsoft basic data
/dev/mmcblk0p15 59221669 59222692     1024   512K Microsoft basic data
/dev/mmcblk0p16 59222693 59746980   524288   256M Microsoft basic data
/dev/mmcblk0p17 59746981 61071326  1324346 646.7M Microsoft basic data




Disk /dev/mmcblk0boot1: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mmcblk0boot0: 4 MiB, 4194304 bytes, 8192 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


nvidia@tegra-ubuntu:~$ uname -a
Linux tegra-ubuntu 4.4.38-tegra #1 SMP PREEMPT Fri Jul 28 09:55:22 PDT 2017 aarch64 aarch64 aarch64 GNU/Linux





python pip install online/offline

http://imshuai.com/python-pip-install-package-offline-tensorflow/

机器架构完全相同

pip download tensorflow
pip install --no-index --find-links=file:/offline_package_dir tensorflow

星期四, 4月 11, 2019

ubuntu init.d runlevel update-rc.d

Ubuntu startup script
http://felix-lin.com/linux/debianubuntu-%E6%96%B0%E5%A2%9E%E9%96%8B%E6%A9%9F%E8%87%AA%E5%8B%95%E5%9F%B7%E8%A1%8C%E7%A8%8B%E5%BC%8F/

/etc/init.d/blah
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /bin/sh
# /etc/init.d/blah
#
 
# Some things that run always
touch /var/lock/blah
 
# Carry out specific functions when asked to by the system
case "$1" in
  start)
    echo "Starting script blah "
    echo "Could do more here"
    ;;
  stop)
    echo "Stopping script blah"
    echo "Could do more here"
    ;;
  *)
    echo "Usage: /etc/init.d/blah {start|stop}"
    exit 1
    ;;
esac
 
exit 0


update-rc.d blah defaults
update-rc.d blah start 20 2 3 4 . stop 80 0 1 6 .
start 20th in 2/3/4 runlevel
update-rc.d -f blah remove