Difference between revisions of "Kameie"

From wiki.ferrari.mo.it
Jump to navigation Jump to search
Line 44: Line 44:
  
 
Prerequisites: having an Opencv environment (see the corrispondent section).
 
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/ ,
 
Create the directory /root/Kameie/ ,
Line 82: Line 84:
 
  LIBS += /usr/local/lib/libopencv_calib3d.so
 
  LIBS += /usr/local/lib/libopencv_calib3d.so
 
  LIBS += /usr/local/lib/libopencv_videoio.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
 
Edit /etc/ld.so.conf, and add

Revision as of 10:00, 27 November 2021

Schema

Kameie.png

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 compile it

ldconfig -v