I am trying to implement a blur detection algorithm for my imaging pipeline. The blur that I want to detect is both -
Camera Shake: Pictures captured using hand which moves/shakes when shutter speed is less.
Motion blur: Fast moving objects in the scene, captured using a not high enough shutter speed. E.g. A moving car a night might show a trail of its headlight/tail light in the image as a blur.
How can one detect this blur and quantify it in some way to make some decision based on that computed 'blur metric'?
What is the theory behind blur detection?
I am looking of good reading material using which I can implement some algorithm for this in C/Matlab.