We present in this paper a method for implementing moment functions in a CMOS retina for shape recognition applications. The method is based on the use of binary patterns and it allows the computation of different moment functions such geometric and Zernike moments of any orders by an adequate choice of the binary patterns. The advantages of the method over other methods described in the literature is that it is particularly suitable for the design of a programmable retina circuit where moment functions of different orders are obtained by simply loading the correct binary patterns into the memory devices implemented on the circuit. The moment values computed by the method are approximate values, but we have verified that in spite of the error the approximate values are significant enough to be applied to classical shape localization and shape representation and description applications.