Skip to content

Commit ee390c5

Browse files
committed
init
0 parents  commit ee390c5

File tree

359 files changed

+77641
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

359 files changed

+77641
-0
lines changed

CMakeLists.txt

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
cmake_minimum_required(VERSION 2.8)
2+
project(gMF)
3+
INCLUDE (FindPkgConfig)
4+
#SET (CMAKE_VERBOSE_MAKEFILE true)
5+
6+
find_package(CUDA REQUIRED)
7+
find_package(OpenCV REQUIRED)
8+
9+
IF(MSVC_IDE)
10+
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
11+
add_definitions(-DUSING_CMAKE=1)
12+
ELSE(MSVC_IDE)
13+
set(CFLAGS_WARN "-Wall -Wextra -Wno-unused-parameter -Wno-strict-aliasing")
14+
set(CMAKE_CXX_FLAGS "-fPIC -O3 -march=native ${CFLAGS_WARN} ${CMAKE_CXX_FLAGS}")
15+
ENDIF(MSVC_IDE)
16+
17+
if(APPLE)
18+
set(CUDA_HOST_COMPILER /usr/bin/clang)
19+
endif(APPLE)
20+
21+
include_directories(${CUDA_INCLUDE_DIRS})
22+
#pkg_search_module (OPENCV opencv REQUIRED)
23+
include_directories(${OPENCV_INCLUDE_DIRS})
24+
include_directories(include)
25+
add_subdirectory(ORUtils)
26+
27+
set(GMF_LIB
28+
gMF_Lib/gMF.h
29+
gMF_Lib/gMF_define.h
30+
gMF_Lib/engines/gMF_fileter_engine.h
31+
gMF_Lib/engines/gMF_fileter_engine.cu
32+
gMF_Lib/engines/gMF_fileter_engine_shared.h
33+
gMF_Lib/engines/gMF_filter_engine_kernel.h
34+
gMF_Lib/engines/gMF_inference_engine.h
35+
gMF_Lib/engines/gMF_inference_engine.cu
36+
gMF_Lib/engines/gMF_inference_engine_kernel.h
37+
gMF_Lib/objects/gMF_BF_info.h
38+
gMF_Lib/objects/gMF_GF_info.h
39+
)
40+
list(APPEND "-std=c++11 -ftree-vectorize")
41+
SOURCE_GROUP(gMF_Lib FILES ${GMF_LIB})
42+
43+
cuda_add_library(gMF_Lib
44+
${GMF_LIB}
45+
OPTIONS -gencode arch=compute_30,code=compute_30)
46+
target_link_libraries(gMF_Lib ${CUDA_LIBRARY})
47+
48+
add_executable(demo demo.cpp NVTimer.h common.cpp Kernel.cpp permutohedral.cpp)
49+
target_link_libraries(demo gMF_Lib ${OpenCV_LIBS})
50+
51+
#message("${OPENCV_LDFLAGS}")
52+
53+
54+
add_executable(demo_debug demo_backup.cpp NVTimer.h)
55+
target_link_libraries(demo_debug gMF_Lib ${OpenCV_LIBS})
56+
#${OpenCV_LIBS}
57+

