Skip to content

Commit

Permalink
latest changes - towards vs2019
Browse files Browse the repository at this point in the history
Former-commit-id: 37827f22dd8874c79b84e89d666231a7a6c8eeaf
  • Loading branch information
Marcin Klimek committed Jul 26, 2020
1 parent 4fd1b8b commit d1de827
Show file tree
Hide file tree
Showing 8 changed files with 74 additions and 56 deletions.
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.277343750</SensingWindow-x-0>
<SensingWindow-y-0>0.311320752</SensingWindow-y-0>
<SensingWindow-x-1>0.890625000</SensingWindow-x-1>
<SensingWindow-y-1>0.323113203</SensingWindow-y-1>
<SensingWindow-x-2>0.910156250</SensingWindow-x-2>
<SensingWindow-y-2>0.891509414</SensingWindow-y-2>
<SensingWindow-x-3>0.271484375</SensingWindow-x-3>
<SensingWindow-y-3>0.900943398</SensingWindow-y-3>
<SensingWindow-x-0>0.000000000</SensingWindow-x-0>
<SensingWindow-y-0>0.000000000</SensingWindow-y-0>
<SensingWindow-x-1>0.994140625</SensingWindow-x-1>
<SensingWindow-y-1>0.000000000</SensingWindow-y-1>
<SensingWindow-x-2>0.998046875</SensingWindow-x-2>
<SensingWindow-y-2>0.995283008</SensingWindow-y-2>
<SensingWindow-x-3>0.000000000</SensingWindow-x-3>
<SensingWindow-y-3>1.000000000</SensingWindow-y-3>
35 changes: 17 additions & 18 deletions apps/hec/cc/bin/data/scripts/game_03-box.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
Utils = require "Utils"

box2d = require "LuaBox2D"
uber = UberObj("Kinect")

numX = 32
Expand All @@ -17,8 +16,8 @@ colorG = 255
colorB = 255

local function Shape(x, y, w, h)
-- public

-- public
local self = {
x = 0,
y = 0,
Expand All @@ -37,7 +36,7 @@ local function Shape(x, y, w, h)
}

function self.draw()
of.pushStyle()
of.pushStyle()

of.setColor(self.r, self.g, self.b, self.alpha)
of.drawRectangle( self.box )
Expand All @@ -52,7 +51,7 @@ local function Shape(x, y, w, h)
end

function self.new_color()


end

Expand All @@ -65,9 +64,9 @@ local function Shape(x, y, w, h)

--print (x >= self.x , y >= self.y , x <= self.x2 , y <= self.y2)
--local p = of.Point(x, y)

if x >= self.x and y >= self.y and x <= self.x2 and y <= self.y2 then

self.touched = true

end
Expand Down Expand Up @@ -154,7 +153,7 @@ function update()
colorTimer = colorTimer + 1

if colorTimer == 120 then

colorTimer = 0

colorR = of.random(100, 255)
Expand All @@ -165,11 +164,11 @@ function update()
for i=1, uber.numBlobs do

local blob = uber.blob(i)

if blob then

of.setColor(255, 0, 0, 128)

for k, v in pairs(blob) do

local x = round(v.x / deltaX)
Expand All @@ -178,15 +177,15 @@ function update()
--for i,shape in ipairs(shapes) do
-- shape.inside(x, y)
--end
local offset = round( x + y*(numX) )
local offset = round( x + y*(numX) )
--print(v.x, v.y, x, y, offset)


if x < numX and y < numY then
shapes[offset].touch()
--print (numX*numY, v.x, v.y, x, y, offset)
end

end

end
Expand All @@ -206,7 +205,7 @@ end
function draw()
of.pushMatrix()
of.pushStyle()

of.enableAlphaBlending()
of.setColor(255, 255, 255, 255)

Expand All @@ -219,12 +218,12 @@ function draw()

for i=1, uber.numBlobs do
local blob = uber.blob(i)

if blob then

of.setColor(255, 0, 0, 128)
of.beginShape()

for k, v in pairs(blob) do
of.vertex(v.x, v.y)
end
Expand All @@ -233,7 +232,7 @@ function draw()
end
end


of.popStyle()
of.popMatrix()
end
Expand Down
46 changes: 24 additions & 22 deletions apps/hec/cc/bin/data/scripts/start.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
Utils = require "Utils"

box2d = require "LuaBox2D"
uber = UberObj("Kinect")

numX = 32
Expand All @@ -17,8 +15,8 @@ colorG = 255
colorB = 255

local function Shape(x, y, w, h)
-- public

-- public
local self = {
x = 0,
y = 0,
Expand All @@ -37,7 +35,7 @@ local function Shape(x, y, w, h)
}

function self.draw()
of.pushStyle()
of.pushStyle()

of.setColor(self.r, self.g, self.b, self.alpha)
of.drawRectangle( self.box )
Expand All @@ -52,7 +50,7 @@ local function Shape(x, y, w, h)
end

function self.new_color()


end

Expand All @@ -65,9 +63,9 @@ local function Shape(x, y, w, h)

--print (x >= self.x , y >= self.y , x <= self.x2 , y <= self.y2)
--local p = of.Point(x, y)

if x >= self.x and y >= self.y and x <= self.x2 and y <= self.y2 then

self.touched = true

end
Expand Down Expand Up @@ -127,7 +125,7 @@ function setup()

of.setFrameRate(60)
of.setWindowTitle("projektor")
of.setWindowPosition(1920 , 0) -- (1920 + 1680,0)
--of.setWindowPosition(1920 , 0) -- (1920 + 1680,0)

