Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Imagem::binariza()
- {
- for (int y = 0; y < altura - 1; y++)
- for (int x = 0; x < largura; x++)
- {
- int RGB = getPixel(x, y);
- int B = RGB >> 16 & 255;
- int G = RGB >> 8 & 255;
- int R = RGB & 255;
- R = (R + G + B) / 3.0;
- if (R > +84)
- R = 255;
- else
- R = 0;
- G = R;
- B = R;
- setPixel(x, y, R, G, B);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement