Few days ago I wrote a program in python that removes objects that touch borders of image. Here is the code:
def reject