图像面积(像素的个数)

writen by [email protected]

void  Cbiaoji1::mianji(IplImage  * src)
{
    biaoji(src);
    memset(fg,
0,255);
    y_sign
=0;
    
int m_Area=0;
    
for(int i=1;i<=x_sign;i++)
    
{
        
if(flag[i]!=0)
        
{
            
if(fg[y_sign]==0)
            
{
                fg[y_sign]
=flag[i];
                
++y_sign;
            }

        }

        m_Area
+=flag[i];
    }

    cout
<<"目标:"<<y_sign<<endl;
    cout
<<"m_Area"<<m_Area<<endl;
    
for(i=0;i<y_sign;i++)
    
{
        cout
<<"连通区:"<<i+1<<"的面积:"<<fg[i]<<endl;
    }

    cvReleaseImage(
&temp);
}

转载于:https://www.cnblogs.com/wqj1212/archive/2007/12/21/1009663.html

你可能感兴趣的:(图像面积(像素的个数))