From: Michael B. <mic...@gm...> - 2009-01-06 12:09:22
|
Hi all, In my app I have two single band grid coverages, one with double values and one with integer values. For each grid cell in the first coverage I want to calculate the sum of values within a given distance, using the second coverage as a mask (ignore pixels with value <= 0). Finally I want to binarize the result of the convolution with a given threshold value. I'm wondering what the most efficient way to do this is. At present I have code working that does the above steps without masking. It makes use of JAI's ConvolveDescriptor class to sum neighbourhood values, then the ImageWorker class to binarize the result. To add masking to the process I guess I start out by creating a JAI ROI object from the RenderedImage derived from the second coverage. But after that I'm a bit stuck as to how to use the ROI in the convolution stage, other than the naive approach of creating a new input image with, for instance, TiledImage.set(img, roi). I wonder if anyone can suggest an approach ? Also, am I overlooking any Geotools class methods that would do some or all of the above without resorting to JAI directly ? Any help much appreciated. Michael |