/theta-termux-node

NodeJS application running inside RICOH THETA with Termux. Control camera with API and process images internally

Primary LanguageHTML

oppkey node server

THETA Termux Node - Run an image server inside your THETA

This is a technology demonstration and not usable in production. The code is for education only to learn fundamental concepts about the RICOH THETA camera and 360 image processing.

Access Image Filesystem Directly

Program running on the camera can access /sdcard/DCIM/100RICOH/ files directly.

Thumbnails Thumbnails created by accessing camera filesystem and reducing from 8.8MB to 4kB.

Access Camera Wi-Fi API from Inside the Camera

Node has can access the default internal web server of your THETA at localhost:8080 (only accessible from plug-in running inside the camera)

Image Listing

Run a node server inside of the RICOH THETA V and Z1

See these articles:

Use Bootstrap and CSS to Create Buttons to Control the Camera

Access CSS, JavaScript, and HTML snippets.

gui

gui2

Image Processing with gm

The graphics processing is handled with GraphicsMagick. See gm node module for more information.

Cartoon transform

Oil paint transform

Negative transform

Image File Size Reduction

Image Use Case File Size Dimensions Compression
Original file from Z1 8.8MB 6720x3360px Original JPG
Web gallery 750kB 6720x3360px Lossy JPEG 30% quality
thumbnail 4kB 200x100px JPEG

Example:

Reduce quality to 30%.

	gm('/sdcard/DCIM/100RICOH/FILENAM.JPG')
	.quality(30)

Autostart Node

Get Termux:Boot from F-Droid

Create a new file ~/.termux/boot/startup and add add these lines:

#!/data/data/com.termux/files/usr/bin/sh
/data/data/com.termux/files/usr/bin/node /data/data/com.termux/files/home/Development/theta-termux-node/index.js

Make sure you have the full path of node index.js. The node command and the index.js file name need to be on the same path.

Adjust the path to the location of your index.js file

.bashrc

sshd
alias l='ls -F'
alias la='ls -a'
alias ll='ls -l'
array=$(ip -4 a | grep inet | grep wlan0 | grep -oP '[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(?=\/)')
echo $array
am broadcast -a com.theta360.plugin.ACTION_OLED_TEXT_SHOW -e text-middle 'Oppkey Node Server'
am broadcast -a com.theta360.plugin.ACTION_OLED_TEXT_SHOW -e text-bottom $array