Not sure what you changed but the problem code remains exactly the same. It's in these lines (from the original code):
for( int i = 0; i <= height ; i++)
for( int j = 0; j <= width ; j++)
// only add valid pixels considering corner and edge pixels
if( indexs[k] >= 0 && indexs[k] <= ...
Well, this code definitely blurs the image, but far from correctly. While the "math" may be right (not saying yes or no because I didn't look), there's a more serious logic problem.
To blur the image correctly, the inputs to the math must come from the ORIGINAL pixel values surrounding the pixel that's being blurred. With this code, each pixel is ...
Look at the following code:
if(SEPIA[k] > 255)
SEPIA[k] = 255;
What is the value of k? Where is it incremented? Is it possible that some code was forgotten to be added? ;-)
If this answers your question, please click on the check mark to accept. Let's keep up on forum maintenance. ;-)
This is happening because your loop is summing values from neighbors to the left and up of the current pixel that have already been blurred by previous iterations of the same loop. You need to check the values from one of your two copies of the image, and write the blurred values to another copy. Right now, you're writing to both copies at the end of the ...
The results are displayed in your question. If the code tries to store a number greater than 8 bits (greater than 255) in a one-byte data type, it generates a runtime overflow error. Nothing will be stored and the program will terminate with an error condition.
Perhaps you should add some code that will check for x > 255 and if true, store 255. OR, use ...