Advertisement Jump to content
Sign in to follow this  
Endemoniada

Convolution Kernel Questions

This topic is 1862 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi guys,

 

Some convolution kernels I see are integer based. If my colour intensities are float based [0...1] how should I scale the convolution output.

 

Do I add up the kernel integers then divide each kernel entry by that sum ? That works with a basic average:

1 1 1
1 1 1
1 1 1
 
becomes
 
1.0f/9.0f ...
...
...

...but what about a Sobel that sums to zero ?

1 0 -1
2 0 -2
1 0 -1

Thanks

 

Share this post


Link to post
Share on other sites
Advertisement

You don't divide with a Sobel. Presumably the matrix with all 1 entries really means they should be all 1/9 anyway? A probable rule of thumb would be if the sum isn't zero divide by the sum of the weights and if it is zero don't do that?

Share this post


Link to post
Share on other sites

It really depends on if you want to keep your convolved image in the [0...1] range. If all of the pixels were 1 under the positive side of the Sobel kernel and 0 on the negative side, the value for the center pixel would be 4. If this were flipped, the value would be -4. If you want to normalize, divide all terms by 4. If you don't care about the range, then I wouldn't worry about normalizing.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!