A Hierarchical Approach to Content-Based Image Retrieval