示例#1
0
    def __init__(self, cascade_path=None, dlib_path=None, ignore_OS=False):
        path_to_lib_file = os.path.join(os.getcwd(), 'libfrontalize.so')

        self.lib = cdll.LoadLibrary(path_to_lib_file)
        self.lib.frontalize.restype = c_char_p

        self.cascade_path = "/bigData/temp/opencv-3.0.0-rc1/data/haarcascades" if cascade_path is None else cascade_path
        self.dlib_path = "data/shape_predictor_68_face_landmarks.dat" if dlib_path is None else dlib_path

        self.raw_result = None
        self.arguments = None
        self.result = {"projection_mat": None}

        check_version("numpy", "1.9.1")

        if platform.system().lower() != "linux" and not ignore_OS:
            raise Exception('This code has not been tested on any OS other than Linux. ' +
                            'IF you still wish to use is on Windows or Mac, pass "ignore_OS=True" ' +
                            'as a parameter when initializing this class (Frontalizer).')
示例#2
0
    def __init__(self, open_cv_haar_cascade_path=None):
        if open_cv_haar_cascade_path is None:
            self.casc_path = "/bigData/mylibs/opencv-3.0.0-rc1/data/haarcascades/haarcascade_frontalface_alt.xml"
        else:
            self.casc_path = open_cv_haar_cascade_path

        check_version("numpy", "1.9.1")
        check_version("PIL", "1.1.7")
        check_version("opencv", "3.0.0-rc1")

        if not os.path.exists(self.casc_path):
            raise Exception(
                self.casc_path
                + "is an invalid path. "
                + "It should be a path to the opencv haarcascades xml files folder."
            )