I am working on Diabetic Retinopathy detection. The database comprises of 2D images that looks like this one:
Now, I want to extract just the retina part from the images so that the final image looks like this one:
I have tried Canny
and HoughCircles
but it failed. Is there any way to extract this region using OpenCv
or scikit-image
or PIL
?
Since the foreground is so obvious, you can use simple thresholding to find it and then use regionprops to get the crop you need:
from skimage import io, color, filters, measure
image = io.imread('https://i.sstatic.net/kKBiU.jpg')
grayscale = color.rgb2gray(image)
foreground = (grayscale > filters.threshold_otsu(grayscale)).astype(int)
foreground_properties = measure.regionprops(foreground)[0]
cropped = image[foreground_properties.slice]