Thilina's Blog

I might be wrong, but…

Interpolation Based method for Directional Derivative Calculation in Image Processing 1.0

Directional derivative calculation can be done by using a number of kernels in image processing. Most of them are fixed and can only use in single direction. This article attempts to discuss and use a geometrical model to as a solution for this situation.

Considering the gradient calculation in image processing, since it is discrete domain, calculations are done by forward and backward differences. Therefore co-efficients of pixels can directly use for built a kernel which can convolve with a given image to determine the gradient.

Consider two pixels f(x,y) and f(xr,y) of an image which are in r direction with |r| distance. Then the directional derivative can be written as;



Model discussed below attempts to specify a virtual pixel D(xr,yr) which can use to determined the directional derivative along the vector r. Consider following 9 pixels.

Assume we need to calculate the directional derivative through Q in θ direction with x axis.

CASE 1 : 0≤θ≤45o


We are going to calculate suitable intensity value for the point D where the vector r intersects the line BC. By using the weighted sum method, we can obtain the intensity value of D.




By considering the neighbourhood of point Q we can also obtain;


Using Forward Difference  clip_image016
Using Backward Difference  clip_image018
Therefore clip_image020


This minimised to,


Therefore we can finalise the kernel K for 0≤θ≤45o,


By using the same approach, we can conclude the kernels for 0≤θ≤180o as;






Figure 1:Derivative Angle and Sum of Directional Derivatives


2010 November 25 - Posted by | Image Processing, MATLAB, Technology


  1. great work..

    Comment by කණිෂ්ක | 2010 November 27 | Reply

  2. nice work machan

    Comment by janitha | 2010 December 13 | Reply

  3. Hi Thilina,

    can you provide matlab codes for this?
    Thank you.

    Comment by Michael | 2011 January 23 | Reply

    • Hi Michael,
      I’m working on another kernel, which can use for directional derivative calculations also simpler and effective than this one, I’ll add codes for this kernel and for the never one on my next article,
      Thanks for the comment..!

      Comment by Thilina S. | 2011 January 23 | Reply

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: