Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
PointCloud
Flann
提交
189914fc
F
Flann
项目概览
PointCloud
/
Flann
通知
4
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
F
Flann
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
189914fc
编写于
10月 04, 2010
作者:
M
Marius Muja
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Python distutils setup.py fixes. Changed install paths to more standard locations
上级
ce204198
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
105 addition
and
61 deletion
+105
-61
Makefile
Makefile
+6
-0
doc/CMakeLists.txt
doc/CMakeLists.txt
+1
-1
src/matlab/CMakeLists.txt
src/matlab/CMakeLists.txt
+1
-1
src/python/CMakeLists.txt
src/python/CMakeLists.txt
+10
-3
src/python/pyflann/bindings/flann_ctypes.py
src/python/pyflann/bindings/flann_ctypes.py
+20
-7
src/python/pyflann/io/hdf5_dataset.py
src/python/pyflann/io/hdf5_dataset.py
+57
-46
src/python/setup.py
src/python/setup.py
+10
-3
未找到文件。
Makefile
浏览文件 @
189914fc
.PHONY
:
flann tests test libs doc all clean examples
all
:
@
-mkdir
-p
build
cd
build
&&
cmake
-DCMAKE_BUILD_TYPE
=
${BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX
=
${INSTALL_PREFIX}
..
&&
make all doc
...
...
@@ -24,6 +25,11 @@ examples:
@
-mkdir
-p
build
cd
build
&&
cmake ..
-DCMAKE_BUILD_TYPE
=
${BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX
=
${INSTALL_PREFIX}
&&
make
$@
install
:
@
-mkdir
-p
build
cd
build
&&
cmake
-DCMAKE_BUILD_TYPE
=
${BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX
=
${INSTALL_PREFIX}
..
&&
make all doc
install
clean
:
-
cd
build
&&
make clean
-
rm
-rf
build
...
...
doc/CMakeLists.txt
浏览文件 @
189914fc
...
...
@@ -55,6 +55,6 @@ if (EXISTS ${PDFLATEX_COMPILER} AND EXISTS ${BIBTEX_COMPILER})
install
(
FILES
${
CMAKE_CURRENT_SOURCE_DIR
}
/
${
TARGET
}
.pdf
DESTINATION
doc
DESTINATION
share/doc/flann
)
endif
()
src/matlab/CMakeLists.txt
浏览文件 @
189914fc
...
...
@@ -44,7 +44,7 @@ if(MEX_CMD AND MEXEXT_CMD)
INSTALL
(
FILES
${
MEX_FILE
}
${
MATLAB_SOURCES
}
DESTINATION matlab
DESTINATION
share/flann/
matlab
)
else
()
message
(
"The 'mex' and 'mexext' programs have been found in different locations. It's likely that one of them is not part of the MATLAB instalation. Make sure that the 'bin' directory from the MATLAB instalation is in PATH"
)
...
...
src/python/CMakeLists.txt
浏览文件 @
189914fc
configure_file
(
${
CMAKE_CURRENT_SOURCE_DIR
}
/setup.py.tpl
${
CMAKE_CURRENT_SOURCE_DIR
}
/setup.py
)
INSTALL
(
PROGRAMS flann
...
...
@@ -7,17 +11,20 @@ INSTALL (
INSTALL
(
FILES setup.py flann
DESTINATION python
DESTINATION
share/flann/
python
)
INSTALL
(
DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
/pyflann
DESTINATION python
DESTINATION
share/flann/
python
PATTERN *.cpp EXCLUDE
PATTERN *.so EXCLUDE
PATTERN *.a EXCLUDE
PATTERN *.dat EXCLUDE
PATTERN *.txt EXCLUDE
PATTERN *.tpl EXCLUDE
PATTERN *~ EXCLUDE
PATTERN _tests EXCLUDE
)
\ No newline at end of file
)
src/python/pyflann/bindings/flann_ctypes.py
浏览文件 @
189914fc
...
...
@@ -123,25 +123,38 @@ allowed_types = [ float32, float64, uint8, int32]
FLANN_INDEX
=
c_void_p
def
load_flann_library
():
root_dir
=
os
.
path
.
abspath
(
os
.
path
.
dirname
(
__file__
))
libname
=
'libflann'
libname
=
'libflann
.so
'
if
sys
.
platform
==
'win32'
:
libname
=
'flann'
libname
=
'flann.dll'
elif
sys
.
platform
==
'darwin'
:
libname
=
'libflann.dylib'
flannlib
=
None
loaded
=
False
while
(
not
loaded
)
and
root_dir
!=
"/"
:
while
(
not
loaded
)
and
root_dir
!=
None
:
try
:
# print "Trying ",os.path.join(root_dir,'lib'
)
flannlib
=
load_library
(
libname
,
os
.
path
.
join
(
root_dir
,
'lib'
))
#print "Trying ",os.path.join(root_dir,'lib',libname
)
flannlib
=
cdll
[
os
.
path
.
join
(
root_dir
,
'lib'
,
libname
)]
loaded
=
True
except
Exception
as
e
:
# print e
root_dir
=
os
.
path
.
dirname
(
root_dir
)
if
root_dir
==
'/'
:
root_dir
=
None
else
:
root_dir
=
os
.
path
.
dirname
(
root_dir
)
if
not
loaded
:
try
:
#print "Trying",libname
flannlib
=
cdll
[
libname
]
loaded
=
True
except
:
pass
return
flannlib
...
...
src/python/pyflann/io/hdf5_dataset.py
浏览文件 @
189914fc
...
...
@@ -27,56 +27,67 @@
from
__future__
import
with_statement
from
pyflann.exceptions
import
FLANNException
import
h5py
import
numpy
have_h5py
=
True
try
:
import
h5py
except
Exception
as
e
:
have_h5py
=
False
if
not
have_h5py
:
def
__missing_h5py
(
*
args
,
**
kwargs
):
raise
FLANNException
(
"h5py library not found"
)
check
=
__missing_h5py
save
=
__missing_h5py
load
=
__missing_h5py
load_range
=
__missing_h5py
else
:
def
check
(
filename
):
f
=
open
(
filename
,
"r"
)
header
=
f
.
read
(
4
)
if
header
[
1
:
4
]
==
"HDF"
:
return
True
return
False
def
check
(
filename
):
f
=
open
(
filename
,
"r"
)
header
=
f
.
read
(
4
)
if
header
[
1
:
4
]
==
"HDF"
:
return
True
return
False
def
save
(
dataset
,
filename
,
**
kwargs
):
if
not
isinstance
(
dataset
,
numpy
.
ndarray
):
raise
FLANNException
(
"Dataset must be in numpy format"
)
try
:
if
'title'
in
kwargs
:
title_name
=
kwargs
[
'title'
]
else
:
title_name
=
"Dataset saved by pyflann"
if
'dataset_name'
in
kwargs
:
dataset_name
=
kwargs
[
'dataset_name'
]
else
:
dataset_name
=
'dataset'
h5file
=
h5py
.
File
(
filename
)
h5file
.
create_dataset
(
dataset_name
,
dataset
)
h5file
.
close
()
except
Exception
as
e
:
h5file
.
close
()
raise
FLANNException
(
e
)
def
save
(
dataset
,
filename
,
**
kwargs
):
if
not
isinstance
(
dataset
,
numpy
.
ndarray
):
raise
FLANNException
(
"Dataset must be in numpy format"
)
try
:
if
'title'
in
kwargs
:
title_name
=
kwargs
[
'title'
]
else
:
title_name
=
"Dataset saved by pyflann"
if
'dataset_name'
in
kwargs
:
dataset_name
=
kwargs
[
'dataset_name'
]
else
:
dataset_name
=
'dataset'
h5file
=
h5py
.
File
(
filename
)
h5file
.
create_dataset
(
dataset_name
,
dataset
)
h5file
.
close
()
except
Exception
as
e
:
h5file
.
close
()
raise
FLANNException
(
e
)
def
load
(
filename
,
rows
=
-
1
,
cols
=
-
1
,
dtype
=
numpy
.
float32
,
**
kwargs
):
try
:
h5file
=
h5py
.
File
(
filename
)
if
'dataset_name'
in
kwargs
:
dataset_name
=
kwargs
[
'dataset_name'
]
else
:
dataset_name
=
'dataset'
for
node
in
h5file
.
keys
():
if
node
==
dataset_name
:
data
=
h5file
[
node
]
h5file
.
close
()
return
data
except
Exception
as
e
:
h5file
.
close
()
raise
FLANNException
(
e
)
def
load
(
filename
,
rows
=
-
1
,
cols
=
-
1
,
dtype
=
numpy
.
float32
,
**
kwargs
):
try
:
def
load_range
(
filename
,
array_name
,
range
):
h5file
=
h5py
.
File
(
filename
)
if
'dataset_name'
in
kwargs
:
dataset_name
=
kwargs
[
'dataset_name'
]
else
:
dataset_name
=
'dataset'
for
node
in
h5file
.
keys
():
if
node
==
dataset_name
:
data
=
h5file
[
node
]
h5file
.
close
()
return
data
except
Exception
as
e
:
h5file
.
close
()
raise
FLANNException
(
e
)
def
load_range
(
filename
,
array_name
,
range
):
h5file
=
h5py
.
File
(
filename
)
dataset
=
h5file
[
array_name
]
return
dataset
[
range
[
0
]:
range
[
1
]]
dataset
=
h5file
[
array_name
]
return
dataset
[
range
[
0
]:
range
[
1
]]
src/python/setup.py
浏览文件 @
189914fc
#!/usr/bin/env python
from
distutils.core
import
setup
import
os.path
import
sys
setup_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
sys
.
argv
[
0
]))
lib_path
=
os
.
path
.
abspath
(
os
.
path
.
join
(
setup_path
,
'../../../lib'
))
setup
(
name
=
'flann'
,
version
=
'1.
2
'
,
version
=
'1.
5.0
'
,
description
=
'Fast Library for Approximate Nearest Neighbors'
,
author
=
'Marius Muja'
,
author_email
=
'mariusm@cs.ubc.ca'
,
license
=
'BSD'
,
url
=
'http://www.cs.ubc.ca/~mariusm/flann/'
,
packages
=
[
'pyflann'
,
'pyflann.command'
,
'pyflann.io'
,
'pyflann.bindings'
,
'pyflann.util'
],
packages
=
[
'pyflann'
,
'pyflann.command'
,
'pyflann.io'
,
'pyflann.bindings'
,
'pyflann.util'
,
'pyflann.lib'
],
scripts
=
[
'flann'
],
package_data
=
{
'pyflann.bindings'
:
[
'libflann.so'
,
'flann.dll'
,
'libflann.dylib'
]},
package_dir
=
{
'pyflann.lib'
:
lib_path
},
package_data
=
{
'pyflann.lib'
:
[
'libflann.so'
,
'flann.dll'
,
'libflann.dylib'
]},
)
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录