gui to file / set dev file
This commit is contained in:
parent
380b116f1a
commit
1e3498fbdb
4 changed files with 52 additions and 19 deletions
|
@ -1,4 +1,5 @@
|
|||
ofxAzureKinect
|
||||
ofxGpuParticles
|
||||
ofxGui
|
||||
ofxV4L2
|
||||
ofxShader
|
||||
|
|
6
zoneb/bin/data/settings.xml
Normal file
6
zoneb/bin/data/settings.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<ZONE_B>
|
||||
<XY>-208, -257</XY>
|
||||
<scale>2</scale>
|
||||
<device>video3</device>
|
||||
</ZONE_B>
|
|
@ -39,7 +39,8 @@ void ofApp::setupThermal()
|
|||
v4l2Cam.setDesiredFramerate(60);
|
||||
|
||||
// use this to set appropriate device and capture method
|
||||
v4l2Cam.initGrabber("/dev/video2", IO_METHOD_MMAP, camWidth, camHeight);
|
||||
std::string dev = captureDeviceName;
|
||||
v4l2Cam.initGrabber((std::string("/dev/") + dev).c_str(), IO_METHOD_MMAP, camWidth, camHeight);
|
||||
|
||||
// some initial settings
|
||||
int set_gain = 2.0;
|
||||
|
@ -63,23 +64,8 @@ void ofApp::setupThermal()
|
|||
}
|
||||
}
|
||||
|
||||
void ofApp::setup()
|
||||
void ofApp::setupParticles()
|
||||
{
|
||||
// ofDisableArbTex();
|
||||
// ofSetVerticalSync(false);
|
||||
//ofSetLogLevel(OF_LOG_VERBOSE);
|
||||
|
||||
setupKinect();
|
||||
setupThermal();
|
||||
|
||||
boundShader.allocate(ofGetWidth(), ofGetHeight());
|
||||
boundShader.load("shaders/bound.frag");
|
||||
|
||||
fbos.insert({"ofcam", ofFbo()});
|
||||
fbos.at("ofcam").allocate(ofGetWidth(), ofGetHeight(), GL_RGBA32F_ARB);
|
||||
|
||||
gradient.load("gradient.jpg");
|
||||
|
||||
// 1,000,000 particles
|
||||
unsigned w = 512;
|
||||
unsigned h = 512;
|
||||
|
@ -130,6 +116,36 @@ void ofApp::setup()
|
|||
ofAddListener(particles.drawEvent, this, &ofApp::onParticlesDraw);
|
||||
}
|
||||
|
||||
void ofApp::setupGui()
|
||||
{
|
||||
gui.setup("ZONE B", "settings.xml"); // most of the time you don't need a name
|
||||
gui.add(registrationXY.setup("XY", {-208, -257}, {-400, -400}, {400, 400}));
|
||||
gui.add(registrationScale.setup("scale", 2.0, 0.1, 3));
|
||||
gui.add(captureDeviceName.setup("device", "video3"));
|
||||
gui.loadFromFile("settings.xml");
|
||||
}
|
||||
|
||||
void ofApp::setup()
|
||||
{
|
||||
// ofDisableArbTex();
|
||||
// ofSetVerticalSync(false);
|
||||
//ofSetLogLevel(OF_LOG_VERBOSE);
|
||||
|
||||
setupGui();
|
||||
setupKinect();
|
||||
setupThermal();
|
||||
|
||||
boundShader.allocate(ofGetWidth(), ofGetHeight());
|
||||
boundShader.load("shaders/bound.frag");
|
||||
|
||||
fbos.insert({"ofcam", ofFbo()});
|
||||
fbos.at("ofcam").allocate(ofGetWidth(), ofGetHeight(), GL_RGBA32F_ARB);
|
||||
|
||||
gradient.load("gradient.jpg");
|
||||
|
||||
setupParticles();
|
||||
}
|
||||
|
||||
void ofApp::exit()
|
||||
{
|
||||
kinectDevice.close();
|
||||
|
@ -150,8 +166,8 @@ void ofApp::updateThermal()
|
|||
{
|
||||
for (int j = 0; j < 512; j++)
|
||||
{
|
||||
int x = j * 1.65 - 115;
|
||||
int y = i * 1.65 - 170;
|
||||
int x = j * registrationScale + registrationXY->x;
|
||||
int y = i * registrationScale + registrationXY->y;
|
||||
if (ofInRange(x, 0, camWidth - 1) == false || ofInRange(y, 0, camHeight - 1) == false)
|
||||
{
|
||||
continue;
|
||||
|
@ -251,6 +267,7 @@ void ofApp::drawMain()
|
|||
|
||||
void ofApp::drawDebug()
|
||||
{
|
||||
gui.draw();
|
||||
ofDrawBitmapStringHighlight(ofToString(ofGetFrameRate(), 2) + " FPS", 10, 20);
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
|
||||
#include "ofMain.h"
|
||||
|
||||
#include "ofxGui.h"
|
||||
|
||||
#include "ofxAzureKinect.h"
|
||||
|
||||
#include "ofxShaderFilter.h"
|
||||
|
@ -16,6 +18,8 @@ class ofApp
|
|||
public:
|
||||
void setupKinect();
|
||||
void setupThermal();
|
||||
void setupParticles();
|
||||
void setupGui();
|
||||
void setup();
|
||||
void exit();
|
||||
|
||||
|
@ -55,4 +59,9 @@ private:
|
|||
ofxGpuParticles particles;
|
||||
|
||||
std::vector<std::vector<ofVec3f>> hotspots;
|
||||
|
||||
ofxVec2Slider registrationXY;
|
||||
ofxFloatSlider registrationScale;
|
||||
ofxInputField<std::string> captureDeviceName;
|
||||
ofxPanel gui;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue