// 最大領域(手領域)の抽出を行う
//
// 引数:
// skinImage : 肌色抽出画像用IplImage
// label : ラベリングした結果
// convexHullImage : ConvexHull画像用IplImage
//
// 戻り値:
// 手領域の面積
//
int pickupMaxArea(IplImage * skinImage, IplImage * label,
IplImage * convexHullImage)
{
int handarea = 0; // 手領域の面積
for (int x = 0; x < skinImage->width; x++) {
for (int y = skinImage->height - 1; y >= 0; y--) {
if (cvGetReal2D(label, y, x) == 1) {
// 最大領域だった場合
handarea++;
cvSet2D(convexHullImage, y, x, CV_RGB(255, 255, 255));
} else {
cvSetReal2D(skinImage, y, x, 0);
cvSet2D(convexHullImage, y, x, CV_RGB(0, 0, 0));
}
}
}
return handarea;
}
最終更新:2010年01月29日 14:24