It depends on kind of images, one workable alternative would be invariant moments ( either hu, or zernike )
We use this method in javaocr library, feel free to grab code from there.
Main advantage of invariant moments with cluster mathing is that it provides distance from cluster centers ( like: this is 90% cucumber but 20% apple )