Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
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
88eeb304
Commit
88eeb304
authored
Jul 27, 2017
by
sarthou
Browse files
Loking for disparities in rand()
parent
191cd12a
Changes
15
Hide whitespace changes
Inline
Side-by-side
InpaintingAlgorithm/algorithm/inpainting/InpaintingConverger.cpp
View file @
88eeb304
...
...
@@ -27,12 +27,16 @@ void InpaintingConverger::Inpaint(InpaintingDataSource * const iDataSource, Inpa
iEvaluator
->
GetPatchDim
().
GetSizeX
(),
iEvaluator
->
GetPatchDim
().
GetSizeY
(),
\
iEvaluator
->
GetPatchDim
().
GetSizeZ
());
if
(
curLevel
<
downsamplingLevels
-
1
)
iReconstructor
->
Reconstruct
(
&
detailedOcclusionDataSource
,
false
);
if
(
curLevel
<
downsamplingLevels
-
1
){
// detailedOcclusionDataSource.GetOcc()->GetFrame(27)->Mprint();
iReconstructor
->
Reconstruct
(
&
detailedOcclusionDataSource
,
false
);
}
float
residual
=
FLT_MAX
;
iProfiler
->
BeforeInpaintingIterations
(
curLevel
);
for
(
int
iteration
=
0
;
iteration
<
nbIterations
&&
residual
>
residualThreshold
;
iteration
++
){
// downsampledDataSource.GetOcc()->GetFrame(27)->Mprint();
iProfiler
->
BeforeInpaintingIteration
(
curLevel
,
iteration
);
if
(
curLevel
==
downsamplingLevels
-
1
&&
iteration
==
0
)
{
...
...
@@ -41,7 +45,6 @@ void InpaintingConverger::Inpaint(InpaintingDataSource * const iDataSource, Inpa
}
else
{
iSearcher
->
Search
(
&
detailedOcclusionDataSource
,
false
);
residual
=
iReconstructor
->
Reconstruct
(
&
detailedOcclusionDataSource
,
false
);
}
iProfiler
->
AfterInpaintingIteration
(
curLevel
,
iteration
);
...
...
InpaintingAlgorithm/algorithm/inpainting/searchers/ISRandom.cpp
View file @
88eeb304
...
...
@@ -280,14 +280,7 @@ void ISRandom::InitialiseDisplacementField(InpaintingDataSource * const iDataPro
}
/*Problème noté:
- Valeur du statut renvoyé dans les cas occlus/pas occlus
,
- Valeur du statut renvoyé dans les cas occlus/pas occlus
=> Ok
- HalfPatchSize à 3 au lieu de 2 (ceil) => Corrigé
- Inverse bool in Search (bof)
*/
/*Float à modifier:
- Initialize displacement sur DispA (appel à evaluate) => template
- EvaluateDisplacement à recoder
- Check for better displacement à recoder avec template
- LoadRGBMatrixFromVideo in Double (template ? )
- Rajouter template double dans PaddedMatrix pour pouvoir utiliser Set et SetFrame
- Need to create new dataset: IDSConcrete can be changed in template, to be changed after in Downsampling*/
InpaintingAlgorithm/main.cpp
View file @
88eeb304
...
...
@@ -53,11 +53,11 @@ int main(){
IDSConcrete
baseIPS
=
IDSConcrete
(
dim
,
redMatrix
,
greenMatrix
,
blueMatrix
,
occMatrix
);
int
level
=
2
;
int
level
=
0
;
IDSDDownsampling
downsampledDataSource
=
IDSDDownsampling
(
&
baseIPS
,
3
,
2
);
downsampledDataSource
.
SetCurLevel
(
level
);
openCVIO
.
LoadRGBMatrixFromVideo
(
"Data/
search
_ant/L
3
_I
8
/M_
S
A_Ante_L
3
_I
8
.avi"
,
\
openCVIO
.
LoadRGBMatrixFromVideo
(
"Data/
reconstruct
_ant/L
1
_I
14
/M_
R
A_Ante_L
1
_I
14
.avi"
,
\
downsampledDataSource
.
GetRed
(),
downsampledDataSource
.
GetGreen
(),
downsampledDataSource
.
GetBlue
());
PaddedMatrix
<
int
>
*
const
frame_x
=
new
PaddedMatrix
<
int
>
(
downsampledDataSource
.
GetDim
());
...
...
@@ -69,34 +69,41 @@ int main(){
for
(
int
nbFrame
=
0
;
nbFrame
<
downsampledDataSource
.
GetDim
()
->
GetSizeZ
();
nbFrame
++
)
{
openCVIO
.
LoadMatrixFromCSV
(
"Data/
search
_ant/L
3
_I
8
/M_
S
A_Ante_DispX_L"
\
+
std
::
to_string
(
level
+
1
)
+
"_I
8
_F"
+
std
::
to_string
(
nbFrame
)
+
".csv"
,
frame_x
,
1
);
openCVIO
.
LoadMatrixFromCSV
(
"Data/
reconstruct
_ant/L
1
_I
14
/M_
R
A_Ante_DispX_L"
\
+
std
::
to_string
(
level
+
1
)
+
"_I
14
_F"
+
std
::
to_string
(
nbFrame
)
+
".csv"
,
frame_x
,
1
);
downsampledDataSource
.
GetDispX
()
->
SetFrame
(
frame_x
,
nbFrame
);
openCVIO
.
LoadMatrixFromCSV
(
"Data/
search
_ant/L
3
_I
8
/M_
S
A_Ante_DispY_L"
\
+
std
::
to_string
(
level
+
1
)
+
"_I
8
_F"
+
std
::
to_string
(
nbFrame
)
+
".csv"
,
frame_y
,
1
);
openCVIO
.
LoadMatrixFromCSV
(
"Data/
reconstruct
_ant/L
1
_I
14
/M_
R
A_Ante_DispY_L"
\
+
std
::
to_string
(
level
+
1
)
+
"_I
14
_F"
+
std
::
to_string
(
nbFrame
)
+
".csv"
,
frame_y
,
1
);
downsampledDataSource
.
GetDispY
()
->
SetFrame
(
frame_y
,
nbFrame
);
openCVIO
.
LoadMatrixFromCSV
(
"Data/
search
_ant/L
3
_I
8
/M_
S
A_Ante_DispZ_L"
\
+
std
::
to_string
(
level
+
1
)
+
"_I
8
_F"
+
std
::
to_string
(
nbFrame
)
+
".csv"
,
frame_z
,
1
);
openCVIO
.
LoadMatrixFromCSV
(
"Data/
reconstruct
_ant/L
1
_I
14
/M_
R
A_Ante_DispZ_L"
\
+
std
::
to_string
(
level
+
1
)
+
"_I
14
_F"
+
std
::
to_string
(
nbFrame
)
+
".csv"
,
frame_z
,
1
);
downsampledDataSource
.
GetDispZ
()
->
SetFrame
(
frame_z
,
nbFrame
);
openCVIO
.
LoadMatrixFromCSV
(
"Data/
search
_ant/L
3
_I
8
/M_
S
A_Ante_DispA_L"
\
+
std
::
to_string
(
level
+
1
)
+
"_I
8
_F"
+
std
::
to_string
(
nbFrame
)
+
".csv"
,
frame_a
,
1
);
openCVIO
.
LoadMatrixFromCSV
(
"Data/
reconstruct
_ant/L
1
_I
14
/M_
R
A_Ante_DispA_L"
\
+
std
::
to_string
(
level
+
1
)
+
"_I
14
_F"
+
std
::
to_string
(
nbFrame
)
+
".csv"
,
frame_a
,
1
);
downsampledDataSource
.
GetDispA
()
->
SetFrame
(
frame_a
,
nbFrame
);
openCVIO
.
LoadMatrixFromCSV
(
"Data/
search
_ant/L
3
_I
8
/M_
S
A_Ante_GradX_L"
\
+
std
::
to_string
(
level
+
1
)
+
"_I
8
_F"
+
std
::
to_string
(
nbFrame
)
+
".csv"
,
frame_gx
,
1
);
openCVIO
.
LoadMatrixFromCSV
(
"Data/
reconstruct
_ant/L
1
_I
14
/M_
R
A_Ante_GradX_L"
\
+
std
::
to_string
(
level
+
1
)
+
"_I
14
_F"
+
std
::
to_string
(
nbFrame
)
+
".csv"
,
frame_gx
,
1
);
downsampledDataSource
.
GetGradX
()
->
SetFrame
(
frame_gx
,
nbFrame
);
openCVIO
.
LoadMatrixFromCSV
(
"Data/
search
_ant/L
3
_I
8
/M_
S
A_Ante_GradY_L"
\
+
std
::
to_string
(
level
+
1
)
+
"_I
5
_F"
+
std
::
to_string
(
nbFrame
)
+
".csv"
,
frame_gy
,
1
);
openCVIO
.
LoadMatrixFromCSV
(
"Data/
reconstruct
_ant/L
1
_I
14
/M_
R
A_Ante_GradY_L"
\
+
std
::
to_string
(
level
+
1
)
+
"_I
14
_F"
+
std
::
to_string
(
nbFrame
)
+
".csv"
,
frame_gy
,
1
);
downsampledDataSource
.
GetGradY
()
->
SetFrame
(
frame_gy
,
nbFrame
);
}
// downsampledDataSource.GetOcc()->Mprint();
searchAlgo
.
Search
(
&
downsampledDataSource
,
false
);
// reconstructAlgo.Reconstruct(&downsampledDataSource, false);
// searchAlgo.Search(&downsampledDataSource, false);
reconstructAlgo
.
Reconstruct
(
&
downsampledDataSource
,
false
);
// Output the new images.
for
(
int
i
=
0
;
i
<
downsampledDataSource
.
GetDim
()
->
GetSizeZ
();
++
i
)
openCVIO
.
GeneralIOForRGB
(
downsampledDataSource
.
GetRed
(),
\
downsampledDataSource
.
GetGreen
(),
downsampledDataSource
.
GetBlue
(),
i
,
\
InpaintingIO
::
IH_DBG_SAVE
,
"Data/reconstruct_ant/result_L1_I14/CppOut_F"
+
std
::
to_string
(
i
));
for
(
int
nbFrame
=
0
;
nbFrame
<
downsampledDataSource
.
GetDim
()
->
GetSizeZ
();
nbFrame
++
)
{
...
...
@@ -104,17 +111,18 @@ int main(){
// downsampledDataSource.GetBlue(),nbFrame,InpaintingIO::IH_DBG_SAVE,\
// "Data/search_reconstruct/CppOut_SR_L"+std::to_string(level+1)+"_F"+ std::to_string(nbFrame));
downsampledDataSource
.
GetDispX
()
->
GetFrame
(
nbFrame
)
->
MprintToCSV
(
"Data/
search
_ant/result_L
3
_I
8
/CppOut_
S
A_DispX_L"
+
std
::
to_string
(
level
+
1
)
+
"_I
8
_F"
+
std
::
to_string
(
nbFrame
));
downsampledDataSource
.
GetDispY
()
->
GetFrame
(
nbFrame
)
->
MprintToCSV
(
"Data/
search
_ant/result_L
3
_I
8
/CppOut_
S
A_DispY_L"
+
std
::
to_string
(
level
+
1
)
+
"_I
8
_F"
+
std
::
to_string
(
nbFrame
));
downsampledDataSource
.
GetDispZ
()
->
GetFrame
(
nbFrame
)
->
MprintToCSV
(
"Data/
search
_ant/result_L
3
_I
8
/CppOut_
S
A_DispZ_L"
+
std
::
to_string
(
level
+
1
)
+
"_I
8
_F"
+
std
::
to_string
(
nbFrame
));
downsampledDataSource
.
GetDispA
()
->
GetFrame
(
nbFrame
)
->
MprintToCSV
(
"Data/
search
_ant/result_L
3
_I
8
/CppOut_
S
A_DispA_L"
+
std
::
to_string
(
level
+
1
)
+
"_I
8
_F"
+
std
::
to_string
(
nbFrame
));
downsampledDataSource
.
GetGradX
()
->
GetFrame
(
nbFrame
)
->
MprintToCSV
(
"Data/
search
_ant/result_L
3
_I
8
/CppOut_
S
A_GradX_L"
+
std
::
to_string
(
level
+
1
)
+
"_I
8
_F"
+
std
::
to_string
(
nbFrame
));
downsampledDataSource
.
GetGradY
()
->
GetFrame
(
nbFrame
)
->
MprintToCSV
(
"Data/
search
_ant/result_L
3
_I
8
/CppOut_
S
A_GradY_L"
+
std
::
to_string
(
level
+
1
)
+
"_I
8
_F"
+
std
::
to_string
(
nbFrame
));
downsampledDataSource
.
GetDispX
()
->
GetFrame
(
nbFrame
)
->
MprintToCSV
(
"Data/
reconstruct
_ant/result_L
1
_I
14
/CppOut_
R
A_DispX_L"
+
std
::
to_string
(
level
+
1
)
+
"_I
14
_F"
+
std
::
to_string
(
nbFrame
));
downsampledDataSource
.
GetDispY
()
->
GetFrame
(
nbFrame
)
->
MprintToCSV
(
"Data/
reconstruct
_ant/result_L
1
_I
14
/CppOut_
R
A_DispY_L"
+
std
::
to_string
(
level
+
1
)
+
"_I
14
_F"
+
std
::
to_string
(
nbFrame
));
downsampledDataSource
.
GetDispZ
()
->
GetFrame
(
nbFrame
)
->
MprintToCSV
(
"Data/
reconstruct
_ant/result_L
1
_I
14
/CppOut_
R
A_DispZ_L"
+
std
::
to_string
(
level
+
1
)
+
"_I
14
_F"
+
std
::
to_string
(
nbFrame
));
downsampledDataSource
.
GetDispA
()
->
GetFrame
(
nbFrame
)
->
MprintToCSV
(
"Data/
reconstruct
_ant/result_L
1
_I
14
/CppOut_
R
A_DispA_L"
+
std
::
to_string
(
level
+
1
)
+
"_I
14
_F"
+
std
::
to_string
(
nbFrame
));
downsampledDataSource
.
GetGradX
()
->
GetFrame
(
nbFrame
)
->
MprintToCSV
(
"Data/
reconstruct
_ant/result_L
1
_I
14
/CppOut_
R
A_GradX_L"
+
std
::
to_string
(
level
+
1
)
+
"_I
14
_F"
+
std
::
to_string
(
nbFrame
));
downsampledDataSource
.
GetGradY
()
->
GetFrame
(
nbFrame
)
->
MprintToCSV
(
"Data/
reconstruct
_ant/result_L
1
_I
14
/CppOut_
R
A_GradY_L"
+
std
::
to_string
(
level
+
1
)
+
"_I
14
_F"
+
std
::
to_string
(
nbFrame
));
}
std
::
cout
<<
"End of search/reconstruct test"
<<
std
::
endl
;
// Execute the work
inpainter
.
Inpaint
(
&
baseIPS
,
&
profiler
);
...
...
MATLAB Inpainting/Content/Oreo.avi
0 → 100644
View file @
88eeb304
File added
MATLAB Inpainting/Patch_match/patch_match.cpp
View file @
88eeb304
...
...
@@ -158,7 +158,7 @@ nTupleVolume<T> * patch_match_ANN(nTupleVolume<T> *imgVolA, nTupleVolume<T> *img
}
else
//normal patchMatch
{
srand
(
0
);
//
srand(0);
mexPrintf
(
"Initialisation
\n
"
);
initialise_displacement_field
(
dispField
,
imgVolA
,
imgVolB
,
firstGuessVol
,
imgVolOcc
,
params
);
...
...
MATLAB Inpainting/Patch_match/spatio_temporal_patch_match_mex.mexa64
View file @
88eeb304
No preview for this file type
MATLAB Inpainting/inpaint_video.m
View file @
88eeb304
...
...
@@ -132,22 +132,6 @@ function[imgOut, shiftVolOut] = inpaint_video(varargin)
firstGuess
=
shiftVol
+
1
-
1
;
write_image_volume
(
imgVol
,
strcat
(
'matlab_debug/search_ant/M_SA_Ante_Im_L'
,
int2str
(
ii
),
'_I'
,
int2str
(
pp
)));
cd
matlab_debug
/
search_ant
/
[
~
,
w
,
l
,
maxFrame
]
=
size
(
shiftVol
);
for
nbframe
=
1
:
maxFrame
csvwrite
(
strcat
(
'M_SA_Ante_DispX_L'
,
int2str
(
ii
),
'_I'
,
int2str
(
pp
),
'_F'
,
int2str
(
nbframe
-
1
),
'.csv'
),
reshape
(
shiftVol
(
1
,:,:,
nbframe
),[
w
,
l
]));
csvwrite
(
strcat
(
'M_SA_Ante_DispY_L'
,
int2str
(
ii
),
'_I'
,
int2str
(
pp
),
'_F'
,
int2str
(
nbframe
-
1
),
'.csv'
),
reshape
(
shiftVol
(
2
,:,:,
nbframe
),[
w
,
l
]));
csvwrite
(
strcat
(
'M_SA_Ante_DispZ_L'
,
int2str
(
ii
),
'_I'
,
int2str
(
pp
),
'_F'
,
int2str
(
nbframe
-
1
),
'.csv'
),
reshape
(
shiftVol
(
3
,:,:,
nbframe
),[
w
,
l
]));
csvwrite
(
strcat
(
'M_SA_Ante_DispA_L'
,
int2str
(
ii
),
'_I'
,
int2str
(
pp
),
'_F'
,
int2str
(
nbframe
-
1
),
'.csv'
),
reshape
(
shiftVol
(
4
,:,:,
nbframe
),[
w
,
l
]));
csvwrite
(
strcat
(
'M_SA_Ante_GradX_L'
,
int2str
(
ii
),
'_I'
,
int2str
(
pp
),
'_F'
,
int2str
(
nbframe
-
1
),
'.csv'
),
normGradX
(:,:,
nbframe
));
csvwrite
(
strcat
(
'M_SA_Ante_GradY_L'
,
int2str
(
ii
),
'_I'
,
int2str
(
pp
),
'_F'
,
int2str
(
nbframe
-
1
),
'.csv'
),
normGradY
(:,:,
nbframe
));
end
cd
..
/
..
% Carry out the 3D PatchMatch
shiftVol
=
spatio_temporal_patch_match_mex
(
...
imgVol
,
...
...
...
@@ -157,22 +141,21 @@ function[imgOut, shiftVolOut] = inpaint_video(varargin)
occVolDilate
,
...
occVolDilate
);
write_image_volume
(
imgVol
,
strcat
(
'matlab_debug/search_ant/M_SA_Post_Im_L'
,
int2str
(
ii
)));
cd
matlab_debug
/
search_ant
/
[
~
,
w
,
l
,
maxFrame
]
=
size
(
shiftVol
);
for
nbframe
=
1
:
maxFrame
csvwrite
(
strcat
(
'M_SA_Post_DispX_L'
,
int2str
(
ii
),
'_I'
,
int2str
(
pp
),
'_F'
,
int2str
(
nbframe
-
1
),
'.csv'
),
reshape
(
shiftVol
(
1
,:,:,
nbframe
),[
w
,
l
]));
csvwrite
(
strcat
(
'M_SA_Post_DispY_L'
,
int2str
(
ii
),
'_I'
,
int2str
(
pp
),
'_F'
,
int2str
(
nbframe
-
1
),
'.csv'
),
reshape
(
shiftVol
(
2
,:,:,
nbframe
),[
w
,
l
]));
csvwrite
(
strcat
(
'M_SA_Post_DispZ_L'
,
int2str
(
ii
),
'_I'
,
int2str
(
pp
),
'_F'
,
int2str
(
nbframe
-
1
),
'.csv'
),
reshape
(
shiftVol
(
3
,:,:,
nbframe
),[
w
,
l
]));
csvwrite
(
strcat
(
'M_SA_Post_DispA_L'
,
int2str
(
ii
),
'_I'
,
int2str
(
pp
),
'_F'
,
int2str
(
nbframe
-
1
),
'.csv'
),
reshape
(
shiftVol
(
4
,:,:,
nbframe
),[
w
,
l
]));
csvwrite
(
strcat
(
'M_SA_Post_GradX_L'
,
int2str
(
ii
),
'_I'
,
int2str
(
pp
),
'_F'
,
int2str
(
nbframe
-
1
),
'.csv'
),
normGradX
(:,:,
nbframe
));
csvwrite
(
strcat
(
'M_SA_Post_GradY_L'
,
int2str
(
ii
),
'_I'
,
int2str
(
pp
),
'_F'
,
int2str
(
nbframe
-
1
),
'.csv'
),
normGradY
(:,:,
nbframe
));
end
cd
..
/
..
/
% write_image_volume(imgVol,strcat('matlab_debug/reconstruct_ant/M_RA_Ante_Im_L',int2str(ii),'_I',int2str(pp)));
% cd matlab_debug/reconstruct_ant/
%
% [~,w,l,maxFrame] = size(shiftVol);
%
% for nbframe=1:maxFrame
% csvwrite(strcat('M_RA_Ante_DispX_L',int2str(ii),'_I',int2str(pp),'_F',int2str(nbframe-1),'.csv'),reshape(shiftVol(1,:,:,nbframe),[w,l]));
% csvwrite(strcat('M_RA_Ante_DispY_L',int2str(ii),'_I',int2str(pp),'_F',int2str(nbframe-1),'.csv'),reshape(shiftVol(2,:,:,nbframe),[w,l]));
% csvwrite(strcat('M_RA_Ante_DispZ_L',int2str(ii),'_I',int2str(pp),'_F',int2str(nbframe-1),'.csv'),reshape(shiftVol(3,:,:,nbframe),[w,l]));
% csvwrite(strcat('M_RA_Ante_DispA_L',int2str(ii),'_I',int2str(pp),'_F',int2str(nbframe-1),'.csv'),reshape(shiftVol(4,:,:,nbframe),[w,l]));
% csvwrite(strcat('M_RA_Ante_GradX_L',int2str(ii),'_I',int2str(pp),'_F',int2str(nbframe-1),'.csv'),normGradX(:,:,nbframe));
% csvwrite(strcat('M_RA_Ante_GradY_L',int2str(ii),'_I',int2str(pp),'_F',int2str(nbframe-1),'.csv'),normGradY(:,:,nbframe));
% end
%
% cd ../../
imgVolCopy
=
permute
(
imgVol
,[
2
3
4
1
]);
...
...
@@ -201,6 +184,21 @@ function[imgOut, shiftVolOut] = inpaint_video(varargin)
useAllPatches
,
...
reconstructionType
);
end
% write_image_volume(imgVol,strcat('matlab_debug/reconstruct_ant/M_RA_Post_Im_L',int2str(ii),'_I',int2str(pp)));
% cd matlab_debug/reconstruct_ant/
%
% [~,w,l,maxFrame] = size(shiftVol);
%
% for nbframe=1:maxFrame
% csvwrite(strcat('M_RA_Post_DispX_L',int2str(ii),'_I',int2str(pp),'_F',int2str(nbframe-1),'.csv'),reshape(shiftVol(1,:,:,nbframe),[w,l]));
% csvwrite(strcat('M_RA_Post_DispY_L',int2str(ii),'_I',int2str(pp),'_F',int2str(nbframe-1),'.csv'),reshape(shiftVol(2,:,:,nbframe),[w,l]));
% csvwrite(strcat('M_RA_Post_DispZ_L',int2str(ii),'_I',int2str(pp),'_F',int2str(nbframe-1),'.csv'),reshape(shiftVol(3,:,:,nbframe),[w,l]));
% csvwrite(strcat('M_RA_Post_DispA_L',int2str(ii),'_I',int2str(pp),'_F',int2str(nbframe-1),'.csv'),reshape(shiftVol(4,:,:,nbframe),[w,l]));
% csvwrite(strcat('M_RA_Post_GradX_L',int2str(ii),'_I',int2str(pp),'_F',int2str(nbframe-1),'.csv'),normGradX(:,:,nbframe));
% csvwrite(strcat('M_RA_Post_GradY_L',int2str(ii),'_I',int2str(pp),'_F',int2str(nbframe-1),'.csv'),normGradY(:,:,nbframe));
% end
%
% cd ../../
else
...
...
@@ -341,7 +339,6 @@ function[imgOut, shiftVolOut] = inpaint_video(varargin)
return
;
end
%write_image_volume(imgVol,strcat('matlab_debug/divergence/M_L',int2str(ii)));
%erase some of the video structures
clearvars
imgVol
occVolDilate
occVolPatchMatch
;
...
...
@@ -352,5 +349,7 @@ function[imgOut, shiftVolOut] = inpaint_video(varargin)
end
,
imgOut
=
imgVol
;
write_image_volume
(
imgOut
,
strcat
(
'matlab_debug/no_seed/M_Im'
));
end
MATLAB Inpainting/matlab_debug/aleatoire/iter1/aleat_sort.sh
0 → 100644
View file @
88eeb304
#!/bin/bash
mkdir
L1 L2 L3
cd
L1
mkdir
I
{
1,2,3,4,5,6,7,8,9
}
I1
{
0,1,2,3,4
}
cd
../L2
mkdir
I
{
1,2,3,4,5,6,7,8,9
}
cd
../L3
mkdir
I
{
1,2,3,4,5,6,7,8
}
cd
..
for
l
in
1 2 3
do
for
i
in
1 2 3 4 5 6 7 8
do
mv
*
'_L'
$l
'_I'
$i
'_'
*
L
$l
/I
$i
/
done
done
mv
*
'_L2_I9_'
*
L2/I9/
mv
*
'_L1_I9_'
*
L1/I9/
for
i
in
10 11 12 13 14
do
mv
*
'_L1_I'
$i
'_'
*
L1/I
$i
/
done
MATLAB Inpainting/matlab_debug/aleatoire/iter2/aleat_sort.sh
0 → 100644
View file @
88eeb304
#!/bin/bash
mkdir
L1 L2 L3
cd
L1
mkdir
I
{
1,2,3,4,5,6,7,8,9
}
I1
{
0,1,2,3,4
}
cd
../L2
mkdir
I
{
1,2,3,4,5,6,7,8,9
}
cd
../L3
mkdir
I
{
1,2,3,4,5,6,7,8
}
cd
..
for
l
in
1 2 3
do
for
i
in
1 2 3 4 5 6 7 8
do
mv
*
'_L'
$l
'_I'
$i
'_'
*
L
$l
/I
$i
/
done
done
mv
*
'_L2_I9_'
*
L2/I9/
mv
*
'_L1_I9_'
*
L1/I9/
for
i
in
10 11 12 13 14
do
mv
*
'_L1_I'
$i
'_'
*
L1/I
$i
/
done
MATLAB Inpainting/matlab_debug/reconstruct_ant/aleat_sort.sh
0 → 100644
View file @
88eeb304
#!/bin/bash
mkdir
L1 L2 L3
cd
L1
mkdir
I
{
1,2,3,4,5,6,7,8,9
}
I1
{
0,1,2,3,4
}
cd
../L2
mkdir
I
{
1,2,3,4,5,6,7,8,9
}
cd
../L3
mkdir
I
{
1,2,3,4,5,6,7,8
}
cd
..
for
l
in
1 2 3
do
for
i
in
1 2 3 4 5 6 7 8
do
mv
*
'_L'
$l
'_I'
$i
'_'
*
L
$l
/I
$i
/
done
done
mv
*
'_L2_I9_'
*
L2/I9/
mv
*
'_L1_I9_'
*
L1/I9/
for
i
in
10 11 12 13 14
do
mv
*
'_L1_I'
$i
'_'
*
L1/I
$i
/
done
MATLAB Inpainting/start_inpaint_video.m
View file @
88eeb304
...
...
@@ -18,7 +18,7 @@ function[] = start_inpaint_video(varargin)
%turn off warning if it exists
warning
(
'off'
,
'MATLAB:aviread:FunctionToBeRemoved'
);
seed_random_numbers
();
%
seed_random_numbers();
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%% get the input video %%%%
...
...
MATLAB Inpainting/test_mex_rand.cpp
0 → 100644
View file @
88eeb304
#include <stdio.h>
#include <stdlib.h>
#include <mex.h>
void
mexFunction
(
int
nlhs
,
mxArray
*
plhs
[],
int
nrhs
,
const
mxArray
*
prhs
[])
{
/* Now generate 5 pseudo-random numbers */
int
i
;
for
(
i
=
0
;
i
<
5
;
i
++
)
{
mexPrintf
(
"rand[%d]= %u
\n
"
,
i
,
rand
());
}
return
;
}
MATLAB Inpainting/test_mex_rand.mexa64
0 → 100644
View file @
88eeb304
File added
compare.py
View file @
88eeb304
...
...
@@ -8,8 +8,8 @@ import scipy.signal
np
.
set_printoptions
(
threshold
=
np
.
nan
)
CppPath
=
"Data/
out_cpp_random/D:
\\
temp
\\
fina
lReconstructedImgF"
MatlabPath
=
"
Data/Out_matlab_random
/beach_umbrellainpainted_frame_
0
"
CppPath
=
"Data/
ful
lReconstructedImgF"
MatlabPath
=
"
MATLAB Inpainting/Output
/beach_umbrellainpainted_frame_"
OccPath
=
"Data/resources/beach_umbrella_occlusion.png"
OccMediumPath
=
"Data/divergence/full_div/M_OccMask_F32_L2_I_1.png"
...
...
@@ -55,6 +55,9 @@ def PixCompare(im1,im2,occMask,threshold):
n
,
m
=
im1
.
shape
[
0
],
im1
.
shape
[
1
]
assert
(
im2
.
shape
[
0
]
==
occMask
.
shape
[
0
]
==
n
and
im2
.
shape
[
1
]
==
occMask
.
shape
[
1
]
==
m
)
#In order to avoid division by zero
im1
[
im1
==
0
]
=
0.0001
Rdiff
=
abs
(
im1
[:,:,
0
]
-
im2
[:,:,
0
])
/
im1
[:,:,
0
]
Gdiff
=
abs
(
im1
[:,:,
1
]
-
im2
[:,:,
1
])
/
im1
[:,:,
1
]
Bdiff
=
abs
(
im1
[:,:,
2
]
-
im2
[:,:,
2
])
/
im1
[:,:,
2
]
...
...
@@ -483,18 +486,64 @@ if __name__ == '__main__':
############## Working on Search/reconstruct
# visual_compare(Cpp_SR_Path,M_SR_Path,[98,17,66,3],"Data/search_reconstruct/SR_result/SR_OutComp_L3_F")
# # visual_compare(Cpp_SR_Path,M_SR_Path,[98,17,66,3],"Data/search_reconstruct/SR_result/SR_OutComp_L3_F")
#
# pixCountSR = FullPixCompare(Cpp_SR_Path,M_SR_Path,[98,17,66,3],OccSmallPath,0.1)
# plt.plot((pixCountSR[0,:]+pixCountSR[1,:]+pixCountSR[2,:])/3,'black')
#
# plt.axhline(np.mean((pixCountSR[0,:]+pixCountSR[1,:]+pixCountSR[2,:])/3),color='red')
#
# plt.xlabel("number of frame (time)")
# plt.ylabel("Percentage of pixels different in each image on the mask")
# plt.legend()
# plt.title("Evolution de la différence de pixel entre les images Matlab et C++\
# sur une itération Recherche/Reconstruction \n \
# Avg:"+str(np.mean((pixCountSR[0,:]+pixCountSR[1,:]+pixCountSR[2,:])/3))+\
# " Ecart-type: "+str(np.std((pixCountSR[0,:]+pixCountSR[1,:]+pixCountSR[2,:])/3)))
# plt.show()
pixCountSR
=
FullPixCompare
(
Cpp_SR_Path
,
M_SR_Path
,[
98
,
17
,
66
,
3
],
OccSmallPath
,
0.1
)
plt
.
plot
((
pixCountSR
[
0
,:]
+
pixCountSR
[
1
,:]
+
pixCountSR
[
2
,:])
/
3
,
'black'
)
# # Compare full outputs of both algorithms, please find something...
# visual_compare("Data/fullReconstructedImgF","Data/resources/beach_umbrella_f",[98,68,264,3],"Data/visu_comp_F")
# # Result: ...
# Comparison between matlab and C++ with L1_I14 injection
# visual_compare("Data/search_ant/result_L1_I14/CppOut_F","Data/resources/beach_umbrella_f",[98,68,264,3],"Data/visual_compare/visu_comp_L1_I14_F")
# Result: Still the same, but pix compare will be interesting
# # plot pix compare between matlab and C++ with L1_I14 injection
# pixCountSR = FullPixCompare("Data/search_ant/result_L1_I14/CppOut_F",\
# "Data/resources/beach_umbrella_f",[98,68,264,3],OccPath,0.1)
#
# plt.plot((pixCountSR[0,:]+pixCountSR[1,:]+pixCountSR[2,:])/3,'black')
# plt.axhline(np.mean((pixCountSR[0,:]+pixCountSR[1,:]+pixCountSR[2,:])/3),color='red')
#
# plt.xlabel("number of frame (time)")
# plt.ylabel("Percentage of pixels different in each image on the mask")
# plt.legend()
# plt.title("Evolution de la différence de pixel entre les images Matlab et C++\
# sur une itération Recherche/Reconstruction avec injection sur le niveau L1-I14 \n \
# Avg:"+str(np.mean((pixCountSR[0,:]+pixCountSR[1,:]+pixCountSR[2,:])/3))+\
# " Ecart-type: "+str(np.std((pixCountSR[0,:]+pixCountSR[1,:]+pixCountSR[2,:])/3)))
# plt.show()
# # Result: plus de 60% de différence, cohérent.
# # Comparison between matlab and C++ with L1_I14 injection
# visual_compare("Data/reconstruct_ant/result_L1_I14/CppOut_F","Data/reconstruct_ant/L1_I14/M_RA_Post_Im_L1_I14_frame_",[98,68,264,3],"Data/reconstruct_ant/visu_comp_L1_I14_F")
# # Result: Weird noise
# plot pix compare between matlab and C++ reconstruction with L1_I14 injection
pixCountSR
=
FullPixCompare
(
"Data/reconstruct_ant/result_L1_I14/CppOut_F"
,
\
"Data/reconstruct_ant/L1_I14/M_RA_Post_Im_L1_I14_frame_"
,[
98
,
68
,
264
,
3
],
OccPath
,
0.1
)
plt
.
plot
((
pixCountSR
[
0
,:]
+
pixCountSR
[
1
,:]
+
pixCountSR
[
2
,:])
/
3
,
'black'
)
plt
.
axhline
(
np
.
mean
((
pixCountSR
[
0
,:]
+
pixCountSR
[
1
,:]
+
pixCountSR
[
2
,:])
/
3
),
color
=
'red'
)
plt
.
xlabel
(
"number of frame (time)"
)
plt
.
ylabel
(
"Percentage of pixels different in each image on the mask"
)
plt
.
legend
()
plt
.
title
(
"Evolution de la différence de pixel entre les images Matlab et C++
\
sur une itération Recherche/Reconstruction
\n
\
sur une itération Recherche/Reconstruction
avec injection sur le niveau L1-I14
\n
\
Avg:"
+
str
(
np
.
mean
((
pixCountSR
[
0
,:]
+
pixCountSR
[
1
,:]
+
pixCountSR
[
2
,:])
/
3
))
+
\
" Ecart-type: "
+
str
(
np
.
std
((
pixCountSR
[
0
,:]
+
pixCountSR
[
1
,:]
+
pixCountSR
[
2
,:])
/
3
)))
plt
.
show
()
# Result: 3% de différence en moyenne, le problème ne doit pas venir de là.
dispcompare.py
View file @
88eeb304
...
...
@@ -108,13 +108,12 @@ def upsample_compare(Mpath,Cpath,nbFrame,XYZ,OccMask,outPath,inputMorC,endPath):
# Load matrices for the second path
temp_cpp
=
np
.
genfromtxt
(
Cpath
+
XYZ
+
endPath
+
str
(
i
)
+
".csv"
,
delimiter
=
';'
)
end
=
np
.
shape
(
temp_cpp
)[
1
]
diff
=
temp_matlab
-
temp_cpp
[:,
0
:
end
-
1
]
# # Those lines are when you compare two matlab paths
# temp_cpp = np.genfromtxt(Cpath+XYZ+endPath+str(i)+".csv",delimiter=',')
# diff = temp_matlab-temp_cpp
# if(np.sum(diff)!=0):
# print("i:",i)
# print(100*diff)
plt
.
imsave
(
outPath
+
XYZ
+
endPath
+
str
(
i
)
+
".png"
,
diff
,
cmap
=
"seismic"
)
...
...
@@ -245,15 +244,40 @@ if __name__=="__main__":
# 98,"DispX",OccSmallMask,"Data/search_ant/Diff_UA_",'Matlab',"_L3_I5_F")
# # Result: For DispXYZ, about 30% difference, for DispA, nearly 100%,
#Compare one search iteration (at end of level iterations)
upsample_compare
(
"Data/search_ant/L3_I8/M_SA_Post_"
,
"Data/search_ant/result_L3_I8/CppOut_SA_"
,
\
98
,
"DispX"
,
OccSmallMask
,
"Data/search_ant/Diff_UA_"
,
'Matlab'
,
"_L3_I8_F"
)
# Result: Mean percentage a bit higher, so there is divergence across iterations.
# Result 2: Testing with new value of HalfPatchSize (à 3), no significant change (0.4%)
#
#Compare one search iteration (at end of level iterations)
#
upsample_compare("Data/search_ant/L3_I8/M_SA_Post_","Data/search_ant/result_L3_I8/CppOut_SA_",\
#
98,"DispX",OccSmallMask,"Data/search_ant/Diff_UA_",'Matlab',"_L3_I8_F")
#
#
Result: Mean percentage a bit higher, so there is divergence across iterations.
#
#
Result 2: Testing with new value of HalfPatchSize (à 3), no significant change (0.4%)
"""A faire pour ce weekend ou la semaine prochaine:
- Regarder si l'inversion du booleen dans Search est positive
- Recoder l'implémentation hard coded du HalfPatchSize (pas utile mais bon au moins ce sera fait)
- Vérifier (en printant sur une vrai itération) que il n'y a pas de problème
de valeur de bord de masque lors de la fonction rand_search
- Vérifier (en printant sur une vraie itération) que il n'y a pas de problème
de valeur de bord de masque lors de la fonction rand_search => normalement
\
non sauf peut être dans l'init
"""
# # Compare two executions of search algo on same dataset, to see random dispersion
# upsample_compare("Data/aleatoire/al_cpp_iter1_L3_I8/CppOut_AL1_",\
# "Data/aleatoire/al_cpp_iter2_L3_I8/CppOut_AL2_",98,"DispX",OccSmallMask,\
# "Data/aleatoire/diff_AL_Cpp_",'Cpp',"_L3_I8_F")
# # Result: 0% WTF ! Aucun aléatoire, c'est pas normal
# # Compare two executions of search algo on same dataset, to see random dispersion
# upsample_compare("Data/aleatoire/al_matlab_iter1_L3_I8/M_AL_Post_",\
# "Data/aleatoire/al_matlab_iter2_L3_I8/M_AL_Post_",98,"DispX",OccSmallMask,\
# "Data/aleatoire/diff_AL_M_Post_",'Matlab',"_L3_I8_F")
# # Result: 0%... ok c'est rassurant pour le c++, apparemment le fait
# # de fixer la seed rend l'algo déterministe
# # Compare two executions of search algo on same dataset, on the highest level just to see the difference
# upsample_compare("Data/search_ant/L1_I14/M_AL_Post_",\
# "Data/search_ant/result_L1_I14/CppOut_AL_",98,"DispX",OccMask,\
# "Data/search_ant/diff_AL_Cpp_",'Matlab',"_L1_I14_F")
# # Result:
# Compare reconstruction algo
upsample_compare
(
"Data/reconstruct_ant/L1_I14/M_RA_Post_"
,
\
"Data/reconstruct_ant/result_L1_I14/CppOut_RA_"
,
98
,
"GradX"
,
OccMask
,
\
"Data/reconstruct_ant/diff_RA_"
,
'Matlab'
,
"_L1_I14_F"
)
# Result: Disp at 0 (which is normal) but reconstruct if Grad at 60% ...
Write
Preview
Markdown
is supported
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