Optimal Memory Allocation and Power Minimization for FPGA-Based Image Processing