implemented a first segmentation of the images for method 1