# Revision history [back]

also it seems that your image is not exactly binary so if you just apply some thresholding or some floodfill() you can get the whole arm easily:

Mat img = imread("img13.jpg", 0);

Mat bin;
threshold(img, bin, 0, 255, THRESH_BINARY);
imshow("bin", bin);


cv::Mat mask = cv::Mat::zeros(img.rows + 2, img.cols + 2, CV_8U); // A image with size greater than the present object is created, needed from floodfil

cv::floodFill(img_c, mask, cv::Point(0,0), 255, 0, cv::Scalar(), cv::Scalar(), 4 + (255 << 8) + cv::FLOODFILL_MASK_ONLY);