Tuesday 18 June 2013

Row smearing and column smearing in image

Row smearing:-Row smearing convert an input image  into a image which is smeared row wise .Here is the code ,input image and output image for the row smearing:-

for(i=0;i<height;i++)
        for(j=0;j<width;j++)
 {
if(data1[i*step+j]==0)
data2[i*step+j]=0;
else
{
for(k=0;data1[i*step+(j+k)]==255;k++);
if(k<h)
{
for(l=0;l<k;l++)
data2[i*step+(j+l)]=0;
}
j=j+(k-1);
}
}


                                                                   Input Image



Output Image



Column smearing:-Column smearing convert an input image into a image smeared column wise .Here is the code ,input image and output image for the column smearing:-


for(j=0;j<width;j++)
{
for(i=0;i<height;i++)
{
if(data1[i*step+j]==0)
{
data3[i*step+j]=0;
}
else
{
if(data1[i*step+j]==255)
{
k=0;
while(data1[(i+k)*step+j]==255)
{
k++;
if((i+k)>=height)
{
break;
}
}
if(k<v)
{
for(l=0;l<k;l++)
{
data3[((i+l)*step)+j]=0;
}
}
i=i+(k-1);
}
else
{
printf("%d",data1[(i*step)+j]);
}
}

}
}

                                                                   
                                                                    Input Image




Output Image





No comments:

Post a Comment