Commit 538df2a279eb98c22253e368e5c03c964804b2e7
1 parent
c4980202
added function definitions for new functions. Sebastian and I will finish these definitions today
Showing
3 changed files
with
23 additions
and
5 deletions
Show diff stats
python/classify.py
@@ -23,4 +23,22 @@ def classcolor2(C): | @@ -23,4 +23,22 @@ def classcolor2(C): | ||
23 | color = numpy.asarray(colorsys.hsv_to_rgb(hsv[0], hsv[1], hsv[2])) * 255 | 23 | color = numpy.asarray(colorsys.hsv_to_rgb(hsv[0], hsv[1], hsv[2])) * 255 |
24 | RGB[C[:, :, c], :] = color | 24 | RGB[C[:, :, c], :] = color |
25 | 25 | ||
26 | - return RGB | ||
27 | \ No newline at end of file | 26 | \ No newline at end of file |
27 | + return RGB | ||
28 | + | ||
29 | +#create a function that loads a set of class images as a stack of binary masks | ||
30 | +#input: list of class image names | ||
31 | +#output: X x Y x C stack of binary mask images | ||
32 | +#example: image2class(("class_coll.bmp", "class_epith.bmp")) | ||
33 | + | ||
34 | +#create a set of feature/target pairs for classification | ||
35 | +#input: envi file object, stack of class masks, list of class names | ||
36 | +#output: feature matrix (features x pixels), target matrix (1 x pixels) | ||
37 | +#example: generate_training(("class_coll.bmp", "class_epith.bmp"), (1, 2)) | ||
38 | + | ||
39 | +#create a class mask stack from an X x Y x C probability image | ||
40 | +#input: X x Y x C image giving the probability P(c |x,y) | ||
41 | +#output: X x Y x C binary class image | ||
42 | + | ||
43 | +#create an ROC curve calculator | ||
44 | +#input: X x Y x C image giving the probability P(c | x,y) | ||
45 | +#output: ROC curve | ||
28 | \ No newline at end of file | 46 | \ No newline at end of file |
python/envi.py
@@ -180,7 +180,6 @@ class envi: | @@ -180,7 +180,6 @@ class envi: | ||
180 | else: | 180 | else: |
181 | self.mask = scipy.misc.imread(maskname, flatten=True).astype(numpy.bool) | 181 | self.mask = scipy.misc.imread(maskname, flatten=True).astype(numpy.bool) |
182 | 182 | ||
183 | - | ||
184 | def open(self, filename, headername = ""): | 183 | def open(self, filename, headername = ""): |
185 | if headername == "": | 184 | if headername == "": |
186 | headername = filename + ".hdr" | 185 | headername = filename + ".hdr" |
@@ -256,7 +255,5 @@ class envi: | @@ -256,7 +255,5 @@ class envi: | ||
256 | bar.update(l+1) | 255 | bar.update(l+1) |
257 | return M | 256 | return M |
258 | 257 | ||
259 | - | ||
260 | - | ||
261 | def __del__(self): | 258 | def __del__(self): |
262 | self.file.close() | 259 | self.file.close() |
263 | \ No newline at end of file | 260 | \ No newline at end of file |
python/spectral.py
@@ -47,4 +47,7 @@ def unsift2(M, mask): | @@ -47,4 +47,7 @@ def unsift2(M, mask): | ||
47 | else: | 47 | else: |
48 | I = numpy.zeros((M.shape[0], mask.shape[0], mask.shape[1]), dtype=M.dtype) | 48 | I = numpy.zeros((M.shape[0], mask.shape[0], mask.shape[1]), dtype=M.dtype) |
49 | I[:, i[0], i[1]] = M | 49 | I[:, i[0], i[1]] = M |
50 | - return I | ||
51 | \ No newline at end of file | 50 | \ No newline at end of file |
51 | + return I | ||
52 | + | ||
53 | +#create a function that sifts a color image | ||
54 | +#input: image name, mask | ||
52 | \ No newline at end of file | 55 | \ No newline at end of file |