def _load_hesaff_clib(rebuild=None): """ Specificially loads the hesaff lib and defines its functions """ global REBUILD_ONCE # Get the root directory which should have the dynamic library in it #root_dir = realpath(dirname(__file__)) if '__file__' in vars() else realpath(os.getcwd()) # os.path.dirname(sys.executable) #if getattr(sys, 'frozen', False): # # we are running in a |PyInstaller| bundle # root_dir = realpath(sys._MEIPASS) #else: # # we are running in a normal Python environment # root_dir = realpath(dirname(__file__)) root_dir = realpath(dirname(__file__)) if rebuild is not False and REBUILD_ONCE == 0 and __name__ != '__main__': REBUILD_ONCE += 1 rebuild = ut.get_argflag('--rebuild-hesaff') if rebuild: print('REBUILDING HESAFF') repo_dir = realpath(dirname(root_dir)) ut.std_build_command(repo_dir) libname = 'hesaff' (clib, def_cfunc, lib_fpath) = ctypes_interface.load_clib(libname, root_dir) # Expose extern C Functions to hesaff's clib #def_cfunc(C.c_char_p, 'cmake_build_type', []) #def_cfunc(None, 'free_char', [C.c_char_p]) def_cfunc(int_t, 'get_cpp_version', []) def_cfunc(int_t, 'is_debug_mode', []) def_cfunc(int_t, 'detect', [obj_t]) def_cfunc(int_t, 'get_kpts_dim', []) def_cfunc(int_t, 'get_desc_dim', []) def_cfunc(None, 'exportArrays', [obj_t, int_t, kpts_t, vecs_t]) def_cfunc(None, 'extractDesc', [obj_t, int_t, kpts_t, vecs_t]) def_cfunc(None, 'extractPatches', [obj_t, int_t, kpts_t, img32_t]) def_cfunc(None, 'extractDescFromPatches', [int_t, int_t, int_t, img_t, vecs_t]) def_cfunc(obj_t, 'new_hesaff_fpath', [str_t] + HESAFF_PARAM_TYPES) def_cfunc(obj_t, 'new_hesaff_image', [img_t, int_t, int_t, int_t] + HESAFF_PARAM_TYPES) def_cfunc(None, 'free_hesaff', [obj_t]) def_cfunc(obj_t, 'detectFeaturesListStep1', [int_t, str_list_t] + HESAFF_PARAM_TYPES) def_cfunc(None, 'detectFeaturesListStep2', [int_t, obj_t, int_array_t]) def_cfunc(None, 'detectFeaturesListStep3', [int_t, obj_t, int_array_t, int_array_t, kpts_t, vecs_t]) return clib, lib_fpath
packages=util_setup.find_packages(), version=util_setup.parse_package_for_version('vtool'), license=util_setup.read_license('LICENSE'), long_description=util_setup.parse_readme('README.md'), ext_modules=util_setup.find_ext_modules(), cmdclass=util_setup.get_cmdclass(), description=('Vision tools - tools for computer vision'), url='https://github.com/Erotemic/vtool', author='Jon Crall', author_email='*****@*****.**', keywords='', install_requires=INSTALL_REQUIRES, clutter_patterns=CLUTTER_PATTERNS, # package_data={'build': ut.get_dynamic_lib_globstrs()}, # build_command=lambda: ut.Repo(dirname(__file__)), build_command=lambda: ut.std_build_command(), classifiers=[], ) setup(**kwargs) #from Cython.Build import cythonize #from Cython.Distutils import build_ext #python -c "import pyximport; pyximport.install(reload_support=True, setup_args={'script_args': ['--compiler=mingw32']})" #extensions = [Extension('vtool/linalg_cython.pyx')] #extensions = cythonize('vtool/*.pyx') #[ # Extension('vtool.linalg_cython', ['vtool/linalg_cython.pyx'], # include_dirs=[np.get_include()]) #]
def mats_t(ndim): return np.ctypeslib.ndpointer(dtype=np.float64, ndim=ndim, flags=FLAGS_RW) dpath = dirname(__file__) lib_fname = join(dpath, 'libsver' + ut.util_cplat.get_lib_ext()) if __name__ != '__main__': if ut.get_argflag('--rebuild-sver'): # and __name__ != '__main__': USE_CMAKE = True if USE_CMAKE: root_dir = realpath(dirname(__file__)) repo_dir = dirname(root_dir) ut.std_build_command(repo_dir) else: cpp_fname = join(dpath, 'sver.cpp') cflags = '-shared -fPIC -O2 -ffast-math' cmd_fmtstr = 'g++ -Wall -Wextra {cpp_fname} -lopencv_core {cflags} -o {lib_fname}' cmd_str = cmd_fmtstr.format(**locals()) ut.cmd(cmd_str) try: c_sver = C.cdll[lib_fname] except Exception as ex: print('Failed to open lib_fname = %r' % (lib_fname,)) ut.checkpath(lib_fname, verbose=True) raise c_getaffineinliers = c_sver['get_affine_inliers'] c_getaffineinliers.restype = C.c_int
URL_LIST = [ 'http://cmp.felk.cvut.cz/~perdom1/hesaff/', 'https://github.com/Erotemic/hesaff', ] INSTALL_REQUIRES = [ 'numpy >= 1.8.0', ] if __name__ == '__main__': setup_dict = dict( name='pyhesaff', #packages=util_setup.find_packages(), packages=['pyhesaff', 'build', 'pyhesaff.tests'], version=util_setup.parse_package_for_version('pyhesaff'), licence=util_setup.read_license('LICENSE'), long_description=util_setup.parse_readme('README.md'), description='Routines for computation of hessian affine keypoints in images.', url='https://github.com/Erotemic/hesaff', author='Krystian Mikolajczyk, Michal Perdoch, Jon Crall, Avi Weinstock', author_email='*****@*****.**', install_requires=INSTALL_REQUIRES, package_data={'build': util_cplat.get_dynamic_lib_globstrs()}, build_command=lambda: ut.std_build_command(dirname(__file__)), setup_fpath=__file__, ) kwargs = util_setup.setuptools_setup(**setup_dict) setup(**kwargs)
def mats_t(ndim): return np.ctypeslib.ndpointer(dtype=np.float64, ndim=ndim, flags=FLAGS_RW) dpath = dirname(__file__) lib_fname = join(dpath, 'libsver' + ut.util_cplat.get_lib_ext()) if __name__ != '__main__': if ut.get_argflag('--rebuild-sver'): # and __name__ != '__main__': USE_CMAKE = True if USE_CMAKE: root_dir = realpath(dirname(__file__)) repo_dir = dirname(root_dir) ut.std_build_command(repo_dir) else: cpp_fname = join(dpath, 'sver.cpp') cflags = '-shared -fPIC -O2 -ffast-math' cmd_fmtstr = 'g++ -Wall -Wextra {cpp_fname} -lopencv_core {cflags} -o {lib_fname}' cmd_str = cmd_fmtstr.format(**locals()) ut.cmd(cmd_str) try: c_sver = C.cdll[lib_fname] except Exception as ex: print('Failed to open lib_fname = %r' % (lib_fname, )) ut.checkpath(lib_fname, verbose=True) raise c_getaffineinliers = c_sver['get_affine_inliers'] c_getaffineinliers.restype = C.c_int
URL_LIST = [ 'http://cmp.felk.cvut.cz/~perdom1/hesaff/', 'https://github.com/Erotemic/hesaff', ] INSTALL_REQUIRES = [ 'numpy >= 1.8.0', ] if __name__ == '__main__': setup_dict = dict( name='pyhesaff', #packages=util_setup.find_packages(), packages=['pyhesaff', 'build', 'pyhesaff.tests'], version=util_setup.parse_package_for_version('pyhesaff'), licence=util_setup.read_license('LICENSE'), long_description=util_setup.parse_readme('README.md'), description= 'Routines for computation of hessian affine keypoints in images.', url='https://github.com/Erotemic/hesaff', author='Krystian Mikolajczyk, Michal Perdoch, Jon Crall, Avi Weinstock', author_email='*****@*****.**', install_requires=INSTALL_REQUIRES, package_data={'build': util_cplat.get_dynamic_lib_globstrs()}, build_command=lambda: ut.std_build_command(dirname(__file__)), setup_fpath=__file__, ) kwargs = util_setup.setuptools_setup(**setup_dict) setup(**kwargs)