-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added npz-save, removed surf and mrogh
- Loading branch information
1 parent
e8569ff
commit 4b06495
Showing
71 changed files
with
14,723 additions
and
3,398 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[Iterations] | ||
Steps=1; max number of steps | ||
minMatches=10 | ||
[HessianAffine0] | ||
initSigma=0.2 | ||
TiltSet=1; floating numbers separated with comma | ||
ScaleSet=1;no need of scale sampling | ||
Phi=360; | ||
Descriptors=RootSIFT;RootSIFT; // | ||
FGINNThreshold=0.8 ; The same order, as in "Descriptors"! | ||
DistanceThreshold=0; The same order, as in "Descriptors"! | ||
[Matching0] | ||
SeparateDetectors=HessianAffine;FAST; Or "All" | ||
GroupDetectors=;HessianAffine;, DoG | ||
SeparateDescriptors=RootSIFT;RootSIFT;h | ||
GroupDescriptors=;RootSIFT;[MSER3] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
CMAKE_MINIMUM_REQUIRED(VERSION 3.0 FATAL_ERROR) | ||
if(COMMAND cmake_policy) | ||
cmake_policy(SET CMP0003 NEW) | ||
endif(COMMAND cmake_policy) | ||
|
||
project(CNPY) | ||
|
||
add_definitions(-std=c++11) | ||
|
||
option(ENABLE_STATIC "Build static (.a) library" ON) | ||
add_subdirectory(./zlib) | ||
include_directories(${ZLIB_INCLUDE_DIRS}) | ||
|
||
add_library(cnpy SHARED "cnpy.cpp") | ||
target_link_libraries(cnpy zlib) | ||
#install(TARGETS "cnpy" LIBRARY DESTINATION lib PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) | ||
|
||
if(ENABLE_STATIC) | ||
add_library(cnpy-static STATIC "cnpy.cpp") | ||
set_target_properties(cnpy-static PROPERTIES OUTPUT_NAME "cnpy") | ||
install(TARGETS "cnpy-static" ARCHIVE DESTINATION lib) | ||
endif(ENABLE_STATIC) | ||
|
||
#install(FILES "cnpy.h" DESTINATION include) | ||
#install(FILES "mat2npz" "npy2mat" "npz2mat" DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) | ||
|
||
#add_executable(example1 example1.cpp) | ||
#target_link_libraries(example1 cnpy) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License | ||
|
||
Copyright (c) Carl Rogers, 2011 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Purpose: | ||
|
||
NumPy offers the `save` method for easy saving of arrays into .npy and `savez` for zipping multiple .npy arrays together into a .npz file. | ||
|
||
`cnpy` lets you read and write to these formats in C++. | ||
|
||
The motivation comes from scientific programming where large amounts of data are generated in C++ and analyzed in Python. | ||
|
||
Writing to .npy has the advantage of using low-level C++ I/O (fread and fwrite) for speed and binary format for size. | ||
The .npy file header takes care of specifying the size, shape, and data type of the array, so specifying the format of the data is unnecessary. | ||
|
||
Loading data written in numpy formats into C++ is equally simple, but requires you to type-cast the loaded data to the type of your choice. | ||
|
||
# Installation: | ||
|
||
Default installation directory is /usr/local. | ||
To specify a different directory, add `-DCMAKE_INSTALL_PREFIX=/path/to/install/dir` to the cmake invocation in step 4. | ||
|
||
1. get [cmake](www.cmake.org) | ||
2. create a build directory, say $HOME/build | ||
3. cd $HOME/build | ||
4. cmake /path/to/cnpy | ||
5. make | ||
6. make install | ||
|
||
# Using: | ||
|
||
To use, `#include"cnpy.h"` in your source code. Compile the source code mycode.cpp as | ||
|
||
```bash | ||
g++ -o mycode mycode.cpp -L/path/to/install/dir -lcnpy -lz --std=c++11 | ||
``` | ||
|
||
# Description: | ||
|
||
There are two functions for writing data: `npy_save` and `npz_save`. | ||
|
||
There are 3 functions for reading: | ||
- `npy_load` will load a .npy file. | ||
- `npz_load(fname)` will load a .npz and return a dictionary of NpyArray structues. | ||
- `npz_load(fname,varname)` will load and return the NpyArray for data varname from the specified .npz file. | ||
|
||
The data structure for loaded data is below. | ||
Data is accessed via the `data<T>()`-method, which returns a pointer of the specified type (which must match the underlying datatype of the data). | ||
The array shape and word size are read from the npy header. | ||
|
||
```c++ | ||
struct NpyArray { | ||
std::vector<size_t> shape; | ||
size_t word_size; | ||
template<typename T> T* data(); | ||
}; | ||
``` | ||
See [example1.cpp](example1.cpp) for examples of how to use the library. example1 will also be build during cmake installation. |
Oops, something went wrong.