I'm working a project using opencv. I want to detect shape from a webcam. I already succes to detect square by edit square.c, and now I want to use square.c to detect triangel.
Is it possible to detect triangle from square.c? which part that I have to add or modify?
edit
i've tried adding this code:
else if ( result->total == 3 &&
fabs ( cvContourArea(result, CV_WHOLE_SEQ)) > 1000 &&
cvCheckContourConvexity(result))
{
s = 0;
for (int i = 0; i < 3; i++)
{
if (i >= 1)
{
t = fabs( angle(
(CvPoint*)cvGetSeqElem(result, i),
(CvPoint*)cvGetSeqElem(result, i-1),
(CvPoint*)cvGetSeqElem(result, i-2)));
s = s > s ? s : t;
}
}
}
bu the result is, the triangle detected on the square..