#ifndef BlockMatching_H_DEFINED
#define BlockMatching_H_DEFINED

#include "../const.h"
#include "Image.h"
#include "Blocks.h"

bool FaceMotion(int* centroid, int* expr_centroid, int* bb, int* expr_bb, int width, int height, const Init_para& parameters, int*& movement);
bool DefineSearchAreas(Block* blocks, int* movement, const Init_para& parameters, const Image& im_exp, int* face_bb, Image*& search_areas);
bool BlockMatching(Block* blocks, const Image& im_expanded, const Image& im_expression, const Image& im_expr_clust,
                   int* face_centroid, int* face_bb, int*& face_movement, const Init_para& parameters, int counter);

bool Correlation(const Image& templ, const Image& search, int templ_name, int method, Image& best_corr, const Init_para& parameters);
double Similarity_function(int method, double p1, double p2);
void Normalize(const Image& image, int width, int height, int DeltaX, int DeltaY, double& avg, double& norm);
bool ShowCorrelations(int templ_name, double** corr, int width, int height, double min, double max, const Image& search, const Init_para& parameters);
bool BuildCorrelationImage(double** corr, double min, double max, Image& best_corr, int width, int height, const Init_para& parameters);

bool ShowOpticalFlow(char* path, Block* blocks, Block* corresponding, int* face_movement, const Image& im_exp);
bool ComputeMotion(int name, Block& from, const Image& corr, int& to_x, int& to_y, int* movement, const Image& search, const Init_para& parameters);


#endif // BlockMatching_H_DEFINED
