开发者

invert colors in image

Can i invert each color and generate a inverte开发者_高级运维d RGB image by matlab code? and how? i want to invert each color then calculate the sum which is the new value for the pixel somehow like this ((255-R)+(255-B)+(255-G)) thnx


myimage = sum(255 - myimage, 3);

Explanation:

  • 255 - myimage does the pixel-wise color inversion, e.g. for each pixel, the R component becomes (255-R) and so on…

  • sum(…, 3) does the pixel-wise sum of each of the 3 layers of the image (Red, Green and Blue)

You end up with a single layer image where each pixel stores the corresponding sum that you are looking for.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