# Detect almost circular shapes in RGB image

I want to extract circular trees from this rgb image, I've tried circular hough and segmentation techniques but in vain. Any help?

The image itself is somehow blurred a little. Whole edges of trees are not visible. The only clue of tree existence seems like shadows. So I suggest using shadow information and watershed transform and local thresholding. I have done similar exercise in here. The result is not that perfect but it will give some idea. Here are the steps. 1. Find shadows, 2. Expand shadows towards sun direction 3. Create shadow mask 4. Blur the image 5. Watershed transform 6. Threshold each watershed segment individually 7. Fit circle with Hough transform

im=imread('P0Yvl.png');
imOrig=im;

% Grayscale
im=rgb2gray(im);

% Grow shadow towards sun direction

% Create structural element for dilation
str_element_initial=flip(eye(25));
str_element_initial(:,1:12)=0;

for i=1:7
end

hold on, plot(ys,xs,'r.')


% Blur image
im2=imfilter(im,fspecial('gaussian',[21 21],3));

% Watershed transform
L = watershed(max(im2(:))-im2);
[xw,yw]=find(L==0);

figure,imagesc(imOrig),axis image
hold on, plot(yw,xw,'r.','MarkerSize',1)


% Threshold each segment individually
tmp=zeros(size(im));

for i=1:max(L(:))
thr =multithresh(im(ind),1);
tmp(ind)=im(ind)>thr*.8;
end

% Remove detections that don't have shadow