Closed Weilin37 closed 2 years ago
Hey @Weilin37, I'll go out on a limb here and pass you an answer @stefanv provided a while ago:
Attached, please find a script that segments an image and displays the resulting labels. If you need the butterfly image data itself, you can also use that mask to select it out.
import sys
from mothra import binarization
from skimage import io
import matplotlib.pyplot as plt
if not len(sys.argv) == 2:
print('Usage: python segment_butterfly.py image.jpg')
sys.exit(1)
# hack required to make fastai happy
def label_func(image):
return path/"labels"/f"{image.stem}{LABEL_EXT}"
image = io.imread(sys.argv[1])
tags, ruler, subject = binarization.main(image)
plt.imshow(subject)
plt.show()
Please let us know if this works for you. Thanks!
Closing. Thank you @Weilin37!
As mentioned in the title: I have a use case needing to crop the moth out, leaving a white background. Is this easily achieved?