cvhciKIT / sloth

Sloth is a tool for labeling image and video data for computer vision research.
Other
608 stars 199 forks source link

A few bugfixes #165

Open isaacgerg opened 6 years ago

isaacgerg commented 6 years ago
  1. When reading in TIFFs with mode='P', the images were being displayed as grayscale. Added fix so P is translated to RGB.

In container.py

        if _use_pil:
            im = Image.open(fullpath)            
            # idg
            if im.mode == 'P':
                im = im.convert('RGB')            
            return np.asarray(im)
        else:
            return okapy.loadImage(fullpath)
  1. Custom items declared in the user-supplied config were not getting parent set (parent was set to None) and then self.prefix() would return None instead of '' (empty quotes).

In items.py

    #def __call__(self, model_item=None, parent=None):        
    def __call__(self, model_item=None, parent=''):
        item = RectItem(model_item, parent)
        item.setPen(self.pen())
        item.setBrush(self.brush())
        return item
  1. Hitting cancel button when adding new images through Edit menu would cause addVideoFile(fname) to be called.

In labeltool.py

        if item is None:
            # idg
            pass
            #return self.labeltool.addVideoFile(fname)
  1. Paths were specified as relative instead of absolute causing issues for network drives in Windows.

in labeltool.py

        for fname,c in zip(fnames, range(numFiles)):
            if len(str(fname)) == 0:
                continue

            fname = str(fname)

            # idg
            #if os.path.isabs(fname):
            #    fname = os.path.relpath(fname, str(path))

            for pattern in image_types:
                if fnmatch.fnmatch(fname.lower(), pattern):
                    item = self.labeltool.addImageFile(fname)