# How to detect fuzzy edge of a raindrop

I want to extract the edge of the raindrop. This is my photo.

I divide the picture into 8*8 blocks and extract the edges using sobel and canny.Now I can get a rough edge. This is the edge I got.

I can't get the fuzzy edge of the raindrop.

Paste my code.

//sobel
Mat SobelProcess(Mat src)
{
Mat Output;
Sobel(src, grad_x, CV_16S, 1, 0, CV_SCHARR, 1, 1, BORDER_DEFAULT);
Sobel(src, grad_y, CV_16S, 0, 1, CV_SCHARR, 1, 1, BORDER_DEFAULT);

//convertScaleAbs(SobelImage, Output);

return Output;
}
int main()
{
Mat Src;
imshow("src", Src);

Mat Gauss;
GaussianBlur(Src, Src, Size(5, 5), 0.5);
imshow("Gauss", Src);

//M * N = 8 * 8
int OtsuThresh[M * N];
vector<Mat>tempThresh = ImageSegment(Src);
for (int i = 0; i < M * N; i++)
{
OtsuThresh[i] = Otsu(tempThresh[i]); //get Otsu Threshold
}
vector<Mat>temp;
temp = ImageSegment(Src);//ImageSegment() is a function to divide the picture into 8*8 blocks
for (int i = 0; i < M * N; i++)
{
temp[i] = SobelProcess(temp[i]);
GaussianBlur(temp[i], temp[i], Size(3, 3), 0.5);
Canny(temp[i], temp[i], OtsuThresh[i] / 3, OtsuThresh[i]);
}
Mat Tem;
Tem = ImageMerge(temp);//ImageMerge() is a function to merge the blocks
imshow("Tem", Tem);
}


Then I use watershed.But I can't use it get an ideal result. Can you help me ? Thank you.

edit retag close merge delete

Have you tried Hough circles? https://docs.opencv.org/4.0.1/d4/d70/...

( 2019-03-07 20:14:57 -0500 )edit

What result are you looking for? An image with just the "fuzzy edge" pixels turned on, or a list of X,Y locations that are part of fuzzy edges, or a contour that is coincident with the fuzzy edge, or ?

Is the edge image you have roughly what you want, or is it detecting things that you don't want (like the light reflections)

With some morphology you might be able to turn what you have into a "fat line", if that's what you want. Try a "closing" operation (dilation + erosion)...but that's only if what you have is already sufficiently correct.

It might help to post a mocked-up picture of what you are hoping to get.

( 2019-03-08 23:06:35 -0500 )edit