First time here? Check out the FAQ!
answered 2016-09-17 19:17:57 -0600
you should correct the line
detected_area = contourArea(i);
to
detected_area = contourArea(contours[i]);