Skip to main content

Convolving from a float kernel

1 reply [Last post]
rudiga
Offline
Joined: 2009-01-22

Hi,

I am attempting to convolve a kernel that contains values such as

3.7370328E-4 3.6612264E-4 3.566659E-4 3.4574384E-4 3.3384064E-4 3.2149375E-4 3.0926973E-4 2.9773745E-4 2.8744002E-4 2.788672E-4 2.724299E-4 2.6843848E-4 2.6708614E-4

and when I receive the image, I only get whole numbers. I am reading in byte images and I am assuming that when I convolve the image, it is rounding to fit in with this.

Is there a way to stop this from happening, since my kernel, along with other tasks, normailzes the value between -1 and 1. The images are not intended to be viewed by a simple desktop viewer, I am using applications such as ENVI to do this.

Regards,

Rudiga

NOTE:
Had a quick check using a float image, and it works as I expect it to.

Update as I wrote some code to test my assumption that the convolution is rounding to the input image data type.

Message was edited by: rudiga

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
rudiga
Offline
Joined: 2009-01-22

OK,

So what I have done is written my own convolve class that does this for me, i.e. takes any PlanarImage and my float kernel, convolves and then creates a new float writable raster.

Of course now this takes forever, especially as I have several filters to convolve, and I have to write each image out because I cannot create a new PlanarImage to pass back. What is more, is that I don't really want to have to convolve the image at this point, hence wanting to use the 'convolve' operator within the rendering pipeline.

Is there a better way of doing all this using the 'convolve' operator? Someone else must have come across this problem.

Rudiga