def get_sample(self, filename, iscolor=cv.CV_LOAD_IMAGE_COLOR):
    if (not (filename in self.image_cache)):
        filedata = None
        if (OpenCVTests.repoPath is not None):
            candidate = ((OpenCVTests.repoPath + '/') + filename)
            if os.path.isfile(candidate):
                with open(candidate, 'rb') as f:
                    filedata = f.read()
        if (filedata is None):
            filedata = urllib.urlopen(((OpenCVTests.repoUrl + '/') + filename)).read()
        imagefiledata = cv.CreateMatHeader(1, len(filedata), cv.CV_8UC1)
        cv.SetData(imagefiledata, filedata, len(filedata))
        self.image_cache[filename] = cv.DecodeImageM(imagefiledata, iscolor)
    return self.image_cache[filename]
def get_sample(self, filename, iscolor=cv.CV_LOAD_IMAGE_COLOR):
    if (not (filename in self.image_cache)):
        filedata = None
        if (OpenCVTests.repoPath is not None):
            candidate = ((OpenCVTests.repoPath + '/') + filename)
            if os.path.isfile(candidate):
                with open(candidate, 'rb') as f:
                    filedata = f.read()
        if (filedata is None):
            filedata = urllib.urlopen(((OpenCVTests.repoUrl + '/') + filename)).read()
        imagefiledata = cv.CreateMatHeader(1, len(filedata), cv.CV_8UC1)
        cv.SetData(imagefiledata, filedata, len(filedata))
        self.image_cache[filename] = cv.DecodeImageM(imagefiledata, iscolor)
    return self.image_cache[filename]