Kameie
Schema
Protocol
Authentication
{ "pin": "00000000" } { "success": [true|false] }
Pin is the password (hardcoded in the software).
Manual commands
{ "command": "[preview|save|rugosity|colorChange|bubbles]", "msgId": I, "camera": J, ["prefix": "KKK"], ["left": L], ["right": M], ["junction": [true|false]] } { "success": [true|false], "communicationId": I, "camera": J, ["errorCode": N], ["avgIntensity": O], ["maxIntensity": P], ["extension": Q], ["redDiff": R], ["greenDiff": S], ["blueDiff": T], ["number": U], ["maxDimension": V] }
Preview: optional prefix.
Save: optional prefix.
Rugosity: returns avgIntensity, maxIntensity, extension.
ColorChange: optional left, right, junction. Returns redDiff, greenDiff, blueDiff.
Bubbles: returns number, maxDimension.
Configuration commands
{ "settings": "[setDutyCycles|pwmOn|pwmOff]", "msgId": I, "pwmId": J, ["white": K], ["red": L], ["green": M], ["blue": N] } { "success": [true|false], "communicationId": I, "pwmId": J, ["errorCode": N] }
Automatic commands
{ "gpioCommand": "[save]", "camera": I, "gpio": J, "sequence": K } { "event": L, "camera": I, "severity": [0|1|2], ["filename": "MMM"], ["sequence": N] }
GpioCommand comes from GpioInterrupt.
Save: severity = 0.
Build Howto
Prerequisites: having an Opencv environment (see the corrispondent section).
NOTE: OpenCV should be compiled from sources in order to have a decent version (packetized versions are 2.x).
Create the directory /root/Kameie/ ,
mkdir /root/Kameie
and copy the following files to it:
*.cpp *.h Kameie.pro
Convert them to unix format
dos2unix /root/Kameie/*
Then, edit Kameie.pro, and change the include from
INCLUDEPATH += C:\OpenCV\build\include LIBS += C:\OpenCV\opencv-build\bin\libopencv_core411.dll LIBS += C:\OpenCV\opencv-build\bin\libopencv_highgui411.dll LIBS += C:\OpenCV\opencv-build\bin\libopencv_imgcodecs411.dll LIBS += C:\OpenCV\opencv-build\bin\libopencv_imgproc411.dll LIBS += C:\OpenCV\opencv-build\bin\libopencv_features2d411.dll LIBS += C:\OpenCV\opencv-build\bin\libopencv_calib3d411.dll LIBS += C:\OpenCV\opencv-build\bin\libopencv_videoio411.dll
to
INCLUDEPATH += /usr/local/include LIBS += /usr/local/lib/libopencv_core.so LIBS += /usr/local/lib/libopencv_highgui.so LIBS += /usr/local/lib/libopencv_imgcodecs.so LIBS += /usr/local/lib/libopencv_imgproc.so LIBS += /usr/local/lib/libopencv_features2d.so LIBS += /usr/local/lib/libopencv_calib3d.so LIBS += /usr/local/lib/libopencv_videoio.so
NOTE: if you installed more than one version of OpenCV, you should find more than one file per module in /usr/local/lib:
libopencv-abc.so -> libopencv-abc.so.x.y -> libopencv-abc.so.x.y.z
so if you want to use a library version different from the default, you should specify it in the Kameie.pro file. Es.
LIBS += /usr/local/lib/libopencv_core.so.4.1
(all lines must poit to the same version).
IMPORTANT NOTE: kameie doen't compile on version 4.1.1 on friendlyelec. Maybe it was built with 3.4 version.
Edit /etc/ld.so.conf, and add
/usr/local/lib
and load it
ldconfig -v
Configurarion files
Edit led.conf. This is mainly used for pwv of illuminators, and automatic capture/signals. If you don'use them, set to 0 all 3 4 pwm lines (white, red, green, blue) and the IN and OUT pins.
The cameras are automatically detected. Edit globals.cpp for MAX_CAMERAS and FIRST_CAMERAS. Boards with integrated camera interfaces use and create one or 2 interfaces even if the cameras aren't connected.
Friendlyelec boards use video4linux, so kameie scans for /sys/class/video4linux/video* links both for USB and dedicated interfaces. Also keep in mind thet sometimes links are duplicated (that is, once you connect the USB camera, 2 links appear instead than one, but only one of them - usually the second - is the good one. Look code of cameraloader.cpp for details).