From 538df2a279eb98c22253e368e5c03c964804b2e7 Mon Sep 17 00:00:00 2001 From: David Mayerich Date: Mon, 24 Jul 2017 09:47:01 -0500 Subject: [PATCH] added function definitions for new functions. Sebastian and I will finish these definitions today --- python/classify.py | 20 +++++++++++++++++++- python/envi.py | 3 --- python/spectral.py | 5 ++++- 3 files changed, 23 insertions(+), 5 deletions(-) diff --git a/python/classify.py b/python/classify.py index fe79b02..96a2a6b 100644 --- a/python/classify.py +++ b/python/classify.py @@ -23,4 +23,22 @@ def classcolor2(C): color = numpy.asarray(colorsys.hsv_to_rgb(hsv[0], hsv[1], hsv[2])) * 255 RGB[C[:, :, c], :] = color - return RGB \ No newline at end of file + return RGB + +#create a function that loads a set of class images as a stack of binary masks +#input: list of class image names +#output: X x Y x C stack of binary mask images +#example: image2class(("class_coll.bmp", "class_epith.bmp")) + +#create a set of feature/target pairs for classification +#input: envi file object, stack of class masks, list of class names +#output: feature matrix (features x pixels), target matrix (1 x pixels) +#example: generate_training(("class_coll.bmp", "class_epith.bmp"), (1, 2)) + +#create a class mask stack from an X x Y x C probability image +#input: X x Y x C image giving the probability P(c |x,y) +#output: X x Y x C binary class image + +#create an ROC curve calculator +#input: X x Y x C image giving the probability P(c | x,y) +#output: ROC curve \ No newline at end of file diff --git a/python/envi.py b/python/envi.py index 13744d8..f013b5b 100644 --- a/python/envi.py +++ b/python/envi.py @@ -180,7 +180,6 @@ class envi: else: self.mask = scipy.misc.imread(maskname, flatten=True).astype(numpy.bool) - def open(self, filename, headername = ""): if headername == "": headername = filename + ".hdr" @@ -256,7 +255,5 @@ class envi: bar.update(l+1) return M - - def __del__(self): self.file.close() \ No newline at end of file diff --git a/python/spectral.py b/python/spectral.py index bcae22c..ee94dff 100644 --- a/python/spectral.py +++ b/python/spectral.py @@ -47,4 +47,7 @@ def unsift2(M, mask): else: I = numpy.zeros((M.shape[0], mask.shape[0], mask.shape[1]), dtype=M.dtype) I[:, i[0], i[1]] = M - return I \ No newline at end of file + return I + +#create a function that sifts a color image +#input: image name, mask \ No newline at end of file -- libgit2 0.21.4