Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

One word: connectedComponentsWithStats

For each component you can simply check if it touches the borders (left==0 or top==0 or right==cols or bottom==rows), and then set every pixel with the corresponding label to 0 if you want to delete it.