OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
ossimJpegYCbCrVector.cpp
Go to the documentation of this file.
3 
5 
7 {
8  theBuf[0] = static_cast<unsigned char>(clamp(ossim::round<int>(0.299*rgbColor.getR() +
9  0.587*rgbColor.getG() +
10  0.114*rgbColor.getB())));
11 
12  theBuf[1] = static_cast<unsigned char>(clamp(ossim::round<int>((-0.1687)*rgbColor.getR() -
13  0.3313*rgbColor.getG() +
14  0.5*rgbColor.getB() + 128)));
15 
16  theBuf[2] = static_cast<unsigned char>(clamp(ossim::round<int>(0.5*rgbColor.getR() -
17  .4187*rgbColor.getG() -
18  .0813*rgbColor.getB() + 128)));
19 
20 }
21 
23 {
24  theBuf[0] = static_cast<unsigned char>(clamp(ossim::round<int>(0.299*rgbColor.getR() +
25  0.587*rgbColor.getG() +
26  0.114*rgbColor.getB())));
27 
28  theBuf[1] = static_cast<unsigned char>(clamp(ossim::round<int>((-0.1687)*rgbColor.getR() -
29  0.3313*rgbColor.getG() +
30  0.5*rgbColor.getB() + 128)));
31 
32  theBuf[2] = static_cast<unsigned char>(clamp(ossim::round<int>(0.5*rgbColor.getR() -
33  .4187*rgbColor.getG() -
34  .0813*rgbColor.getB() + 128)));
35 
36  return *this;
37 }
unsigned char getR() const
ossimJpegYCbCrVector(unsigned char Y=0, unsigned char Cb=0, unsigned char Cr=0)
unsigned char getB() const
unsigned char getG() const
long clamp(long colorValue, unsigned char min=0, unsigned char max=255) const
ossimJpegYCbCrVector & operator=(const ossimRgbVector &)