Skip to content

Commit

Permalink
latest version - before any major change
Browse files Browse the repository at this point in the history
Former-commit-id: 0e9aa09875ad04ab0a0df36a214c10caa05b9cb3
  • Loading branch information
Marcin Klimek committed Apr 15, 2020
1 parent 961e0bd commit 15781b5
Show file tree
Hide file tree
Showing 66 changed files with 688 additions and 201 deletions.
2 changes: 1 addition & 1 deletion addons/ofxCv/libs/ofxCv/src/Distance.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace ofxCv {
};

const std::string& mostRepresentative(const std::vector<std::string>& strs) {
int bestScore;
int bestScore=0;
int besti;
int n = strs.size();
for(int i = 0; i < n; i++) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,13 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<!-- ObjectFileName>$(IntDir)\%(Directory)\</ObjectFileName -->
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
Expand Down
3 changes: 2 additions & 1 deletion addons/ofxLua/ofxLuaLib/ofxLuaLib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,13 @@
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<Optimization>MaxSpeed</Optimization>
<Optimization>Full</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<!-- ObjectFileName>$(IntDir)\%(Directory)\</ObjectFileName -->
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
</ClCompile>
<Link>
<GenerateDebugInformation>true</GenerateDebugInformation>
Expand Down
2 changes: 1 addition & 1 deletion addons/ofxOpenCv/src/ofxCvColorImage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ofxCvColorImage::ofxCvColorImage( const ofxCvColorImage& _mom ) {
if( _mom.bAllocated ) {
// cast non-const, to get read access to the mon::cvImage
ofxCvColorImage& mom = const_cast<ofxCvColorImage&>(_mom);
allocate( (int)mom.getWidth(), (int)mom.getHeight() );
ofxCvImage::allocate( (int)mom.getWidth(), (int)mom.getHeight() );
cvCopy( mom.getCvImage(), cvImage, 0 );
} else {
ofLogWarning("ofxCvColorImage") << "copy constructor: source image not allocated";
Expand Down
10 changes: 5 additions & 5 deletions addons/ofxOpenCv/src/ofxCvContourFinder.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ class ofxCvContourFinder : public ofBaseDraws {
// along a straight line, for example...

virtual void draw() const { draw(0,0, _width, _height); };
virtual void draw( float x, float y ) const { draw(x,y, _width, _height); };
virtual void draw( float x, float y, float w, float h ) const;
virtual void draw(const ofPoint & point) const;
virtual void draw(const ofRectangle & rect) const;
virtual void setAnchorPercent(float xPct, float yPct);
void draw( float x, float y ) const override { draw(x,y, _width, _height); };
void draw( float x, float y, float w, float h ) const override;
void draw(const ofPoint & point) const override;
void draw(const ofRectangle & rect) const override;
void setAnchorPercent(float xPct, float yPct) override;
virtual void setAnchorPoint(int x, int y);
virtual void resetAnchor();
//virtual ofxCvBlob getBlob(int num);
Expand Down
70 changes: 48 additions & 22 deletions addons/ofxTiming/src/FadeTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,62 +3,88 @@
#include "ofMain.h"
#include "Hysteresis.h"

class FadeTimer {
class FadeTimer
{
protected:
enum {RISING = true, FALLING = false};
enum { RISING = true, FALLING = false };

double referenceTime, risingLength, fallingLength;
bool direction;
public:
FadeTimer()
:risingLength(0)
,fallingLength(0)
,direction(RISING)
,referenceTime(0) {
: risingLength(0)
, fallingLength(0)
, direction(RISING)
, referenceTime(0)
{
}
void setLength(double length) {

void setLength(double length)
{
this->risingLength = length;
this->fallingLength = length;
}
void setLength(double risingLength, double fallingLength) {

void setLength(double risingLength, double fallingLength)
{
this->risingLength = risingLength;
this->fallingLength = fallingLength;
}
void start() {

void start()
{
double curTime = ofGetElapsedTimef();
double state = get();
referenceTime = curTime - state * risingLength;
direction = RISING;
}
void stop() {

void stop()
{
double curTime = ofGetElapsedTimef();
double state = get();
referenceTime = curTime - (1 - state) * fallingLength;
direction = FALLING;
}
void update(Hysteresis& hysteresis) {
if(hysteresis.wasTriggered()) {

void update(Hysteresis& hysteresis)
{
if (hysteresis.wasTriggered())
{
start();
} else if(hysteresis.wasUntriggered()) {
}
else if (hysteresis.wasUntriggered())
{
stop();
}
}
double get() {
if(referenceTime > 0) {

double get()
{
if (referenceTime > 0)
{
double base = ofGetElapsedTimef() - referenceTime;
if(direction == FALLING) {
if (direction == FALLING)
{
base /= fallingLength;
base = 1 - base;
} else {
}
else
{
base /= risingLength;
}
if(base < 0) return 0;
if(base > 1) return 1;
if (base < 0) return 0;
if (base > 1) return 1;
return base;
} else {
}
else
{
return 0;
}
}
bool getActive() {

bool getActive()
{
return get() > 0;
}
};
};
123 changes: 77 additions & 46 deletions addons/ofxTiming/src/Hysteresis.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,82 +2,113 @@

#include "ofMain.h"

class Hysteresis {
class Hysteresis
{
protected:
uint64_t lastTime;
bool lastValue, curValue;
uint64_t risingDelay, fallingDelay;
bool triggered, untriggered;

void resetTriggers() {
triggered = false;
untriggered = false;
}

void resetTriggers()
{
triggered = false;
untriggered = false;
}

public:
Hysteresis()
:risingDelay(0)
,fallingDelay(0)
,lastTime(0)
,lastValue(false)
,curValue(false)
,triggered(false)
,untriggered(false)
: lastTime(0)
, lastValue(false)
, curValue(false)
, risingDelay(0)
, fallingDelay(0)
, triggered(false)
, untriggered(false)
{
}
void setDelay(float risingDelay, float fallingDelay) {

void setDelay(float risingDelay, float fallingDelay)
{
this->risingDelay = 1000 * risingDelay;
this->fallingDelay = 1000 * fallingDelay;
}
void setDelay(float delay) {

void setDelay(float delay)
{
setDelay(delay, delay);
}
bool update(bool value) {
resetTriggers();

bool update(bool value)
{
resetTriggers();
uint64_t curTime = ofGetElapsedTimeMillis();
if(value != curValue) {
if(value != lastValue) {
if (value != curValue)
{
if (value != lastValue)
{
lastTime = curTime;
}
uint64_t& delay = value ? risingDelay : fallingDelay;
if(curTime > delay + lastTime) {
uint64_t& delay = value ? risingDelay : fallingDelay;
if (curTime > delay + lastTime)
{
curValue = value;
if(value) {
if (value)
{
triggered = true;
} else {
}
else
{
untriggered = true;
}
}
}
lastValue = value;
return get();
return get();
}

bool set(bool value)
{
resetTriggers();
if (value != curValue)
{
if (value)
{
triggered = true;
}
else
{
untriggered = true;
}
}
curValue = value;
lastValue = value;
lastTime = ofGetElapsedTimeMillis();
return get();
}
bool set(bool value) {
resetTriggers();
if(value != curValue) {
if(value) {
triggered = true;
} else {
untriggered = true;
}
}
curValue = value;
lastValue = value;
lastTime = ofGetElapsedTimeMillis();
return get();
}
bool get() const {

bool get() const
{
return curValue;
}
bool wasTriggered() const {
return triggered;

bool wasTriggered() const
{
return triggered;
}
bool wasUntriggered() const {
return untriggered;

bool wasUntriggered() const
{
return untriggered;
}
float length() const {

float length() const
{
return lengthMillis() / 1000.;
}
uint64_t lengthMillis() const {

uint64_t lengthMillis() const
{
return ofGetElapsedTimeMillis() - lastTime;
}
};
};
16 changes: 8 additions & 8 deletions apps/hec/cc/bin/data/cc-settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
<sensing_window_width>0.529296875</sensing_window_width>
<sensing_window_height>0.568396211</sensing_window_height>
</analysis>
<SensingWindow-x-0>0.015625000</SensingWindow-x-0>
<SensingWindow-y-0>0.108490564</SensingWindow-y-0>
<SensingWindow-x-1>0.560546875</SensingWindow-x-1>
<SensingWindow-y-1>0.077830188</SensingWindow-y-1>
<SensingWindow-x-2>0.484375000</SensingWindow-x-2>
<SensingWindow-y-2>0.653301895</SensingWindow-y-2>
<SensingWindow-x-3>0.013671875</SensingWindow-x-3>
<SensingWindow-y-3>0.653301895</SensingWindow-y-3>
<SensingWindow-x-0>0.251953125</SensingWindow-x-0>
<SensingWindow-y-0>0.297169805</SensingWindow-y-0>
<SensingWindow-x-1>0.919921875</SensingWindow-x-1>
<SensingWindow-y-1>0.323113203</SensingWindow-y-1>
<SensingWindow-x-2>0.900390625</SensingWindow-x-2>
<SensingWindow-y-2>0.912735820</SensingWindow-y-2>
<SensingWindow-x-3>0.216796875</SensingWindow-x-3>
<SensingWindow-y-3>0.896226406</SensingWindow-y-3>
23 changes: 23 additions & 0 deletions apps/hec/cc/bin/data/hec-settings.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Parameters>
<colormap>117</colormap>
<tolerance>0.0006</tolerance>
<smoothing>7</smoothing>
<blur_amount>0</blur_amount>
<erosion_open>0</erosion_open>
<erosion_close>0</erosion_close>
<dillate>0</dillate>
<blur_amount_2>0</blur_amount_2>
<erosion_open_2>1</erosion_open_2>
<erosion_close_2>0</erosion_close_2>
<dillate_2>0</dillate_2>
<area_min>2232.5</area_min>
<area_max>5e+06</area_max>
<Threshold_Value>3.825</Threshold_Value>
<near>560</near>
<far>4520</far>
<reset_Background>0</reset_Background>
<reset_Background_time>5</reset_Background_time>
<epsilon>100</epsilon>
<Parameters/>
<script>0</script>
</Parameters>
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/hec/cc/bin/data/images/totoro/bz_0.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/hec/cc/bin/data/images/totoro/bz_1.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/hec/cc/bin/data/images/totoro/bz_10.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/hec/cc/bin/data/images/totoro/bz_11.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/hec/cc/bin/data/images/totoro/bz_2.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/hec/cc/bin/data/images/totoro/bz_3.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/hec/cc/bin/data/images/totoro/bz_4.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/hec/cc/bin/data/images/totoro/bz_5.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/hec/cc/bin/data/images/totoro/bz_6.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/hec/cc/bin/data/images/totoro/bz_7.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/hec/cc/bin/data/images/totoro/bz_8.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added apps/hec/cc/bin/data/images/totoro/bz_9.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 15781b5

Please sign in to comment.