Simultaneous estimation of segmented telescope phasing errors and non-common path aberrations from adaptive optics corrected images