开发者

How do I convert normal UIImage into corresponding NES palette color?

I want to convert UIImage into 8 bit NES colors. The problem is, i couldn't find any algorithm on internet which can perform such operation. I don't want to use openCV for this. Is th开发者_C百科ere any method to do so? Any help is appreciated.


I found the answer for this. The solution is as follows: For every pixel of CGImage calculate the nearest color from the NES palette. Distance between two colors can be calculated using the vector distance between them. Vector distance can be calculated using math function sqrt( (R1-R2)(R1-R2) + (G1-G2)(G1-G2) + (B1-B2)*(B1-B2)), where, R,G,B indicates the values of the color components.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