コード例 #1
0
    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))
コード例 #2
0
    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))
コード例 #3
0
    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))
コード例 #4
0
    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))
コード例 #5
0
ファイル: question5.py プロジェクト: agingrasc/glo-4001
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