2017年12月4日月曜日

lighttpd 1.4.48 インストール

ロボットコントローラーには、lighttpdを使って

RDCSのRESTモドキや、ロボットのコントロールに活用している。

最新が、1.4.48 になっていたのでインストール

./configure
make
sudo make install

確認すると、

$ lighttpd -v
lighttpd/1.4.48 - a light and fast webserver

めでたし、めでたし、

Peace!!

2017年11月30日木曜日

An installation shell script of OpenCV3.3.0 on Raspberry Pi3

Movidius のインストールスクリプトの中にある
OpenCV3.3.0のスクリプト

このスクリプトは、便利なので自己メモとして、記録

Peace!!


#! /bin/bash

#test for python already installed for opencv
python3 -c "import cv2" > /dev/null 2>&1
if [ $? -eq 0 ] ;
then
        echo "";
        echo "OpenCV already setup for python";
        echo "";
        exit 0
fi;

## Install OpenCV
if [[ `lsb_release -d` =~ .*Raspbian.* ]]
then
        echo ""
        echo "************************ Please confirm *******************************"
        echo " Installing OpenCV on Raspberry Pi may take a long time. "
        echo " You may skip this part of the installation in which case some examples "
        echo " may not work without modifications but the rest of the SDK will still "
        echo " be functional. Select n to skip OpenCV installation or y to install it."
        read -p " Continue installing OpenCV (y/n) ? " CONTINUE
        if [[ "$CONTINUE" == "y" || "$CONTINUE" == "Y" ]]; then
                echo "";
                echo "Installing OpenCV";
                echo "";
                sudo apt-get update -y && sudo apt-get upgrade -y
                sudo apt-get install -y build-essential cmake pkg-config
                sudo apt-get install -y libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
                sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
                sudo apt-get install -y libxvidcore-dev libx264-dev
                sudo apt-get install -y libgtk2.0-dev libgtk-3-dev
                sudo apt-get install -y libatlas-base-dev gfortran
                sudo apt-get install -y python2.7-dev python3-dev

                cd ~
                wget -O opencv.zip https://github.com/Itseez/opencv/archive/3.3.0.zip
                unzip opencv.zip
                wget -O opencv_contrib.zip https://github.com/Itseez/opencv_contrib/archive/3.3.0.zip
                unzip opencv_contrib.zip
                cd ~/opencv-3.3.0/
                mkdir build
                cd build
                cmake -D CMAKE_BUILD_TYPE=RELEASE \
                      -D CMAKE_INSTALL_PREFIX=/usr/local \
                      -D INSTALL_PYTHON_EXAMPLES=OFF \
                      -D ENABLE_NEON=ON \
                      -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.3.0/modules \
                      -D BUILD_EXAMPLES=OFF ..
                make
                sudo make install
                sudo ldconfig
        else
                echo "";
                echo "Skipping OpenCV installation";
                echo "";
        fi
else
        echo "Installing opencv python for non-Raspbian";
        sudo -H pip3 install opencv-python
        sudo -H pip3 install opencv-contrib-python
fi

Nara

ちょっと、接待で、、、

いにしえの奈良

大神神社、長谷寺

疲れた。。。でも綺麗。

最後の写真が、日本らしいかも、、、(^^)/

Peace!








Upgrade Jessie to Stretch

今更感、満載だけど、、、

ロボットのOSを、アップグレードするメモ

apt-get でアップグレードするので、apt関連のファイル設定を変更して実行

(1) バックアップ
僕の場合は、~/prj 以下に全部あるので、、、

tar cvf 171129_prj.tar

history > 171129_history.txt


(2) Jessieを最新版にする

sudo apt-get update && sudo apt-get upgrade -y

(3) 設定ファイルの変更部分を探す

grep jessie /etc/apt/ -R

/etc/apt/sources.list:deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
/etc/apt/sources.list:#deb-src http://archive.raspbian.org/raspbian/ jessie main contrib non-free rpi
/etc/apt/sources.list.d/raspi.list:deb http://archive.raspberrypi.org/debian/ jessie main ui
/etc/apt/sources.list.d/raspi.list:#deb-src http://archive.raspberrypi.org/debian/ jessie main ui

sudo sed -i 's/jessie/stretch/g' /etc/apt/sources.list
sudo sed -i 's/jessie/stretch/g' /etc/apt/sources.list.d/raspi.list

変更の確認
sudo grep stretch /etc/apt/  -R

/etc/apt/sources.list:deb http://mirrordirector.raspbian.org/raspbian/ stretch main contrib non-free rpi
/etc/apt/sources.list:#deb-src http://archive.raspbian.org/raspbian/ stretch main contrib non-free rpi
/etc/apt/sources.list.d/raspi.list:deb http://archive.raspberrypi.org/debian/ stretch main ui
/etc/apt/sources.list.d/raspi.list:#deb-src http://archive.raspberrypi.org/debian/ stretch main ui

(4) 更新
sudo apt-get update

sudo apt-get -y dist-upgrade

途中で、2回、聞いてくるので、y
で、、、小一時間

確認

cat /etc/debian_version
9.1

sudo reboot


最後に、
sudo apt-get -y autoremove


Peace!!

2017年11月25日土曜日

Movidius and PiTF3.5 on Raspberry Pi

MovidiusとAdafruitのPiTFT3.5 をセットアップ

しかし、問題がある。

Movidiusは、Stretchが推奨
PiTFT3.5は、Jessieがサポート対象

という事で、
PiTFT3.5 は、AdafruitのこのURLのEasy Installでインストール
このパッケージは、Jessie

https://learn.adafruit.com/adafruit-pitft-3-dot-5-touch-screen-for-raspberry-pi/easy-install

実は、Stretchで、下のURLの通りに処理したら、逝ってしまった。

https://learn.adafruit.com/adafruit-pitft-3-dot-5-touch-screen-for-raspberry-pi/detailed-install

kernelをdownloadして、そのページある設定をする。

最後に、rpi-upgradeしちゃだめって、出たけどやっちゃた。

で、こんな感じ


まずは、問題なくPiTFT3.5 の設定完了


Movidiusですが、

手順1 TesorFlowをインストールする
手順2 Movidiusのライブラリーインストール
         OpenCV3.3もインストールするけど、途中でY/N聞いてくる

TesorFlowは、ここからdownload

wget https://github.com/lhelontra/tensorflow-on-arm/releases/download/v1.4.0/tensorflow-1.4.0-cp35-none-linux_armv7l.whl

sudo pip3 install tensorflow-1.4.0-cp35-none-linux_armv7l.whl

ここで問題が発生する。
Jessieは、python3.4、よってpip3でエラー発生。
このwhlは、3.5じゃないとダメと怒られる

で、python3.5のbuild&install

sudo apt-get remove python3 python3-dev

wget https://www.python.org/ftp/python/3.5.4/Python-3.5.4.tar.xz

tar xvf Python-3.5.4.tar.xz

cd Python-3.5.4

./configure

make -j4

sudo make install

sudo cp /usr/local/bin/pip3 /usr/bin

sudo ln -s /usr/local/bin/python3.5 /usr/bin/python3

再度

sudo pip3 install tensorflow-1.4.0-cp35-none-linux_armv7l.whl

なんかやっている、、、、OK!

次は、MovidiusのSDK

git clone http://github.com/Movidius/ncsdk && cd ncsdk && make install && make examples

OSは、Jessieではダメだそうです。。。

Movidiusは、Stretch

PiTFT3.5は、Jessie

当面組み合わせられない。。。

Peace!!

2017年9月19日火曜日

An installation of openCV 3.3.0 on raspberry ZERO W stretch

初めての組み合わせ、、、10時間(笑)

OSはStretchにするのが良いのかの議論はありますが、、、

基本、これまでのインストールの手順です。

でも、いろいろあったわけで、


(1) 依存ファイルのインストール

以前
sudo apt-get install -y build-essential git cmake pkg-config cmake-qt-gui mesa-utils  libgl1-mesa-dri libjpeg-dev libtiff5-dev libpng12-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libxvidcore-dev libx264-dev libgtk2.0-dev libprotobuf-dev protobuf-compiler libvtk5-dev libvtk5-qt4-dev python-vtk tcl-vtk  libatlas-base-dev gfortran libeigen3-dev libv4l-dev libqt4-core libqtgui4 libqt4-test libqt4-opengl-dev sphinx-common doxygen



今回、最小限です。かつ、Raspberry Piをセットアップして、


最初の、update, upgrade, raspi-update して、reboot した直後の状態

sudo apt-get -y install build-essential cmake pkg-config cmake-qt-gui git libjpeg-dev libtiff5-dev libjasper-dev libpng12-dev
sudo apt-get -y install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev
sudo apt-get -y install libxvidcore-dev libx264-dev
sudo apt-get -y install  libqtgui4 libqt4-test libqt4-opengl-dev


(2)cmakeは、こんな感じ

cd ~
cd opencv-3.3.0
mkdir build
cd build

cmake -D CMAKE_BUILD_TYPE=RELEASE \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D INSTALL_PYTHON_EXAMPLES=OFF \ -D PLANTUML_JAR=/usr/share/java/plantuml.jar \ -D ENABLE_NEON=OFF \ -D WITH_TBB=OFF -D BUILD_TBB=OFF \ -D WITH_QT=ON -D WITH_OPENGL=OFF \ -D BUILD_opencv_freetype=OFF \ -D BUILD_EXAMPLES=OFF \ -D INSTALL_C_EXAMPLES=OFF ..



