Joint dictionary and classifier learning for categorization of images using a max-margin framework