Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef GLImagePainter_H
00011 #define GLImagePainter_H
00012
00013 #include <vector>
00014 #include <iostream>
00015 #include <cmath>
00016 #include <QRgb>
00017 #include <QtOpenGL>
00018
00019 #include "../../Workers/Puma2/ColorImageRGB8.h"
00020 #include "../../Workers/Puma2/GrayLevelImage8.h"
00021 #include "../../Workers/Puma2/ColorImageUV8.h"
00022
00023 #include "../../Devices/ImageGrabber/ImageGrabber.h"
00024 #include "Workers/Math/Box2D.h"
00025 #include "Workers/Math/Circle2D.h"
00026 #include "Workers/Math/Line2D.h"
00027 #include "../../Workers/VectorGraphics/VectorObject2D.h"
00028
00033 class GLImagePainter {
00034
00035 public:
00036 GLImagePainter();
00037 ~GLImagePainter();
00038
00040 void setColorImage(const puma2::ColorImageRGB8* image, float aspect=1.0 );
00041 void setColorImage(const puma2::GrayLevelImage8* yImage, const puma2::ColorImageUV8* uvImage, float aspect=1.0 );
00042 void setThermalImage(const puma2::GrayLevelImage8* image, float roomTemp=30.0 );
00043 void setGrayLevelImage(const puma2::GrayLevelImage8* image, float aspect=1.0 );
00044
00045 void setAnaglyphImage( const puma2::GrayLevelImage8* leftYImage, const puma2::GrayLevelImage8* rightYImage, float aspect=1.0 );
00046
00051 void setPixelAspectRatio(float ratio) { m_PixelAspectRatio=ratio; };
00052
00054 void addVectorObject( VectorObject2D vectorObject );
00055
00057 void clearForms();
00058
00059 void saveImage( std::string filename );
00060
00062 void paintImage( float alpha=1.0 );
00063
00065 void paintVectorObjects();
00066
00067 private:
00068
00069
00071 static int calcTextureSize( int width, int height );
00072
00073 protected :
00074
00075 void initTexture( unsigned resolution, unsigned imageWidth, unsigned imageHeight, ImageGrabber::ColorFormat textureFormat );
00076 void updateTexture( unsigned char* imageData, unsigned width, unsigned height, ImageGrabber::ColorFormat format );
00077 void clearTexture();
00078
00079 unsigned m_ImageWidth;
00080 unsigned m_ImageHeight;
00081
00082 float m_PixelAspectRatio;
00083
00084 unsigned m_TextureResolution;
00085
00086 GLuint m_TextureId;
00087 unsigned char* m_TextureData;
00088 ImageGrabber::ColorFormat m_TextureFormat;
00089 unsigned int m_TextureByteSize;
00090
00091 std::list< VectorObject2D > m_VectorObjects;
00092
00093 };
00094
00095 #endif