Pyromancer
Pyromancer

Reputation: 11

Python GUI to label and train SLIC images

Hello I am currently trying to develop a python GUI using tkinter to train a CNN. For that I need a button to label SLIC superpixel images. Can someone help me out on how to do that.

This is the part of a code I am using but I need make SLIC images appear in GUI instead of separate window.

'''
 def _load_image(path):
    """
    Loads and resizes an image from a given path using the Pillow library
    :param path: Path to image
    :return: Resized or original image 
    """
    image = Image.open(path);segments = slic(image, n_segments = 300, compactness=30, sigma = 1);fig = plt.figure("Superpixels -- %d segments%");ax = fig.add_subplot(1, 1, 1);pimg=mark_boundaries(image, segments);ax.imshow(pimg);plt.axis("off");x=plt.show()
    if(resize):
        max_height = 500
        img = image;
        s = img.size
        ratio = max_height / s[1]
        image = img.resize((int(s[0]*ratio), int(s[1]*ratio)), Image.ANTIALIAS)
    return pimg

'''

Kindly help me out in this

Upvotes: 0

Views: 91

Answers (0)

Related Questions