24 #ifndef CCORRELATION_OPTICALFLOW_INTEGRATED_BLOCK_A
25 #define CCORRELATION_OPTICALFLOW_INTEGRATED_BLOCK_A
42 template<
typename T,
typename Timg>
51 this->class_name =
"Correlation : Optical Flow Integrated per Block version AA";
55 virtual void init(CParameterNetCDF &fp)
64 std::string attribute_name =
"median_filter";
65 int error = fp.loadAttribute(attribute_name,this->m_medianFilter);
66 if (this->m_verbose){printf(
"\t\t median filter over following domain -> %i\n",this->m_medianFilter);}
74 this->_3D = oMesh._3D;
76 int iter(0), converged(1), thread(0);
81 CImgList<T> solution(oField.m_mode);
82 assign(oMesh, this->m_threadNB, Ke, Fe, Ve);
84 CImgList<T> N(oMesh.num_var(), oMesh.num_mod(),1,1,1, 0);
86 CImg<T> current_res(this->m_threadNB,1,1,1,0);
88 CImg<T> tmp1(Fe[0].width(), Fe[0].height(), Fe[0].depth(),1,0), tmp2(Ke[0].width(), Ke[0].height(), Ke[0].depth(),1,0);
90 T residue(0), deformed(0);
92 std::vector<T> ref, offset, lCoor, gCoor, grad, U;
93 ref.assign(3,0);offset.assign(3,0);lCoor.assign(3,0); gCoor.assign(3,0); U.assign(3,0); grad.assign(oMesh.num_var(),0);
102 #pragma omp parallel for firstprivate(ref, N, Ve, tmp1, tmp2, grad, U, residue, deformed, lCoor, gCoor, offset, box, thread) schedule(runtime)
103 cimglist_for(oMesh.m_connect, elem)
107 if (this->cropBox(oMesh, oImage, elem, box, offset))
110 thread = omp_get_thread_num();
112 this->metric(thread, oImage,oMesh,elem, oField, N,Ve,Ke,Fe, current_res,ref,grad,U, residue, deformed, lCoor, gCoor, box, offset);
114 tmp1 = Fe[0].get_channel(thread);
115 tmp2 = Ke[0].get_channel(thread);
117 solve_CImg(tmp2,tmp1,oMesh,solution);
119 cimg_forY(tmp1,y){solution[y][elem] += tmp1[y];}
126 oField.m_meanRes.push_back(std::sqrt(current_res.sum())/oMesh.m_numPix);
129 if (this->m_medianFilter){this->
regularize(oMesh, oImage, solution);}
132 this->actu(thread, oImage, oMesh, oField, solution, converged, N, current_res, ref,U, residue, deformed, lCoor, gCoor, box, offset);
135 this->test(solution, this->m_current_res, this->m_epsilon, oField, previous_res, iter, converged);
141 if (oImage.m_storeActiv)
142 {actu(thread, oImage, oMesh, oField, oField.m_mode, converged, N, current_res, ref,U, residue, deformed, lCoor, gCoor, box, offset);}
virtual void regularize(const Cmesh< T, Timg > &oMesh, const Cimage< Timg > &oImage, CImgList< T > &solution)
Definition: Ccorrelation.h:96
virtual void init(CParameterNetCDF &fp)
Definition: Ccorrelation_opticalFlow_integrated.h:56
It implements the Optical Flow with Integrated kinematics within independant block such as Block-matc...
Definition: Ccorrelation_opticalFlow_integrated_block.h:43
virtual void init(CParameterNetCDF &fp)
Definition: Ccorrelation_opticalFlow_integrated_block_A.h:55
It implements the Optical Flow with Integrated kinematics within independant block such as Block-matc...
Definition: Ccorrelation_opticalFlow_integrated_block_A.h:43
virtual void exec(const Cimage< Timg > &oImage, const Cmesh< T, Timg > &oMesh, Cfield< T, Timg > &oField)
Definition: Ccorrelation_opticalFlow_integrated_block_A.h:70