I basically have multiple binary images, each containing one connected component. These connected components were retrieved from an image, meaning that if all connected components were to be drawn into a single image file, there would be no empty spaces, and no overlapping connected components. I am looking for a fast way to extract the edge pixels from the connected components. The connected components are currently saved in a single image, where a number i at position (x,y) corresponds to the i-th connected component. Since there are a lot of connected components with the maximum number i beeing in the range of 400-2000, i am looking for a fast way to get the edge pixels of each component. Here is an image to illustrate what i expect from the algorithm: Example
I am aware that there are a few edge detection algorithms, but they deal with grayscale images and won't be any good for small objects in big images at a big amount of images. Any suggestions?