-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Initial commit, working synthetic dataset generator (dependencies are…
… ugly)
- Loading branch information
0 parents
commit 5e6fa61
Showing
6 changed files
with
1,184 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,130 @@ | ||
cmake_minimum_required( VERSION 2.8 ) | ||
|
||
if(NOT CMAKE_BUILD_TYPE) | ||
set(CMAKE_BUILD_TYPE Release) | ||
endif() | ||
|
||
project( smplsynth ) | ||
|
||
set( CMAKE_CXX_STACK_SIZE "10000000" ) | ||
set( CMAKE_CXX_STANDARD 11 ) | ||
set( CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake_modules" ) | ||
if (WIN32) | ||
set( COLOR_TERM OFF ) | ||
else() | ||
set( COLOR_TERM ON ) | ||
endif() | ||
|
||
if( NOT CMAKE_BUILD_TYPE ) | ||
set( CMAKE_BUILD_TYPE Release ) | ||
endif() | ||
|
||
set( PROJ_NAME "smplsynth" ) | ||
set( PART_LABELS_NAME "partlabels" ) | ||
set( OUTPUT_NAME "smplsynth" ) | ||
|
||
include( CheckCXXCompilerFlag ) | ||
CHECK_CXX_COMPILER_FLAG( "-std=c++11" COMPILER_SUPPORTS_CXX11 ) | ||
CHECK_CXX_COMPILER_FLAG( "-std=c++0x" COMPILER_SUPPORTS_CXX0X ) | ||
|
||
if( COMPILER_SUPPORTS_CXX11 ) | ||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11" ) | ||
elseif( COMPILER_SUPPORTS_CXX0X ) | ||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x" ) | ||
else() | ||
message( STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler." ) | ||
endif() | ||
|
||
if ( CMAKE_COMPILER_IS_GNUCXX ) | ||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-deprecated-declarations -O3 -g" ) | ||
endif ( CMAKE_COMPILER_IS_GNUCXX ) | ||
|
||
set( Boost_USE_STATIC_LIBS ON ) | ||
set( Boost_USE_STATIC ON ) | ||
|
||
if( NOT DEFINED EIGEN_INCLUDE_DIRS ) | ||
if ( DEFINED Eigen_DIR ) | ||
set( EIGEN_INCLUDE_DIRS ${Eigen_DIR} ) | ||
endif ( DEFINED Eigen_DIR ) | ||
endif( NOT DEFINED EIGEN_INCLUDE_DIRS ) | ||
if ( NOT DEFINED Eigen_DIR ) | ||
find_package( Eigen QUIET ) | ||
endif ( NOT DEFINED Eigen_DIR ) | ||
set( EIGEN_INCLUDE_DIR EIGEN_INCLUDE_DIRS ) | ||
include_directories(${EIGEN_INCLUDE_DIRS}) | ||
message(STATUS "Found Eigen: ${EIGEN_INCLUDE_DIRS}") | ||
|
||
# require OpenCV | ||
find_package( OpenCV REQUIRED ) | ||
if( OpenCV_FOUND ) | ||
message( STATUS "Found OpenCV: ${OpenCV_INCLUDE_DIRS}" ) | ||
endif( OpenCV_FOUND ) | ||
|
||
# require PCL | ||
find_package( PCL REQUIRED ) | ||
if( PCL_FOUND ) | ||
message( STATUS "Found PCL: ${PCL_INCLUDE_DIRS}" ) | ||
endif( PCL_FOUND ) | ||
|
||
# require OpenARK | ||
find_package( OpenARK REQUIRED ) | ||
if( OpenARK_FOUND ) | ||
message( STATUS "Found OpenARK: ${OpenARK_INCLUDE_DIR}" ) | ||
endif( OpenARK_FOUND ) | ||
|
||
# require K4A | ||
find_package( k4a REQUIRED ) | ||
if( k4a_FOUND) | ||
message( STATUS "Found k4a (Azure Kinect SDK)" ) | ||
endif( k4a_FOUND ) | ||
|
||
find_package( Boost REQUIRED COMPONENTS system program_options ) | ||
|
||
# require Ceres | ||
find_package( Ceres REQUIRED ) | ||
IF(Ceres_FOUND) | ||
MESSAGE(STATUS "Found Ceres: ${CERES_INCLUDE_DIRS} ${CERES_LIBRARIES}") | ||
ENDIF(Ceres_FOUND) | ||
|
||
include_directories( | ||
${OpenCV_INCLUDE_DIRS} | ||
${PCL_INCLUDE_DIRS} | ||
${CERES_INCLUDE_DIRS} | ||
${OpenARK_INCLUDE_DIR} | ||
${Boost_INCLUDE_DIRS} | ||
) | ||
|
||
set( | ||
DEPENDENCIES | ||
${OpenCV_LIBRARIES} | ||
${PCL_LIBRARIES} | ||
${OpenARK_LIB} | ||
${CERES_LIBRARIES} | ||
${Boost_LIBRARIES} | ||
k4a::k4a | ||
) | ||
|
||
add_definitions( | ||
${PCL_DEFINITIONS} | ||
) | ||
foreach( DEFINITION ${PCL_DEFINITIONS} ) | ||
set( TARGET_COMPILE_FLAGS "${TARGET_COMPILE_FLAGS} ${DEFINITION}" ) | ||
endforeach() | ||
|
||
add_executable( ${PROJ_NAME} sample.cpp ) | ||
target_include_directories( ${PROJ_NAME} PRIVATE ${INCLUDE_DIR} ) | ||
set_target_properties( ${PROJ_NAME} PROPERTIES OUTPUT_NAME ${OUTPUT_NAME} ) | ||
target_link_libraries( ${PROJ_NAME} ${DEPENDENCIES} ) | ||
set_target_properties( ${PROJ_NAME} PROPERTIES COMPILE_FLAGS ${TARGET_COMPILE_FLAGS} ) | ||
|
||
add_executable( ${PART_LABELS_NAME} partlabels.cpp ) | ||
target_include_directories( ${PART_LABELS_NAME} PRIVATE ${INCLUDE_DIR} ) | ||
set_target_properties( ${PART_LABELS_NAME} PROPERTIES OUTPUT_NAME ${PART_LABELS_NAME} ) | ||
target_link_libraries( ${PART_LABELS_NAME} ${DEPENDENCIES} ) | ||
set_target_properties( ${PART_LABELS_NAME} PROPERTIES COMPILE_FLAGS ${TARGET_COMPILE_FLAGS} ) | ||
|
||
if ( MSVC ) | ||
set_property(TARGET ${PROJ_NAME} APPEND PROPERTY LINK_FLAGS /DEBUG) | ||
else () | ||
target_link_libraries( ${PROJ_NAME} -pthread ) | ||
endif ( MSVC ) |
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,13 @@ | ||
Copyright 2019 Alex Yu | ||
|
||
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. |
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,50 @@ | ||
## Fast marching method | ||
|
||
- To use in a project, include fmm.hpp and use `fmm::fmm<image_data_type>(image, seeds, weight_map_type[, image_segmentation_threshold])` | ||
|
||
- This is header-only and you do not need to build this, unless you want to build the sample program. | ||
|
||
- All functions are templated to be OpenCV Mat compatible, also includes bare-bones Image struct which allows you to use any row-major contiguous matrix type: `Image<filed_type>(rows, cols, data_ptr)` | ||
|
||
Comment on top of fmm.hpp copied here: | ||
```cpp | ||
/** Fast marching method implementation | ||
* usage: fmm::fmm(image, seeds, weight_map_type = IDENTITY, | ||
* segmentation_threshold = disabled, | ||
* normalize_output_geodesic_distances = true, | ||
* output = nullptr) | ||
* > returns an image, either geodesic distance map or, if | ||
* segmentation_threshold is given, a segmentation mask | ||
* image: input image (can be OpenCV Mat or fmm::Image<T>) | ||
* seeds: std::vector of points (each can be OpenCV Point or fmm::Point) | ||
* weight_map_type: transformation to apply to input image to use as FMM | ||
* weight function. Can be one of: | ||
* fmm::weight::IDENTITY no transformation (avoids a copy) | ||
* fmm::weight::GRADIENT gradient magnitude (using Sobel) | ||
* fmm::weight::ABSDIFF absolute difference from average | ||
* grayscale value of seeds | ||
* fmm::weight::LAPLACIAN image Laplacian magnitude | ||
* segmentation_threshold: if specified, sets pixels with geodesic value less | ||
* than or equal to this threshold to 1 and others to 0 | ||
* in the output image. If not given,the geodesic | ||
* distances map will be returned. | ||
* normalize_output_geodesic_distances: if true, normalizes geodesic distances | ||
* values to be in the interval [0, 1]. | ||
* If segmentation_threshold is specified, | ||
* this occurs prior to segmentation. | ||
* Default true. | ||
* output: optionally, a pointer to an already-allocated output image. | ||
* This allows you to avoid a copy if you already have one | ||
* allocated. By default a new image is created, and this | ||
* is not necessary. | ||
* | ||
* fmm::Image<T> usage (optional) | ||
* - To make owning image fmm::Image<T>(rows, cols) | ||
* - To make non-owning image that maps to row-major data (of same type, or char/uchar): | ||
* fmm::Image<T>(rows, cols, data_ptr) | ||
* */ | ||
``` | ||
|
||
## License | ||
|
||
Apache 2.0 |
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,12 @@ | ||
fx 606.438 | ||
cx 637.294 | ||
fy 606.351 | ||
cy 366.992 | ||
k0 0.777798 | ||
k1 -2.93384 | ||
k2 1.6463 | ||
k3 0.655163 | ||
k4 -2.76696 | ||
k5 1.57894 | ||
p0 0.000662754 | ||
p1 6.69302e-05 |
Oops, something went wrong.