Efficient way to replace specific color in Bitmap/Image

后端 未结 1 1575
长发绾君心
长发绾君心 2021-01-06 03:08

In my grayscale picture I need to find specific value and replace it with some color, e.g yellow. Here is the code which I have right now, but it\'s not as fast as I need. I

1条回答
  •  走了就别回头了
    2021-01-06 03:46

    In the case of a 4 channel image, where each pixel is 4 bytes (8-bits per channel), you can use a 256 entry lookup-table indexed by row[0] and assign all four channels simultaneously as a single 32-bit int.

    0 讨论(0)
提交回复
热议问题