#ifndef IMAGEOUTPUT_H
#define IMAGEOUTPUT_H

#include "output.h"
#include "../recognition/imagesource.h"
#include <string>

extern "C"
{
  #include <opencv/highgui.h>
}

namespace seemicro
{

class ImageOutput : public OutputModule
{
  ImageSource& src;
  string windowname;

public:
  ImageOutput(ImageSource& Asrc, string Awindowname) :
    src(Asrc), windowname(Awindowname)
  {
    cvNamedWindow(windowname.c_str(), 1);
  };

  ~ImageOutput()
  {
    cvDestroyWindow(windowname.c_str());
  }
  
  void output(bool keyframe)
  {
    if(!src.outputChanged) return;
    if(!keyframe) return;

    cvShowImage(windowname.c_str(), src.img);
    cvResizeWindow(windowname.c_str(), src.img->width+15, src.img->height+15);
    src.outputChanged = false;
  }

}; // ImageOutput

} // seemicro

#endif
