Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

colors.cc

Go to the documentation of this file.
00001 #include "Vision/colors.h"
00002 #include <cstdio>
00003 
00004 //! displays an rgb value in the form '[r,g,b]'
00005 std::ostream& operator<<(std::ostream &os, const rgb &rgbval) {
00006   os << "[" << (unsigned int)rgbval.red
00007      << "," << (unsigned int)rgbval.green
00008      << "," << (unsigned int)rgbval.blue
00009      << "]";
00010   return os;
00011 }
00012 
00013 //! returns @a rgbval in the form 'r g b'
00014 std::string toString(const rgb &rgbval) {
00015   char buff[15];
00016   snprintf(buff,15,"%d %d %d",rgbval.red,rgbval.green,rgbval.blue);
00017   return buff;
00018 }
00019 
00020 
00021 //! displays an rgb value in the form '[y,u,v]'
00022 std::ostream& operator<<(std::ostream &os, const yuv &yuvval) {
00023   os << "yuv[" << (unsigned int)yuvval.y
00024      << "," << (unsigned int)yuvval.u
00025      << "," << (unsigned int)yuvval.v
00026      << "]";
00027   return os;
00028 }
00029 
00030 //! returns @a yuvval in the form 'r g b'
00031 std::string toString(const yuv &yuvval) {
00032   char buff[15];
00033   snprintf(buff,15,"%d %d %d",yuvval.y,yuvval.u,yuvval.v);
00034   return buff;
00035 }
00036 
00037 

Tekkotsu v5.1CVS
Generated Fri Mar 16 05:26:35 2012 by Doxygen 1.6.3