Method of providing a sharpness measure for an image
A method of providing a sharpness measure for an image comprises detecting an object region within an image; obtaining meta-data for the image; and scaling the chosen object region to a fixed size. A gradient map is calculated for the scaled object region and compared against a threshold determined for the image to provide a filtered gradient map of values exceeding the threshold. The threshold for the image is a function of at least: a contrast level for the detected object region, a distance to the subject and an ISO/gain used for image acquisition. A sharpness measure for the object region is determined as a function of the filtered gradient map values, the sharpness measure being proportional to the filtered gradient map values.
1 . A method of providing a sharpness measure for an image comprising the steps of:
detecting an object region within an image;
obtaining meta-data for the image;
scaling the chosen object region to a fixed size;
calculating a gradient map for the scaled object region;
comparing the gradient map against a threshold determined for the image to provide a filtered gradient map of values exceeding the threshold;
determining a sharpness measure for the object region as a function of the filtered gradient map values, the sharpness measure being proportional to the filtered gradient map values;
wherein the threshold for the image is a function of at least: a contrast level for the detected object region, a distance to the subject and an ISO/gain used for image acquisition.
2 . A method according to claim 1 wherein the method further comprises scaling the chosen object region to a fixed size.
3 . A method according to claim 2 wherein the fixed size is 200×100 pixels.
4 . A method according to claim 1 wherein the object is a face.
5 . A method according to claim 4 wherein the method further comprises cropping the face region to only use a face region containing at least one eye as the chosen object region.
6 . A method according to claim 1 wherein the sharpness measure is a function of a noise measure for the object region, the sharpness measure being inversely proportional to the noise measure.
7 . A method according to claim 6 comprising calculating the noise measure by:
splitting the filtered gradient map into an array;
determining a mean sharpness for each cell of the array;
sorting the mean sharpness values in order of magnitude;
selecting a sub-range of sharpness values from the sorted sharpness values; and
calculating said noise measure as a function of said sub-range of sharpness values.
8 . A method according to claim 7 wherein said sub-range comprises a group of the lowest valued sharpness values.
9 . A method according to claim 1 wherein the threshold for the image is the maximum of: a constant; and a sum of thresholds for ISO, contrast and distance.
10 . A method according to claim 1 wherein the threshold for the image is proportional to average luminance, ISO and distance.
11 . A method according to claim 1 further comprising extracting meta-data from an acquired image to determine parameters for each of said ISO, contrast and distance thresholds.
12 . An image processing device arranged to perform the method of claim 1 .
13 . A computer program product comprising computer readable instructions, which when executed in an image processing device are arranged to perform the method of claim 1 .