for y=0,numY-1 do
for x=0,numX-1 do
Expand All @@ -154,7 +152,7 @@ function update()
colorTimer = colorTimer + 1

if colorTimer == 120 then

colorTimer = 0

colorR = of.random(100, 255)
Expand All @@ -165,11 +163,11 @@ function update()
for i=1, uber.numBlobs do

local blob = uber.blob(i)

if blob then

of.setColor(255, 0, 0, 128)

for k, v in pairs(blob) do

local x = round(v.x / deltaX)
Expand All @@ -178,15 +176,18 @@ function update()
--for i,shape in ipairs(shapes) do
-- shape.inside(x, y)
--end
local offset = round( x + y*(numX) )
local offset = round( x + y*numX )
--print(v.x, v.y, x, y, offset)


if x < numX and y < numY then
shapes[offset].touch()
--print (numX*numY, v.x, v.y, x, y, offset)
local one = shapes[offset]

if one ~= nil then
one.touch()
end
end

end

end
Expand All @@ -200,13 +201,14 @@ end


function keyPressed(key)
print("key pressed")
end

----------------------------------------------------
function draw()
of.pushMatrix()
of.pushStyle()

of.enableAlphaBlending()
of.setColor(255, 255, 255, 255)

Expand All @@ -219,12 +221,12 @@ function draw()

for i=1, uber.numBlobs do
local blob = uber.blob(i)

if blob then

of.setColor(255, 0, 0, 128)
of.beginShape()

for k, v in pairs(blob) do
of.vertex(v.x, v.y)
end
Expand All @@ -233,7 +235,7 @@ function draw()
end
end


of.popStyle()
of.popMatrix()
end
Expand Down
10 changes: 6 additions & 4 deletions apps/hec/cc/bin/data/settings.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<?xml version="1.0"?>
<Parameters>
<colormap>117</colormap>
<tolerance>0.0006</tolerance>
Expand All @@ -10,17 +11,18 @@
<erosion_open_2>1</erosion_open_2>
<erosion_close_2>0</erosion_close_2>
<dillate_2>0</dillate_2>
<area_min>5500</area_min>
<area_min>500</area_min>
<area_max>5e+06</area_max>
<use_convex>0</use_convex>
<near>0</near>
<far>8000</far>
<Reset_Background>0</Reset_Background>
<Learning_Time>30</Learning_Time>
<Threshold_Value>10</Threshold_Value>
<Parameters/>
<learing_rate>0.99</learing_rate>
<Parameters />
<learing_rate>0.99</learing_rate>
<reset_Background>0</reset_Background>
<reset_Background_time>5</reset_Background_time>
<epsilon>0</epsilon>
<epsilon>100</epsilon>
<script>0</script>
</Parameters>
1 change: 1 addition & 0 deletions apps/hec/cc/cc.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ copy /Y "$(OF_ROOT)build\bin\luaBox2D_$(Platform)_$(Configuration)"
<FloatingPointModel>Fast</FloatingPointModel>
<Optimization>Full</Optimization>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<LanguageStandard>stdcpplatest</LanguageStandard>
</ClCompile>
<Link>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
Expand Down
15 changes: 12 additions & 3 deletions apps/hec/cc/src/Grabber.cpp
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
#include "Grabber.h"
#include "ofxColorMap/src/ofxColorMap.h"
#include <cmath>


ofGrabber::ofGrabber(std::shared_ptr<ofSettings> settings)
{
_settings = settings;
kinect.open();

if ( !kinect.isOpen() )
{
// display message box
MessageBox(0, _T("Brak kamery Kinect"), _T("Error"), MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}

kinect.initDepthSource();
kinect.initColorSource();
kinect.initInfraredSource();
Expand All @@ -15,7 +22,8 @@ ofGrabber::ofGrabber(std::shared_ptr<ofSettings> settings)

if (kinect.getSensor()->get_CoordinateMapper(&coordinateMapper) < 0)
{
ofLogError() << "Could not acquire CoordinateMapper";
MessageBox(0, _T("Problem z uzyskaniem CoordinateMapper"), _T("Error"), MB_OK | MB_ICONERROR);
exit(EXIT_FAILURE);
}

haveAllStreams = false;
Expand Down Expand Up @@ -84,7 +92,8 @@ void ofGrabber::update()

updateRawDepthLookupTable();
}
// Count number of tracked bodies

// Count number of tracked bodies
numBodiesTracked = 0;
auto& bodies = kinect.getBodySource()->getBodies();
for (auto& body : bodies)
Expand Down
2 changes: 1 addition & 1 deletion apps/hec/cc/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ int main()
app_settings = std::make_shared<ofSettings>();

projector_settings.setSize(1024, 768);
projector_settings.resizable = false;
projector_settings.resizable = true;

shared_ptr<ofAppBaseWindow> projector_window = ofCreateWindow(projector_settings);
projector_window->setVerticalSync(true);
Expand Down
5 changes: 5 additions & 0 deletions apps/hec/cc/src/ofAppGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ constexpr char roi_config_file_name[] = "cc-settings.xml";
//--------------------------------------------------------------
void ofAppGui::setup_gui()
{
gui.setupFlexBoxLayout();

ofxGuiPanel* panel = gui.addPanel(_settings->get_gui_parameters());
panel->loadTheme("theme_default.json", true);

//gui.setup(_settings->get_gui_parameters());
//gui.setPosition(spacing + _settings->image_size_W + 5*spacing, spacing + _settings->image_size_H);

Expand Down

0 comments on commit d1de827

Please sign in to comment.