From 25b256a4ba3f5eaf717d3a7fb44504bd13091bfd Mon Sep 17 00:00:00 2001 From: TinyO Date: Fri, 1 Nov 2019 14:39:37 +0800 Subject: [PATCH] chore(*): remove ptyhon things. --- wrappers/python/CMakeLists.txt | 194 ---- wrappers/python/README.md | 18 - wrappers/python/samples/mynteye.py | 199 ---- wrappers/python/samples/util/__init__.py | 0 wrappers/python/samples/util/cv_painter.py | 52 -- wrappers/python/src/mynteye_py.cc | 464 ---------- wrappers/python/third_party/array/README.md | 7 - .../array/array_indexing_suite.hpp | 142 --- .../python/third_party/array/array_ref.hpp | 859 ------------------ 9 files changed, 1935 deletions(-) delete mode 100644 wrappers/python/CMakeLists.txt delete mode 100644 wrappers/python/README.md delete mode 100644 wrappers/python/samples/mynteye.py delete mode 100644 wrappers/python/samples/util/__init__.py delete mode 100644 wrappers/python/samples/util/cv_painter.py delete mode 100644 wrappers/python/src/mynteye_py.cc delete mode 100644 wrappers/python/third_party/array/README.md delete mode 100644 wrappers/python/third_party/array/array_indexing_suite.hpp delete mode 100644 wrappers/python/third_party/array/array_ref.hpp diff --git a/wrappers/python/CMakeLists.txt b/wrappers/python/CMakeLists.txt deleted file mode 100644 index b6b3ab9..0000000 --- a/wrappers/python/CMakeLists.txt +++ /dev/null @@ -1,194 +0,0 @@ -# Copyright 2018 Slightech Co., Ltd. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -cmake_minimum_required(VERSION 3.0) - -project(mynteye_python VERSION 2.0.0 LANGUAGES C CXX) - -get_filename_component(PRO_DIR "${PROJECT_SOURCE_DIR}/../.." ABSOLUTE) - -include(${PRO_DIR}/cmake/Common.cmake) - -# configs - -#set(BOOST_ROOT) -#set(BOOST_FIND_VERSION 1.67) - -# Boost Python 2.7 -set(PYTHON_FIND_VERSION 2.7) -set(PYTHON_BOOST_SUFFIX 27) -set(PYTHON_BOOST_CODE) -# Boost Python 3.6 -#set(PYTHON_FIND_VERSION 3.6) -#set(PYTHON_BOOST_SUFFIX 36) -#set(PYTHON_BOOST_CODE 3) - -if(OS_MAC) - execute_process( - COMMAND brew --prefix python@2 - OUTPUT_VARIABLE PYTHON_INSTALL_PREFIX - OUTPUT_STRIP_TRAILING_WHITESPACE - ) - if(PYTHON_INSTALL_PREFIX) - message(STATUS "PYTHON_INSTALL_PREFIX: ${PYTHON_INSTALL_PREFIX}") - set(PYTHON_INCLUDE_DIR "${PYTHON_INSTALL_PREFIX}/Frameworks/Python.framework/Headers") - set(PYTHON_LIBRARY "${PYTHON_INSTALL_PREFIX}/Frameworks/Python.framework/Python") - endif() -endif() - -# flags - -if(OS_WIN) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") -else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra") -endif() - -include(${PRO_DIR}/cmake/DetectCXX11.cmake) - -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -march=native") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native") - -string(STRIP "${CMAKE_C_FLAGS}" CMAKE_C_FLAGS) -string(STRIP "${CMAKE_CXX_FLAGS}" CMAKE_CXX_FLAGS) -message(STATUS "C_FLAGS: ${CMAKE_C_FLAGS}") -message(STATUS "CXX_FLAGS: ${CMAKE_CXX_FLAGS}") - -# packages - -LIST(APPEND CMAKE_PREFIX_PATH ${PRO_DIR}/_install/lib/cmake) -find_package(mynteye REQUIRED) -message(STATUS "Found mynteye: ${mynteye_VERSION}") - -if(NOT mynteye_WITH_API) - message(FATAL_ERROR "Must with API layer :(") -endif() - -include(${PRO_DIR}/cmake/DetectOpenCV.cmake) - -if(mynteye_WITH_GLOG) - include(${PRO_DIR}/cmake/DetectGLog.cmake) -endif() - -## boost & python - -if(CMAKE_VERSION VERSION_LESS "3.10" OR CMAKE_VERSION VERSION_EQUAL "3.10") - find_package(Boost ${BOOST_FIND_VERSION} REQUIRED - COMPONENTS python${PYTHON_BOOST_CODE} # numpy${PYTHON_BOOST_CODE} - ) -else() - find_package(Boost ${BOOST_FIND_VERSION} REQUIRED COMPONENTS - python${PYTHON_BOOST_SUFFIX} - ) -endif() -message(STATUS "Found Boost: ${Boost_VERSION}") -message(STATUS " Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}") -message(STATUS " Boost_LIBRARIES: ${Boost_LIBRARIES}") - -find_package(PythonLibs ${PYTHON_FIND_VERSION} REQUIRED) -message(STATUS "Found PythonLibs: ${PYTHONLIBS_VERSION_STRING}") -message(STATUS " PYTHON_INCLUDE_DIRS: ${PYTHON_INCLUDE_DIRS}") -message(STATUS " PYTHON_LIBRARIES: ${PYTHON_LIBRARIES}") - -#LIST(APPEND CMAKE_MODULE_PATH ${PRO_DIR}/cmake) - -# targets - -set(OUT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/_output") - -set_outdir( - "${OUT_DIR}/lib" - "${OUT_DIR}/lib" - "${OUT_DIR}/bin" -) - -set(DEST_DIR "${CMAKE_CURRENT_SOURCE_DIR}/_install") -message(STATUS "DEST_DIR: ${DEST_DIR}") - -set(CMAKE_SKIP_BUILD_RPATH FALSE) -set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) -set(CMAKE_INSTALL_RPATH "${DEST_DIR}/lib") -set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - -if(OS_WIN) - add_definitions(${Boost_LIB_DIAGNOSTIC_DEFINITIONS}) -endif() - -# add_library_py(NAME -# [SRCS src1 src2 ...] -# [LINK_LIBS lib1 lib2 ...]) -macro(add_library_py NAME) - set(options) - set(oneValueArgs) - set(multiValueArgs SRCS LINK_LIBS) - cmake_parse_arguments(THIS "${options}" "${oneValueArgs}" - "${multiValueArgs}" ${ARGN}) - - add_library(${NAME} SHARED ${THIS_SRCS}) - target_link_libraries(${NAME} - ${THIS_LINK_LIBS} ${Boost_LIBRARIES} ${PYTHON_LIBRARIES} - ) - target_include_directories(${NAME} PUBLIC - ${Boost_INCLUDE_DIRS} - ${PYTHON_INCLUDE_DIR} - ) - set_target_properties(${NAME} PROPERTIES PREFIX "") - if(OS_MAC) - set_target_properties(${NAME} PROPERTIES SUFFIX ".so") - endif() -endmacro() - -## mynteye_py - -include_directories( - ${CMAKE_CURRENT_SOURCE_DIR}/third_party/array -) - -#set(PBCVT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/pyboostcvconverter") -# -#include_directories( -# ${PBCVT_DIR}/include -#) -# -#set(PBCVT_SRCS -# ${PBCVT_DIR}/src/pyboost_cv2_converter.cpp -# ${PBCVT_DIR}/src/pyboost_cv3_converter.cpp -# ${PBCVT_DIR}/include/pyboostcvconverter/pyboostcvconverter.hpp -#) - -set(NPCV_DIR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/numpy-opencv-converter") - -include_directories( - ${NPCV_DIR} -) - -set(NPCV_SRCS - ${NPCV_DIR}/np_opencv_converter.cpp - ${NPCV_DIR}/utils/conversion.cpp -) - -add_library_py(mynteye_py - SRCS src/mynteye_py.cc ${NPCV_SRCS} - LINK_LIBS mynteye ${OpenCV_LIBS} -) - -# insall - -install(TARGETS mynteye_py - ARCHIVE DESTINATION "${DEST_DIR}/lib" - LIBRARY DESTINATION "${DEST_DIR}/lib" - RUNTIME DESTINATION "${DEST_DIR}/bin" -) diff --git a/wrappers/python/README.md b/wrappers/python/README.md deleted file mode 100644 index 092da4d..0000000 --- a/wrappers/python/README.md +++ /dev/null @@ -1,18 +0,0 @@ -# MYNT® EYE Python Wrapper - -## Prerequisites - -* [Boost.Python](https://www.boost.org/doc/libs/1_67_0/libs/python/doc/html/index.html) - -## Build - -```bash -cd -make python -``` - -## Run - -```bash -python wrappers/python/samples/mynteye.py -``` diff --git a/wrappers/python/samples/mynteye.py b/wrappers/python/samples/mynteye.py deleted file mode 100644 index 1e70f75..0000000 --- a/wrappers/python/samples/mynteye.py +++ /dev/null @@ -1,199 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright 2018 Slightech Co., Ltd. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# pylint: disable=missing-docstring - -from __future__ import print_function - -import os -import sys - -PY_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) -LIB_DIR = os.path.join(PY_DIR, '_install/lib') -for root, dirs, files in os.walk(LIB_DIR): - if files: - sys.path.append(root) - -# pylint: disable=import-error,wrong-import-position -import mynteye_py as mynteye -# glog_init = mynteye.glog_init.create(sys.argv) - - -def main(): - # api = mynteye.API.create() # should glog_init - api = mynteye.API.create(sys.argv) - if not api: - sys.exit(1) - - # model - print('model: {}'.format(api.model)) - - # supports - supports_types = ( - mynteye.Stream, - mynteye.Capabilities, - mynteye.Option, - mynteye.AddOns) - for x in supports_types: - print('\nsupports({})'.format(x.__name__)) - for k, v in x.names.iteritems(): - print(' supports({}): {}'.format(k, api.supports(v))) - - # get_stream_requests - for k, v in mynteye.Capabilities.names.iteritems(): - if v != mynteye.STEREO: - continue - if not api.supports(v): - continue - print('\nget_stream_requests({})'.format(k)) - for req in api.get_stream_requests(v): - print(' {}'.format(req)) - - # config_stream_request - # print('\nconfig_stream_request({},?)'.format(mynteye.STEREO)) - # api.config_stream_request(mynteye.STEREO, req) - # print(' {}'.format(req)) - - # get_info - print() - for k, v in mynteye.Info.names.iteritems(): - print('get_info({}): {}'.format(k, api.get_info(v))) - - # get_intrinsics - print('\nget_intrinsics(LEFT)\n{}'.format(api.get_intrinsics(mynteye.LEFT))) - print('\nget_intrinsics(RIGHT)\n{}'.format(api.get_intrinsics(mynteye.RIGHT))) - # get_extrinsics - print('\nget_extrinsics(LEFT, RIGHT)\n{}'.format( - api.get_extrinsics(mynteye.LEFT, mynteye.RIGHT))) - # get_motion_intrinsics - print('\nget_motion_intrinsics()\n{}'.format(api.get_motion_intrinsics())) - # get_motion_extrinsics - print('\nget_motion_extrinsics(LEFT)\n{}'.format( - api.get_motion_extrinsics(mynteye.LEFT))) - - # api.log_option_infos() - - # get_option_info, get_option_value - print() - for k, v in mynteye.Option.names.iteritems(): - if v == mynteye.ZERO_DRIFT_CALIBRATION or v == mynteye.ERASE_CHIP: - continue - if not api.supports(v): - continue - print('get_option_info({}): {}, cur: {}'.format( - k, api.get_option_info(v), api.get_option_value(v))) - - # set_option_value - - def set_rate(frame_rate=25, imu_frequency=500): # pylint: disable=unused-variable - # FRAME_RATE values: 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60 - api.set_option_value(mynteye.FRAME_RATE, frame_rate) - # IMU_FREQUENCY values: 100, 200, 250, 333, 500 - api.set_option_value(mynteye.IMU_FREQUENCY, imu_frequency) - - def set_ir(intensity=80): # pylint: disable=unused-variable - # set infrared intensity value: range [0,48], default 160 - api.set_option_value(mynteye.IR_CONTROL, intensity) - - def set_auto_exposure( # pylint: disable=unused-variable - max_gain=48, # pylint: disable=bad-continuation - max_exposure_time=240, # pylint: disable=bad-continuation - desired_brightness=192): # pylint: disable=bad-continuation - # auto-exposure: 0 - api.set_option_value(mynteye.EXPOSURE_MODE, 0) - # max_gain: range [0,48], default 48 - api.set_option_value(mynteye.MAX_GAIN, max_gain) - # max_exposure_time: range [0,240], default 240 - api.set_option_value(mynteye.MAX_EXPOSURE_TIME, max_exposure_time) - # desired_brightness: range [0,255], default 192 - api.set_option_value(mynteye.DESIRED_BRIGHTNESS, desired_brightness) - - def set_manual_exposure(gain=24, brightness=120, contrast=127): # pylint: disable=unused-variable - # manual-exposure: 1 - api.set_option_value(mynteye.EXPOSURE_MODE, 1) - # gain: range [0,48], default 24 - api.set_option_value(mynteye.GAIN, gain) - # brightness/exposure_time: range [0,240], default 120 - api.set_option_value(mynteye.BRIGHTNESS, brightness) - # contrast/black_level_calibration: range [0,255], default 127 - api.set_option_value(mynteye.CONTRAST, contrast) - - # set_rate(25, 500); - # set_ir(80); - # set_auto_exposure(48, 240, 192); - # set_manual_exposure(24, 120, 127); - - # run_option_action - # api.run_option_action(mynteye.ZERO_DRIFT_CALIBRATION) - - ############################################################################## - # get stream and motion datas - - import cv2 - import numpy as np - from util.cv_painter import Gravity, draw_text - - # api.enable_stream_data(mynteye.DISPARITY_NORMALIZED); - - api.enable_motion_datas() - - api.start(mynteye.ALL) - - # cv2.namedWindow('frame') - # cv2.namedWindow('disparity') - - fps = 0. - while True: - t = cv2.getTickCount() - - api.wait_for_streams() - - left_data = api.get_stream_data(mynteye.LEFT) - right_data = api.get_stream_data(mynteye.RIGHT) - - motion_datas = api.get_motion_datas() - - img = np.hstack((left_data.frame, right_data.frame)) - draw_text(img, '{1}x{0}'.format(*img.shape), Gravity.TOP_LEFT) - draw_text(img, '{:.1f}'.format(fps), Gravity.TOP_RIGHT) - if motion_datas: - imu = motion_datas[0].imu - draw_text(img, - 'accel: {:+8f}, {:+8f}, {:+8f}'.format(*imu.accel), - Gravity.BOTTOM_LEFT) - draw_text(img, - 'gyro: {:+8f}, {:+8f}, {:+8f}'.format(*imu.gyro), - Gravity.BOTTOM_RIGHT) - cv2.imshow('frame', img) - - # disp_data = api.get_stream_data(mynteye.DISPARITY_NORMALIZED); - # if disp_data.frame is not None: - # cv2.imshow('disparity', disp_data.frame); - - t = cv2.getTickCount() - t - fps = cv2.getTickFrequency() / t - - key = cv2.waitKey(10) & 0xFF - if key == 27 or key == ord('q'): # esc, q - break - - api.stop(mynteye.ALL) - - cv2.destroyAllWindows() - - -if __name__ == '__main__': - main() diff --git a/wrappers/python/samples/util/__init__.py b/wrappers/python/samples/util/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/wrappers/python/samples/util/cv_painter.py b/wrappers/python/samples/util/cv_painter.py deleted file mode 100644 index b6150a4..0000000 --- a/wrappers/python/samples/util/cv_painter.py +++ /dev/null @@ -1,52 +0,0 @@ -#!/usr/bin/env python -# -*- coding: utf-8 -*- -# Copyright 2018 Slightech Co., Ltd. All rights reserved. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -# pylint: disable=missing-docstring - -import cv2 - - -FONT_FACE = cv2.FONT_HERSHEY_SIMPLEX -FONT_SCALE = 1 -FONT_COLOR = (255, 255, 255) -THICKNESS = 1 - - -class Gravity(object): # pylint: disable=no-init - TOP_LEFT = 1 - TOP_RIGHT = 2 - BOTTOM_LEFT = 3 - BOTTOM_RIGHT = 4 - - -def draw_text(img, text, gravity, margin=10, offset_x=0, offset_y=0): - h, w = img.shape[:2] # pylint: disable=invalid-name - - # getTextSize, result: ((width, height), baseline) - x, y = cv2.getTextSize(text, FONT_FACE, FONT_SCALE, THICKNESS)[0] - - org = { - Gravity.TOP_LEFT: (margin, margin + y), - Gravity.TOP_RIGHT: (w - margin - x, margin + y), - Gravity.BOTTOM_LEFT: (margin, h - margin), - Gravity.BOTTOM_RIGHT: (w - margin - x, h - margin), - }.get(gravity, (margin, margin + y)) - - org = (org[0] + offset_x, org[1] + offset_y) - - # putText(img, text, org, fontFace, fontScale, color, thickness, lineType) - cv2.putText(img, text, org, FONT_FACE, FONT_SCALE, - FONT_COLOR, THICKNESS, cv2.LINE_AA) diff --git a/wrappers/python/src/mynteye_py.cc b/wrappers/python/src/mynteye_py.cc deleted file mode 100644 index b27a044..0000000 --- a/wrappers/python/src/mynteye_py.cc +++ /dev/null @@ -1,464 +0,0 @@ -// Copyright 2018 Slightech Co., Ltd. All rights reserved. -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -#include - -// #include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include "mynteye/logger.h" -#include "mynteye/api/api.h" -#include "mynteye/device/utils.h" - -#include "array_indexing_suite.hpp" -#include "array_ref.hpp" - -// #define PY_ARRAY_UNIQUE_SYMBOL pbcvt_ARRAY_API -// #include "pyboostcvconverter/pyboostcvconverter.hpp" -#include "np_opencv_converter.hpp" - -#define ENUM_EXPORT_VALUES - -namespace bp = boost::python; - -namespace { - -template -inline void std_vector_assign( - std::vector &l, const bp::object &o) { // NOLINT - l.assign(bp::stl_input_iterator(o), bp::stl_input_iterator()); -} - -template -inline std::vector py_list_to_std_vector(const bp::object &o) { - return std::vector( - bp::stl_input_iterator(o), bp::stl_input_iterator()); -} - -template -inline bp::list std_vector_to_py_list(const std::vector &v) { - bp::list l; - for (auto &&val : v) { - l.append(val); - } - return l; -} - -template -char **new_cstrings(const Container &strings, std::size_t n) { - char **cstrings = new char *[n]; - for (std::size_t i = 0; i < n; i++) { - cstrings[i] = new char[strings[i].size() + 1]; - std::strcpy(cstrings[i], strings[i].c_str()); // NOLINT - } - return cstrings; -} - -void del_cstrings(char **cstrings, std::size_t n) { - for (std::size_t i = 0; i < n; i++) { - delete[] cstrings[i]; - } - delete[] cstrings; -} - -} // namespace - -MYNTEYE_BEGIN_NAMESPACE - -namespace python { - -// api wrapper - -struct MYNTEYE_API StreamData { - /** ImgData. */ - ImgData img; - /** Frame. */ - PyObject *frame; - - bool operator==(const StreamData &other) const { - return img.frame_id == other.img.frame_id && - img.timestamp == other.img.timestamp; - } -}; - -struct MYNTEYE_API MotionData { - /** ImuData. */ - ImuData imu; - - bool operator==(const MotionData &other) const { - return imu.timestamp == other.imu.timestamp; - } -}; - -class MYNTEYE_API APIWrap : public API { - public: - explicit APIWrap(std::shared_ptr device) : API(device) {} - ~APIWrap() {} - - static std::shared_ptr Create() { - auto &&device = device::select(); - if (!device) - return nullptr; - return std::make_shared(device); - } - - static std::shared_ptr Create(int argc, char *argv[]) { - static glog_init _(argc, argv); - auto &&device = device::select(); - if (!device) - return nullptr; - return std::make_shared(device); - } - - python::StreamData GetStreamData(const Stream &stream) { - auto &&data = API::GetStreamData(stream); - // return {*data.img, pbcvt::fromMatToNDArray(data.frame)}; - return {*data.img, - fs::python::Mat_to_PyObject::convert(data.frame)}; - } - - std::vector GetStreamDatas(const Stream &stream) { - std::vector datas; - for (auto &&data : API::GetStreamDatas(stream)) { - // datas.push_back({*data.img, pbcvt::fromMatToNDArray(data.frame)}); - datas.push_back( - {*data.img, - fs::python::Mat_to_PyObject::convert(data.frame)}); - } - return datas; - } - - std::vector GetMotionDatas() { - std::vector datas; - for (auto &&data : API::GetMotionDatas()) { - datas.push_back({*data.imu}); - } - return datas; - } -}; - -// api create static methods - -std::shared_ptr (*api_create_1)() = &APIWrap::Create; - -std::shared_ptr api_create_2(bp::list argv) { - auto &&args = py_list_to_std_vector(argv); - auto &&n = args.size(); - if (n == 0) { - return APIWrap::Create(); - } - char **cstrings = new_cstrings(args, n); - auto &&api = APIWrap::Create(args.size(), cstrings); - del_cstrings(cstrings, n); - return api; -} - -// glog_init create static methods - -std::shared_ptr glog_init_create(bp::list argv) { - auto &&args = py_list_to_std_vector(argv); - auto &&n = args.size(); - assert(n > 0); - char **cstrings = new_cstrings(args, n); - auto &&ret = std::make_shared(args.size(), cstrings); - del_cstrings(cstrings, n); - return ret; -} - -// BOOST_PYTHON_MODULE - -BOOST_PYTHON_MODULE(mynteye_py) { - /* - Py_Initialize(); - import_array(); - bp::to_python_converter(); - pbcvt::matFromNDArrayBoostConverter(); - */ - fs::python::init_and_export_converters(); - py::scope scope = py::scope(); - - bp::class_>("DoubleArray") - .def(array_indexing_suite>()); - - bp::class_>>("Double2DArray") - .def(array_indexing_suite>>{}); - - // types.h - enums - - bp::enum_("Model") - .value("STANDARD", Model::STANDARD) -#ifdef ENUM_EXPORT_VALUES - .export_values() -#endif - ; // NOLINT - - bp::enum_("Stream") - .value("LEFT", Stream::LEFT) - .value("RIGHT", Stream::RIGHT) - .value("LEFT_RECTIFIED", Stream::LEFT_RECTIFIED) - .value("RIGHT_RECTIFIED", Stream::RIGHT_RECTIFIED) - .value("DISPARITY", Stream::DISPARITY) - .value("DISPARITY_NORMALIZED", Stream::DISPARITY_NORMALIZED) - .value("DEPTH", Stream::DEPTH) - .value("POINTS", Stream::POINTS) -#ifdef ENUM_EXPORT_VALUES - .export_values() -#endif - ; // NOLINT - - bp::enum_("Capabilities") - .value("STEREO", Capabilities::STEREO) - .value("COLOR", Capabilities::COLOR) - .value("DEPTH", Capabilities::DEPTH) - .value("POINTS", Capabilities::POINTS) - .value("FISHEYE", Capabilities::FISHEYE) - .value("INFRARED", Capabilities::INFRARED) - .value("INFRARED2", Capabilities::INFRARED2) - .value("IMU", Capabilities::IMU) -#ifdef ENUM_EXPORT_VALUES - .export_values() -#endif - ; // NOLINT - - bp::enum_("Info") - .value("DEVICE_NAME", Info::DEVICE_NAME) - .value("SERIAL_NUMBER", Info::SERIAL_NUMBER) - .value("FIRMWARE_VERSION", Info::FIRMWARE_VERSION) - .value("HARDWARE_VERSION", Info::HARDWARE_VERSION) - .value("SPEC_VERSION", Info::SPEC_VERSION) - .value("LENS_TYPE", Info::LENS_TYPE) - .value("IMU_TYPE", Info::IMU_TYPE) - .value("NOMINAL_BASELINE", Info::NOMINAL_BASELINE) - .value("AUXILIARY_CHIP_VERSION", Info::AUXILIARY_CHIP_VERSION) - .value("ISP_VERSION", Info::ISP_VERSION) -#ifdef ENUM_EXPORT_VALUES - .export_values() -#endif - ; // NOLINT - - bp::enum_