|
From: xx <xia...@16...> - 2009-04-15 08:56:20
|
I tried this: GeoTiffReader reader = new GeoTiffReader(new FileInputStream(strfile).getChannel()); GridCoverage2D c = (GridCoverage2D) reader.read(null); RenderedImage img = c.getRenderedImage(); RandomIter iter = RandomIterFactory.create(img, null); int s = iter.getSample(x, y, 0); but the result is different from the bufferedimage.getRGB(x,y), it is much smaller than this. it looks like getSample don't return the value of a image. what's the return value of a getSample operation? 在2009-04-15,"Jody Garnett" <jod...@gm...> 写道: >We use PlanarImage as I recall; the idea with these things is *not* >GetRGB(x,y) / SetRGB(x,y) but to set up a chain of JAI operations that >accomplishes something. You can get the raster and sample out some RGB >values (but that will "pull" pixels through the chain). > >The chapter here >http://docs.codehaus.org/display/GEOTDOC/08+Grid+Coverage has some >examples. But you may just want to read through the JAI reference >material? > >Jody >PS. If you can please keep reply's to the user list > > >2009/4/14 xx <xia...@16...>: >> Jody, thanks very much. but I looked through the user guide and didn't find >> information about how to access the pixel of a image, like >> BufferedImage.GetRGB(x,y) and SetRGB(x,y)in java. I can only get a >> GridCoverage from a geotiff file. How can I get some objects as >> bufferedimage from the gridCoverage , or any other way to access the pixel ? >> >> >> 在2009-04-14,"Jody Garnett" <jod...@gm...> 写道: >>>Check out the user guide; geotiff is handled just like any of the grid >>>coverage formats (ie raster formats). >>>I recommend making use of the Reader and Writer directly rather than >>>relying on the FormatFinder; but the user guide should get you >>>started. >>> >>>Jody >>> >>>2009/4/14 xx <xia...@16...>: >>>> Hello, >>>> Everybody, I am a fresh to geotools. And I intend to read and write >>>> geotiff image with geotools . But I don't know how to start my work. Is >>>> there any guide or tutorials for this? >>>> Thanks >>>> >>>> >>>> ________________________________ >>>> 网易邮箱,中国第一大电子邮件服务商 >>>> >>>> ------------------------------------------------------------------------------ >>>> This SF.net email is sponsored by: >>>> High Quality Requirements in a Collaborative Environment. >>>> Download a free trial of Rational Requirements Composer Now! >>>> http://p.sf.net/sfu/www-ibm-com >>>> _______________________________________________ >>>> Geotools-gt2-users mailing list >>>> Geo...@li... >>>> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users |