English | 한국어 | 日本語 | Tiếng Việt |
Go サンプル
https://github.com/bobhyun/TS-ANPR/tree/main/examples/Go/anpr
1. エンジンファイルのコピー
【参考】 この例では、他のサンプルとエンジンファイルを共有するために examples/bin/
ディレクトリに展開しますが、実際の配布時には通常、アプリケーションの実行ファイルがあるディレクトリにエンジンファイルをコピーします。
- Windows x86 64 ビット
エンジンファイルを
examples/bin/windows-x86_64
ディレクトリに展開unzip tsanpr*-windows-x86_64.zip
- Windows x86 32 ビット
エンジンファイルを
examples/bin/windows-x86
ディレクトリに展開unzip tsanpr*-windows-x86.zip
- Linux x86 64 ビット
エンジンファイルを
examples/bin/linux-x86_64
ディレクトリに展開tar xvf tsanpr*-linux-x86_64.tar.xz
- Linux ARM 64 ビット
エンジンファイルを
examples/bin/linux-aarch64
ディレクトリに展開tar xvf tsanpr*-linux-aarch64.tar.xz
- ディレクトリ構成
examples ├── bin │ ├─── windows-x86_64 # engine directory for windows (x86_64) │ │ ├── libtsanpr.so │ │ ├── tsanpr-2505M.eon │ │ └── tshelper │ ├── linux-x86_64 # engine directory for linux (x86_64) │ │ ├── libtsanpr.so │ │ ├── tsanpr-2505M.eon │ │ └── tshelper │ └── linux-aarch64 # engine directory for linux (arm64) │ ├── libtsanpr.so │ ├── tsanpr-2505M.eon │ └── tshelper ├── img # image directory └── Go └── anpr # source directory ├── anpr # compiled executable for Windows ├── anpr.exe # compiled executable for Linux ├── go.mod ├── main.go └── tsanpr ├── tsanpr_windows.go └── tsanpr_linux.go
2. ビルドと実行
2.1 Windows (MinGW)
-
モジュールの初期化
go mod tidy
-
依存関係のインストール
- GoCV 公式インストールガイドを参照してください。(https://gocv.io/getting-started/windows/)
-
ビルド方法
go build -o anpr.exe main.go
-
実行方法
.\anpr.exe
2.2. Linux
-
モジュールの初期化
go mod tidy
- 依存関係のインストール
- Debian / Ubuntu Linux
sudo apt install -y build-essential g++ libopencv-dev
- Oracle Linux / RedHat (RHEL) / CentOS
sudo dnf install -y epel-release gcc gcc-c++ opencv opencv-devel
- Debian / Ubuntu Linux
-
ビルド方法
go build -o anpr main.go
-
実行方法
./anpr