Gradient Based Image Segmentation And Classification