A method in an electronic device for correcting color shading in a captured image of a captured image scene, the method comprising: receiving image data comprising the captured image and scene statistics, wherein the scene statistics are a downsampled version of the captured image; accessing a reference table, wherein the reference table comprises shading correction data calibrated under a typical illumination; correcting color shading in the downsampled version of the captured image using the reference table; estimating color shading in the corrected downsampled version of the captured image, wherein estimating color shading comprises: transforming the corrected downsampled version of the captured image into at least one hue channel and estimating a first color shading component and an intrinsic color component which, when summed together, result in the at least one hue channel, wherein the intrinsic color component represents the true hue content of the captured image scene; wherein estimating a first color shading component and an intrinsic color component comprises jointly minimizing the number of non-zero gradients in the intrinsic color component and the magnitude of gradients in the first color shading component; updating the reference table based on the estimated color shading; and correcting color shading in the captured image using the updated reference table. receiving image data comprising the captured image and scene statistics, wherein the scene statistics are a downsampled version of the captured image; accessing a reference table, wherein the reference table comprises shading correction data calibrated under a typical illumination; correcting color shading in the downsampled version of the captured image using the reference table; estimating color shading in the corrected downsampled version of the captured image, wherein estimating color shading comprises: transforming the corrected downsampled version of the captured image into at least one hue channel and estimating a first color shading component and an intrinsic color component which, when summed together, result in the at least one hue channel, wherein the intrinsic color component represents the true hue content of the captured image scene; wherein estimating a first color shading component and an intrinsic color component comprises jointly minimizing the number of non-zero gradients in the intrinsic color component and the magnitude of gradients in the first color shading component; transforming the corrected downsampled version of the captured image into at least one hue channel and estimating a first color shading component and an intrinsic color component which, when summed together, result in the at least one hue channel, wherein the intrinsic color component represents the true hue content of the captured image scene; wherein estimating a first color shading component and an intrinsic color component comprises jointly minimizing the number of non-zero gradients in the intrinsic color component and the magnitude of gradients in the first color shading component; updating the reference table based on the estimated color shading; and correcting color shading in the captured image using the updated reference table.