Hi everybody, I have a problem with Opencv. I have to recognize some object in a image. The problem these object is attached,tangent. So I tried a lot of solutions but nothing works fine.
Here is my code:
...
IplConvKernel * kernel = cvCreateStructuringElementEx(2,2,0,0,CV_SHAPE_RECT,0);
IplConvKernel * kernel2 = cvCreateStructuringElementEx(3,3,0,0,CV_SHAPE_ELLIPSE,0);
cvThreshold(image,image,80,255,0);
cvSmooth(image, image_mod, CV_GAUSSIAN,5,5);
/* */
cvSub(image,image_mod,image_mod);
cvAdd(image,image_mod,image_mod);
cvCanny(image_mod,image_canny,0,100);
/* */
for(j=0; j<h; j++)
{
for(l=0; l<w; l++)
{
((unsigned char*)(image_inv->imageData))[j*ws + l] = 255 - ((unsigned char*)(image_canny->imageData))[j*ws+l];
}
}
/* */
cvCvtColor(image_inv,image_out,CV_GRAY2RGB);
/* */
int Nc=cvFindContours( image_canny, stor, &cont, sizeof(CvContour),CV_RETR_TREE,CV_CHAIN_APPROX_SIMPLE, cvPoint(0,0));
...
I've tried also with cvErode and cvDilate using kernel & kernel2 but I don't know how to split the objects.
I have to recognize the three object in this image: http://s19.postimage.org/5p17s1eoz/TESI51.png
Any idea?