1 // convkernel_unsharpmask.h - a class to create convolution kernel. 2 // Copyright (C) 2008 by Alastair M. Robinson 3 4 #ifndef CONVKERNEL_UNSHARPMASK 5 #define CONVKERNEL_UNSHARPMASK 6 7 #include <cmath> 8 #include <iostream> 9 10 #include "convkernel.h" 11 #include "convkernel_gaussian.h" 12 13 class ConvKernel_UnsharpMask : public ConvKernel_Gaussian 14 { 15 public: ConvKernel_UnsharpMask(float radius,float amount)16 ConvKernel_UnsharpMask(float radius,float amount) : ConvKernel_Gaussian(radius), amount(amount) 17 { 18 Normalize(); 19 for(int y=0;y<height;++y) 20 { 21 for(int x=0;x<width;++x) 22 { 23 Kernel(x,y)*=-amount; 24 } 25 } 26 Kernel(width/2,height/2)+=1.0+amount; 27 } 28 ~ConvKernel_UnsharpMask()29 virtual ~ConvKernel_UnsharpMask() 30 { 31 } 32 33 protected: 34 float amount; 35 }; 36 37 #endif 38