One last example... You can use identically the same workflow to create an NDVI display from four band NAIP. The example I used for grayscale is from the image I used in various comments about Color Infrared (CIR) displays from NAIP. That's where the image name came from. So, here's how we do NDVI: 1. Open the four band image. (make sure it's one that's already been inverted, or which uses the build that is going to come out next week which brings in the near-IR band without any need to invert). 2. In the Transform panel click on the Channel transform and then choose Edit Query so it writes the query for you. I love that button. :-) 3. NDVI is a single band image created from the Red band and the near-IR ("NIR") bands of a four band image. The Green and Blue bands are not used. The formula to create the single band in NDVI is trivial: (NIR - Red) / (NIR + Red) In Manifold, here is the line that does the calculation, ready to drop in as a replacement for the CASTV line in the query created by the Edit Query button: CASTV (((TileChannel([Tile], 3) - TileChannel([Tile], 2 )) / (TileChannel([Tile], 3) + TileChannel([Tile], 2 ))) AS FLOAT64) We need to cast it as a float64 because NDVI is within the range of -1 to 1, with all the action of interest happening from 0.2 to around .9. In addition to making that change, you also have to change every place where it says UINT8 or uint8 to FLOAT64 or float64. The resulting query is below. Run it and it creates NDVI. For the image to make sense, you have to style it and apply a palette. The easiest way to do that is to right-click on the image, choose Properties and in the Properties dialog add a StylePixel property with the value one of the text strings below. There is no standard for NDVI so people use all sorts of things. Here are some I've used: Useful for leaf cover from http://web.nmsu.edu/~tcarrill/what_is_ndvi.htm: { "Channel": 0, "Fill": "boundaverage", "Value": 4333842, "Values": { "-0.31": 4333842, "0.05": 10441002, "0.16": 13412885, "0.25": 16580099, "0.3": 15068672, "0.35": 13688576, "0.4": 12177152, "0.45": 10665984, "0.5": 9154560, "0.55": 7708160, "0.6": 6196736, "0.65": 4554752, "0.7": 2977792, "0.75": 1532160, "0.8": 20992 } } USDA Crop Explorer palette: { "Channel": 0, "Fill": "boundaverage", "Value": 15183459, "Values": { "0": 15183459, "0.1": 16769940, "0.2": 15204269, "0.3": 10289052, "0.4": 6553443, "0.5": 3264305, "0.6": 39424, "0.7": 25856 } } A classic palette as used by many third party applications, applied to the USDA intervals: { "Channel": 0, "Fill": "boundaverage", "Value": 14102567, "Values": { "0": 14102567, "0.1": 16018755, "0.2": 16625249, "0.3": 16703627, "0.4": 14282635, "0.5": 10934634, "0.6": 6733155, "0.7": 1742928 } } The CE Spectral palette applied to the USDA intervals: { "Channel": 0, "Fill": "boundaverage", "Value": 13975119, "Values": { "0": 13975119, "0.1": 16018755, "0.2": 16625249, "0.3": 16703627, "0.4": 15136152, "0.5": 11263396, "0.6": 6734501, "0.7": 3311805 } } Here is the query: -- $manifold$ -- -- Create NDVI -- CREATE TABLE [m_4012230_nw_10_h_20160717 Tiles Channel] ( [X] INT32, [Y] INT32, [Tile] TILE, [mfd_id] INT64, INDEX [mfd_id_x] BTREE ([mfd_id]), INDEX [Y_X_x] BTREE ([Y], [X]), INDEX [X_Y_Tile_x] RTREE ([X], [Y], [Tile] TILESIZE (128, 128) TILETYPE FLOAT64), PROPERTY 'FieldCoordSystem.Tile' 'EPSG:26910,mfd:{ "LocalOffsetX": 552708, "LocalOffsetY": 4490226, "LocalScaleX": 0.6, "LocalScaleY": 0.6 }', PROPERTY 'FieldTileSize.Tile' '[ 128, 128 ]', PROPERTY 'FieldTileType.Tile' 'float64' ); CREATE IMAGE [m_4012230_nw_10_h_20160717 Tiles Channel Image] ( PROPERTY 'Table' '[m_4012230_nw_10_h_20160717 Tiles Channel]', PROPERTY 'FieldTile' 'Tile', PROPERTY 'FieldX' 'X', PROPERTY 'FieldY' 'Y', PROPERTY 'Rect' '[ 0, 0, 9410, 12140 ]' ); PRAGMA ('progress.percentnext' = '100'); INSERT INTO [m_4012230_nw_10_h_20160717 Tiles Channel] ( [X], [Y], [Tile] ) SELECT [X], [Y], CASTV (((TileChannel([Tile], 3) - TileChannel([Tile], 2 )) / (TileChannel([Tile], 3) + TileChannel([Tile], 2 ))) AS FLOAT64) FROM [m_4012230_nw_10_h_20160717] THREADS SystemCpuCount(); TABLE CALL TileUpdatePyramids([m_4012230_nw_10_h_20160717 Tiles Channel Image]); Enjoy!
|