Algorithm of contour grouping elements extraction based on global motion contrast