# 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