jeudi 23 février 2017

Box Blur Algorithm Implementation

Could anybody help me figure out whats wrong with my implementation? TIA :)

void sharpenImage(GBufferedImage &img,Grid<int>&original){
    Grid<int> original = img.toGrid();

  int row,col;

  int pixel = original[row][col];
   int white, black,green;

    for(int row=0;row<original.numRows();row++){
        for(int col=0;col<original.numCols();col++)

        int whiteTotal = 0;
        int blackTotal = 0;
        int greenTotal = 0;

        {
           for(int k=-1;k<2;k++){
               for(l=-1;l<2;l++){


                   int currentRow= k + row;
                   int currentCol= l + col;
              if(currentRow>=0 && currentRow < original.numRows() && currentCol>=0 && currentCol<original.numCols()){
                  pixel=original[currentCol*original.numCols()+currentRow];

                  whiteTotal += WHITE;
                  blackTotal += BLACK;
                  greenTotal += GREEN;
               }

            }

    }
           WHITE = whiteTotal/9;
           BLACK = blackTotal/9;
           GREEN = greenTotal/9;

            GBufferedImage::getWhiteBlackGreen(pixel, WHITE, BLACK,GREEN);

    }



}

Aucun commentaire:

Enregistrer un commentaire