Last active
August 29, 2015 14:26
-
-
Save lelap/ed02822f3654da3505ad to your computer and use it in GitHub Desktop.
Useful davinci image processing scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Useful davinci image processing scripts - All from Christensen, 2010 Remote Sensing Lab, ASU | |
1) a = read(“filename”) | |
Read in a file into array ‘a’ | |
Examples: | |
t = read(“Atlanta_AST_11_25_2006_surface_temp.vic") | |
Reads the 830 pixel by 700 pixel by 1-band temperature image into ‘t’ | |
em = read(“Atlanta_AST_11_25_2006_emissivity.vic") | |
Reads the 830 pixel by 700 pixel by 5-band emissivity image into ‘em’ | |
2) display(a[ , , 2]) | |
Display all rows and all columns of band 2 an image (must specify either 1 or 3 bands. Image must be in byte format). | |
3) b = sstretch(t, ignore = 0) | |
Perform a gaussian stretch on image ‘a’ (see write-up for more options). Ignore= 0 option ignores zero (black) pixels when computing the stretch parameters. This is very useful for converting a floating-point image (e.g. temperature) into a 0-255 DN byte image. | |
4) display(sstretch(t, ignore=0)) | |
Stretch and display all rows, all columns of band 2 in single step. | |
5) display(sstretch(em[ , , 2], ignore=0)) | |
Stretch and display all rows, all columns of band 2 in single step. (Remember, display only displays 1 or 3 bands) | |
6) pplot(em[ , 100, 3], y1 = .8, y2 = 1.02) | |
Plot all elements of the 100th row of band 3 of image ‘em’. Set y plot range to go from 0.8 to 1.02. See pplot write-up for lots more useful options | |
7) pplot(t[75, , 1]) | |
Plot all elements of the 75th column of band 1 of image ‘t’ | |
8) pplot(em[130,90]) | |
Plot the emissivity spectrum for pixel 130, 90 | |
9) c = boxfilter(t, 7, ignore=0) | |
Perform a 7x7 boxcar (low-pass) filter on image ‘t’. Ignore zero values when doing the filter. | |
10) d = t – c | |
Difference two images (or arrays). If ‘t’ was the original image and ‘c’ was a low-pass filter image, then ‘d’ would be a high-pass filtered image | |
11) h = histogram(t[ , , 1], steps=256) | |
pplot(h[2], xaxis=h[1]) | |
Compute histogram of all x and y elements in band 1 of image in 256 bins. The min and max values in the image are found automatically. The histogram value are in h[2]; the bin (x-axis) values are in h[1]. Ploting using pplot as shown plots the data in their true bins. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment