English | 한국어 | 日本語 | Tiếng Việt |
Ví dụ Go
https://github.com/bobhyun/TS-ANPR/tree/main/examples/Go/anpr
1. Sao chép tệp Engine
[Lưu ý] Trong ví dụ này, tệp engine được giải nén vào thư mục examples/bin/ để chia sẻ với các ví dụ khác. Tuy nhiên, khi triển khai thực tế, tệp engine thường được sao chép vào thư mục chứa tệp thực thi của ứng dụng.
- Windows x86 64-bit
Giải nén tệp engine vào thư mục
examples/bin/windows-x86_64
unzip tsanpr*-windows-x86_64.zip
- Windows x86 32-bit
Giải nén tệp engine vào thư mục
examples/bin/windows-x86
unzip tsanpr*-windows-x86.zip
- Linux x86 64-bit
Giải nén tệp engine vào thư mục
examples/bin/linux-x86_64
tar xvf tsanpr*-linux-x86_64.tar.xz
- Linux ARM 64-bit
Giải nén tệp engine vào thư mục
examples/bin/linux-aarch64
tar xvf tsanpr*-linux-aarch64.tar.xz
- Cấu trúc thư mục
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. Biên dịch và chạy
2.1 Windows
-
Khởi tạo module
go mod tidy
-
Cài đặt phụ thuộc
- Tham khảo hướng dẫn cài đặt chính thức của GoCV. (https://gocv.io/getting-started/windows/)
-
Cách biên dịch
go build -o anpr.exe main.go
-
Cách chạy
.\anpr.exe
2.2. Linux
-
Khởi tạo module
go mod tidy
- Cài đặt phụ thuộc
- 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
-
Cách biên dịch
go build -o anpr main.go
-
Cách chạy
./anpr