Link to home
Start Free TrialLog in
Avatar of killaz4life
killaz4life

asked on

sharpen function

Hey I have a problem with this function it supposed to sharpen an image, I also think im missing the scaling function which i do not know! image2D_Buffer is the final image, image2D is the temporary image.

void CImgProcess::simsharp()
{
      int P[559][345];
      for(int x=0;x<ROW+2;x++)
            for(int y=0;y<COL+2;y++)
                  P[x][y]=0;

      for(int x=0;x<ROW;x++)
            for(int y=0;y<COL;y++)
                  P[x+1][y+1]=(unsigned char)image2D[x][y];

      for(int x=1;x<=ROW;x++)
            for(int y=1;y<=COL;y++)
                  image2D_Buffer[x-1][y-1]=(unsigned char)5*P[x][y]-(P[x+1][y]+P[x-1][y]+P[x][y+1]+P[x][y-1]);
}
ASKER CERTIFIED SOLUTION
Avatar of Infinity08
Infinity08
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of killaz4life
killaz4life

ASKER

sorry this is the updated simsharp

void CImgProcess::simsharp()
{
     int P[240][320];
     for(int x=0;x<ROW;x++)
          for(int y=0;y<COL;y++)
               P[x][y]=0;

     for(int x=0;x<ROW;x++)
          for(int y=0;y<COL;y++)
               P[x][y]=(unsigned char)image2D[x][y];

     for(int x=1;x<=ROW;x++)
          for(int y=1;y<=COL;y++)
               image2D_Buffer[x][y]=(unsigned char)5*P[x][y]-(P[x+1][y]+P[x-1][y]+P[x][y+1]+P[x][y-1]);
}
Still the same ... P needs to be 2 columns wider and 2 rows wider than the image