This time, we will use one extra tool in our function, removing the need for ROI selection. The rationale of the refined function will be to first check the image for circular regions in color channel a* (we must find two) and then perform masking of the pixels in these regions having high a* values. You may have noticed that we did not mention any manual ROI selection step. However, we should state the suspected radii for the circle detection.
Let's see if this approach works, by first writing our function:
function output = RedEyeReductionCircular(input, thresh, radii) % Function for red eye reduction in input image % Inputs: % input - Input image % thresh – Threshold value in channel a* % radii – 2x1 matrix with lowest and highest radius % Output: % output - Output image (after red-eye reduction) cform = makecform('srgb2lab'); % Make the transform structureimg_lab = applycform(input,cform); % Apply transform to L*a...