Leaper Vision Toolkit
中文 / English 2.x
Quick Guide - MacOS

Requirements

LPV runs on MacOS 10 or later, either Intel or Apple M-seres processors. For more details, see Supported Platforms and Minimum System Requirements page.

Install

Download then extract the lpv_sdk_x.x.x.x_linux_arch.tar.gz file to any directory.

Install x86_64 Package

mkdir lpv & tar -xf lpv_sdk_x.x.x.x_linux_x86_64.tar.gz -C lpv

Install arm64 Package

mkdir lpv & tar -xf lpv_sdk_x.x.x.x_linux_arm64.tar.gz -C lpv

Licensing

Using License File

  1. Run lpvKeyTool under LPV bin folder. It generates a lpv.key file in the current folder.
  2. Send the generated lpv.key file to us or your LPV SDK Tech Support. We will send you back a .lic license file.
  3. You may manually place the license file into any of the following folder:
    • LPV lib folder
    • ~/Library/Application Support/LPV/



Integration

Integrated with LPV

On MacOS, LPV interfaces are exported in C symbols then wrapped into C++ classes which is much more convenient for use.

In your C++ code, add #include "LPVXXX.h" to include the required LPV modules, then create LPV instances via static LClass::Create() functions.
The following code show a short example:

// add include.
#include "LPVCore.h";
#include "LPVGeom.h";
#include "LPVPat.h";
using namespace LPVCoreLib;
using namespace LPVGeomLib;
using namespace LPVPatLib;
// create class instance
// the following code defined an ILMatch interface of a LMatch object.
ILMatchPtr lmatch = LMatch::Create();
// call functions, such as set pattern matching's maximum count, or angle tolerance.
lmatch->MaxCount = 1;
lmatch->AngleTolerance = 180;
// call functions and handle the returned error code, such as do pattern matching.
LPVErrorCode errCode = lmatch->Match(sourceImg, roi, out matchResults);
if (errCode != LPVErrorCode::LPVNoError) {}
LPV Core Library, provide basic functionalities.
Definition: LPVCore.idl:427
LPVErrorCode
This enumeration represents the type of a LPV function error.
Definition: LPVCore.idl:530
LPV Geometry Library, provide geometric functionalities.
Definition: LPVGeom.idl:80
LPV Pattern Library, provides functionality for pattern matching.
Definition: LPVPat.idl:80


Add LPV Libraries to XCode Projects

  1. Open project tab
  2. Under PROJECT -> Build Settings -> Search Paths:
    • Header Search Paths: add LPV include folder
    • Library Search Paths: add LPV lib folder
  3. Under TARGETS -> Build Phases -> Link Binary With Libraries, add LPV dynamic libraries from file.
  4. Go to TARGETS -> General -> Frameworks and Libraries, change LPV libraries' Embed type to Embed & Sign
  5. To debug inside XCode, go to TARGETS -> Build Settings -> Linking, add LPV lib folder into Runpath Search Paths.


Add LPV Libraries to CMake Projects

Edit CMakeList.txt, add include path and link libraries.

# set C++ starndard to at least cpp11
set(CMAKE_CXX_STANDARD 11)
# add include path
# ${LPV_INCLUDE_PATH} points to include folder
target_include_directories(${PROJECT_NAME} ${LPV_INCLUDE_PATH})
# link lpv module
# ${LPV_LIB_PATH} points to lib folder
function(link_lpv_lib module_name)
find_library(LPV_LIBRARY_${module_name} NAMES ${module_name} PATHS ${LPV_LIB_PATH})
if(NOT LPV_LIBRARY_${module_name})
message("!!!! LPV_LIBRARY_${module_name} not found")
else()
target_link_libraries(${PROJECT_NAME} ${LPV_LIBRARY_${module_name}})
endif()
endfunction()
link_lpv_lib(lpvCore)
link_lpv_lib(lpvGeom)
link_lpv_lib(lpvPat)


Add LPV Libraries to Qt Projects

If you are using Qt Creator,

  1. RMC your project, select Add Library.
  2. Choose External library, then click Next.
  3. Browse Library file to LPV dynamic libraries under lib folder.
  4. Browse Include path to LPV include folder.
  5. Check Mac platform and Library.
  6. Click Next and then Finish.

Alternatively, you can edit .pro file manually as the following:

# add include path
# ${LPV_INCLUDE_PATH} points to include folder
INCLUDEPATH += $$LPV_INCLUDE_PATH
# link lpv module
# ${LPV_LIB_PATH} points to lib folder
LIBS += -L$$LPV_LIB_PATH -llpvCore -llpvGeom -llpvPat
DEPENDPATH += $$LPV_LIB_PATH