Implementation of the pictorial structures algorithm