Thursday, September 24, 2009

Why we have to use integer pixel values as final output? no floating-point values?

Most output devices are controlled by integer pixel values. The process of converting the floating-point real values into integers is called quantization

자연스럽게 나오는 질문중에 하나가 "왜 우리는 최종 output image로 integer를 쓸까?" 라는 질문일 것이다. 대답은 간단하다 gamma가 그랬듯이 거의 모든 device들이 실질적인 color를 생성할때 인티저 값을 요구하기 때문이다. 그럴것이 채널당 8bit 즉 256 칼라 수만큼 표현하는데 있어 명확한 칼라값을 요구 하기에는 인티저가 제격일 것이다. 32bit상에서도 integer가 유용할때가 있다. 예를 들면 칼라의 경계를 명확히 해야하는 ID를 추출할때를 들수 있다. 하지만 거의 모든 3D 더나가 2D and compositing application에서 계산하는 전 과정은 floating-point이다. 하지만 최종 아웃풋으로 내 보낼때 아래와(256 color수의 예) 같은 integer로 전환과정을 가게 된다.

outPixel = (pow(((inPixel * 255.0) - inBlack) / (inWhite - inBlack), inGamma) * (outWhite - outBlack) + outBlack) / 255.0;

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home