Crop Image to Select Object for Classification

Often there are unnecessary pixels around the objects to train the model on. Is there an established library/routine to crop the images to select only the objects using cnn before passing the images for classification? This seems like something that is done routinely. Thank you.