try MATLAB machan, it has inbuilt image processing libraries (eg - imhist). I remember we used it to build a CBIR system. It is much easier to work with once you get your head around. They all ready made.
Here's some links to get an idea
http://www.mathworks.co.uk/products/image/...