How to replace color of an image?

后端 未结 3 527
执念已碎
执念已碎 2020-12-30 13:36

I want to replace color of an image. For example turn all blue colors to red without any distortion on shape. When i try this i can swap the colors by iterating every pixel,

3条回答
  •  太阳男子
    2020-12-30 14:06

    The problem with the issue that you are asking is that a strict color replacement will modify the shape of the image. What you need to do is get a little information on what the shape is. I.e. Find boundaries and shading along the boundaries. My suggestion to you is:

    1. Use edge detection to separate out blobs
    2. Find a blob that fits your demands: i.e. Has a tolerant likelihood for [color]ish.
    3. Identify blobs and filters applied
    4. Recolor the blob and reshade.

    IMO: That is the only way you're going to get the result you're looking for.

    Some notes: Finding a blob may require some testing to determine how much tolerance you have for blobs and shapes. [Connected Regions].

    Another thing: The shading and relative coloring will require you to have a devience for the color you want.

提交回复
热议问题