File size: 290 Bytes
054ead5
 
 
 
 
 
db821c3
054ead5
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from rembg import remove
from PIL import Image
import numpy as np

def segment_leaf(image_path):

    input_image = Image.open(image_path)

    output = remove(input_image)

    output = output.convert("RGB")

    segmented_array = np.array(output)

    return segmented_array