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.