Flexible hardware accelerator for 2D Convolution and Census Transform