Commit 2f833ad3 authored by sarthou's avatar sarthou
Browse files

Upsampled correction terminated

!
parent df9a08ea
...@@ -48,7 +48,8 @@ void InpaintingConverger::Inpaint(InpaintingDataSource * const iDataSource, Inpa ...@@ -48,7 +48,8 @@ void InpaintingConverger::Inpaint(InpaintingDataSource * const iDataSource, Inpa
} }
if(curLevel != 0) if(curLevel != 0)
downsampledDataSource.UpsampleShiftMatrices(); //downsampledDataSource.UpsampleShiftMatrices();
downsampledDataSource.MatlabUpsampleShiftMatrix();
iProfiler->AfterInpaintingIterations(curLevel); iProfiler->AfterInpaintingIterations(curLevel);
iProfiler->AfterInpaintLevel(curLevel); iProfiler->AfterInpaintLevel(curLevel);
......
...@@ -141,12 +141,13 @@ void IDSDDownsampling::MatlabUpsampleShiftMatrix(){ ...@@ -141,12 +141,13 @@ void IDSDDownsampling::MatlabUpsampleShiftMatrix(){
int tempDispZ = fromZDispData[fromDim->DeterminePosition(GridX->GetData()[nextVolIt.GetPosition()],\ int tempDispZ = fromZDispData[fromDim->DeterminePosition(GridX->GetData()[nextVolIt.GetPosition()],\
GridY->GetData()[nextVolIt.GetPosition()],GridZ->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 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()] =\ toZDispData[nextVolIt.GetPosition()] =\
std::max(std::min(tempDispZ,maxBarrier-GridZ->GetData()[nextVolIt.GetPosition()]),minBarrier-GridZ->GetData()[nextVolIt.GetPosition()]); std::max(std::min(tempDispZ,maxBarrier-GridZ->GetData()[nextVolIt.GetPosition()]),minBarrier-GridZ->GetData()[nextVolIt.GetPosition()]);
// toZDispData[nextVolIt.GetPosition()] = tempDispZ;
toADispData[nextVolIt.GetPosition()] =\ toADispData[nextVolIt.GetPosition()] =\
......
...@@ -52,7 +52,7 @@ int main(){ ...@@ -52,7 +52,7 @@ int main(){
openCVIO.LoadOcclusionMatrixFromImage(occFileName, occMatrix); openCVIO.LoadOcclusionMatrixFromImage(occFileName, occMatrix);
IDSConcrete baseIPS = IDSConcrete(dim, redMatrix, greenMatrix, blueMatrix, occMatrix); IDSConcrete baseIPS = IDSConcrete(dim, redMatrix, greenMatrix, blueMatrix, occMatrix);
/*
// Work for testing upsampe algorithm // Work for testing upsampe algorithm
IDSDDownsampling downsampledDataSource = IDSDDownsampling(&baseIPS, 3, 2); IDSDDownsampling downsampledDataSource = IDSDDownsampling(&baseIPS, 3, 2);
...@@ -95,7 +95,7 @@ int main(){ ...@@ -95,7 +95,7 @@ int main(){
downsampledDataSource.GetDispA()->GetFrame(nbFrame)->MprintToCSV("Data/upsample_ant/Cpp_UA_DispA_F"+std::to_string(nbFrame)); downsampledDataSource.GetDispA()->GetFrame(nbFrame)->MprintToCSV("Data/upsample_ant/Cpp_UA_DispA_F"+std::to_string(nbFrame));
} }
std::cout << "End of upsample test"<< std::endl; std::cout << "End of upsample test"<< std::endl;
*/
/* /*
int level = 2; int level = 2;
...@@ -170,7 +170,7 @@ int main(){ ...@@ -170,7 +170,7 @@ int main(){
// Output the new images. // Output the new images.
for(int i = 0; i < baseIPS.GetDim()->GetSizeZ(); ++i) for(int i = 0; i < baseIPS.GetDim()->GetSizeZ(); ++i)
openCVIO.GeneralIOForRGB(baseIPS.GetRed(), baseIPS.GetGreen(), baseIPS.GetBlue(), 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(); profiler.AfterInpainting();
......
...@@ -95,7 +95,7 @@ def upsample_compare(Mpath,Cpath,nbFrame,XYZ,level,OccMask,outPath,inputMorC,lev ...@@ -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)" "This function is to compare two set of data, in .csv matrices, and produce a visual output (in .png)"
results=[] results=[]
for i in range(1,nbFrame): for i in range(nbFrame):
# Add level in the pathway # Add level in the pathway
if(levelBool==True): if(levelBool==True):
endPath = "_L"+str(level)+"_F" endPath = "_L"+str(level)+"_F"
...@@ -117,6 +117,7 @@ def upsample_compare(Mpath,Cpath,nbFrame,XYZ,level,OccMask,outPath,inputMorC,lev ...@@ -117,6 +117,7 @@ def upsample_compare(Mpath,Cpath,nbFrame,XYZ,level,OccMask,outPath,inputMorC,lev
diff = temp_matlab-temp_cpp[:,0:end-1] diff = temp_matlab-temp_cpp[:,0:end-1]
# if(np.sum(diff)!=0): # if(np.sum(diff)!=0):
# print("i:",i) # print("i:",i)
# print(100*diff) # print(100*diff)
...@@ -174,10 +175,6 @@ if __name__=="__main__": ...@@ -174,10 +175,6 @@ if __name__=="__main__":
# plt.imshow(VolOnion[3,:,:,]) # plt.imshow(VolOnion[3,:,:,])
# plt.show() # 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 between C++ old and new implementation
# upsample_compare("Data/upsample/CppOut_",\ # upsample_compare("Data/upsample/CppOut_",\
# "Data/upsample/test_methodCpp/CppOut_",98,"DispX",1,OccMediumMask,"Data/upsample/results/DiffMethod_",1) # "Data/upsample/test_methodCpp/CppOut_",98,"DispX",1,OccMediumMask,"Data/upsample/results/DiffMethod_",1)
...@@ -214,6 +211,7 @@ if __name__=="__main__": ...@@ -214,6 +211,7 @@ if __name__=="__main__":
# # Result: Ok there is a problem in the indexation of data... # # Result: Ok there is a problem in the indexation of data...
# # Upsample compare of DispA to test the indexation problem # # 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_",\ # upsample_compare("Data/upsample/matlab_upsample/M_upsampleAfter_",\
# "Data/upsample/test_methodCpp/CppOut_",98,"DispZ",1,OccMediumMask,"Data/upsample/results/NewIndNewImp_",'Matlab',True) # "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. # # 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__": ...@@ -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 #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_",\ upsample_compare("Data/upsample_ant/M_UA_Post_","Data/upsample_ant/Cpp_UA_",\
98,"DispZ",3,OccMediumMask,"Data/upsample_ant/DiffOut_UA_",'Matlab',False) 98,"DispA",3,OccMediumMask,"Data/upsample_ant/DiffOut_UA_",'Matlab',False)
# Result: Implementation succesful but the difference is still here ... WTF # Result: Implementation succesful but the difference is still here ... WTF
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment