OSSIM - Open Source Software Image Map  Version 1.9.0 (20180803)
Public Member Functions | Protected Attributes | Friends | List of all members
ossimJpegYCbCrVector Class Reference

#include <ossimJpegYCbCrVector.h>

Public Member Functions

 ossimJpegYCbCrVector (unsigned char Y=0, unsigned char Cb=0, unsigned char Cr=0)
 
 ossimJpegYCbCrVector (const ossimRgbVector &)
 
long clamp (long colorValue, unsigned char min=0, unsigned char max=255) const
 
ossimJpegYCbCrVectoroperator= (const ossimRgbVector &)
 
unsigned char getY () const
 
unsigned char getCb () const
 
unsigned char getCr () const
 
void setY (unsigned char Y)
 
void setCb (unsigned char Cb)
 
void setCr (unsigned char Cr)
 

Protected Attributes

unsigned char theBuf [3]
 

Friends

ostream & operator<< (ostream &out, const ossimJpegYCbCrVector &data)
 

Detailed Description

Definition at line 18 of file ossimJpegYCbCrVector.h.

Constructor & Destructor Documentation

◆ ossimJpegYCbCrVector() [1/2]

ossimJpegYCbCrVector::ossimJpegYCbCrVector ( unsigned char  Y = 0,
unsigned char  Cb = 0,
unsigned char  Cr = 0 
)
inline

Definition at line 30 of file ossimJpegYCbCrVector.h.

33  {
34  theBuf[0] = Y;
35  theBuf[1] = Cb;
36  theBuf[2] = Cr;
37  }

◆ ossimJpegYCbCrVector() [2/2]

ossimJpegYCbCrVector::ossimJpegYCbCrVector ( const ossimRgbVector rgbColor)

Definition at line 6 of file ossimJpegYCbCrVector.cpp.

References clamp(), ossimRgbVector::getB(), ossimRgbVector::getG(), ossimRgbVector::getR(), and theBuf.

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 }
unsigned char getR() const
unsigned char getB() const
unsigned char getG() const
long clamp(long colorValue, unsigned char min=0, unsigned char max=255) const

Member Function Documentation

◆ clamp()

long ossimJpegYCbCrVector::clamp ( long  colorValue,
unsigned char  min = 0,
unsigned char  max = 255 
) const
inline

Definition at line 41 of file ossimJpegYCbCrVector.h.

References max, and min.

Referenced by operator=(), and ossimJpegYCbCrVector().

42  {
43  colorValue = colorValue > max? max:colorValue;
44  colorValue = colorValue < min? min:colorValue;
45 
46  return colorValue;
47  }
#define max(a, b)
Definition: auxiliary.h:76
#define min(a, b)
Definition: auxiliary.h:75

◆ getCb()

unsigned char ossimJpegYCbCrVector::getCb ( ) const
inline

◆ getCr()

unsigned char ossimJpegYCbCrVector::getCr ( ) const
inline

◆ getY()

unsigned char ossimJpegYCbCrVector::getY ( ) const
inline

◆ operator=()

ossimJpegYCbCrVector & ossimJpegYCbCrVector::operator= ( const ossimRgbVector rgbColor)

Definition at line 22 of file ossimJpegYCbCrVector.cpp.

References clamp(), ossimRgbVector::getB(), ossimRgbVector::getG(), ossimRgbVector::getR(), and theBuf.

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
unsigned char getB() const
unsigned char getG() const
long clamp(long colorValue, unsigned char min=0, unsigned char max=255) const

◆ setCb()

void ossimJpegYCbCrVector::setCb ( unsigned char  Cb)
inline

Definition at line 56 of file ossimJpegYCbCrVector.h.

56 { theBuf[1] = Cb; }

◆ setCr()

void ossimJpegYCbCrVector::setCr ( unsigned char  Cr)
inline

Definition at line 57 of file ossimJpegYCbCrVector.h.

57 { theBuf[2] = Cr; }

◆ setY()

void ossimJpegYCbCrVector::setY ( unsigned char  Y)
inline

Definition at line 55 of file ossimJpegYCbCrVector.h.

55 { theBuf[0] = Y; }

Friends And Related Function Documentation

◆ operator<<

ostream& operator<< ( ostream &  out,
const ossimJpegYCbCrVector data 
)
friend

Definition at line 21 of file ossimJpegYCbCrVector.h.

22  {
23  out << "<" << (long)data.theBuf[0] << ", "
24  << (long)data.theBuf[1] << ", "
25  << (long)data.theBuf[2] << ">";
26 
27  return out;
28  }

Member Data Documentation

◆ theBuf

unsigned char ossimJpegYCbCrVector::theBuf[3]
protected

JpegYCbCr is an 8-bit YCbCr color model. We will let: buf[0] = Y buf[1] = Cb buf[2] = Cr

Definition at line 67 of file ossimJpegYCbCrVector.h.

Referenced by operator=(), and ossimJpegYCbCrVector().


The documentation for this class was generated from the following files: