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 there any method to do so? Any help is appreciated.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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.