__init__.py 2.05 KB
Newer Older
1 2 3 4 5 6 7
from .extractor import Extractor
from .feature_extraction import FeatureExtractor
from .color_summarizer import ColorStats
from .glcm import GLCM
from .hog import HOG
from .image_moments import RawCentralMoments, HuMoments
from .lbp import LBP
8
from .gabor import GABOR
9 10 11

__all__ = ["extractor",
            "color_summarizer",
12
            "glcm",
13 14
            "hog",
            "image_moments",
15 16
            "lbp",
	    "gabor"]
17 18 19 20 21 22


from collections import OrderedDict
from util.config import Config


23 24 25 26
_extractor_list = OrderedDict( [ 
                            ["color_summarizer", Config("Color Statistics", True, bool, meta=ColorStats)],
                            ["glcm", Config("Gray-Level Co-Occurrence Matrix", True, bool, meta=GLCM)],
                            ["hog", Config("Histogram of Oriented Gradients", True, bool, meta=HOG)],
27
                            ["hu_moments", Config("Hu Image Moments", False, bool, meta=HuMoments)],
28
                            ["rc_moments", Config("Image Moments (Raw/Central)", False, bool, meta=RawCentralMoments)],
29 30 31
                            ["lbp", Config("Local Binary Patterns", True, bool, meta=LBP)],
                            ["gabor", Config("Gabor Filter Bank", True, bool, meta=GABOR)]

32
                        ] )
33 34 35 36 37 38

def get_extractor_config():
    return _extractor_list

def set_extractor_config(configs):
        _extractor_list["color_summarizer"] = Config.nvl_config(configs["color_summarizer"], _extractor_list["color_summarizer"])
39
        _extractor_list["glcm"] = Config.nvl_config(configs["glcm"], _extractor_list["glcm"])
40
        _extractor_list["hog"] = Config.nvl_config(configs["hog"], _extractor_list["hog"])
41 42
        _extractor_list["hu_moments"] = Config.nvl_config(configs["hu_moments"], _extractor_list["hu_moments"])
        _extractor_list["rc_moments"] = Config.nvl_config(configs["rc_moments"], _extractor_list["rc_moments"])
43
        _extractor_list["lbp"] = Config.nvl_config(configs["lbp"], _extractor_list["lbp"])
44
        _extractor_list["gabor"] = Config.nvl_config(configs["gabor"], _extractor_list["gabor"])