public
Created

  • Download Gist
ImageFilter.m
Matlab
1 2 3 4 5 6 7 8 9 10 11 12 13 14
for (int i = 0; i < length; i += 4) {
blue = m_OriginalPixelBuf[i];
green = m_OriginalPixelBuf[i+1];
red = m_OriginalPixelBuf[i+2];
red = pow(red / 255.0f, 1.3f) * 255.0;
green = pow(green / 255.0f, 1.3f) * 255.0;
blue = pow(blue / 255.0f, 1.3f) * 255.0;
// Ensure that pixel is not more than 255
m_OriginalPixelBuf[i] = blue > 255 ? 255 : (int)blue;
m_OriginalPixelBuf[i+1] = green > 255 ? 255 : (int)green;
m_OriginalPixelBuf[i+2] = red > 255 ? 255 : (int)red;
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.