image-morphology

Delete single pixels in binary image

Delete single pixels in binary image Question: Suppose I have a binary image, represented as a numpy matrix where a pixel is either background (0) or foreground (1). I’m looking for a way, to delete all pixels in the foreground, that don’t have any nearest neighbour. Suppose, the image matrix is: a = np.array([[0,0,1,1],[1,0,0,0]]) The …

Total answers: 3