#ifndef Blocks_H_DEFINED
#define Blocks_H_DEFINED

#include "Image.h"
#include "Init_para.h"

struct Block {
       // Block coordinates
       int x_min;
       int x_max;
       int y_min;
       int y_max; 
       // Block motion (module and direction)
       int motion_mod;
       int motion_dir;
       
       Block() {
               x_min = x_max = y_min = y_max = 0;
               motion_mod = 0;
               motion_dir = 0;
       }
       
       Block(int x1, int x2, int y1, int y2) {
               x_min = x1;
               x_max = x2;
               y_min = y1;
               y_max = y2;
               motion_mod = 0;
               motion_dir = 0;

       }
       
       Block(int x1, int x2, int y1, int y2, int mod, int dir) {
               x_min = x1;
               x_max = x2;
               y_min = y1;
               y_max = y2;
               motion_mod = mod;
               motion_dir = dir;

       }


};

bool PlaceBlocks(const Image& im_exp, const Image& mouth, const Image& eyebrow_left, const Image& eyebrow_right, int* face_bb, 
                 Block*& all_blocks, const Init_para& parameters, int serialNumber);
bool PlaceMouthBlocks(int* mouth_bb, const Image& im_exp, int* face_bb, Block*& mouth_blocks, const Init_para& parameters, int serialNumber);
bool PlaceEyebrowBlocks(int* eyebrow_bb, int which, const Image& im_exp, Block*& eyebrow_blocks, const Init_para& parameters, int serialNumber);
bool BuildTemplate(const Block& b, const Image& image, Image& templ);
bool ShowAllBlocks(char* path, const Image& image, Block* blocks);
void SetMotion(Block& block, int module, double direction);


#endif // Blocks_H_DEFINED
