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
191cd12a
Commit
191cd12a
authored
Jul 23, 2017
by
sarthou
Browse files
Ready for switching the code to double precisin
parent
b775485d
Changes
3
Hide whitespace changes
Inline
Side-by-side
InpaintingAlgorithm/algorithm/inpainting/searchers/ISRandom.cpp
View file @
191cd12a
...
...
@@ -30,6 +30,7 @@ void ISRandom::Search(InpaintingDataSource * const iDataProvider, bool const has
double
propTime
=
0
,
randTime
=
0
;
int
propCount
=
0
,
randCount
=
0
;
for
(
int
i
=
0
;
i
<
searchIterations
;
++
i
){
// TODO In matlab code, it is opposed, maybe worth it to test if it differs ? (but there's no hope)
bool
goForward
=
(
i
&
1
)
!=
0
;
sectionClock
=
std
::
chrono
::
steady_clock
::
now
();
...
...
@@ -115,7 +116,7 @@ int ISRandom::RandomSearch(InpaintingDataSource * const iDataProvider, bool cons
int
wTemp
=
wValues
[
ii
];
// X Values // TODO The 2 comes from the half patch size...
// X Values // TODO The 2 comes from the half patch size
(floor)
...
int
randMinX
=
std
::
max
(
xTemp
-
wTemp
,
2
);
int
randMaxX
=
std
::
min
(
xTemp
+
wTemp
,
levelDim
->
GetSizeX
()
-
2
-
1
);
...
...
@@ -131,16 +132,6 @@ int ISRandom::RandomSearch(InpaintingDataSource * const iDataProvider, bool cons
int
randDispY
=
(
randMaxY
==
randMinY
?
randMaxY
:
rand
()
%
(
randMaxY
-
randMinY
+
1
)
+
randMinY
);
int
randDispZ
=
(
randMaxZ
==
randMinZ
?
randMaxZ
:
rand
()
%
(
randMaxZ
-
randMinZ
+
1
)
+
randMinZ
);
// std::ofstream fichier("rand_out.txt", std::ios::app);
// if(fichier)
// {
// fichier << "(" << randDispX << ":" << randDispY << ':' << randDispZ << ")" << std::endl;
//
// fichier.close();
// }
// else
// std::cerr << "Impossible d'ouvrir le fichier !" << std::endl;
if
(
CheckForBetterDisplacement
(
iDataProvider
,
levelDim
,
hasInvalidPixels
,
matIt
.
GetPosition
(),
matIt
.
GetCurX
(),
randDispX
-
matIt
.
GetCurX
(),
...
...
@@ -286,4 +277,17 @@ void ISRandom::InitialiseDisplacementField(InpaintingDataSource * const iDataPro
volIt
.
GetCurX
(),
volIt
.
GetCurY
(),
volIt
.
GetCurZ
(),
xDispT
,
yDispT
,
zDispT
);
}
while
(
volIt
.
Next
());
}
}
/*Problème noté:
- Valeur du statut renvoyé dans les cas occlus/pas occlus,
- 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/algorithm/inpainting/searchers/ISRandom.h
View file @
191cd12a
...
...
@@ -19,8 +19,8 @@ private:
// Tools
// std::mt19937 randEngine = std::mt19937(0);
// TODO Hardcoded so we know what to remove later...
int
patchHalfSize
=
2
;
// Works for X, Y and Z since they're all the same...
// TODO Hardcoded so we know what to remove later...
Not sure it is 2 or 3...
int
patchHalfSize
=
3
;
// Works for X, Y and Z since they're all the same...
int
searchCall
=
0
;
InpaintingEvaluator
*
const
iEvaluator
;
...
...
dispcompare.py
View file @
191cd12a
...
...
@@ -248,4 +248,12 @@ if __name__=="__main__":
#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: 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
"""
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