J-EGG500の水深データをGeoTiffに変換しました(補間がいまいち)
秋田港周辺の海底地形を作成したかったので、まず"海底地形データ フリー"で検索したところ
のリンクがありJ-EGG500というデータが日本周辺では定番のようです。早速、日本海洋データセンターのサイトに行ってデータをダウンロードしてきました。
データはこんな感じで説明もあります。
0 39.10205 139.00005 672 0 39.09754 139.00021 736 0 39.09303 139.00038 704 0 39.08852 139.00055 676 0 39.08401 139.00070 669 0 39.07949 139.00087 662 0 39.07498 139.00104 661
点のデータとしてQGISで直接読み込んでみると
それらしい位置に表示されますね。
これを扱いやすいようにGeoTiffに変換しようと検索したところ、結局GDALという地理関連の処理ライブラリで変換するのが主な方法のようです。
このYoutubeビデオ
https://www.youtube.com/watch?v=zLNLG0j13Cw&ab_channel=MakingSenseRemotely
#%% from osgeo import gdal import pandas as pd import numpy as np import os filepath="jodc-depth500mesh-20210728053445.txt" df = pd.read_csv(filepath, sep="\s+", header=None) # Keep only xyz df.drop(columns=[0], inplace=True) df.columns=['x','y','value'] df = df.sort_values(by=['y','x'], ascending=[False, True]) df.to_csv("dem.xyz", index=False, header=None, sep=" ",float_format='%.8f') #demn = gdal.Translate('dem.tif', 'dem.xyz', outputSRS='EPSG:32719') df.to_csv("dem.csv", index=False) if os.path.exists('dem.vrt'): os.remove('dem.vrt') with open("dem.vrt", 'w') as f: f.write("<OGRVRTDataSource>\n \ <OGRVRTLayer name=\"dem\">\n \ <SrcDataSource>dem.csv</SrcDataSource>\n \ <GeometryType>wkbPoint</GeometryType>\n \ <GeometryField encoding=\"PointFromColumns\" x=\"y\" y=\"x\" z=\"value\"/>\n \ </OGRVRTLayer>\n \ </OGRVRTDataSource>") g = gdal.Grid("dem.tif", "dem.vrt", outputSRS="EPSG:4326") g = None
それらしい位置に表示されました。補間の影響と思われる人工的なパターンが見られますがおそらく補間の方法とパラメータの設定で消えそうな感じです。
スクリプトを作成したというより、Youtubeのビデオにあるスクリプトをコピーしただけですね。作者に感謝です。また、こちらの記事も参考になりました。 500mメッシュ水深データをGISで利用する方法 - 自然環境保全のための周辺技術
ランドサットの衛星画像をダウンロードしました
まずは"free satelite image"で検索して上位にあった以下のリンク
15 Free Satellite Imagery Data Sources - GIS Geography
を見てみるとUSGSのサイトでLandsatという衛星の画像がダウンロード出来るようなので
に行ってアカウントを作成しました。
使い方のガイドも合わせてあるので
USGS Earth Explorer: Download Free Landsat Imagery
それを見ながら秋田港の近くを選んで
”Use Map”ボタンを押して範囲を選択、”DataSets”を押して表示された中から”Landsat 8”をチェック、
雲があまり掛かってない画像を選ぶために"Land Cloud Cover"を ”0 to 10”に設定して”Results”を押すと
ダウンロード出来る画像のリストが表示されました。
とりあえずNaturalの画像をダウンロードしてみるとQGISでも無事に読み込めました。
ガイドが親切に全部説明してくれているので思ってたよりも簡単に出来ました。
Delft 3Dを始めてみよう (4) - 付属波の計算例の実行エラーを修正
前回はコンパイルは上手く行ったのですが、例にある波の計算がエラーで出来なかったところでした。
vagrant@ubuntu-bionic:~/delft3d_repository/examples/07_wave$ ./run.sh mdw-file : obw.mdw D3D_HOME : /home/vagrant/delft3d_repository/src/bin/.. Working directory: /home/vagrant/delft3d_repository/examples/07_wave executing: /home/vagrant/delft3d_repository/src/bin/../bin/wave obw.mdw 0 -------------------------------------------------------------------------------- - Delft3D - Deltares, Delft3D-WAVE Version 3.07.00.66656, May 23 2020, 23:01:03 - Open source - -------------------------------------------------------------------------------- *** MESSAGE: Delft3D-WAVE runs stand alone Done reading input Initialising grids and grid mappings Start loop over SWAN grids, time = 0.000 Allocate input fields Allocate and read SWAN depth Write SWAN depth file Deallocate input fields Write SWAN input <<Run SWAN... >>...Check file swan_sh.log /home/vagrant/delft3d_repository/src/bin/../bin/swan_4072ABCDE_del_l64_i11_omp.exe: error while loading shared libraries: libiomp5.so: cannot open shared object file: No such file or directory mv: cannot stat 'PRINT': No such file or directory *** WARNING: unable to run SWAN using "swan.sh". Trying with "swan.bat" ... sh: 1: swan.bat: not found >>...End of SWAN run *** ERROR: file 'norm_end' expected to signal a correct SWAN calculation ERROR: *** ERROR: file 'norm_end' expected to signal a correct SWAN calculation Wave exited abnormally terminate called after throwing an instance of 'char const*' Program received signal SIGABRT: Process abort signal. Backtrace for this error: #0 0x1476a6bdd2ed in ??? #1 0x1476a6bdc503 in ???
エラーメッセージを良くみてみるとlibiomp5.so
というライブラリファイルがないので起動出来ないとなっています。
デルフト3Dのディレクトリ内を探してみるとファイルはあるようなのでPATHが通っていないのが原因のようです。
vagrant@ubuntu-bionic:~/delft3d_repository$ find ./ -name libiomp5.so ./src/third_party_open/swan/bin/linux/libiomp5.so ./src/third_party_open/esmf/lnx64/bin/libiomp5.so
実行スクリプトのrun.sh
をみてみると
vagrant@ubuntu-bionic:~/delft3d_repository/examples/07_wave$ cat run.sh #!/bin/bash ../../src/bin/run_dwaves.sh obw.mdw
別のスクリプト../../src/bin/run_dwaves.sh
を呼んでいるようなので、この中の実行ファイルを呼んでいるあたりをみてみます。
export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH export PATH=$bindir:$PATH echo "executing:" echo "$bindir/wave $mdwfile 0" echo $bindir/wave $mdwfile 0
LD_LIBRARY_PATH
に無理やり先程見つけたファイルのフォルダを追加してみましょう。
export LD_LIBRARY_PATH=$libdir:$LD_LIBRARY_PATH:/home/vagrant/delft3d_repository/src/third_party_open/swan/bin/linux export PATH=$bindir:$PATH echo "executing:" echo "$bindir/wave $mdwfile 0" echo $bindir/wave $mdwfile 0
もう一度計算を実行してみます。
vagrant@ubuntu-bionic:~/delft3d_repository/examples/07_wave$ ./run.sh mdw-file : obw.mdw D3D_HOME : /home/vagrant/delft3d_repository/src/bin/.. Working directory: /home/vagrant/delft3d_repository/examples/07_wave executing: /home/vagrant/delft3d_repository/src/bin/../bin/wave obw.mdw 0 -------------------------------------------------------------------------------- - Delft3D - Deltares, Delft3D-WAVE Version 3.07.00.66656, May 23 2020, 23:01:03 - Open source - -------------------------------------------------------------------------------- *** MESSAGE: Delft3D-WAVE runs stand alone Done reading input Initialising grids and grid mappings Start loop over SWAN grids, time = 0.000 Allocate input fields Allocate and read SWAN depth Write SWAN depth file Deallocate input fields Write SWAN input <<Run SWAN... >>...Check file swan_sh.log >>...End of SWAN run Allocate output fields Read SWAN output Write WAVE map file, nest 1 time 0.000 Time written 0 Write WAVE NetCDF map file, nest 1 time 0.000 Write WAVE NetCDF his file, nest 1 time 0.000 Start loop over SWAN grids, time = 60.000 Allocate input fields Allocate and read SWAN depth Write SWAN depth file Deallocate input fields Write SWAN input <<Run SWAN... >>...Check file swan_sh.log >>...End of SWAN run Allocate output fields Read SWAN output Write WAVE map file, nest 1 time 60.000 Time written 60 Write WAVE NetCDF map file, nest 1 time 60.000 Write WAVE NetCDF his file, nest 1 time 60.000 Delft3D-WAVE finished normally.
正常に計算できました。次回は計算結果をプロットしてみましょう。
Delft 3Dを始めてみよう (3) - netcdfのインストール
NetCDFをソースからインストール
始める前にapt
でインストールしたパッケージをアンインストールしましょう。
vagrant@ubuntu-bionic:~$ sudo apt remove libnetcdf-dev libnetcdff-dev
まずは公式ページを確認します。
https://www.unidata.ucar.edu/software/netcdf/docs/index.html
CバージョンとFortranバージョンが別々のGithubレポジトリで管理されているようです。FortranバージョンをインストールするにはCバージョンが必要なので、まずはCバージョンをダウンロードします。現在の最新版は4.7.4です。
vagrant@ubuntu-bionic:~$ wget https://github.com/Unidata/netcdf-c/archive/v4.7.4.tar.gz
Cバージョンのコンパイルに必要なもの
- For netCDF-4 support
- HDF5 1.8.9 or later.
- HDF5 1.10.1 or later.
- zlib 1.2.5 or later (for netCDF-4 compression)
- curl 7.18.0 or later (for DAP remote access client support)
- For parallel I/O support on classic netCDF files
- PnetCDF 1.6.0 or later
これらをインストールしていきましょう。
zlib
ソースをダウンロードして
vagrant@ubuntu-bionic:~$ wget http://www.zlib.net/zlib-1.2.11.tar.gz
Netcdfのページにあるようにコマンドを実行します。
$ # Build and install zlib $ ZDIR=/usr/local $ ./configure --prefix=${ZDIR} $ make check $ make install # or sudo make install, if root permissions required
問題なくインストールできました。
HDF5
HDF5も同様です。最新版の1.12.xは1.10.xとの互換性が?のようなので1.10.6バージョンをダウンロードします。
vagrant@ubuntu-bionic:~$ wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.6/src/hdf5-1.10.6.tar.gz
で以下のコマンドを実行。
$ # Build and install HDF5 $ H5DIR=/usr/local $ ./configure --with-zlib=${ZDIR} --prefix=${H5DIR} --enable-hl $ make check $ make install # or sudo make install, if root permissions required
問題なくインストールできました。
netcdf-c
インストール
これで準備ができたのでnetcdf-cのフォルダから以下のコマンドを実行します。
$ # Build and install netCDF-4 $ NCDIR=/usr/local $ CPPFLAGS='-I${H5DIR}/include -I${ZDIR}/include' LDFLAGS='-L${H5DIR}/lib -L${ZDIR}/lib' ./configure --prefix=${NCDIR} $ make check $ make install # or sudo make install
ユニットテストが失敗しました。
make[3]: Entering directory '/home/vagrant/netcdf-c-4.7.4/h5_test' FAIL: tst_h_files FAIL: tst_h_files2 FAIL: tst_h_files4 FAIL: tst_h_atts FAIL: tst_h_atts3 FAIL: tst_h_atts4 FAIL: tst_h_vars FAIL: tst_h_vars2 FAIL: tst_h_vars3 FAIL: tst_h_grps FAIL: tst_h_compounds FAIL: tst_h_compounds2 FAIL: tst_h_wrt_cmp FAIL: tst_h_vl FAIL: tst_h_opaques FAIL: tst_h_strings FAIL: tst_h_strings1 FAIL: tst_h_strings2 FAIL: tst_h_ints FAIL: tst_h_dimscales FAIL: tst_h_dimscales1 FAIL: tst_h_dimscales2 FAIL: tst_h_dimscales3 FAIL: tst_h_enums FAIL: tst_h_dimscales4 FAIL: tst_h_rename ============================================================================ Testsuite summary for netCDF 4.7.4 ============================================================================ # TOTAL: 26 # PASS: 0 # SKIP: 0 # XFAIL: 0 # FAIL: 26 # XPASS: 0 # ERROR: 0 ============================================================================ See h5_test/test-suite.log Please report to support-netcdf@unidata.ucar.edu ============================================================================
ライブラリパスの問題だったようです。ドキュメントにも書いてありましたね...
ライブラリパスをHDF5のフォルダに通して
vagrant@ubuntu-bionic:~/netcdf-c-4.7.4$ export LD_LIBRARY_PATH=${H5DIR}/lib:$LD_LIBRARY_PATH
再度、make check
をするとエラーなく終了しました。
sudo make install
で無事インストールされました。Delft 3Dには並列I/Oでのインストールが必要な気もしますがひとまずこれで進めてみましょう。
netcdf-fortran
インストール
Fortranバージョンは以下のリンクの説明のとおりに進めます。
https://www.unidata.ucar.edu/software/netcdf/docs/building_netcdf_fortran.html
vagrant@ubuntu-bionic:~$ wget https://github.com/Unidata/netcdf-fortran/archive/v4.5.2.tar.gz
NFDIR=/usr/local CPPFLAGS=-I${NCDIR}/include LDFLAGS=-L${NCDIR}/lib \ ./configure --prefix=${NFDIR} make check sudo make install
無事インストールされました。
Delft 3Dのインストール再トライ
これでDelft 3Dのインストールができるはずなので再トライします。
vagrant@ubuntu-bionic:~/delft3d_repository/src$ CFLAGS='-O2' CXXFLAGS='-O2' FFLAGS='-O2' FCFLAGS='-O2' ./configure --prefix=`pwd` --with-netcdf --with-mpi --with-metis --with-petsc vagrant@ubuntu-bionic:~/delft3d_repository/src$ make ds-install ... In file included from /usr/include/fcntl.h:290:0, from oc.c:45: In function ‘open’, inlined from ‘open_nefis_file’ at oc.c:1296:19: /usr/include/x86_64-linux-gnu/bits/fcntl2.h:50:4: error: call to ‘__open_missing_mode’ declared with attribute error: open with O_CREAT or O_TMPFILE in second argument needs 3 arguments __open_missing_mode (); ^~~~~~~~~~~~~~~~~~~~~~ Makefile:573: recipe for target 'oc.lo' failed
がエラーで止まってしまいました。
/home/vagrant/delft3d_repository/src/utils_lgpl/nefis/packages/nefis/src/oc.c
の中の
fds = FILE_OPEN( file_name, acType );
の引数が足りないのエラーになっています。
fds = FILE_OPEN( file_name, acType, FILE_MODE );
これはifで分岐している中で、わざわざ引数を変えてるので本当はきちんと直すのがよいのでしょうが...ひとまず足りない引数を適当に足してもう一度コンパイルしてみます。
vagrant@ubuntu-bionic:~/delft3d_repository/src$ make ds-install ... make[1]: Leaving directory '/home/vagrant/delft3d_repository/src' ( \ cd . ; \ ./install.sh /home/vagrant/delft3d_repository/src \ ) oss-install... Prefix : /home/vagrant/delft3d_repository/src Target directory : /home/vagrant/delft3d_repository/src/bin Project : install_all Current directory : /home/vagrant/delft3d_repository/src Source root dir : /home/vagrant/delft3d_repository/src/scripts_lgpl/linux/../.. Gathering dependent libraries . . . Gathering libraries for lib/* ... Gathering libraries for bin/* ... cp: '/home/vagrant/delft3d_repository/src/lib/libdelwaq.so.0' and '/home/vagrant/delft3d_repository/src/lib/libdelwaq.so.0' are the same file cp: '/home/vagrant/delft3d_repository/src/lib/libdimr.so.0' and '/home/vagrant/delft3d_repository/src/lib/libdimr.so.0' are the same file cp: '/home/vagrant/delft3d_repository/src/lib/libgfortran.so.4' and '/home/vagrant/delft3d_repository/src/lib/libgfortran.so.4' are the same file cp: '/home/vagrant/delft3d_repository/src/lib/libgomp.so.1' and '/home/vagrant/delft3d_repository/src/lib/libgomp.so.1' are the same file cp: '/home/vagrant/delft3d_repository/src/lib/libstdc++.so.6' and '/home/vagrant/delft3d_repository/src/lib/libstdc++.so.6' are the same file cp: '/home/vagrant/delft3d_repository/src/lib/libwaq_plugin_wasteload.so.0' and '/home/vagrant/delft3d_repository/src/lib/libwaq_plugin_wasteload.so.0' are the same file
無事にエラーなく終了しました。
これで終わりじゃなかったですね。残りのステップもやりましょう。
"src/bin"フォルダでlibtool_install.sh
を実行します。
vagrant@ubuntu-bionic:~/delft3d_repository/src/bin$ ./libtool_install.sh
1つ目の例は計算できたようですが、
vagrant@ubuntu-bionic:~/delft3d_repository/examples/01_standard$ ./run.sh Configfile : config_d_hydro.xml D3D_HOME : /home/vagrant/delft3d_repository/src/bin/.. Working directory: /home/vagrant/delft3d_repository/examples/01_standard executing: /home/vagrant/delft3d_repository/src/bin/../bin/d_hydro config_d_hydro.xml -------------------------------------------------------------------------------- Deltares, FLOW2D3D Version 6.03.00.66656, May 23 2020, 23:00:46 libflow2d3d.so entry Flow2D3D::Run --------------------------------------------------------------------------------
計算したい肝心の波の方はエラーで終了してしまいました。
vagrant@ubuntu-bionic:~/delft3d_repository/examples/07_wave$ ./run.sh mdw-file : obw.mdw D3D_HOME : /home/vagrant/delft3d_repository/src/bin/.. Working directory: /home/vagrant/delft3d_repository/examples/07_wave executing: /home/vagrant/delft3d_repository/src/bin/../bin/wave obw.mdw 0 -------------------------------------------------------------------------------- - Delft3D - Deltares, Delft3D-WAVE Version 3.07.00.66656, May 23 2020, 23:01:03 - Open source - -------------------------------------------------------------------------------- *** MESSAGE: Delft3D-WAVE runs stand alone Done reading input Initialising grids and grid mappings Start loop over SWAN grids, time = 0.000 Allocate input fields Allocate and read SWAN depth Write SWAN depth file Deallocate input fields Write SWAN input <<Run SWAN... >>...Check file swan_sh.log /home/vagrant/delft3d_repository/src/bin/../bin/swan_4072ABCDE_del_l64_i11_omp.exe: error while loading shared libraries: libiomp5.so: cannot open shared object file: No such file or directory mv: cannot stat 'PRINT': No such file or directory *** WARNING: unable to run SWAN using "swan.sh". Trying with "swan.bat" ... sh: 1: swan.bat: not found >>...End of SWAN run *** ERROR: file 'norm_end' expected to signal a correct SWAN calculation ERROR: *** ERROR: file 'norm_end' expected to signal a correct SWAN calculation Wave exited abnormally terminate called after throwing an instance of 'char const*' Program received signal SIGABRT: Process abort signal. Backtrace for this error: #0 0x1476a6bdd2ed in ??? #1 0x1476a6bdc503 in ??? #2 0x1476a5cb1f1f in ??? #3 0x1476a5cb1e97 in ??? #4 0x1476a5cb3800 in ??? #5 0x1476a6308956 in ??? #6 0x1476a630eae5 in ??? #7 0x1476a630eb20 in ??? #8 0x1476a630ed53 in ??? #9 0x563551ff6ed8 in ??? #10 0x563551f20669 in ??? #11 0x563551f196c6 in ??? #12 0x563551f189fa in ??? #13 0x563551f173ce in ??? #14 0x1476a5c94b96 in ??? #15 0x563551f17409 in ??? #16 0xffffffffffffffff in ??? ../../src/bin/run_dwaves.sh: line 108: 17564 Aborted (core dumped) $bindir/wave $mdwfile 0
OpenMPが見つからないだけのようですが、次回確認して行きます。そもそもSWAN
という波の計算用のFortranプログラムを流してるいるだけっぽいのでSWAN
だけコンパイルして確認するのもいいのかもしれません。
systemdのサービスとしてpythonスクリプトを実行
systemd
のサービスを作るチュートリアルは多々ありますが、説明が少なすぎたり多すぎたりするのが多いのですが丁度良い具合のチュートリアルがありました。
systemd
のサービスを作成するには
* unit ファイルの作成
* サービスを実行可能に設定
する必要があります。
systemd
ユニットファイル
/etc/systemd/system
フォルダに service_name.service
とファイル名で以下のような内容のファイルを作成します。
[Unit] Description=My Systemd service After=multi-user.target [Service] Type=simple ExecStart=/home/pi/my_python.py User=pi WorkingDirectory=/home/pi/ Restart=on-failure [Install] WantedBy=multi-user.target
Description
はサービスの概要です。
is the user-friendly name of the service.
After=multi-user.target
は全てのユーザーがログイン可能になった後で実行する設定です。特に考えず
この設定にしておけば問題ないでしょう。
Type
はサービスをどのように実行するかの設定です。他にもいろいろあるようですが普通のスクリプトを実行するだけのサービスならsimple
で良さそうです。一応、リンク。
ExecStart
には実行したいスクリプトを指定します。実行権限を付けてスクリプトの一行目にshebangを付けておきましょう。
pi@pizero1:~ $chmod +x my_python.py
#!/usr/bin/python3
User
は指定しないとroot
で実行されるので指定しておきましょう。
WorkingDirectory
は実行フォルダを指定します。オプションなので指定しなくても大丈夫です。
Restart=on-failure
はエラーでスクリプトが修了した際にリスタートする設定です。
WantedBy
はブート時にサービスがインストールされ開始可能にする設定です。この設定を使っておけば問題なさそうです。
実行可能に設定
上のユニットファイルを/etc/systemd/system/
フォルダに作成したら、後は
pi@pizero1:~ $ sudo systemctl daemon-reload pi@pizero1:~ $ sudo systemctl enable my_service pi@pizero1:~ $ sudo systemctl start my_service
で実行されます。enable
を設定したのでマシンの起動時に自動的に実行されます。
Delft 3Dを始めてみよう (2) - mpichのインストール
https://oss.deltares.nl/web/delft3d/get-started
前回はmpichとnetcdfをapt
でインストールしたため、Delft3dのインストールが上手く行きませんでした。
今回はまずmpichをソースからインストールしていこうと思います。インストールの手順は公式ホームページに詳しく説明してあるのでそれに沿ってインストールします。
https://www.mpich.org/static/downloads/3.3.2/mpich-3.3.2-installguide.pdf
apt
バージョンのアンインスール
まずは前回apt
でインストールしたパッケージをアンインストールします。
vagrant@ubuntu-bionic:~$ which mpiexec /usr/bin/mpiexec vagrant@ubuntu-bionic:~$ sudo apt remove mpich Reading package lists... Done ... vagrant@ubuntu-bionic:~$ mpiexec -bash: /usr/bin/mpiexec: No such file or directory
前提条件
ソースのダウンロード
vagrant@vagrant:~$ wget http://www.mpich.org/static/downloads/3.3.2/mpich-3.3.2.tar.gz ... 2020-05-13 11:32:58 (3.04 MB/s) - ‘mpich-3.3.2.tar.gz’ saved [27311775/27311775]
コンパイラのインストール
vagrant@vagrant:~$ sudo apt install gcc g++ gfortran
インストール
tar
ファイルの解凍
vagrant@vagrant:~$ tar xfz mpich-3.3.2.tar.gz
ビルドディレクトリの作成
vagrant@vagrant:~$ mkdir -p /tmp/vagrant/mpich-3.3.2
ビルドの設定
Delft 3Dのガイドでは特別なオプションはなかったので全てデフォルトで設定します。
vagrant@vagrant:/tmp/vagrant/mpich-3.3.2$ /home/vagrant/mpich-3.3.2/configure 2>&1 | tee c.txt
ビルド
vagrant@vagrant:/tmp/vagrant/mpich-3.3.2$ make 2>&1 | tee m.txt
インストール
vagrant@vagrant:/tmp/vagrant/mpich-3.3.2$sudo make install 2>&1 | tee mi.txt
ターミナルを別に開いてmpichがインストールされているのを確認出来ました。
vagrant@vagrant:~$ which mpiexec /usr/local/bin/mpiexec
次回はnetcdfをソースからインストールします。
ラスパイゼロでビデオをストリーム配信した際の負荷
パイカメラの公式ドキュメントにあるビデオのストリーム配信した際の負荷です。
実際のコードはこちら。 picamera.readthedocs.io
大体20%くらいの負荷なのでストリーム配信はラスパイゼロで全く問題なさそうですね。"raspberry pi zero stream"とかで検索するとopencvをパイゼロ側で使うのが結構あって、コンパイルとかしたくないな...と思ってたら公式ドキュメントにありました。ラズベリーパイ側でopencvを使う際に役立つリンク。 https://www.pyimagesearch.com/2015/03/30/accessing-the-raspberry-pi-camera-with-opencv-and-python/