Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Sarthou Benoît
PRE
Commits
2f833ad3
Commit
2f833ad3
authored
Jul 19, 2017
by
sarthou
Browse files
Upsampled correction terminated
!
parent
df9a08ea
Changes
4
Show whitespace changes
Inline
Side-by-side
InpaintingAlgorithm/algorithm/inpainting/InpaintingConverger.cpp
View file @
2f833ad3
...
...
@@ -48,7 +48,8 @@ void InpaintingConverger::Inpaint(InpaintingDataSource * const iDataSource, Inpa
}
if
(
curLevel
!=
0
)
downsampledDataSource
.
UpsampleShiftMatrices
();
//downsampledDataSource.UpsampleShiftMatrices();
downsampledDataSource
.
MatlabUpsampleShiftMatrix
();
iProfiler
->
AfterInpaintingIterations
(
curLevel
);
iProfiler
->
AfterInpaintLevel
(
curLevel
);
...
...
InpaintingAlgorithm/algorithm/inpainting/dataSources/decorators/IDSDDownsampling.cpp
View file @
2f833ad3
...
...
@@ -141,12 +141,13 @@ void IDSDDownsampling::MatlabUpsampleShiftMatrix(){
int
tempDispZ
=
fromZDispData
[
fromDim
->
DeterminePosition
(
GridX
->
GetData
()[
nextVolIt
.
GetPosition
()],
\
GridY
->
GetData
()[
nextVolIt
.
GetPosition
()],
GridZ
->
GetData
()[
nextVolIt
.
GetPosition
()])];
// TODO Here the
2
(
half
patch
size is hardcoded, have to change it later)
// TODO Here the
3
(
ceil(
patch
_
size
/2)
is hardcoded, have to change it later)
int
minBarrier
=
2
;
int
maxBarrier
=
toDim
->
GetSizeZ
()
-
2
;
// In fact it is 3 -1, to fit with C++ indexing
// -1 is because of C++ indexation...
int
maxBarrier
=
(
toDim
->
GetSizeZ
()
-
1
)
-
3
;
toZDispData
[
nextVolIt
.
GetPosition
()]
=
\
std
::
max
(
std
::
min
(
tempDispZ
,
maxBarrier
-
GridZ
->
GetData
()[
nextVolIt
.
GetPosition
()]),
minBarrier
-
GridZ
->
GetData
()[
nextVolIt
.
GetPosition
()]);
// toZDispData[nextVolIt.GetPosition()] = tempDispZ;
toADispData
[
nextVolIt
.
GetPosition
()]
=
\
...
...
InpaintingAlgorithm/main.cpp
View file @
2f833ad3
...
...
@@ -52,7 +52,7 @@ int main(){
openCVIO
.
LoadOcclusionMatrixFromImage
(
occFileName
,
occMatrix
);
IDSConcrete
baseIPS
=
IDSConcrete
(
dim
,
redMatrix
,
greenMatrix
,
blueMatrix
,
occMatrix
);
/*
// Work for testing upsampe algorithm
IDSDDownsampling downsampledDataSource = IDSDDownsampling(&baseIPS, 3, 2);
...
...
@@ -95,7 +95,7 @@ int main(){
downsampledDataSource.GetDispA()->GetFrame(nbFrame)->MprintToCSV("Data/upsample_ant/Cpp_UA_DispA_F"+std::to_string(nbFrame));
}
std::cout << "End of upsample test"<< std::endl;
*/
/*
int level = 2;
...
...
@@ -170,7 +170,7 @@ int main(){
// Output the new images.
for
(
int
i
=
0
;
i
<
baseIPS
.
GetDim
()
->
GetSizeZ
();
++
i
)
openCVIO
.
GeneralIOForRGB
(
baseIPS
.
GetRed
(),
baseIPS
.
GetGreen
(),
baseIPS
.
GetBlue
(),
i
,
InpaintingIO
::
IH_DBG_SAVE
,
"Data/
other_tests
/CppOut_
Oreo_
F"
+
std
::
to_string
(
i
));
InpaintingIO
::
IH_DBG_SAVE
,
"Data/
upsample_ant/final
/CppOut_F"
+
std
::
to_string
(
i
));
profiler
.
AfterInpainting
();
...
...
dispcompare.py
View file @
2f833ad3
...
...
@@ -95,7 +95,7 @@ def upsample_compare(Mpath,Cpath,nbFrame,XYZ,level,OccMask,outPath,inputMorC,lev
"This function is to compare two set of data, in .csv matrices, and produce a visual output (in .png)"
results
=
[]
for
i
in
range
(
1
,
nbFrame
):
for
i
in
range
(
nbFrame
):
# Add level in the pathway
if
(
levelBool
==
True
):
endPath
=
"_L"
+
str
(
level
)
+
"_F"
...
...
@@ -117,6 +117,7 @@ def upsample_compare(Mpath,Cpath,nbFrame,XYZ,level,OccMask,outPath,inputMorC,lev
diff
=
temp_matlab
-
temp_cpp
[:,
0
:
end
-
1
]
# if(np.sum(diff)!=0):
# print("i:",i)
# print(100*diff)
...
...
@@ -174,10 +175,6 @@ if __name__=="__main__":
# plt.imshow(VolOnion[3,:,:,])
# plt.show()
# # upsample compare between Matlab and C++ with new implementation
# upsample_compare("Data/upsample/matlab_upsample/M_upsampleAfter_",\
# "Data/upsample/CppOut_",98,"DispX",1,OccMediumMask,"Data/upsample/results/DiffNewFunc_",'Matlab',True)
# # Upsample compare between C++ old and new implementation
# upsample_compare("Data/upsample/CppOut_",\
# "Data/upsample/test_methodCpp/CppOut_",98,"DispX",1,OccMediumMask,"Data/upsample/results/DiffMethod_",1)
...
...
@@ -214,6 +211,7 @@ if __name__=="__main__":
# # Result: Ok there is a problem in the indexation of data...
# # Upsample compare of DispA to test the indexation problem
# # WARNING: ON THIS DATA SET, YOU HAVE TO CHANGE INDEXING (i-1 on matlab)
# upsample_compare("Data/upsample/matlab_upsample/M_upsampleAfter_",\
# "Data/upsample/test_methodCpp/CppOut_",98,"DispZ",1,OccMediumMask,"Data/upsample/results/NewIndNewImp_",'Matlab',True)
# # Result: There was indeed an index problem... X,Y and A exactly the same, but problem with the Z, with small peak of differences.
...
...
@@ -236,5 +234,5 @@ if __name__=="__main__":
#Compare the output of data out of C++ algo, after and before on DispZ to see if clamp is effective
upsample_compare
(
"Data/upsample_ant/M_UA_Post_"
,
"Data/upsample_ant/Cpp_UA_"
,
\
98
,
"Disp
Z
"
,
3
,
OccMediumMask
,
"Data/upsample_ant/DiffOut_UA_"
,
'Matlab'
,
False
)
98
,
"Disp
A
"
,
3
,
OccMediumMask
,
"Data/upsample_ant/DiffOut_UA_"
,
'Matlab'
,
False
)
# Result: Implementation succesful but the difference is still here ... WTF
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment