Skip to the content.
English 한국어 日本語 Tiếng Việt

C++ 예제

https://github.com/bobhyun/TS-ANPR/tree/main/examples/C%2B%2B/anpr

1. 엔진 파일 복사

[참고] 이 예제의 경우 다른 예제들과 엔진 파일을 공유하기 위해 examples/bin/ 디렉토리에 압축 해제하지만 실제 배포시는 일반적으로 응용 프로그램의 실행 파일이 있는 디렉토리에 엔진 파일을 복사합니다.

2. 빌드 및 실행 방법

  1. Windows 64bit (MSVC, x64 Native Tools Command Prompt)

    mkdir build\windows-x86_64
    cd build\windows-x86_64
    
    # vcpkg 설치
    git clone https://github.com/microsoft/vcpkg.git
    cd vcpkg
    bootstrap-vcpkg.bat
    
    # opencv 설치
    vcpkg install opencv:x64-windows
    cd ..
    
    cmake ../.. -G "Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
    cmake --build . --config Debug   # Debug build
    cmake --build . --config Release # Release build
    cd ..\..
    
    # 윈도우즈에서 non-ASCII 문자가 깨지는 경우 실행
    chcp 65001
    
    # Run
    bin\windows-x86_64\Debug\anpr.exe
    bin\windows-x86_64\Release\anpr.exe
    
  2. Windows 32bit (MSVC, x86 Native Tools Command Prompt)

    mkdir build\windows-x86
    cd build\windows-x86
    
    # vcpkg 설치
    git clone https://github.com/microsoft/vcpkg.git
    cd vcpkg
    bootstrap-vcpkg.bat
    
    # opencv 설치
    vcpkg install opencv:x86-windows
    cd ..
    
    cmake ../.. -G "Visual Studio 17 2022" -A Win32  -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake
    cmake --build . --config Debug   # Debug build
    cmake --build . --config Release # Release build
    cd ..\..
    
    # 윈도우즈에서 non-ASCII 문자가 깨지는 경우 실행
    chcp 65001
    
    # Run
    bin\windows-x86\Debug\anpr.exe
    bin\windows-x86\Release\anpr.exe
    
  3. Windows MinGW64 (MSYS2)

    # 종속성 설치
    pacman -Syu
    pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-g++ mingw-w64-x86_64-opencv
    
    mkdir -p build/mingw-x86_64
    cd build/mingw-x86_64
    
    # build
    cmake ../.. -G "MinGW Makefiles"
    mingw32-make
    cd ../..
    
    # Run
    bin/mingw-x86_64/anpr
    
  4. Windows MinGW32 (MSYS2)

    # 종속성 설치
    pacman -Syu
    pacman -S mingw-w64-i686-gcc mingw-w64-i686-g++ mingw-w64-i686-opencv
    
    mkdir -p build/mingw-x86
    cd build/mingw-x86
    
    # build
    cmake ../.. -G "MinGW Makefiles"
    mingw32-make
    cd ../..
    
    # Run
    bin/mingw-x86/anpr
    
  5. Linux x86_64

    # 종속성 설치
    # Debian / Ubuntu Linux
    sudo apt update
    sudo apt install build-essential libopencv-dev
    
    # Oracle Linux / RedHat (RHEL) / CentOS
    sudo yum install epel-release
    sudo yum install gcc g++ make opencv opencv-devel
    
    mkdir -p build/linux-x86_64
    cd build/linux-x86_64
    
    # Debug build
    cmake ../.. -DCMAKE_BUILD_TYPE=Debug
    make
    
    # Release build
    cmake ../.. -DCMAKE_BUILD_TYPE=Release
    make
    cd ../..
    
    # Run
    bin/linux-x86_64/anpr
    
  6. Linux aarch64 (ARM64)

    # 종속성 설치
    # Debian / Ubuntu Linux
    sudo apt update
    sudo apt install libopencv-dev
    
    # Oracle Linux / RedHat (RHEL) / CentOS
    sudo yum install epel-release
    sudo yum install gcc g++ make opencv opencv-devel
    
    mkdir -p build/linux-aarch64
    cd build/linux-aarch64
    
    # Debug build
    cmake ../.. -DCMAKE_BUILD_TYPE=Debug
    make
    
    # Release build
    cmake ../.. -DCMAKE_BUILD_TYPE=Release
    make
    cd ../..
    
    # Run
    bin/linux-aarch64/anpr