I have this Original-Image: And my Task is to count those Peppercorns. I managed to remove the Noise and the Grid, but at counting those Corns im Stuck. There are 3 pairs, that are so close to each other, that my Program cant count them. Can u help me with it? Thats my attempt: In The last 2, i tried to erode/Open those corns with that code:
thresh = filters.threshold_minimum(orig_img_no_grid)
img_eroded = morphology.binary_erosion(orig_img_no_grid < thresh, iterations=7)
img_opened = morphology.binary_closing(img_eroded, iterations=4)
But those marked corns make Problems. The One in the bottom i think i solved with enough erosions, but the other 3? If i erode more, some corns will vanish