This paper proposes for the first time an approximate computing based energy-efficient hardware accelerator using Ramanujan Sums for edge detection applications. We exploit the inherent error resilience in the edge detection algorithm to propose an approximation technique by combining two very efficient approximation methods,viz., precision scaling and loop skipping that reduces the energy consumption of the edge detection system. We propose a gradient descent based novel heuristic to automatically configure the two approximation knobs to result in the least energy consumption for a specified application-level quality, that reduces the energy consumption of the total accelerator by almost 30% for negligible application-level quality degradation.