Repository: sergeytulyakov/FaceCept3D
Branch: master
Commit: f13c791af154
Files: 128
Total size: 331.9 KB
Directory structure:
gitextract_pxarii44/
├── .gitignore
├── FaceCept3D/
│ ├── 3dheadposeestimation.sln
│ ├── CMakeLists.txt
│ ├── Config/
│ │ ├── CommonProperties.props
│ │ ├── CommonPropertiesLibsDebug.props
│ │ └── CommonPropertiesLibsRelease.props
│ ├── HeadPoseEstimationFramework/
│ │ ├── Align/
│ │ │ ├── CloudMapper.cpp
│ │ │ ├── CloudMapper.h
│ │ │ ├── IHeadTemplateCreator.h
│ │ │ ├── IncrementalHeadTemplateCreator.cpp
│ │ │ ├── IncrementalHeadTemplateCreator.h
│ │ │ ├── TransformationEstimationHPE.cpp
│ │ │ └── TransformationEstimationHPE.h
│ │ ├── CMakeLists.txt
│ │ ├── Common.h
│ │ ├── Converter/
│ │ │ ├── IDataConverter.h
│ │ │ ├── KinectDataConverter.cpp
│ │ │ └── KinectDataConverter.h
│ │ ├── DataFilter/
│ │ │ └── IDataFilter.h
│ │ ├── DataObject/
│ │ │ ├── CloudXYZRGBA.h
│ │ │ ├── HeadPoseInfo.h
│ │ │ ├── IDataObject.h
│ │ │ ├── IDataStorage.h
│ │ │ ├── LandmarksObject.h
│ │ │ ├── MapDataStorage.cpp
│ │ │ ├── MapDataStorage.h
│ │ │ └── RawFrames.h
│ │ ├── Detector/
│ │ │ └── DepthFrameDetector/
│ │ │ ├── DepthDetector.cpp
│ │ │ ├── DepthDetector.h
│ │ │ ├── LeafNode.cpp
│ │ │ ├── LeafNode.h
│ │ │ ├── Tree.cpp
│ │ │ ├── Tree.h
│ │ │ ├── csvMat.cpp
│ │ │ ├── csvMat.h
│ │ │ ├── localFunctions.cpp
│ │ │ └── localFunctions.h
│ │ ├── Exception/
│ │ │ ├── HPEException.cpp
│ │ │ └── HPEException.h
│ │ ├── FacialExpressions/
│ │ │ ├── ferLocalFunctions.cpp
│ │ │ └── ferLocalFunctions.h
│ │ ├── Features/
│ │ │ ├── Calculator/
│ │ │ │ ├── CylinderOptimizedFeatureCalculator.cpp
│ │ │ │ ├── CylinderOptimizedFeatureCalculator.h
│ │ │ │ ├── FeatureCalculatorBase.h
│ │ │ │ └── IFeatureCalculator.h
│ │ │ ├── IFeature.h
│ │ │ └── Sampler/
│ │ │ ├── CylinderSampler.cpp
│ │ │ ├── CylinderSampler.h
│ │ │ └── IPatchSampler.h
│ │ ├── Filter/
│ │ │ ├── BoxFilter.h
│ │ │ ├── CenteredBoxFilter.h
│ │ │ ├── FilteringQueue.h
│ │ │ ├── Filters.h
│ │ │ ├── FunctorFilter.h
│ │ │ ├── ICenterCloudFilter.h
│ │ │ ├── ICloudFilter.h
│ │ │ └── MovingLeastSquaresFilter.h
│ │ ├── Grabber/
│ │ │ ├── GrabberBase.cpp
│ │ │ ├── GrabberBase.h
│ │ │ ├── OpenNIGrabber.cpp
│ │ │ ├── OpenNIGrabber.h
│ │ │ ├── PCDGrabber.cpp
│ │ │ ├── PCDGrabber.h
│ │ │ ├── ProviderGrabber.cpp
│ │ │ └── ProviderGrabber.h
│ │ ├── HeadPoseEstimationFramework.vcxproj
│ │ ├── Helpers/
│ │ │ ├── HpeHelpers.cpp
│ │ │ └── HpeHelpers.h
│ │ ├── Interface/
│ │ │ └── IInterface.h
│ │ ├── Landmarks.h
│ │ ├── Processor/
│ │ │ ├── ConverterProcessor.cpp
│ │ │ ├── ConverterProcessor.h
│ │ │ ├── DepthPreprocessingProcessor.cpp
│ │ │ ├── DepthPreprocessingProcessor.h
│ │ │ ├── DetectorProcessor.cpp
│ │ │ ├── DetectorProcessor.h
│ │ │ ├── FacialExpressionsProcessor.cpp
│ │ │ ├── FacialExpressionsProcessor.h
│ │ │ ├── FilterProcessor.cpp
│ │ │ ├── FilterProcessor.h
│ │ │ ├── HeadExtractionProcessor.cpp
│ │ │ ├── HeadExtractionProcessor.h
│ │ │ ├── IProcessor.h
│ │ │ ├── SaveCloudProcessor.cpp
│ │ │ ├── SaveCloudProcessor.h
│ │ │ ├── ShowCloudProcessor.cpp
│ │ │ ├── ShowCloudProcessor.h
│ │ │ ├── TemplateCreatorProcessor.cpp
│ │ │ ├── TemplateCreatorProcessor.h
│ │ │ ├── TrackingProcessor.cpp
│ │ │ └── TrackingProcessor.h
│ │ ├── Provider/
│ │ │ ├── IDataProvider.h
│ │ │ ├── RawDataProvider.cpp
│ │ │ └── RawDataProvider.h
│ │ ├── Settings/
│ │ │ ├── HPESettings.cpp
│ │ │ └── HPESettings.h
│ │ ├── Tracker/
│ │ │ └── ICPTemplateTracker.h
│ │ ├── UI/
│ │ │ ├── PointPicker.h
│ │ │ ├── ShowCloud.h
│ │ │ ├── ShowMesh.h
│ │ │ └── VisualizerCommon.h
│ │ └── WindowsOnly/
│ │ ├── Grabber/
│ │ │ ├── KinectSDKGrabber.cpp
│ │ │ └── KinectSDKGrabber.h
│ │ └── Processor/
│ │ ├── KinectSDKConverterProcessor.cpp
│ │ └── KinectSDKConverterProcessor.h
│ ├── TemplateCreator/
│ │ ├── CMakeLists.txt
│ │ ├── TemplateCreator.cpp
│ │ ├── TemplateCreator.vcxproj
│ │ ├── UIProcessor.cpp
│ │ ├── UIProcessor.h
│ │ ├── settings.ini
│ │ ├── stdafx.cpp
│ │ └── stdafx.h
│ └── TemplateTracker/
│ ├── ShowTwoCloudsProcessor.cpp
│ ├── ShowTwoCloudsProcessor.h
│ ├── TemplateTracker.cpp
│ ├── TemplateTracker.vcxproj
│ ├── UIProcessor.cpp
│ ├── UIProcessor.h
│ ├── VisuilizeProcessor.cpp
│ ├── VisuilizeProcessor.h
│ ├── VoxelizeProcessor.cpp
│ ├── VoxelizeProcessor.h
│ ├── settings.ini
│ ├── stdafx.cpp
│ └── stdafx.h
├── LICENSE
└── README.md
================================================
FILE CONTENTS
================================================
================================================
FILE: .gitignore
================================================
*.suo
*.sdf
*.user
*.opensdf
*.txt
*.idea
!CMakeLists.txt
build
ipch
Debug
Release
x64
data/DetectorData
data/FERData
================================================
FILE: FaceCept3D/3dheadposeestimation.sln
================================================
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.21005.1
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HeadPoseEstimationFramework", "HeadPoseEstimationFramework\HeadPoseEstimationFramework.vcxproj", "{A46EAD61-34BD-4EFA-B545-B8FD8C2C3BBD}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TemplateCreator", "TemplateCreator\TemplateCreator.vcxproj", "{39EBEEC1-29C0-48BA-9858-E593CAEE7757}"
ProjectSection(ProjectDependencies) = postProject
{A46EAD61-34BD-4EFA-B545-B8FD8C2C3BBD} = {A46EAD61-34BD-4EFA-B545-B8FD8C2C3BBD}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TemplateTracker", "TemplateTracker\TemplateTracker.vcxproj", "{68A9917E-A682-4013-8D30-389AB45A9E0D}"
ProjectSection(ProjectDependencies) = postProject
{A46EAD61-34BD-4EFA-B545-B8FD8C2C3BBD} = {A46EAD61-34BD-4EFA-B545-B8FD8C2C3BBD}
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Mixed Platforms = Debug|Mixed Platforms
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|Mixed Platforms = Release|Mixed Platforms
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{A46EAD61-34BD-4EFA-B545-B8FD8C2C3BBD}.Debug|Mixed Platforms.ActiveCfg = Debug|x64
{A46EAD61-34BD-4EFA-B545-B8FD8C2C3BBD}.Debug|Win32.ActiveCfg = Debug|x64
{A46EAD61-34BD-4EFA-B545-B8FD8C2C3BBD}.Debug|x64.ActiveCfg = Debug|x64
{A46EAD61-34BD-4EFA-B545-B8FD8C2C3BBD}.Debug|x64.Build.0 = Debug|x64
{A46EAD61-34BD-4EFA-B545-B8FD8C2C3BBD}.Release|Mixed Platforms.ActiveCfg = Release|x64
{A46EAD61-34BD-4EFA-B545-B8FD8C2C3BBD}.Release|Win32.ActiveCfg = Release|x64
{A46EAD61-34BD-4EFA-B545-B8FD8C2C3BBD}.Release|x64.ActiveCfg = Release|x64
{A46EAD61-34BD-4EFA-B545-B8FD8C2C3BBD}.Release|x64.Build.0 = Release|x64
{39EBEEC1-29C0-48BA-9858-E593CAEE7757}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{39EBEEC1-29C0-48BA-9858-E593CAEE7757}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{39EBEEC1-29C0-48BA-9858-E593CAEE7757}.Debug|Win32.ActiveCfg = Debug|Win32
{39EBEEC1-29C0-48BA-9858-E593CAEE7757}.Debug|Win32.Build.0 = Debug|Win32
{39EBEEC1-29C0-48BA-9858-E593CAEE7757}.Debug|x64.ActiveCfg = Debug|x64
{39EBEEC1-29C0-48BA-9858-E593CAEE7757}.Debug|x64.Build.0 = Debug|x64
{39EBEEC1-29C0-48BA-9858-E593CAEE7757}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{39EBEEC1-29C0-48BA-9858-E593CAEE7757}.Release|Mixed Platforms.Build.0 = Release|Win32
{39EBEEC1-29C0-48BA-9858-E593CAEE7757}.Release|Win32.ActiveCfg = Release|Win32
{39EBEEC1-29C0-48BA-9858-E593CAEE7757}.Release|Win32.Build.0 = Release|Win32
{39EBEEC1-29C0-48BA-9858-E593CAEE7757}.Release|x64.ActiveCfg = Release|x64
{39EBEEC1-29C0-48BA-9858-E593CAEE7757}.Release|x64.Build.0 = Release|x64
{68A9917E-A682-4013-8D30-389AB45A9E0D}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
{68A9917E-A682-4013-8D30-389AB45A9E0D}.Debug|Mixed Platforms.Build.0 = Debug|Win32
{68A9917E-A682-4013-8D30-389AB45A9E0D}.Debug|Win32.ActiveCfg = Debug|Win32
{68A9917E-A682-4013-8D30-389AB45A9E0D}.Debug|Win32.Build.0 = Debug|Win32
{68A9917E-A682-4013-8D30-389AB45A9E0D}.Debug|x64.ActiveCfg = Debug|x64
{68A9917E-A682-4013-8D30-389AB45A9E0D}.Debug|x64.Build.0 = Debug|x64
{68A9917E-A682-4013-8D30-389AB45A9E0D}.Release|Mixed Platforms.ActiveCfg = Release|Win32
{68A9917E-A682-4013-8D30-389AB45A9E0D}.Release|Mixed Platforms.Build.0 = Release|Win32
{68A9917E-A682-4013-8D30-389AB45A9E0D}.Release|Win32.ActiveCfg = Release|Win32
{68A9917E-A682-4013-8D30-389AB45A9E0D}.Release|Win32.Build.0 = Release|Win32
{68A9917E-A682-4013-8D30-389AB45A9E0D}.Release|x64.ActiveCfg = Release|x64
{68A9917E-A682-4013-8D30-389AB45A9E0D}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
================================================
FILE: FaceCept3D/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 2.8)
add_subdirectory(HeadPoseEstimationFramework)
add_subdirectory(TemplateCreator)
================================================
FILE: FaceCept3D/Config/CommonProperties.props
================================================
$(KINECTSDK10_DIR)/inc;$(FACECEPT3D_3RDPARTY_DIR)\Boost\include;$(FACECEPT3D_3RDPARTY_DIR)\Eigen\include;$(FACECEPT3D_3RDPARTY_DIR)\FLANN\include;$(FACECEPT3D_3RDPARTY_DIR)\Opencv\include;$(FACECEPT3D_3RDPARTY_DIR)\PCL\include;$(FACECEPT3D_3RDPARTY_DIR)\Qhull\include;$(FACECEPT3D_3RDPARTY_DIR)\Qt\include;$(FACECEPT3D_3RDPARTY_DIR)\VTK\include\vtk-5.8;$(ProjectDir);$(VCInstallDir)include;$(VCInstallDir)atlmfc\include;$(WindowsSdkDir)include;$(FrameworkSDKDir)\include
<_PropertySheetDisplayName>CommonPropertiesPaths
/Zm500 %(AdditionalOptions)
================================================
FILE: FaceCept3D/Config/CommonPropertiesLibsDebug.props
================================================
$(KINECTSDK10_DIR)\lib\amd64;$(FACECEPT3D_3RDPARTY_DIR)\Boost\lib;$(FACECEPT3D_3RDPARTY_DIR)\FLANN\lib;$(FACECEPT3D_3RDPARTY_DIR)\Opencv\lib;$(FACECEPT3D_3RDPARTY_DIR)\PCL\lib;$(FACECEPT3D_3RDPARTY_DIR)\Qhull\lib;$(FACECEPT3D_3RDPARTY_DIR)\Qt\lib;$(FACECEPT3D_3RDPARTY_DIR)\VTK\lib\vtk-5.8;$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSdkDir)lib\x64
HeadPoseEstimationFramework_Debug.lib;opencv_calib3d2410d.lib;opencv_contrib2410d.lib;opencv_core2410d.lib;opencv_features2d2410d.lib;opencv_flann2410d.lib;opencv_gpu2410d.lib;opencv_highgui2410d.lib;opencv_imgproc2410d.lib;opencv_legacy2410d.lib;opencv_ml2410d.lib;opencv_nonfree2410d.lib;opencv_objdetect2410d.lib;opencv_ocl2410d.lib;opencv_photo2410d.lib;opencv_stitching2410d.lib;opencv_superres2410d.lib;opencv_ts2410d.lib;opencv_video2410d.lib;opencv_videostab2410d.lib;Kinect10.lib;opengl32.lib;qhullstatic_d.lib;pcl_common_debug.lib;pcl_features_debug.lib;pcl_filters_debug.lib;pcl_io_debug.lib;pcl_io_ply_debug.lib;pcl_kdtree_debug.lib;pcl_keypoints_debug.lib;pcl_octree_debug.lib;pcl_outofcore_debug.lib;pcl_people_debug.lib;pcl_recognition_debug.lib;pcl_registration_debug.lib;pcl_sample_consensus_debug.lib;pcl_search_debug.lib;pcl_segmentation_debug.lib;pcl_surface_debug.lib;pcl_tracking_debug.lib;pcl_visualization_debug.lib;flann_cpp_s-gd.lib;libboost_atomic-vc100-mt-gd-1_55.lib;libboost_chrono-vc100-mt-gd-1_55.lib;libboost_context-vc100-mt-gd-1_55.lib;libboost_coroutine-vc100-mt-gd-1_55.lib;libboost_date_time-vc100-mt-gd-1_55.lib;libboost_exception-vc100-mt-gd-1_55.lib;libboost_filesystem-vc100-mt-gd-1_55.lib;libboost_graph-vc100-mt-gd-1_55.lib;libboost_iostreams-vc100-mt-gd-1_55.lib;libboost_locale-vc100-mt-gd-1_55.lib;libboost_log_setup-vc100-mt-gd-1_55.lib;libboost_log-vc100-mt-gd-1_55.lib;libboost_math_c99f-vc100-mt-gd-1_55.lib;libboost_math_c99l-vc100-mt-gd-1_55.lib;libboost_math_c99-vc100-mt-gd-1_55.lib;libboost_math_tr1f-vc100-mt-gd-1_55.lib;libboost_math_tr1l-vc100-mt-gd-1_55.lib;libboost_math_tr1-vc100-mt-gd-1_55.lib;libboost_prg_exec_monitor-vc100-mt-gd-1_55.lib;libboost_program_options-vc100-mt-gd-1_55.lib;libboost_random-vc100-mt-gd-1_55.lib;libboost_regex-vc100-mt-gd-1_55.lib;libboost_serialization-vc100-mt-gd-1_55.lib;libboost_signals-vc100-mt-gd-1_55.lib;libboost_system-vc100-mt-gd-1_55.lib;libboost_test_exec_monitor-vc100-mt-gd-1_55.lib;libboost_thread-vc100-mt-gd-1_55.lib;libboost_timer-vc100-mt-gd-1_55.lib;libboost_unit_test_framework-vc100-mt-gd-1_55.lib;libboost_wave-vc100-mt-gd-1_55.lib;libboost_wserialization-vc100-mt-gd-1_55.lib;phonond4.lib;QAxContainerd.lib;QAxServerd.lib;Qt3Supportd4.lib;QtCLucened4.lib;QtCored4.lib;QtDeclaratived4.lib;QtDesignerComponentsd4.lib;QtDesignerd4.lib;QtGuid4.lib;QtHelpd4.lib;qtmaind.lib;QtMultimediad4.lib;QtNetworkd4.lib;QtOpenGLd4.lib;QtScriptd4.lib;QtScriptToolsd4.lib;QtSqld4.lib;QtSvgd4.lib;QtTestd4.lib;QtUiToolsd.lib;QtWebKitd4.lib;QtXmld4.lib;QtXmlPatternsd4.lib;MapReduceMPI-gd.lib;mpistubs-gd.lib;QVTK-gd.lib;vtkalglib-gd.lib;vtkCharts-gd.lib;vtkCommon-gd.lib;vtkDICOMParser-gd.lib;vtkexoIIc-gd.lib;vtkexpat-gd.lib;vtkFiltering-gd.lib;vtkfreetype-gd.lib;vtkftgl-gd.lib;vtkGenericFiltering-gd.lib;vtkGeovis-gd.lib;vtkGraphics-gd.lib;vtkhdf5-gd.lib;vtkHybrid-gd.lib;vtkImaging-gd.lib;vtkInfovis-gd.lib;vtkIO-gd.lib;vtkjpeg-gd.lib;vtklibxml2-gd.lib;vtkmetaio-gd.lib;vtkNetCDF-gd.lib;vtkNetCDF_cxx-gd.lib;vtkpng-gd.lib;vtkproj4-gd.lib;vtkRendering-gd.lib;vtksqlite-gd.lib;vtksys-gd.lib;vtktiff-gd.lib;vtkverdict-gd.lib;vtkViews-gd.lib;vtkVolumeRendering-gd.lib;vtkWidgets-gd.lib;vtkzlib-gd.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)
================================================
FILE: FaceCept3D/Config/CommonPropertiesLibsRelease.props
================================================
$(KINECTSDK10_DIR)\lib\amd64;$(FACECEPT3D_3RDPARTY_DIR)\Boost\lib;$(FACECEPT3D_3RDPARTY_DIR)\FLANN\lib;$(FACECEPT3D_3RDPARTY_DIR)\Opencv\lib;$(FACECEPT3D_3RDPARTY_DIR)\PCL\lib;$(FACECEPT3D_3RDPARTY_DIR)\Qhull\lib;$(FACECEPT3D_3RDPARTY_DIR)\Qt\lib;$(FACECEPT3D_3RDPARTY_DIR)\VTK\lib\vtk-5.8;$(VCInstallDir)lib\amd64;$(VCInstallDir)atlmfc\lib\amd64;$(WindowsSdkDir)lib\x64
HeadPoseEstimationFramework_Release.lib;Kinect10.lib;opengl32.lib;MapReduceMPI.lib;mpistubs.lib;QVTK.lib;vtkalglib.lib;vtkCharts.lib;vtkCommon.lib;vtkDICOMParser.lib;vtkexoIIc.lib;vtkexpat.lib;vtkFiltering.lib;vtkfreetype.lib;vtkftgl.lib;vtkGenericFiltering.lib;vtkGeovis.lib;vtkGraphics.lib;vtkhdf5.lib;vtkHybrid.lib;vtkImaging.lib;vtkInfovis.lib;vtkIO.lib;vtkjpeg.lib;vtklibxml2.lib;vtkmetaio.lib;vtkNetCDF.lib;vtkNetCDF_cxx.lib;vtkpng.lib;vtkproj4.lib;vtkRendering.lib;vtksqlite.lib;vtksys.lib;vtktiff.lib;vtkverdict.lib;vtkViews.lib;vtkVolumeRendering.lib;vtkWidgets.lib;vtkzlib.lib;opencv_calib3d2410.lib;opencv_contrib2410.lib;opencv_core2410.lib;opencv_features2d2410.lib;opencv_flann2410.lib;opencv_gpu2410.lib;opencv_highgui2410.lib;opencv_imgproc2410.lib;opencv_legacy2410.lib;opencv_ml2410.lib;opencv_nonfree2410.lib;opencv_objdetect2410.lib;opencv_ocl2410.lib;opencv_photo2410.lib;opencv_stitching2410.lib;opencv_superres2410.lib;opencv_ts2410.lib;opencv_video2410.lib;opencv_videostab2410.lib;qhullstatic.lib;pcl_common_release.lib;pcl_features_release.lib;pcl_filters_release.lib;pcl_io_ply_release.lib;pcl_io_release.lib;pcl_kdtree_release.lib;pcl_keypoints_release.lib;pcl_octree_release.lib;pcl_outofcore_release.lib;pcl_people_release.lib;pcl_recognition_release.lib;pcl_registration_release.lib;pcl_sample_consensus_release.lib;pcl_search_release.lib;pcl_segmentation_release.lib;pcl_surface_release.lib;pcl_tracking_release.lib;pcl_visualization_release.lib;flann_cpp_s.lib;libboost_atomic-vc100-mt-1_55.lib;libboost_chrono-vc100-mt-1_55.lib;libboost_context-vc100-mt-1_55.lib;libboost_coroutine-vc100-mt-1_55.lib;libboost_date_time-vc100-mt-1_55.lib;libboost_exception-vc100-mt-1_55.lib;libboost_filesystem-vc100-mt-1_55.lib;libboost_graph-vc100-mt-1_55.lib;libboost_iostreams-vc100-mt-1_55.lib;libboost_locale-vc100-mt-1_55.lib;libboost_log-vc100-mt-1_55.lib;libboost_log_setup-vc100-mt-1_55.lib;libboost_math_c99-vc100-mt-1_55.lib;libboost_math_c99f-vc100-mt-1_55.lib;libboost_math_c99l-vc100-mt-1_55.lib;libboost_math_tr1-vc100-mt-1_55.lib;libboost_math_tr1f-vc100-mt-1_55.lib;libboost_math_tr1l-vc100-mt-1_55.lib;libboost_prg_exec_monitor-vc100-mt-1_55.lib;libboost_program_options-vc100-mt-1_55.lib;libboost_random-vc100-mt-1_55.lib;libboost_regex-vc100-mt-1_55.lib;libboost_serialization-vc100-mt-1_55.lib;libboost_signals-vc100-mt-1_55.lib;libboost_system-vc100-mt-1_55.lib;libboost_test_exec_monitor-vc100-mt-1_55.lib;libboost_thread-vc100-mt-1_55.lib;libboost_timer-vc100-mt-1_55.lib;libboost_unit_test_framework-vc100-mt-1_55.lib;libboost_wave-vc100-mt-1_55.lib;libboost_wserialization-vc100-mt-1_55.lib;phonon4.lib;QAxContainer.lib;QAxServer.lib;Qt3Support4.lib;QtCLucene4.lib;QtCore4.lib;QtDeclarative4.lib;QtDesigner4.lib;QtDesignerComponents4.lib;QtGui4.lib;QtHelp4.lib;qtmain.lib;QtMultimedia4.lib;QtNetwork4.lib;QtOpenGL4.lib;QtScript4.lib;QtScriptTools4.lib;QtSql4.lib;QtSvg4.lib;QtTest4.lib;QtUiTools.lib;QtWebKit4.lib;QtXml4.lib;QtXmlPatterns4.lib;%(AdditionalDependencies)
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/Align/CloudMapper.cpp
================================================
#include "CloudMapper.h"
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include "UI/ShowCloud.h"
#include "Exception/HPEException.h"
#include "Filter/Filters.h"
#include "TransformationEstimationHPE.h"
#include
namespace hpe
{
float CalculateDistance(pcl::PointXYZRGBA &p1, pcl::PointXYZRGBA &p2)
{
Eigen::VectorXf d(3);
d(0) = p1.x - p2.x;
d(1) = p1.y - p2.y;
d(2) = p1.z - p2.z;
return d.norm();
}
CloudMapper::CloudMapper()
: m_icpParams(CloudMapper::ICPParams(0.05, 0.05, 0.000001, 100000, 100)),
m_useDynamicICP(false), m_usePointToPlaneMetric(false), m_useNormalShooting(false),
m_estimateScale(false)
{
}
void CloudMapper::AddCloud(CloudMapper::Cloud::Ptr &cloud, CloudMapper::Landmarks &landmarks)
{
m_pointClouds.push_back(cloud);
m_landmarks.push_back(landmarks);
}
CloudMapper::Clouds CloudMapper::GetAlignedClouds(TransformationsPtr transformations)
{
return AlignAll(m_pointClouds, m_landmarks);
}
CloudMapper::Cloud::Ptr CloudMapper::GetMergedCloud()
{
CloudMapper::Clouds alignedClouds = AlignAll(m_pointClouds, m_landmarks);
CloudMapper::Cloud::Ptr merged(new CloudMapper::Cloud);
auto it = alignedClouds.begin();
do
{
auto current = (*it);
*merged += *current;
++it;
}
while (it != alignedClouds.end());
return merged;
}
CloudMapper::TransformationsPtr CloudMapper::GetTransforms()
{
CloudMapper::TransformationsPtr transforms(new CloudMapper::Transformations);
AlignAll(m_pointClouds, m_landmarks, transforms);
return transforms;
}
void CloudMapper::SetICPParams(CloudMapper::ICPParams params)
{
m_icpParams = params;
}
void CloudMapper::SetDynamicICPParams(CloudMapper::DynamicICPParams ¶ms)
{
m_dynamicICPParams = params;
SetUseDynamicICP(true);
}
void CloudMapper::SetUseDynamicICP(bool use)
{
m_useDynamicICP = use;
}
void CloudMapper::SetUseNormalShooting(bool use)
{
m_useNormalShooting = use;
}
void CloudMapper::SetEstimateScale(bool estimateScale)
{
m_estimateScale = estimateScale;
}
void CloudMapper::SetUsePointToPlaneMetric(bool use)
{
m_usePointToPlaneMetric = use;
}
Eigen::Matrix4f CloudMapper::GetTransformForTwoCloudsPointToPlane(CloudMapper::Cloud::Ptr &source,
CloudMapper::Cloud::Ptr &target,
ICPParams params)
{
CloudMapper::NormalCloud::Ptr normalSource(new CloudMapper::NormalCloud);
pcl::copyPointCloud(*source, *normalSource);
CloudMapper::NormalCloud::Ptr normalTarget(new CloudMapper::NormalCloud);
pcl::copyPointCloud(*target, *normalTarget);
typedef pcl::search::KdTree Search2;
Search2::Ptr search(new Search2);
pcl::NormalEstimation estimation;
estimation.setSearchMethod(search);
estimation.setKSearch(10);
estimation.setInputCloud(normalTarget);
estimation.compute(*normalTarget);
typedef pcl::registration::CorrespondenceRejectorSampleConsensus Rejector;
pcl::Registration::Ptr registration(new pcl::IterativeClosestPoint);
pcl::registration::CorrespondenceRejectorSampleConsensus::Ptr rejector(new pcl::registration::CorrespondenceRejectorSampleConsensus);
rejector->setInlierThreshold(params.RansacRejectionThreshold);
rejector->setMaximumIterations(params.MaxRANSACIterations);
rejector->setInputSource(normalSource);
rejector->setInputTarget(normalTarget);
registration->setInputSource(normalSource);
registration->setInputTarget(normalTarget);
registration->setMaxCorrespondenceDistance(params.MaxCorrespondenceDistance);
registration->setRANSACOutlierRejectionThreshold(params.RansacRejectionThreshold);
registration->setTransformationEpsilon(params.TransformationEpsilon);
registration->setMaximumIterations(params.MaxICPIterations);
registration->setRANSACIterations(params.MaxRANSACIterations);
registration->addCorrespondenceRejector(rejector);
if (m_useNormalShooting)
{
typedef pcl::registration::CorrespondenceEstimationNormalShooting NormalShooting;
NormalShooting::Ptr ce(new NormalShooting);
registration->setCorrespondenceEstimation(ce);
}
typedef TransformationEstimationHPE Custom;
Custom::Ptr metric(new Custom);
metric->SetWeights(m_weights);
registration->setTransformationEstimation(metric);
CloudMapper::NormalCloud::Ptr c(new CloudMapper::NormalCloud);
registration->align(*c);
//std::cout << "Fitness Score " << registration->getFitnessScore() << std::endl;
return registration->getFinalTransformation();
}
Eigen::Matrix4f CloudMapper::GetTransformForTwoCloudsPointToPoint(CloudMapper::Cloud::Ptr &source,
CloudMapper::Cloud::Ptr &target,
ICPParams params)
{
pcl::Registration::Ptr registration(new pcl::IterativeClosestPoint);
typedef pcl::registration::CorrespondenceRejectorSampleConsensus Rejector;
Rejector::Ptr rejector(new Rejector);
rejector->setInlierThreshold(params.RansacRejectionThreshold);
rejector->setMaximumIterations(params.MaxRANSACIterations);
rejector->setInputSource(source);
rejector->setInputTarget(target);
registration->setInputSource(source);
registration->setInputTarget(target);
registration->setMaxCorrespondenceDistance(params.MaxCorrespondenceDistance);
registration->setRANSACOutlierRejectionThreshold(params.RansacRejectionThreshold);
registration->setTransformationEpsilon(params.TransformationEpsilon);
registration->setMaximumIterations(params.MaxICPIterations);
registration->setRANSACIterations(params.MaxRANSACIterations);
registration->addCorrespondenceRejector(rejector);
CloudMapper::Cloud::Ptr c(new CloudMapper::Cloud);
registration->align(*c);
std::cout << "Fitness Score " << registration->getFitnessScore() << std::endl;
return registration->getFinalTransformation();
}
Eigen::Matrix4f CloudMapper::GetTransformForTwoCloudsDynamically(CloudMapper::Cloud::Ptr &source,
CloudMapper::Cloud::Ptr &target,
CloudMapper::DynamicICPParams &dynamicParams)
{
int icpRound = 1;
CloudMapper::Cloud::Ptr result(new Cloud);
pcl::copyPointCloud(*source, *result);
Eigen::Matrix4f finalTransformationMatrix = Eigen::Matrix4f::Identity();
for (auto it = dynamicParams.begin(); it != dynamicParams.end(); ++it)
{
auto params = *it;
Eigen::Matrix4f stepTransform = Eigen::Matrix4f::Identity();
if (m_usePointToPlaneMetric)
{
stepTransform = GetTransformForTwoCloudsPointToPlane(result, target, params);
}
else
{
stepTransform = GetTransformForTwoCloudsPointToPoint(result, target, params);
}
pcl::transformPointCloud(*result, *result, stepTransform);
finalTransformationMatrix = finalTransformationMatrix * stepTransform;
}
return finalTransformationMatrix;
}
Eigen::Matrix4f CloudMapper::GetTransformHavingLandmarks(CloudMapper::Cloud::Ptr &source, Common::Landmarks &l1,
CloudMapper::Cloud::Ptr &target, Common::Landmarks &l2)
{
pcl::CorrespondencesPtr correspondences = LandmarksToCorresponencies(source, l1, target, l2);
return GetTransformHavingCorrespondences(source, target, correspondences);
}
Eigen::Matrix4f CloudMapper::GetTransformHavingCorrespondences(CloudMapper::Cloud::Ptr &source, CloudMapper::Cloud::Ptr &target, pcl::CorrespondencesPtr &correspondences)
{
Eigen::Matrix4f initialAlignmentMatrix = ComputeInitialAlignment(source, target, correspondences);
bool initialAlignmentSucceed = IsNotNAN(initialAlignmentMatrix);
CloudMapper::Cloud::Ptr sourceTransformed(new CloudMapper::Cloud);
if (initialAlignmentSucceed)
{
pcl::transformPointCloud(*source, *sourceTransformed, initialAlignmentMatrix);
}
else
{
sourceTransformed = source;
}
if (m_estimateScale)
{
ShowTwoCloudsInDifferentColors(sourceTransformed, target, pcl::CorrespondencesPtr(), "After IA");
}
CloudMapper::DynamicICPParams dynamicParams = m_dynamicICPParams;
if (m_useDynamicICP == false)
{
dynamicParams.push_back(m_icpParams);
}
CloudMapper::Cloud::Ptr result = sourceTransformed;
Eigen::Matrix4f finalTransformationMatrix = GetTransformForTwoCloudsDynamically(sourceTransformed, target, dynamicParams);
Eigen::Matrix4f totalTransform;
if (initialAlignmentSucceed)
{
totalTransform = finalTransformationMatrix * initialAlignmentMatrix;
}
else
{
totalTransform = finalTransformationMatrix;
}
pcl::transformPointCloud(*source, *result, totalTransform);
return totalTransform;
}
CloudMapper::Clouds CloudMapper::AlignAll(CloudMapper::Clouds &clouds, CloudMapper::LandmarksVector &landmarksVector, TransformationsPtr transformations)
{
TransformationsPtr allTransformations(new Transformations);
if (transformations != nullptr)
{
allTransformations = transformations;
}
if (clouds.size() != landmarksVector.size())
{
throw HPEException("CloudMapper::AlignAll - clouds.size() != landmarksVector.size()");
}
std::vector stepTransformations;
pcl::PointCloud::Ptr sourceCloud = clouds[0];
for (int cloudIndex = 1; cloudIndex < clouds.size() - 1; cloudIndex++)
{
int sourceIndex = cloudIndex;
int targetIndex = sourceIndex + 1;
pcl::PointCloud::Ptr targetCloud = clouds[targetIndex];
auto totalTransform = GetTransformHavingLandmarks(sourceCloud, landmarksVector[sourceIndex],
targetCloud, landmarksVector[targetIndex]);
Eigen::Matrix3f rotationMatrix = totalTransform.block<3, 3>(0, 0);
Eigen::Vector3f translationVector = totalTransform.block<3, 1>(0, 3);
Eigen::Quaternionf quaternion(rotationMatrix);
Eigen::Matrix3f rotation2(quaternion);
pcl::transformPointCloud(*sourceCloud, *sourceCloud, totalTransform);
pcl::PointCloud::Ptr newCloud(new pcl::PointCloud);
*sourceCloud += *targetCloud;
sourceCloud = Voxelize(sourceCloud, 0.006f);
//ShowCloud(sourceCloud);
if (IsNotNAN(totalTransform) == false)
{
int q = 42;
}
std::cout << cloudIndex << std::endl;
stepTransformations.push_back(totalTransform);
}
ShowCloud(sourceCloud);
CloudMapper::Clouds result;
auto targetCloud = clouds[clouds.size() - 1];
for (int cloudIndex = 0; cloudIndex < clouds.size() - 1; cloudIndex++)
{
Eigen::Matrix4f accumulatedMatrix = stepTransformations[cloudIndex];
for (int matrixIndex = cloudIndex + 1; matrixIndex < stepTransformations.size(); matrixIndex++)
{
accumulatedMatrix = accumulatedMatrix * stepTransformations[matrixIndex];
}
CloudMapper::Cloud::Ptr transformed(new CloudMapper::Cloud);
pcl::transformPointCloud(*clouds[cloudIndex], *transformed, accumulatedMatrix);
allTransformations->push_back(accumulatedMatrix);
result.push_back(transformed);
}
result.push_back(targetCloud);
return result;
}
Eigen::Matrix4f CloudMapper::ComputeInitialAlignment(Cloud::Ptr &cloud1, Cloud::Ptr &cloud2, pcl::CorrespondencesPtr &correspondences)
{
if (correspondences->empty())
{
return Eigen::Matrix4f::Identity();
}
pcl::registration::CorrespondenceRejectorSampleConsensus sac;
sac.setInlierThreshold(0.5);
sac.setInputSource(cloud1);
sac.setInputTarget(cloud2);
sac.setInputCorrespondences(correspondences);
pcl::Correspondences inliers;
sac.getCorrespondences(inliers);
Eigen::Matrix4f transformation;
if (m_estimateScale)
{
pcl::registration::TransformationEstimationSVDScale transformationEstimation;
transformationEstimation.estimateRigidTransformation(*cloud1, *cloud2, inliers, transformation);
}
else
{
pcl::registration::TransformationEstimationSVD transformationEstimation;
transformationEstimation.estimateRigidTransformation(*cloud1, *cloud2, inliers, transformation);
}
if (transformation == Eigen::Matrix4f::Identity() || IsNotNAN(transformation) == false)
{
std::cout << "Identity or NAN" << std::endl;
}
return transformation;
}
Common::Landmark CloudMapper::FindClosestPoint(CloudMapper::Cloud::Ptr &cloud, CloudMapper::PointType &p)
{
pcl::search::KdTree search;
search.setInputCloud(cloud);
std::vector indices;
std::vector distances;
search.nearestKSearch(p, 1, indices, distances);
Common::Landmark result;
result.index = indices[0];
result.point = cloud->at(indices[0]);
return result;
}
pcl::CorrespondencesPtr CloudMapper::LandmarksToCorresponencies(Cloud::Ptr &cloud1, CloudMapper::Landmarks &landmarks1, Cloud::Ptr &cloud2, CloudMapper::Landmarks &landmarks2)
{
pcl::CorrespondencesPtr result(new pcl::Correspondences);
int resultSize = std::min(landmarks1.size(), landmarks2.size());
for (int i = 0; i < resultSize; i++)
{
auto sourcePoint1 = landmarks1.at(i).point;
auto sourcePoint2 = landmarks2.at(i).point;
auto p1IsNotNan = IsNotNAN(sourcePoint1);
auto p2IsNotNan = IsNotNAN(sourcePoint2);
if (p1IsNotNan && p2IsNotNan)
{
CloudMapper::Landmarks::value_type pt1 = FindClosestPoint(cloud1, sourcePoint1);
CloudMapper::Landmarks::value_type pt2 = FindClosestPoint(cloud2, sourcePoint2);
float distance = CalculateDistance(pt1.point, pt2.point);
pcl::Correspondence correspondence(pt1.index, pt2.index, distance);
result->push_back(correspondence);
}
}
return result;
}
bool CloudMapper::IsNotNAN(const Eigen::Matrix4f &x)
{
return ((x.array() == x.array())).all();
}
bool CloudMapper::IsNotNAN(CloudMapper::PointType &point)
{
return (boost::math::isnan(point.x) || boost::math::isnan(point.y) || boost::math::isnan(point.z)) == false;
}
}
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/Align/CloudMapper.h
================================================
#ifndef CLOUDMAPPER_H
#define CLOUDMAPPER_H
#include
#include
#include
#include
#include
//#include "Provider_Old/DataProviderOld.h"
#include
namespace hpe
{
/**
\class CloudMapper
\brief Class that performs Iterative closest point alighment.
*/
class CloudMapper
{
public:
typedef pcl::PointXYZRGBA PointType;
typedef pcl::PointCloud Cloud;
typedef pcl::PointNormal PointNormal;
typedef pcl::PointCloud NormalCloud;
typedef Common::Landmarks Landmarks;
typedef std::vector LandmarksVector;
typedef std::vector Clouds;
typedef std::vector Transformations;
typedef std::shared_ptr> TransformationsPtr;
struct ICPParams
{
ICPParams(float distance, float threshold, float epsilon, int maxICPIterations, int maxRansacIterations)
: MaxCorrespondenceDistance(distance),
RansacRejectionThreshold(threshold),
TransformationEpsilon(epsilon),
MaxICPIterations(maxICPIterations),
MaxRANSACIterations(maxRansacIterations)
{
}
float MaxCorrespondenceDistance;
float RansacRejectionThreshold;
float TransformationEpsilon;
int MaxICPIterations;
int MaxRANSACIterations;
};
typedef std::vector DynamicICPParams;
CloudMapper();
void AddCloud(Cloud::Ptr &cloud, Landmarks &landmarks);
Clouds GetAlignedClouds(TransformationsPtr transformations = nullptr);
Cloud::Ptr GetMergedCloud();
TransformationsPtr GetTransforms();
void SetICPParams(ICPParams params);
void SetDynamicICPParams(DynamicICPParams ¶ms);
void SetUseDynamicICP(bool use);
void SetUseNormalShooting(bool use);
void SetEstimateScale(bool estimateScale);
void SetUsePointToPlaneMetric(bool use);
void SetWeights(std::vector &weights) {
m_weights = weights;
}
Eigen::Matrix4f GetTransformForTwoCloudsPointToPlane(Cloud::Ptr &source,
Cloud::Ptr &target,
ICPParams params = ICPParams(0.05, 0.05, 0.000001, 100000, 100));
Eigen::Matrix4f GetTransformForTwoCloudsPointToPoint(Cloud::Ptr &source,
Cloud::Ptr &target,
ICPParams params = ICPParams(0.05, 0.05, 0.000001, 100000, 100));
Eigen::Matrix4f GetTransformForTwoCloudsDynamically(Cloud::Ptr &source,
Cloud::Ptr &target,
DynamicICPParams &dynamicParams);
Eigen::Matrix4f GetTransformHavingLandmarks(Cloud::Ptr &source,
Common::Landmarks &l1,
Cloud::Ptr &target,
Common::Landmarks &l2);
Eigen::Matrix4f GetTransformHavingCorrespondences(Cloud::Ptr &source,
Cloud::Ptr &target,
pcl::CorrespondencesPtr &correspondences);
pcl::CorrespondencesPtr LandmarksToCorresponencies(Cloud::Ptr &cloud1, Landmarks &landmarks1,
Cloud::Ptr &cloud2, Landmarks &landmarks2);
Eigen::Matrix4f ComputeInitialAlignment(Cloud::Ptr &cloud1,
Cloud::Ptr &cloud2,
pcl::CorrespondencesPtr &correspondencies);
private:
Clouds m_pointClouds;
LandmarksVector m_landmarks;
Clouds AlignAll(Clouds &clouds, LandmarksVector &landmarksVector, TransformationsPtr transformations = nullptr);
static Common::Landmark FindClosestPoint(Cloud::Ptr &cloud, PointType &p);
ICPParams m_icpParams;
DynamicICPParams m_dynamicICPParams;
bool m_useDynamicICP;
bool m_usePointToPlaneMetric;
bool m_useNormalShooting;
bool m_estimateScale;
std::vector m_weights;
static bool IsNotNAN(const Eigen::Matrix4f &x);
static bool IsNotNAN(CloudMapper::PointType &point);
};
}
#endif // CLOUDMAPPER_H
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/Align/IHeadTemplateCreator.h
================================================
#ifndef IHEADTEMPLATECREATOR_H
#define IHEADTEMPLATECREATOR_H
#include
#include
namespace hpe
{
template
class IHeadTemplateCreator : public IInterface
{
public:
virtual typename pcl::PointCloud::Ptr GetTemplate() = 0;
};
}
#endif // IHEADTEMPLATECREATOR_H
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/Align/IncrementalHeadTemplateCreator.cpp
================================================
#include "IncrementalHeadTemplateCreator.h"
#include
#include
#include
#include
namespace hpe
{
IncrementalHeadTemplateCreator::IncrementalHeadTemplateCreator(void)
: m_template(new CloudType), m_targetCloud(new CloudType)
{
m_mapper.SetUseNormalShooting(false);
m_mapper.SetUsePointToPlaneMetric(true);
m_icpParams.push_back(CloudMapper::ICPParams(0.03, 0.005, 10e-6, 400, 10));
m_mapper.SetDynamicICPParams(m_icpParams);
m_aggregatedTransform = Eigen::Matrix4f::Identity();
}
IncrementalHeadTemplateCreator::~IncrementalHeadTemplateCreator(void)
{
}
IncrementalHeadTemplateCreator::CloudType::Ptr IncrementalHeadTemplateCreator::GetTemplate()
{
CloudType::Ptr result(new CloudType);
pcl::copyPointCloud(*m_template, *result);
return result;
}
IncrementalHeadTemplateCreator::CloudType::Ptr IncrementalHeadTemplateCreator::AddCloudToTemplate(CloudType::Ptr cloud)
{
if (m_template->points.size() == 0)
{
pcl::copyPointCloud(*cloud, *m_template);
pcl::copyPointCloud(*cloud, *m_targetCloud);
}
else
{
pcl::ScopeTime t("AddCloudToTemplate");
Eigen::Matrix4f transformMatrix = m_mapper.GetTransformForTwoCloudsDynamically(cloud, m_targetCloud, m_icpParams);
m_aggregatedTransform *= transformMatrix;
CloudType::Ptr transformedSource(new CloudType);
pcl::transformPointCloud(*cloud, *transformedSource, m_aggregatedTransform);
*m_template += *transformedSource;
m_template = Voxelize(m_template, 0.001f);
pcl::copyPointCloud(*cloud, *m_targetCloud);
}
return GetTemplate();
}
}
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/Align/IncrementalHeadTemplateCreator.h
================================================
#pragma once
#ifndef INCREMENTALHEADTEMPLATECREATOR_H
#define INCREMENTALHEADTEMPLATECREATOR_H
#include
#include
#include
#include
namespace hpe
{
/**
\class IncrementalHeadTemplateCreator
\brief Class that performs incremental alighment.
\author Sergey
\date 8/11/2015
*/
class IncrementalHeadTemplateCreator : public IHeadTemplateCreator
{
public:
typedef pcl::PointXYZRGBA PointType;
typedef pcl::PointCloud CloudType;
IncrementalHeadTemplateCreator(void);
~IncrementalHeadTemplateCreator(void);
CloudType::Ptr GetTemplate();
CloudType::Ptr AddCloudToTemplate(CloudType::Ptr cloud);
private:
CloudType::Ptr m_template;
CloudType::Ptr m_targetCloud;
CloudMapper m_mapper;
CloudMapper::DynamicICPParams m_icpParams;
Eigen::Matrix4f m_aggregatedTransform;
};
}
#endif
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/Align/TransformationEstimationHPE.cpp
================================================
#include "TransformationEstimationHPE.h"
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/Align/TransformationEstimationHPE.h
================================================
#ifndef TRANSFORMATIONESTIMATION_H
#define TRANSFORMATIONESTIMATION_H
#include
#include
namespace hpe
{
/**
\class TransformationEstimationHPE
\brief Class that performs history-based weighting of the points for ICP
Thanks to this, ICP is speeded up 4 times. The method overloads
the standard pcl class to get the desired functionality
\tparam PointSource PointType of the source point cloud.
\tparam PointTarget PointType of the target point cloud.
\tparam MatScalar scalar type.
*/
template
class TransformationEstimationHPE : public pcl::registration::TransformationEstimationPointToPlaneWeighted
{
typedef TransformationEstimationHPE Self;
typedef pcl::registration::TransformationEstimationPointToPlaneWeighted Base;
typedef typename Base::Matrix4 Matrix4;
public:
typedef boost::shared_ptr> Ptr;
TransformationEstimationHPE()
{
}
void SetWeights(std::vector &weights)
{
m_weights = weights;
}
inline void
estimateRigidTransformation(
const pcl::PointCloud &cloud_src,
const pcl::PointCloud &cloud_tgt,
Matrix4 &transformation_matrix) const
{
Base::estimateRigidTransformation(cloud_src, cloud_tgt, transformation_matrix);
}
inline void
estimateRigidTransformation(
const pcl::PointCloud &cloud_src,
const std::vector &indices_src,
const pcl::PointCloud &cloud_tgt,
Matrix4 &transformation_matrix) const
{
Base::estimateRigidTransformation(cloud_src, indices_src, cloud_tgt, transformation_matrix);
}
void
estimateRigidTransformation(
const pcl::PointCloud &cloud_src,
const std::vector &indices_src,
const pcl::PointCloud &cloud_tgt,
const std::vector &indices_tgt,
Matrix4 &transformation_matrix) const
{
std::vector weights(indices_src.size());
if (m_weights.size() != 0)
{
for (int i = 0; i < indices_src.size(); i += 1)
{
weights[i] = m_weights[indices_src[i]];
}
}
else
{
for (int i = 0; i < indices_src.size(); i += 1)
{
weights[i] = 1;
}
}
Self *self = const_cast(this);
self->Base::setWeights(weights);
self->Base::setUseCorrespondenceWeights(false);
Base::estimateRigidTransformation(cloud_src, indices_src, cloud_tgt, indices_tgt, transformation_matrix);
}
void
estimateRigidTransformation(
const pcl::PointCloud &cloud_src,
const pcl::PointCloud &cloud_tgt,
const pcl::Correspondences &correspondences,
Matrix4 &transformation_matrix) const
{
Base::estimateRigidTransformation(cloud_src, cloud_tgt, correspondences, transformation_matrix);
}
private:
std::vector m_weights;
};
}
#endif // TRANSFORMATIONESTIMATION_H
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/CMakeLists.txt
================================================
cmake_minimum_required(VERSION 2.8)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
project(HeadPoseEstimationFramework)
FILE (GLOB_RECURSE SRC_LIST *.cpp *.h)
foreach (SRC ${SRC_LIST})
string (FIND ${SRC} "WindowsOnly" FOUND)
if (NOT ${FOUND} EQUAL "-1")
list (REMOVE_ITEM SRC_LIST ${SRC})
endif()
endforeach ()
find_package(PCL 1.7 REQUIRED)
find_package(OpenCV REQUIRED)
include_directories(${PCL_INCLUDE_DIRS} ${CMAKE_CURRENT_LIST_DIR})
link_directories(${PCL_LIBRARY_DIRS} ${CMAKE_BINARY_DIR} )
add_definitions(${PCL_DEFINITIONS})
add_library(${PROJECT_NAME} SHARED ${SRC_LIST})
target_link_libraries(${PROJECT_NAME} ${PCL_LIBRARIES} ${OpenCV_LIBS})
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/Common.h
================================================
#pragma once
#ifndef COMMON_H
#define COMMON_H
#include
#include
namespace hpe
{
template
class Common
{
public:
struct Landmark
{
Landmark() {}
Landmark(int i, PointType p)
: index(i), point(p)
{}
int index;
PointType point;
};
typedef std::vector Landmarks;
};
typedef std::vector PointIndexes;
typedef std::list PointHistory;
}
#endif // COMMON_H
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/Converter/IDataConverter.h
================================================
#ifndef IDATACONVERTER_H
#define IDATACONVERTER_H
#include
#include
#include
#include "Interface/IInterface.h"
namespace hpe
{
class IDataConverter : public IInterface
{
public:
virtual pcl::PointCloud::Ptr DepthRGBToPointCloud(cv::Mat &depth, cv::Mat &bgr) = 0;
};
}
#endif // IDATACONVERTER_H
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/Converter/KinectDataConverter.cpp
================================================
#include "KinectDataConverter.h"
#include
#include
namespace hpe
{
typedef union
{
struct
{
unsigned char Blue;
unsigned char Green;
unsigned char Red;
unsigned char Alpha;
};
float float_value;
uint32_t long_value;
} RGBValue;
KinectDataConverter::KinectDataConverter()
{
}
pcl::PointCloud::Ptr KinectDataConverter::DepthRGBToPointCloud(cv::Mat &depth, cv::Mat &bgr)
{
cv::Size depthImageSize = depth.size();
float centerX, centerY;
float scaleFactorX, scaleFactorY;
ComputeCameraIntrinsics(depthImageSize, centerX, centerY, scaleFactorX, scaleFactorY);
pcl::PointCloud::Ptr result(new pcl::PointCloud);
result->width = depthImageSize.width;
result->height = depthImageSize.height;
result->is_dense = false;
result->points.resize(depthImageSize.width * depthImageSize.height);
for (int y = 0; y < depthImageSize.height; ++y)
{
for (int x = 0; x < depthImageSize.width; ++x)
{
pcl::PointXYZRGBA &pt = result->at(x, y);
float depthValue = (float) depth.at(y, x);
if (depthValue == -1000.f || depthValue == 0.0f || boost::math::isnan(depthValue))
{
pt.x = pt.y = pt.z = std::numeric_limits::quiet_NaN();
}
else
{
//depthValue /= 1000;
pt.x = (static_cast(x) - centerX) * scaleFactorX * depthValue;
pt.y = (centerY - static_cast(y)) * scaleFactorY * depthValue;
pt.z = depthValue;
cv::Vec3b colorValue = bgr.at(y, x);
RGBValue color;
color.Red = colorValue[2];
color.Green = colorValue[1];
color.Blue = colorValue[0];
pt.rgba = color.long_value;
}
}
}
return result;
}
void KinectDataConverter::ComputeCameraIntrinsics(cv::Size &imageSize, float ¢erX, float ¢erY, float &scaleFactorX, float &scaleFactorY)
{
int dims[] = {imageSize.width, imageSize.height};
// The 525 factor default is only true for VGA. If not, we should scale
scaleFactorX = scaleFactorY = 1 / 525.f * 640.f / dims[0];
centerX = ((float)dims[0] - 1.f) / 2.f;
centerY = ((float)dims[1] - 1.f) / 2.f;
}
pcl::PointXYZ KinectDataConverter::ConvertOnePoint(float x, float y, float depthValue, cv::Size frameSize)
{
float centerX, centerY;
float scaleFactorX, scaleFactorY;
ComputeCameraIntrinsics(frameSize, centerX, centerY, scaleFactorX, scaleFactorY);
pcl::PointXYZ pt;
pt.x = (static_cast(x) - centerX) * scaleFactorX * depthValue;
pt.y = (centerY - static_cast(y)) * scaleFactorY * depthValue;
pt.z = depthValue;
return pt;
}
}
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/Converter/KinectDataConverter.h
================================================
#ifndef KINECTDATACONVERTER_H
#define KINECTDATACONVERTER_H
#include
namespace hpe
{
/**
\class KinectDataConverter
\brief Converts RGB-D pair to a point cloud. Work only for a kinect sensor.
\author Sergey
\date 8/11/2015
*/
class KinectDataConverter : public IDataConverter
{
public:
KinectDataConverter();
pcl::PointCloud::Ptr DepthRGBToPointCloud(cv::Mat &depth, cv::Mat &bgr) override;
pcl::PointXYZ ConvertOnePoint(float x, float y, float depthValue, cv::Size frameSize);
protected:
virtual void ComputeCameraIntrinsics(cv::Size &imageSize, float ¢erX, float ¢erY, float &scaleFactorX, float &scaleFactorY);
};
}
#endif // KINECTDATACONVERTER_H
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/DataFilter/IDataFilter.h
================================================
#ifndef IDATAFILTER_H
#define IDATAFILTER_H
#include "Interface/IInterface.h"
namespace hpe
{
template
class DataFilter : public IInterface
{
public:
virtual DataType Filter(DataType &input) = 0;
};
}
#endif // IDATAFILTER_H
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/DataObject/CloudXYZRGBA.h
================================================
#pragma once
#ifndef CLOUDXYZRGBA_H
#define CLOUDXYZRGBA_H
#include
#include
#include
namespace hpe
{
class CloudXYZRGBA : public IDataObject
{
public:
typedef std::shared_ptr Ptr;
CloudXYZRGBA()
{
}
CloudXYZRGBA(bool create)
{
if (create)
{
cloud = pcl::PointCloud::Ptr(new pcl::PointCloud);
}
}
pcl::PointCloud::Ptr cloud;
};
}
#endif
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/DataObject/HeadPoseInfo.h
================================================
#ifndef HEADPOSEINFO_H
#define HEADPOSEINFO_H
#include
namespace hpe
{
class HeadPoseInformation : public IDataObject
{
public:
typedef std::shared_ptr Ptr;
HeadPoseInformation()
{
Yaw = 0;
Tilt = 0;
Roll = 0;
WorldX = 0;
WorldY = 0;
WorldZ = 0;
DepthFrameX = 0;
DepthFrameY = 0;
HasHeadInfo = false;
}
double Yaw;
double Tilt;
double Roll;
double WorldX;
double WorldY;
double WorldZ;
double DepthFrameX;
double DepthFrameY;
bool HasHeadInfo;
};
}
#endif
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/DataObject/IDataObject.h
================================================
#pragma once
#ifndef IDATAOBJECT_H
#define IDATAOBJECT_H
#include
#include
namespace hpe
{
/**
\class IDataObject
\brief Interface to store the objects to put into IDataStorage.
See subclasses for examples.
\author Sergey
\date 8/11/2015
*/
class IDataObject : public IInterface
{
public:
typedef std::shared_ptr Ptr;
};
}
#endif
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/DataObject/IDataStorage.h
================================================
#pragma once
#ifndef IDATASTORAGE_H
#define IDATASTORAGE_H
#include
#include
#include
#include
namespace hpe
{
/**
\class IDataStorage
\brief One of the key classes to organize between communications processors.
Basically is a key-value storage.
\author Sergey
\date 8/11/2015
*/
class IDataStorage : public IInterface
{
public:
typedef std::shared_ptr Ptr;
/**
\fn virtual void IDataStorage::Set(std::string key, IDataObject::Ptr object) = 0;
\brief Add object into storage with key
\author Sergey
\date 8/11/2015
\param key Key
\param object Object to add. The object should be contained in IDataObject
*/
virtual void Set(std::string key, IDataObject::Ptr object) = 0;
virtual IDataObject::Ptr Get(std::string key) = 0;
virtual void Remove(std::string key) = 0;
template
std::shared_ptr GetAndCast(std::string key)
{
IDataObject::Ptr obj = Get(key);
return std::dynamic_pointer_cast(obj);
}
template
std::shared_ptr GetAndCastNotNull(std::string key, std::string message = "Got nullptr from storage")
{
std::shared_ptr ptr = GetAndCast(key);
if (ptr.get() == nullptr)
{
throw HPEException(message);
}
return ptr;
}
};
}
#endif
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/DataObject/LandmarksObject.h
================================================
#pragma once
#ifndef LANDMARKSOBJECT_H
#define LANDMARKSOBJECT_H
#include
#include
namespace hpe
{
template
class LandmarksObject : public IDataObject
{
public:
typedef std::shared_ptr Ptr;
typename Common::Landmarks landmarks;
};
}
#endif
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/DataObject/MapDataStorage.cpp
================================================
#include "MapDataStorage.h"
namespace hpe
{
void MapDataStorage::Set(std::string key, IDataObject::Ptr object)
{
m_storage[key] = object;
}
IDataObject::Ptr MapDataStorage::Get(std::string key)
{
return m_storage[key];
}
void MapDataStorage::Remove(std::string key)
{
auto it = m_storage.find(key);
if (it != m_storage.end())
{
m_storage.erase(it);
}
}
}
================================================
FILE: FaceCept3D/HeadPoseEstimationFramework/DataObject/MapDataStorage.h
================================================
#pragma once
#ifndef MAPDATASTORAGE_H
#define MAPDATASTORAGE_H
#include
#include