Skip to content

Commit

Permalink
Remove skimage dependency for #50.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brandon Amos committed Dec 8, 2015
1 parent a780439 commit a1a89ea
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 16 deletions.
2 changes: 0 additions & 2 deletions demos/web/create-unknown-vectors.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

import cv2

from skimage import io

import openface
from openface.alignment import NaiveDlib
from openface.data import iterImgs
Expand Down
2 changes: 0 additions & 2 deletions openface/alignment/naive_dlib.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@
import random
import sys

from skimage import io

from .. import helper
from .. import data

Expand Down
26 changes: 14 additions & 12 deletions openface/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@

import os

from skimage import io

import cv2

class Image:

Expand All @@ -25,17 +24,20 @@ def __init__(self, cls, name, path):
self.path = path
self.rgb = None

def getRGB(self, cache=False):
if self.rgb is not None:
return self.rgb
def getBGR(self):
try:
bgr = cv2.imread(self.path)
except:
bgr = None
return bgr

def getRGB(self):
bgr = self.getBGR()
if bgr is not None:
rgb = cv2.cvtColor(bgr, cv2.COLOR_BGR2RGB)
else:
try:
rgb = io.imread(self.path)
except:
rgb = None
if cache:
self.rgb = rgb
return rgb
rgb = None
return rgb

def __repr__(self):
return "({}, {})".format(self.cls, self.name)
Expand Down

0 comments on commit a1a89ea

Please sign in to comment.