def test_givenSamePatchTwice_whenExtractBrief_thenReturnSameDescriptor( self): first_descriptor = brief.extract_brief(self.alternate_patch, self.config) second_descriptor = brief.extract_brief(self.alternate_patch, self.config) assert_that(first_descriptor, is_(second_descriptor))
def test_givenAlternatePatch_whenExtractBrief_thenReturnCorrectSumDescriptor( self): expected_sum = 33 descriptor = brief.extract_brief(self.alternate_patch, self.config) assert_that(sum(descriptor), is_(expected_sum))
def test_givenDescriptorWith128Pairs_whenExtractBrief_thenReturn128Pairs( self): expected_pairs = DEFAULT_NUMBER_OF_PAIRS descriptor = brief.extract_brief(self.empty_patch, self.config) assert_that(len(descriptor), is_(expected_pairs))
def test_givenEmptyPatch_whenExtractBrief_thenReturnZeroSumDescriptor( self): expected_sum = 0 descriptor = brief.extract_brief(self.empty_patch, self.config) assert_that(sum(descriptor), is_(expected_sum))
def extract_descriptors(img, points, config): descriptors = {} for keypoint in points: patch = get_patch(img, keypoint.point) print("Patch:\n {}".format(patch)) descriptors[keypoint.point] = brief.extract_brief(patch, config) return descriptors