To get the difference image, you can do that all in one line with a single call to conv2(). Do you want the average of the difference in all 8 directions, or just the different in one directions? Either way, just make up your kernel for the situation you want and call conv2(). Then call hist() or histc() to get its histogram.
Best Answer