简体   繁体   中英

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);
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM