PIL Best Way To Replace Color?

后端 未结 6 1955
时光取名叫无心
时光取名叫无心 2020-12-04 20:06

I am trying to remove a certain color from my image however it\'s not working as well as I\'d hoped. I tried to do the same thing as seen here Using PIL to make all white pi

6条回答
  •  萌比男神i
    2020-12-04 21:03

    If the pixels are not easily identifiable e.g you say (r < 100 and g < 100 and b < 100) also doesn't match correctly the black region, it means you have lots of noise.

    Best way would be to identify a region and fill it with color you want, you can identify the region manually or may be by edge detection e.g. http://bitecode.co.uk/2008/07/edge-detection-in-python/

    or more sophisticated approach would be to use library like opencv (http://opencv.willowgarage.com/wiki/) to identify objects.

提交回复
热议问题