indramurari indramurari - 1 month ago 4x
Android Question

How to get intensity of each pixel in image. I want to calculate higher intensity pixels in image

I am doing image processing in my project so I need to calculate the intensity of each pixel.
If it is greater than a threshold then keep it as it is, otherwise remove that pixel.


You may convert RGB to HSB and use brightness. But I think its slow method. Maybe something like this:

#define DWORD unsigned long

DWORD density(DWORD pixel)
//  RGB in DWORD: 0x00rrggbb
    return (pixel & 0x000000ff) + ((pixel >> 8) & 0x000000ff) + ((pixel >> 16) & 0x000000ff);