Hi,
> I need to find NDVI and other vegetation indices and then find changes 
> in time with tif images.
>
> I've been using Geotools for this. Took 2 tiff images, then using QGis 
> I changed them to PNG because original ones are huge. Then taking 
> those 2 PNG I created NDVI image using JAI. The problem is that I 
> couldn't show this file with Geotools. You can look at the code here:
That code creates a TIFF with floating point pixels, which can be 
loaded/viewed with DisplayNBImage since DisplayNBImage internally 
creates a byte-based surrogate version of the floating-point image. If 
your purpose is just to display the image why not create a byte-based one?

>
> In fact, proposing non-Jai way of the same thing would be awesome.
>
If you don't mind having a byte image that should be simple. Open both 
images, declare a matrix of the appropriate size of type float, 
calculate the NDVI for each pixel, create a temporary byte image and 
populate it with the values from the matrix, properly normalized. Some 
steps for this are on 
http://www.lac.inpe.br/JIPCookbook/1200-create-gl.jsp#imageanddatamanipulationcreatinggraylevelimages
 
. Two caveats: I am not sure if plain Java have readers for TIFF images 
(in case your original images are TIFFs) and the original NDVI values 
will be of course gone -- not an issue for visualization/comparison.

hope it helps

Rafael



------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to