First you need to label your objects with bwlabel, e.g.
labelled_image = bwlabel (original_image);
that will return your same image but each non-zero connected region will have a unique label (1,2,3,...) that will allow the function regionprops to extract the features you require:
features = regionprops(labelled_image,'Area','Perimeter', 'MajorAxisLength','MinorAxisLength') ;
Check the description of the functions to see if you can get compactness directly, otherwise you may have to calculate that from another value.
Hope that helps