def get_sample(self, filename, iscolor=cv2.IMREAD_COLOR):
    if (not (filename in self.image_cache)):
        filedata = None
        if (NewOpenCVTests.repoPath is not None):
            candidate = ((NewOpenCVTests.repoPath + '/') + filename)
            if os.path.isfile(candidate):
                with open(candidate, 'rb') as f:
                    filedata = f.read()
        if (NewOpenCVTests.extraTestDataPath is not None):
            candidate = ((NewOpenCVTests.extraTestDataPath + '/') + filename)
            if os.path.isfile(candidate):
                with open(candidate, 'rb') as f:
                    filedata = f.read()
        if (filedata is None):
            return None
        self.image_cache[filename] = cv2.imdecode(np.fromstring(filedata, dtype=np.uint8), iscolor)
    return self.image_cache[filename]
def get_sample(self, filename, iscolor=cv2.IMREAD_COLOR):
    if (not (filename in self.image_cache)):
        filedata = None
        if (NewOpenCVTests.repoPath is not None):
            candidate = ((NewOpenCVTests.repoPath + '/') + filename)
            if os.path.isfile(candidate):
                with open(candidate, 'rb') as f:
                    filedata = f.read()
        if (NewOpenCVTests.extraTestDataPath is not None):
            candidate = ((NewOpenCVTests.extraTestDataPath + '/') + filename)
            if os.path.isfile(candidate):
                with open(candidate, 'rb') as f:
                    filedata = f.read()
        if (filedata is None):
            return None
        self.image_cache[filename] = cv2.imdecode(np.fromstring(filedata, dtype=np.uint8), iscolor)
    return self.image_cache[filename]