Ignore:
Timestamp:
Dec 22, 2016, 5:32:58 PM (5 years ago)
Author:
Sanahuja Guillaume
Message:

modifs camera

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/lib/FlairSensorActuator/src/Camera.cpp

    r15 r121  
    2424#include <DataPlot1D.h>
    2525#include <Picture.h>
     26#include <Buffer.h>
    2627#include <highgui.h>
    2728#include <fstream>
     
    3839    : IODevice(parent, name) {
    3940  plot_tab = NULL;
     41        jpgBuffer=NULL;
     42        logFormat=LogFormat::NONE;
    4043
    4144  // do not allocate imagedata, allocation is done by the camera
    4245  output = new cvimage((IODevice *)this, width, height, format, "out", false);
    43 
     46       
    4447  // station sol
    4548  main_tab = new Tab(parent->GetTabWidget(), name);
     
    5053}
    5154
     55//This contructor must only be called for a simulated device.
    5256Camera::Camera(const IODevice *parent, std::string name)
    5357    : IODevice(parent, name) {
     
    5963
    6064  output = NULL;
     65        jpgBuffer=NULL;
     66        logFormat=LogFormat::NONE;
    6167}
    6268
     
    6470  if (main_tab != NULL)
    6571    delete main_tab;
     72}
     73
     74void Camera::SetLogFormat(LogFormat logFormat) {
     75        this->logFormat=logFormat;
     76        switch(logFormat) {
     77                case LogFormat::RAW:
     78                        AddDataToLog(output);
     79                        Warn("raw log of cvimage is not yet implemented\n");
     80                        break;
     81                case LogFormat::JPG:
     82                        if(jpgBuffer==NULL) {
     83                                jpgBuffer=new Buffer(this,"jpg_bufer");
     84                                AddDataToLog(jpgBuffer);
     85                        }else{
     86                                Warn("log format already defined\n");
     87                        }
     88                        break;
     89        }
    6690}
    6791
     
    94118core::cvimage *Camera::Output(void) { return output; }
    95119
     120void Camera::ProcessUpdate(core::io_data* data) {
     121        switch(logFormat) {
     122                case LogFormat::JPG:
     123                                ajouter compression jpg
     124                        break;
     125        }
     126        IODevice::ProcessUpdate(data);
     127}
     128
    96129void Camera::SaveToFile(string filename) const {
    97130  Printf("saving %s, size %i\n", filename.c_str(), output->img->imageSize);
Note: See TracChangeset for help on using the changeset viewer.