Loading .travis.yml +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ install: - conda info -a # Create a virtual env and install dependencies - conda create -y -q -n test-env python=$TRAVIS_PYTHON_VERSION nose gdal numpy scipy pandas networkx - conda create -y -q -n test-env python=$TRAVIS_PYTHON_VERSION nose gdal numpy pillow scipy pandas networkx # Activate the env - source activate test-env Loading autocnet/matcher/feature_extractor.py 0 → 100644 +24 −0 Original line number Diff line number Diff line import cv2 from scipy import misc def extract_features(image_array, num_nodes=500): """ Extracts keypoints and corresponding descriptors from a numpy array that represents an image. The extracted information is returned as a tuple whose first element is a list of KeyPoints and whose second element is a numpy array of geometric vector descriptors. Parameters ---------- image_array : ndarray a numpy array that represents an image num_nodes : int the number of best features to retain Returns ------- : tuple This tuple is in the form (list of KeyPoints, array of descriptors) """ sift = cv2.xfeatures2d.SIFT_create(num_nodes) converted_array = misc.bytescale(image_array) return sift.detectAndCompute(converted_array, None) autocnet/matcher/tests/test_feature_extractor.py 0 → 100644 +24 −0 Original line number Diff line number Diff line import os import numpy as np import unittest from autocnet.examples import get_path import cv2 import sys sys.path.insert(0, os.path.abspath('..')) from .. import feature_extractor from autocnet.fileio import io_gdal class TestFeatureExtractor(unittest.TestCase): def setUp(self): self.dataset = io_gdal.GeoDataset(get_path('Mars_MGS_MOLA_ClrShade_MAP2_0.0N0.0_MERC.tif')) self.data_array = self.dataset.read_array() def test_extract_features(self): features = feature_extractor.extract_features(self.data_array, 10) self.assertEquals(len(features), 2) self.assertIsInstance(features[0][0], type(cv2.KeyPoint())) self.assertIsInstance(features[1][0], np.ndarray) requirements.txt +1 −0 Original line number Diff line number Diff line Loading @@ -4,3 +4,4 @@ gdal>=2.0 pvl>=0.2.0 protobuf==3.0.0b2 networkx Loading
.travis.yml +1 −1 Original line number Diff line number Diff line Loading @@ -27,7 +27,7 @@ install: - conda info -a # Create a virtual env and install dependencies - conda create -y -q -n test-env python=$TRAVIS_PYTHON_VERSION nose gdal numpy scipy pandas networkx - conda create -y -q -n test-env python=$TRAVIS_PYTHON_VERSION nose gdal numpy pillow scipy pandas networkx # Activate the env - source activate test-env Loading
autocnet/matcher/feature_extractor.py 0 → 100644 +24 −0 Original line number Diff line number Diff line import cv2 from scipy import misc def extract_features(image_array, num_nodes=500): """ Extracts keypoints and corresponding descriptors from a numpy array that represents an image. The extracted information is returned as a tuple whose first element is a list of KeyPoints and whose second element is a numpy array of geometric vector descriptors. Parameters ---------- image_array : ndarray a numpy array that represents an image num_nodes : int the number of best features to retain Returns ------- : tuple This tuple is in the form (list of KeyPoints, array of descriptors) """ sift = cv2.xfeatures2d.SIFT_create(num_nodes) converted_array = misc.bytescale(image_array) return sift.detectAndCompute(converted_array, None)
autocnet/matcher/tests/test_feature_extractor.py 0 → 100644 +24 −0 Original line number Diff line number Diff line import os import numpy as np import unittest from autocnet.examples import get_path import cv2 import sys sys.path.insert(0, os.path.abspath('..')) from .. import feature_extractor from autocnet.fileio import io_gdal class TestFeatureExtractor(unittest.TestCase): def setUp(self): self.dataset = io_gdal.GeoDataset(get_path('Mars_MGS_MOLA_ClrShade_MAP2_0.0N0.0_MERC.tif')) self.data_array = self.dataset.read_array() def test_extract_features(self): features = feature_extractor.extract_features(self.data_array, 10) self.assertEquals(len(features), 2) self.assertIsInstance(features[0][0], type(cv2.KeyPoint())) self.assertIsInstance(features[1][0], np.ndarray)
requirements.txt +1 −0 Original line number Diff line number Diff line Loading @@ -4,3 +4,4 @@ gdal>=2.0 pvl>=0.2.0 protobuf==3.0.0b2 networkx