raspberry_pi_4のセットアップ_raspberry_pi_os編
差分
このページの2つのバージョン間の差分を表示します。
| 両方とも前のリビジョン前のリビジョン次のリビジョン | 前のリビジョン | ||
| raspberry_pi_4のセットアップ_raspberry_pi_os編 [2022/05/28 16:18] – [OpenCVのインストール] makotoa67 | raspberry_pi_4のセットアップ_raspberry_pi_os編 [2022/05/29 19:01] (現在) – [OpenCVのインストール] makotoa67 | ||
|---|---|---|---|
| 行 76: | 行 76: | ||
| ``` | ``` | ||
| - | sirius@raspberrypi: | + | $ pip3 install opencv-python |
| Looking in indexes: https:// | Looking in indexes: https:// | ||
| Collecting opencv-python | Collecting opencv-python | ||
| 行 84: | 行 84: | ||
| Installing collected packages: opencv-python | Installing collected packages: opencv-python | ||
| Successfully installed opencv-python-4.5.5.64 | Successfully installed opencv-python-4.5.5.64 | ||
| - | sirius@raspberrypi: | + | $ pip3 install numpy --upgrade |
| Looking in indexes: https:// | Looking in indexes: https:// | ||
| Requirement already satisfied: numpy in / | Requirement already satisfied: numpy in / | ||
| 行 94: | 行 94: | ||
| Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. | Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. | ||
| Successfully installed numpy-1.22.4 | Successfully installed numpy-1.22.4 | ||
| + | $ sudo apt install libatlas3-base | ||
| + | パッケージリストを読み込んでいます... 完了 | ||
| + | 依存関係ツリーを作成しています... 完了 | ||
| + | 状態情報を読み取っています... 完了 | ||
| + | 以下のパッケージが自動でインストールされましたが、もう必要とされていません: | ||
| + | libfuse2 | ||
| + | これを削除するには 'sudo apt autoremove' | ||
| + | 以下のパッケージが新たにインストールされます: | ||
| + | libatlas3-base | ||
| + | アップグレード: | ||
| + | 2,278 kB のアーカイブを取得する必要があります。 | ||
| + | この操作後に追加で 9,160 kB のディスク容量が消費されます。 | ||
| + | 取得:1 http:// | ||
| + | 2,278 kB を 0秒 で取得しました (4,986 kB/s) | ||
| + | 以前に未選択のパッケージ libatlas3-base: | ||
| + | (データベースを読み込んでいます ... 現在 103232 個のファイルとディレクトリがインストールされています。) | ||
| + | .../ | ||
| + | libatlas3-base: | ||
| + | libatlas3-base: | ||
| + | update-alternatives: | ||
| + | update-alternatives: | ||
| + | libc-bin (2.31-13+rpt2+rpi1+deb11u2) のトリガを処理しています ... | ||
| + | ``` | ||
| + | |||
| + | 上記のやり方でインストールされたOpenCVのバージョンを確認してみた。 | ||
| + | |||
| + | ``` | ||
| + | $ python3 -c ' | ||
| + | |||
| + | General configuration for OpenCV 4.5.5 ===================================== | ||
| + | Version control: | ||
| + | |||
| + | Platform: | ||
| + | Timestamp: | ||
| + | Host: Linux 4.9.140-tegra aarch64 | ||
| + | CMake: | ||
| + | CMake generator: | ||
| + | CMake build tool: /bin/gmake | ||
| + | Configuration: | ||
| + | |||
| + | CPU/HW features: | ||
| + | Baseline: | ||
| + | |||
| + | C/C++: | ||
| + | Built as dynamic libs?: | ||
| + | C++ standard: | ||
| + | C++ Compiler: | ||
| + | C++ flags (Release): | ||
| + | C++ flags (Debug): | ||
| + | C Compiler: | ||
| + | C flags (Release): | ||
| + | C flags (Debug): | ||
| + | Linker flags (Release): | ||
| + | Linker flags (Debug): | ||
| + | ccache: | ||
| + | Precompiled headers: | ||
| + | Extra dependencies: | ||
| + | 3rdparty dependencies: | ||
| + | |||
| + | OpenCV modules: | ||
| + | To be built: | ||
| + | Disabled: | ||
| + | Disabled by dependency: | ||
| + | Unavailable: | ||
| + | Applications: | ||
| + | Documentation: | ||
| + | Non-free algorithms: | ||
| + | |||
| + | GUI: QT5 | ||
| + | QT: YES (ver 5.15.0 ) | ||
| + | QT OpenGL support: | ||
| + | GTK+: NO | ||
| + | VTK support: | ||
| + | |||
| + | Media I/O: | ||
| + | ZLib: / | ||
| + | JPEG: libjpeg-turbo (ver 2.1.2-62) | ||
| + | WEBP: build (ver encoder: 0x020f) | ||
| + | PNG: build (ver 1.6.37) | ||
| + | TIFF: build (ver 42 - 4.2.0) | ||
| + | JPEG 2000: build (ver 2.4.0) | ||
| + | OpenEXR: | ||
| + | HDR: YES | ||
| + | SUNRASTER: | ||
| + | PXM: YES | ||
| + | PFM: YES | ||
| + | |||
| + | Video I/O: | ||
| + | DC1394: | ||
| + | FFMPEG: | ||
| + | avcodec: | ||
| + | avformat: | ||
| + | avutil: | ||
| + | swscale: | ||
| + | avresample: | ||
| + | GStreamer: | ||
| + | v4l/ | ||
| + | |||
| + | Parallel framework: | ||
| + | |||
| + | Trace: | ||
| + | |||
| + | Other third-party libraries: | ||
| + | Lapack: | ||
| + | Eigen: | ||
| + | Custom HAL: YES (carotene (ver 0.0.1)) | ||
| + | Protobuf: | ||
| + | |||
| + | OpenCL: | ||
| + | Include path: / | ||
| + | Link libraries: | ||
| + | |||
| + | Python 3: | ||
| + | Interpreter: | ||
| + | Libraries: | ||
| + | numpy: | ||
| + | install path: python/ | ||
| + | |||
| + | Python (for build): | ||
| + | |||
| + | Java: | ||
| + | ant: NO | ||
| + | JNI: NO | ||
| + | Java wrappers: | ||
| + | Java tests: | ||
| + | |||
| + | Install to: / | ||
| + | ----------------------------------------------------------------- | ||
| + | ``` | ||
| + | |||
| + | この後は、 | ||
| + | |||
| + | [カメラモジュールを使ってOpenCVでキャプチャする](https:// | ||
| + | |||
| + | を参考に。レガシーカメラスタックを有効にすると、こちらの世界は動作するが、libcamera-helloなどは動作しなくなる。 | ||
| + | |||
| + | ``` | ||
| + | $ libcamera-hello -t 0 --rotation 180 | ||
| + | ERROR: the system appears to be configured for the legacy camera stack | ||
| + | ``` | ||
| + | |||
| + | C++向けのOpenCV環境も作りたいが、パッケージ化されていない?ひとまず、ソースからビルドする案内をしているページを載せておく。 | ||
| + | |||
| + | [OpenCV + OpenCV Contribをビルド 【Raspberry Pi OS編】](https:// | ||
| + | |||
| + | opencv-pythonでインストールされたバージョン(4.5.5)に合わせて、基本的に、上記サイトを参考にしてダウンロードして展開。 | ||
| + | |||
| + | ``` | ||
| + | $ sudo apt update | ||
| + | $ sudo apt upgrade | ||
| + | $ sudo apt install cmake libgtk2.0-dev libjpeg-dev libpng-dev | ||
| + | $ wget https:// | ||
| + | $ wget https:// | ||
| + | $ gzip -d -c opencv.tar.gz |tar xvf - | ||
| + | $ gzip -d -c opencv_contrib.tar.gz |tar xvf - | ||
| + | ``` | ||
| + | |||
| + | カーネルをビルドしたときに熱で落ちたりしたことがあるので、一応、 | ||
| + | |||
| + | ``` | ||
| + | #!/bin/sh | ||
| + | |||
| + | while true | ||
| + | do | ||
| + | echo temparature: | ||
| + | sleep 1 | ||
| + | done | ||
| + | ``` | ||
| + | |||
| + | などというスクリプトで温度をモニタリングしながら、以下でビルド。 | ||
| + | |||
| + | ``` | ||
| + | $ cd opencv-4.5.5 | ||
| + | $ mkdir build | ||
| + | $ cd build | ||
| + | $ cmake -DOPENCV_EXTRA_MODULES_PATH=../ | ||
| + | $ make -j4 | ||
| + | $ sudo make install | ||
| + | $ sudo ldconfig | ||
| ``` | ``` | ||
raspberry_pi_4のセットアップ_raspberry_pi_os編.1653722325.txt.gz · 最終更新: 2022/05/28 16:18 by makotoa67