• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 201
  • Last Modified:

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]);
}
0
killaz4life
Asked:
killaz4life
  • 2
1 Solution
 
Infinity08Commented:
For one, define P as :

     int P[ROW + 2][COL + 2];
0
 
killaz4lifeAuthor Commented:
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]);
}
0
 
Infinity08Commented:
Still the same ... P needs to be 2 columns wider and 2 rows wider than the image
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now