开发者

invert colors in image

开发者 https://www.devze.com 2023-02-24 09:53 出处:网络
Can i invert each color and generate a inverte开发者_高级运维d RGB image by matlab code? and how?

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

精彩评论

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