1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
void f_check(int position2, int position1)
{
pixel_value=cvGet2D(img_bin,position2,position1+1);
if (pixel_value.val[0]=255) {
cvSet2D(img_bin,position2,position1+1,qq3);
f_check(position2,position1+1);
area++;}
pixel_value=cvGet2D(img_bin,position2-1,position1);
if (pixel_value.val[0]=255) {
cvSet2D(img_bin,position2-1,position1,qq3);
f_check(position2-1,position1);
area++;}
pixel_value=cvGet2D(img_bin,position2,position1-1);
if (pixel_value.val[0]=255) {
cvSet2D(img_bin,position2,position1-1,qq3);
f_check(position2,position1-1);
area++;}
pixel_value=cvGet2D(img_bin,position2+1,position1);
if (pixel_value.val[0]=255) {
cvSet2D(img_bin,position2+1,position1,qq3);
f_check(position2+1,position1);
area++;}
cout << "Area=" << area;
};
|