(3) makeとインストール

make

10時間待ちます。。。(^^)


sudo make install

sudo ldconfig


(4)確認

cd ~/opencv-3.3.0/samples/cpp

cd ~/opencv-3.3.0/samples/cpp


g++ `pkg-config opencv --cflags --libs` facedetect.cpp -o facedetect

./facedetect  --cascade="../../data/haarcascades/haarcascade_frontalface_alt.xml" --scale=1.5 ../data/lena.jpg

どーーん、peace!!







2017年8月7日月曜日

OpenCV 3.2 Module List (自分用)


ABCD

modulefunctionlink

cappsapps provides various nodes that run internally OpenCV's functionalities

ccalib3dThe functions in this section use a so-called pinhole camera model. In this model, a scene view is formed by projecting 3D points into the image plane using a perspective transformation.
カメラキャリブレーション、ステレオ対応点探索
calib3d

ccore画像・行列データ構造の提供、配列操作、基本図形描画、XMLおよびYAML入出力、コマンドラインパーサー、ユーティリティ機能などcore

cfeatures2d特徴点抽出(ORB、BRISK、FREAKなど)features2d

cflann多次元空間のクラスタリングやサーチ問題flann

chighguiGUI(ウィンドウ表示など)highgui

cimgcodecs画像ファイル入出力imgcodecs

cimgprocフィルター処理、アフィン変換、エッジ検出、ハフ検出、色変換、ヒストグラム計算、ラベリングなどimgproc

cjavajava

cmlSVM、決定木、ブースティング、ニューラルネットワークなどml

cobjdetectオブジェクト検出(顔検出、人体検出など)objdetect

cphoto画像修復、ノイズ除去処理、HDR(High Dynamic Range)合成、画像合成などphoto

cpython2python

cshape形状マッチングshape

cstitchingパノラマ合成stitching

csuperres超解像処理superres

ctsテスト用モジュールts

cvideoオプティカルフロー、カルマンフィルター、背景差分などvideo

cvideoio動画ファイルの入出力、カメラキャプチャなどvideoio

cvideostab手ブレ補正(Video Stabilization)videostab

cviz3Dデータの可視化(内部的にVTKを使用)viz

cworldOpenCV を利用するときには複数のライブラリをリンクする必要があり、world は、その手間を軽減するために作られた、複数のモジュールをまとめた一つのライブラリ。つまりwrapperworld

earucoThis module is dedicated to square fiducial markers (also known as Augmented Reality Markers) These markers are useful for easy, fast and robust camera pose estimation.ARマーカーaruco

ebgsegmThis algorithm combines statistical background image estimation and per-pixel Bayesian segmentation.背景セグメンテーションnbgsegm

ebioinspiredThis class provides the main controls of the Gipsa/Listic labs human retina model. This is a non separable spatio-temporal filter modelling the two main retina information channels.視覚モデルに従う処理bioinspired

eccalibCustom Calibration Pattern for 3D reconstruction
キャリブレーションパターンのカスタム
ccalib

econtrib_worldThe world module is actually a wrapper module that builds the complete openCV module interface, so basically all modules available.contrib_world

edatasetsInterface forinterfacing With existing Computervision databases.
様々なデータセットをダウンロード
datasets

ednnFunctionality of this module is designed only for forward pass computations (i. e. network testing). A network training is in principle not supported.
ディープラーニング
dnn

ednn_modernThe module is wrapper to tiny-dnn, a header only, dependency-free deep learning framework in C++11.dnn_modern

edpmThis is a C++ abstract class, it provides external user API to work with DPM.
デフォマブル パートモデル
dpm

eface顔認識face

efreetypematにtextをマージするfreetype

efuzzyファジーfuzzy

eimg_hash画像の各種ハッシュ処理img_hash

eline_descriptor線記述子line_descriptor

eoptflowオプティカルフロー推定optflow

e
phase_unwrapping
位相アンラッピングphase_unwrapping

eplotグラププロットplot

ereg画像のレジストレーションreg

ergbdRGB+デプス処理rgbd

esaliency顕著性マップsaliency

estereoステレオマッチングstereo

estructured_lightカメラープロジェクション用パターン投影structured_light

e
surface_matching
3次元点マッチングsurface_matching

etext文字認識text

etrackingトラッキングtracking

exfreatures2d拡張特徴量計算モジュールxfeatures2d

eximgproc拡張画像処理モジュールximgproc

exobjdetect拡張物体検出モジュールxobjdetect

exphoto拡張コンピュテーショナルフォトグラフィモジュールxphoto



cnn_3dobj

cvv

dnns_easily_fooled

hdf

matlab

sfm

CUDA