Optimal Linear Features For Content Based Image Retrieval And Applications