__init__.py 1.82 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 9 10

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


from collections import OrderedDict
from util.config import Config


21 22 23 24
_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)],
25
                            ["hu_moments", Config("Hu Image Moments", False, bool, meta=HuMoments)],
26 27 28
                            ["rc_moments", Config("Image Moments (Raw/Central)", False, bool, meta=RawCentralMoments)],
                            ["lbp", Config("Local Binary Patterns", True, bool, meta=LBP)]
                        ] )
29 30 31 32 33 34

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"])
35
        _extractor_list["glcm"] = Config.nvl_config(configs["glcm"], _extractor_list["glcm"])
36
        _extractor_list["hog"] = Config.nvl_config(configs["hog"], _extractor_list["hog"])
37 38
        _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"])
39
        _extractor_list["lbp"] = Config.nvl_config(configs["lbp"], _extractor_list["lbp"])