thermo delay
This commit is contained in:
parent
a42886c0ca
commit
4d1349f720
3 changed files with 16 additions and 7 deletions
|
@ -3,4 +3,5 @@
|
||||||
<XY>61.2245, -12.2449</XY>
|
<XY>61.2245, -12.2449</XY>
|
||||||
<scale>1.869</scale>
|
<scale>1.869</scale>
|
||||||
<device>video3</device>
|
<device>video3</device>
|
||||||
|
<thermo_delay>7</thermo_delay>
|
||||||
</ZONE_B>
|
</ZONE_B>
|
||||||
|
|
|
@ -50,9 +50,11 @@ void ofApp::setupThermal()
|
||||||
v4l2Cam.settings(ofxV4L2_AUTOGAIN, set_autogain);
|
v4l2Cam.settings(ofxV4L2_AUTOGAIN, set_autogain);
|
||||||
v4l2Cam.settings(ofxV4L2_GAIN, set_gain);
|
v4l2Cam.settings(ofxV4L2_GAIN, set_gain);
|
||||||
|
|
||||||
// we use a texture because the ofxV4L2 class has no draw method (yet)
|
v4l2Buffer.resize(60);
|
||||||
// we use GL_LUMINANCE because the ofxV4L2 class supports only grayscale (for now)
|
for (int i = 0; i < v4l2Buffer.size(); i++)
|
||||||
v4l2Tex.allocate(512, 512, GL_RGB);
|
{
|
||||||
|
v4l2Buffer.at(i).allocate(512, 512, GL_RGB);
|
||||||
|
}
|
||||||
|
|
||||||
v4l2Pixels.allocate(512, 512, OF_PIXELS_RGB);
|
v4l2Pixels.allocate(512, 512, OF_PIXELS_RGB);
|
||||||
for (int i = 0; i < 512; i++)
|
for (int i = 0; i < 512; i++)
|
||||||
|
@ -125,13 +127,14 @@ void ofApp::setupGui()
|
||||||
gui.setup("ZONE B", "settings.xml"); // most of the time you don't need a name
|
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(registrationXY.setup("XY", {-208, -257}, {-400, -400}, {400, 400}));
|
||||||
gui.add(registrationScale.setup("scale", 2.0, 0.1, 3));
|
gui.add(registrationScale.setup("scale", 2.0, 0.1, 3));
|
||||||
|
gui.add(v4l2Delay.setup("thermo delay", 0, 0, 59));
|
||||||
gui.add(captureDeviceName.setup("device", "video3"));
|
gui.add(captureDeviceName.setup("device", "video3"));
|
||||||
gui.loadFromFile("settings.xml");
|
gui.loadFromFile("settings.xml");
|
||||||
gui.setPosition(10, 10);
|
gui.setPosition(10, 10);
|
||||||
|
|
||||||
debugGui.setup("DEBUG");
|
debugGui.setup("DEBUG");
|
||||||
debugGui.add(calibMode.setup("calib", false));
|
debugGui.add(calibMode.setup("calib", false));
|
||||||
debugGui.add(dummyMode.setup("dummy", true)); // should be false
|
debugGui.add(dummyMode.setup("dummy", true)); // should be false
|
||||||
debugGui.add(dummyXY.setup("XY", {0, 0}, {-500, -1000}, {500, 500})); // should be false
|
debugGui.add(dummyXY.setup("XY", {0, 0}, {-500, -1000}, {500, 500})); // should be false
|
||||||
debugGui.add(debugFps.setup("FPS", "0"));
|
debugGui.add(debugFps.setup("FPS", "0"));
|
||||||
debugGui.setPosition(230, 10);
|
debugGui.setPosition(230, 10);
|
||||||
|
@ -211,7 +214,9 @@ void ofApp::updateThermal()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
v4l2Tex.allocate(v4l2Pixels);
|
v4l2Buffer.at(v4l2BufferCount).allocate(v4l2Pixels);
|
||||||
|
v4l2BufferCount = (v4l2BufferCount + 1) % (v4l2Delay + 1);
|
||||||
|
|
||||||
struct
|
struct
|
||||||
{
|
{
|
||||||
bool operator()(ofVec3f a, ofVec3f b) const
|
bool operator()(ofVec3f a, ofVec3f b) const
|
||||||
|
@ -305,7 +310,7 @@ void ofApp::drawMain()
|
||||||
auto tex = kinectDevice.getDepthTex();
|
auto tex = kinectDevice.getDepthTex();
|
||||||
boundShader.setUniformTexture("u_depth", tex);
|
boundShader.setUniformTexture("u_depth", tex);
|
||||||
boundShader.setUniformTexture("u_ofcam", fbos.at("ofcam"));
|
boundShader.setUniformTexture("u_ofcam", fbos.at("ofcam"));
|
||||||
boundShader.setUniformTexture("u_v4l2cam", v4l2Tex);
|
boundShader.setUniformTexture("u_v4l2cam", v4l2Buffer.at(v4l2BufferCount));
|
||||||
boundShader.setUniform1i("u_calib", calibMode == true ? 1 : 0);
|
boundShader.setUniform1i("u_calib", calibMode == true ? 1 : 0);
|
||||||
boundShader.setUniform2f("u_calibXY", registrationXY);
|
boundShader.setUniform2f("u_calibXY", registrationXY);
|
||||||
boundShader.setUniform1f("u_calibScale", registrationScale);
|
boundShader.setUniform1f("u_calibScale", registrationScale);
|
||||||
|
@ -328,7 +333,7 @@ void ofApp::draw()
|
||||||
{
|
{
|
||||||
particles.whateverImages.at("u_depth") = kinectDevice.getDepthTex();
|
particles.whateverImages.at("u_depth") = kinectDevice.getDepthTex();
|
||||||
particles.whateverImages.at("u_world") = kinectDevice.getDepthToWorldTex();
|
particles.whateverImages.at("u_world") = kinectDevice.getDepthToWorldTex();
|
||||||
particles.whateverImages.at("u_v4l2cam") = v4l2Tex;
|
particles.whateverImages.at("u_v4l2cam") = v4l2Buffer.at(v4l2BufferCount);
|
||||||
|
|
||||||
fbos.at("ofcam").begin();
|
fbos.at("ofcam").begin();
|
||||||
ofClear(0);
|
ofClear(0);
|
||||||
|
|
|
@ -55,6 +55,8 @@ private:
|
||||||
|
|
||||||
ofxV4L2 v4l2Cam;
|
ofxV4L2 v4l2Cam;
|
||||||
ofTexture v4l2Tex;
|
ofTexture v4l2Tex;
|
||||||
|
std::vector<ofTexture> v4l2Buffer;
|
||||||
|
int v4l2BufferCount;
|
||||||
ofPixels v4l2Pixels;
|
ofPixels v4l2Pixels;
|
||||||
|
|
||||||
ofxGpuParticles particles;
|
ofxGpuParticles particles;
|
||||||
|
@ -66,6 +68,7 @@ private:
|
||||||
|
|
||||||
ofxVec2Slider registrationXY;
|
ofxVec2Slider registrationXY;
|
||||||
ofxFloatSlider registrationScale;
|
ofxFloatSlider registrationScale;
|
||||||
|
ofxIntSlider v4l2Delay;
|
||||||
ofxInputField<std::string> captureDeviceName;
|
ofxInputField<std::string> captureDeviceName;
|
||||||
ofxPanel gui;
|
ofxPanel gui;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue