From b79752f96f9e58c0b4636cc024add698e0ce0c5f Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 20 Aug 2013 14:49:48 +0100 Subject: frame mode for video loader + audio output bugfix --- rotord/src/rotor.h | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) (limited to 'rotord/src/rotor.h') diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h index a2e5876..fc557cd 100755 --- a/rotord/src/rotor.h +++ b/rotord/src/rotor.h @@ -126,6 +126,7 @@ namespace Rotor { virtual ~Attribute(){}; Attribute(const string &_desc,const string &_title,const string &_value,std::vector _vals={}): description(_desc),title(_title),value(_value),intVal(0){ vals=_vals; + init(_value); }; void init(const string &_key){ //inits int value from set::string vals index value=_key; @@ -157,6 +158,14 @@ namespace Rotor { void create_attribute(const string &_attr,const string &_desc,const string &_title,const string &_value,std::vector _vals={}) { attributes[_attr]=new Attribute(_desc,_title,_value,_vals); }; + void create_attribute(string *alias,const string &_attr,const string &_desc,const string &_title,const string &_value,std::vector _vals={}) { + attributes[_attr]=new Attribute(_desc,_title,_value,_vals); + alias=&(attributes[_attr]->value); + }; + void create_attribute(int *alias,const string &_attr,const string &_desc,const string &_title,const string &_value,std::vector _vals={}) { + attributes[_attr]=new Attribute(_desc,_title,_value,_vals); + alias=&(attributes[_attr]->intVal); + }; string description; string type; string ID; @@ -227,6 +236,29 @@ namespace Rotor { virtual void print_summary(){}; int channels,bits,samples,rate; }; + class LUT { + LUT(){ + lut=nullptr; + }; + ~LUT(){if (lut) { delete[] lut;} }; + void generate(float black_in,float white_in,float black_out,float white_out,float gamma){ + //can check here if anything has changed + if (lut) delete[] lut; + lut=new unsigned char[256]; + float fltmax=(255.0f/256.0f); + for (int i=0;i<256;i++){ + lut[i]=(unsigned char)(((pow(min(fltmax,max(0.0f,(((((float)i)/256.0f)-black_in)/(white_in-black_in)))),(1.0/gamma))*(white_out-black_out))+black_out)*255.0f); + } + } + void apply(const cv::Mat& in,cv::Mat &out){ //facility to apply to other images for inherited classes + out.create(in.rows,in.cols,in.type()); + for (int i=0;i