CMakeLists.txt.user

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,234 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!DOCTYPE QtCreatorProject>
3+
<!-- Written by QtCreator 3.0.1, 2015-07-06T14:14:16. -->
4+
<qtcreator>
5+
<data>
6+
<variable>ProjectExplorer.Project.ActiveTarget</variable>
7+
<value type="int">0</value>
8+
</data>
9+
<data>
10+
<variable>ProjectExplorer.Project.EditorSettings</variable>
11+
<valuemap type="QVariantMap">
12+
<value type="bool" key="EditorConfiguration.AutoIndent">true</value>
13+
<value type="bool" key="EditorConfiguration.AutoSpacesForTabs">false</value>
14+
<value type="bool" key="EditorConfiguration.CamelCaseNavigation">true</value>
15+
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.0">
16+
<value type="QString" key="language">Cpp</value>
17+
<valuemap type="QVariantMap" key="value">
18+
<value type="QByteArray" key="CurrentPreferences">CppGlobal</value>
19+
</valuemap>
20+
</valuemap>
21+
<valuemap type="QVariantMap" key="EditorConfiguration.CodeStyle.1">
22+
<value type="QString" key="language">QmlJS</value>
23+
<valuemap type="QVariantMap" key="value">
24+
<value type="QByteArray" key="CurrentPreferences">QmlJSGlobal</value>
25+
</valuemap>
26+
</valuemap>
27+
<value type="int" key="EditorConfiguration.CodeStyle.Count">2</value>
28+
<value type="QByteArray" key="EditorConfiguration.Codec">UTF-8</value>
29+
<value type="bool" key="EditorConfiguration.ConstrainTooltips">false</value>
30+
<value type="int" key="EditorConfiguration.IndentSize">4</value>
31+
<value type="bool" key="EditorConfiguration.KeyboardTooltips">false</value>
32+
<value type="bool" key="EditorConfiguration.MouseNavigation">true</value>
33+
<value type="int" key="EditorConfiguration.PaddingMode">1</value>
34+
<value type="bool" key="EditorConfiguration.ScrollWheelZooming">true</value>
35+
<value type="int" key="EditorConfiguration.SmartBackspaceBehavior">0</value>
36+
<value type="bool" key="EditorConfiguration.SpacesForTabs">true</value>
37+
<value type="int" key="EditorConfiguration.TabKeyBehavior">0</value>
38+
<value type="int" key="EditorConfiguration.TabSize">8</value>
39+
<value type="bool" key="EditorConfiguration.UseGlobal">true</value>
40+
<value type="int" key="EditorConfiguration.Utf8BomBehavior">1</value>
41+
<value type="bool" key="EditorConfiguration.addFinalNewLine">true</value>
42+
<value type="bool" key="EditorConfiguration.cleanIndentation">true</value>
43+
<value type="bool" key="EditorConfiguration.cleanWhitespace">true</value>
44+
<value type="bool" key="EditorConfiguration.inEntireDocument">false</value>
45+
</valuemap>
46+
</data>
47+
<data>
48+
<variable>ProjectExplorer.Project.PluginSettings</variable>
49+
<valuemap type="QVariantMap"/>
50+
</data>
51+
<data>
52+
<variable>ProjectExplorer.Project.Target.0</variable>
53+
<valuemap type="QVariantMap">
54+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Desktop</value>
55+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Desktop</value>
56+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{c9d921ca-fd0c-4a12-babf-a0c409ae8c56}</value>
57+
<value type="int" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value>
58+
<value type="int" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
59+
<value type="int" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
60+
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
61+
<value type="bool" key="CMakeProjectManager.CMakeBuildConfiguration.UseNinja">false</value>
62+
<value type="QString" key="ProjectExplorer.BuildConfiguration.BuildDirectory">/home/carl/Work/Code/build-gmeanfild-Desktop-Default</value>
63+
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
64+
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
65+
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments"></value>
66+
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"/>
67+
<value type="bool" key="CMakeProjectManager.MakeStep.Clean">false</value>
68+
<value type="bool" key="CMakeProjectManager.MakeStep.UseNinja">false</value>
69+
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
70+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
71+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
72+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
73+
</valuemap>
74+
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
75+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Build</value>
76+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
77+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Build</value>
78+
</valuemap>
79+
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.1">
80+
<valuemap type="QVariantMap" key="ProjectExplorer.BuildStepList.Step.0">
81+
<value type="QString" key="CMakeProjectManager.MakeStep.AdditionalArguments">clean</value>
82+
<valuelist type="QVariantList" key="CMakeProjectManager.MakeStep.BuildTargets"/>
83+
<value type="bool" key="CMakeProjectManager.MakeStep.Clean">true</value>
84+
<value type="bool" key="CMakeProjectManager.MakeStep.UseNinja">false</value>
85+
<value type="bool" key="ProjectExplorer.BuildStep.Enabled">true</value>
86+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Make</value>
87+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
88+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.MakeStep</value>
89+
</valuemap>
90+
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">1</value>
91+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Clean</value>
92+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
93+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Clean</value>
94+
</valuemap>
95+
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">2</value>
96+
<value type="bool" key="ProjectExplorer.BuildConfiguration.ClearSystemEnvironment">false</value>
97+
<valuelist type="QVariantList" key="ProjectExplorer.BuildConfiguration.UserEnvironmentChanges"/>
98+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Default</value>
99+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Default</value>
100+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeBuildConfiguration</value>
101+
</valuemap>
102+
<value type="int" key="ProjectExplorer.Target.BuildConfigurationCount">1</value>
103+
<valuemap type="QVariantMap" key="ProjectExplorer.Target.DeployConfiguration.0">
104+
<valuemap type="QVariantMap" key="ProjectExplorer.BuildConfiguration.BuildStepList.0">
105+
<value type="int" key="ProjectExplorer.BuildStepList.StepsCount">0</value>
106+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy</value>
107+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
108+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.BuildSteps.Deploy</value>
109+
</valuemap>
110+
<value type="int" key="ProjectExplorer.BuildConfiguration.BuildStepListCount">1</value>
111+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Deploy locally</value>
112+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
113+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">ProjectExplorer.DefaultDeployConfiguration</value>
114+
</valuemap>
115+
<value type="int" key="ProjectExplorer.Target.DeployConfigurationCount">1</value>
116+
<valuemap type="QVariantMap" key="ProjectExplorer.Target.PluginSettings"/>
117+
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.0">
118+
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
119+
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
120+
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
121+
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
122+
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
123+
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
124+
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
125+
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
126+
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
127+
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
128+
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
129+
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
130+
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
131+
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
132+
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
133+
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
134+
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
135+
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
136+
<value type="int">0</value>
137+
<value type="int">1</value>
138+
<value type="int">2</value>
139+
<value type="int">3</value>
140+
<value type="int">4</value>
141+
<value type="int">5</value>
142+
<value type="int">6</value>
143+
<value type="int">7</value>
144+
<value type="int">8</value>
145+
<value type="int">9</value>
146+
<value type="int">10</value>
147+
<value type="int">11</value>
148+
<value type="int">12</value>
149+
<value type="int">13</value>
150+
<value type="int">14</value>
151+
</valuelist>
152+
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguation.Title">demo</value>
153+
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments">/home/carl/Work/Code/gmeanfild/data/2007_000129.jpg /home/carl/Work/Code/gmeanfild/data/2007_000129.png /home/carl/Work/Code/gmeanfild/data/2007_000129_mf.png </value>
154+
<value type="bool" key="CMakeProjectManager.CMakeRunConfiguration.UseTerminal">false</value>
155+
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
156+
<value type="int" key="PE.EnvironmentAspect.Base">2</value>
157+
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
158+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">demo</value>
159+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
160+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.demo</value>
161+
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
162+
<value type="bool" key="RunConfiguration.UseCppDebugger">true</value>
163+
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">false</value>
164+
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
165+
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
166+
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
167+
</valuemap>
168+
<valuemap type="QVariantMap" key="ProjectExplorer.Target.RunConfiguration.1">
169+
<valuelist type="QVariantList" key="Analyzer.Valgrind.AddedSuppressionFiles"/>
170+
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectBusEvents">false</value>
171+
<value type="bool" key="Analyzer.Valgrind.Callgrind.CollectSystime">false</value>
172+
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableBranchSim">false</value>
173+
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableCacheSim">false</value>
174+
<value type="bool" key="Analyzer.Valgrind.Callgrind.EnableEventToolTips">true</value>
175+
<value type="double" key="Analyzer.Valgrind.Callgrind.MinimumCostRatio">0.01</value>
176+
<value type="double" key="Analyzer.Valgrind.Callgrind.VisualisationMinimumCostRatio">10</value>
177+
<value type="bool" key="Analyzer.Valgrind.FilterExternalIssues">true</value>
178+
<value type="int" key="Analyzer.Valgrind.LeakCheckOnFinish">1</value>
179+
<value type="int" key="Analyzer.Valgrind.NumCallers">25</value>
180+
<valuelist type="QVariantList" key="Analyzer.Valgrind.RemovedSuppressionFiles"/>
181+
<value type="int" key="Analyzer.Valgrind.SelfModifyingCodeDetection">1</value>
182+
<value type="bool" key="Analyzer.Valgrind.Settings.UseGlobalSettings">true</value>
183+
<value type="bool" key="Analyzer.Valgrind.ShowReachable">false</value>
184+
<value type="bool" key="Analyzer.Valgrind.TrackOrigins">true</value>
185+
<value type="QString" key="Analyzer.Valgrind.ValgrindExecutable">valgrind</value>
186+
<valuelist type="QVariantList" key="Analyzer.Valgrind.VisibleErrorKinds">
187+
<value type="int">0</value>
188+
<value type="int">1</value>
189+
<value type="int">2</value>
190+
<value type="int">3</value>
191+
<value type="int">4</value>
192+
<value type="int">5</value>
193+
<value type="int">6</value>
194+
<value type="int">7</value>
195+
<value type="int">8</value>
196+
<value type="int">9</value>
197+
<value type="int">10</value>
198+
<value type="int">11</value>
199+
<value type="int">12</value>
200+
<value type="int">13</value>
201+
<value type="int">14</value>
202+
</valuelist>
203+
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguation.Title">demo_debug</value>
204+
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.Arguments"></value>
205+
<value type="bool" key="CMakeProjectManager.CMakeRunConfiguration.UseTerminal">false</value>
206+
<value type="QString" key="CMakeProjectManager.CMakeRunConfiguration.UserWorkingDirectory"></value>
207+
<value type="int" key="PE.EnvironmentAspect.Base">-1</value>
208+
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
209+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">demo_debug</value>
210+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName"></value>
211+
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">CMakeProjectManager.CMakeRunConfiguration.demo_debug</value>
212+
<value type="uint" key="RunConfiguration.QmlDebugServerPort">3768</value>
213+
<value type="bool" key="RunConfiguration.UseCppDebugger">false</value>
214+
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
215+
<value type="bool" key="RunConfiguration.UseMultiProcess">false</value>
216+
<value type="bool" key="RunConfiguration.UseQmlDebugger">false</value>
217+
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
218+
</valuemap>
219+
<value type="int" key="ProjectExplorer.Target.RunConfigurationCount">2</value>
220+
</valuemap>
221+
</data>
222+
<data>
223+
<variable>ProjectExplorer.Project.TargetCount</variable>
224+
<value type="int">1</value>
225+
</data>
226+
<data>
227+
<variable>ProjectExplorer.Project.Updater.EnvironmentId</variable>
228+
<value type="QByteArray">{497c6cd1-b6cd-4082-85d7-b87bf4accfd5}</value>
229+
</data>
230+
<data>
231+
<variable>ProjectExplorer.Project.Updater.FileVersion</variable>
232+
<value type="int">15</value>
233+
</data>
234+
</qtcreator>

Kernel.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#include <Eigen/Core>
2+
using namespace Eigen;
3+
typedef Matrix<short,Dynamic,1> VectorXs;
4+
5+
#include "Kernel.h"
6+
7+
8+
void DenseKernel::initLattice( const MatrixXf & f ) {
9+
const int N = f.cols();
10+
lattice_.init( f );
11+
12+
norm_ = lattice_.compute( VectorXf::Ones( N ).transpose() ).transpose();
13+
14+
for ( int i=0; i<N; i++ )
15+
norm_[i] = 1.0 / (norm_[i]+1e-20);
16+
}
17+
18+
void DenseKernel::filter( MatrixXf & out, const MatrixXf & in ) const {
19+
// Read in the values
20+
out = in;
21+
22+
// Filter
23+
lattice_.compute( out, out );
24+
// lattice_.compute( out.data(), out.data(), out.rows() );
25+
26+
// Normalize again
27+
out = out*norm_.asDiagonal();
28+
}
29+
30+
DenseKernel::DenseKernel(const MatrixXf & f):f_(f){
31+
initLattice( f );
32+
}
33+
34+
void DenseKernel::apply( MatrixXf & out, const MatrixXf & Q ) const {
35+
filter( out, Q );
36+
}

0 commit comments

Comments
 (0)