easy calib mode
This commit is contained in:
parent
61ee9e7240
commit
9428900252
5 changed files with 25 additions and 23 deletions
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0"?>
|
||||
<ZONE_B>
|
||||
<XY>-195.918, -220.408</XY>
|
||||
<XY>36.7347, 8.16327</XY>
|
||||
<scale>1.869</scale>
|
||||
<device>video3</device>
|
||||
</ZONE_B>
|
||||
|
|
|
@ -8,6 +8,10 @@ uniform sampler2DRect u_v4l2cam;
|
|||
uniform sampler2DRect u_buffer0;
|
||||
uniform sampler2DRect u_buffer1;
|
||||
|
||||
uniform bool u_calib;
|
||||
uniform vec2 u_calibXY;
|
||||
uniform float u_calibScale;
|
||||
|
||||
uniform vec2 u_resolution;
|
||||
uniform vec2 u_mouse;
|
||||
uniform float u_time;
|
||||
|
@ -172,25 +176,17 @@ void main() {
|
|||
gl_FragColor = texture(u_buffer0, st);
|
||||
#else
|
||||
// Main Buffer
|
||||
vec2 st2 = st + vec2(simplex3d_fractal(vec3(st/200,u_time/4)), simplex3d_fractal(vec3(u_time/4,st.ts/200))) * 40;
|
||||
vec3 dispColor = vec3(0, 0, 0);
|
||||
vec4 pointCloudColor = texture(u_ofcam, st);
|
||||
|
||||
// float maxVal = 0;
|
||||
// float minVal = 1;
|
||||
// for (int i=0; i < 9; i++){
|
||||
// float tmp = texture(u_buffer1, st2 + offset[i]/2).r > 0.5 ? 1 : 0;
|
||||
// maxVal = max(maxVal, tmp);
|
||||
// minVal = min(minVal, tmp);
|
||||
// }
|
||||
|
||||
// if(maxVal - minVal >= 0.5) {
|
||||
// dispColor.rgb = vec3(1);
|
||||
// }
|
||||
|
||||
// gl_FragColor = vec4(dispColor, 1.0);
|
||||
// gl_FragColor.rgb += pointCloudColor.rgb; // not good
|
||||
gl_FragColor = vec4(mix(vec3(0), pointCloudColor.rgb, pointCloudColor.a), 1.0);
|
||||
if (u_calib) {
|
||||
vec4 depth = texture(u_depth, st);
|
||||
depth.r *= 100;
|
||||
depth.a = 0;
|
||||
vec4 v4l2 = texture(u_v4l2cam, st);
|
||||
gl_FragColor = depth + v4l2;
|
||||
}
|
||||
else {
|
||||
vec4 pointCloudColor = texture(u_ofcam, st);
|
||||
gl_FragColor = vec4(mix(vec3(0), pointCloudColor.rgb, pointCloudColor.a), 1.0);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
@ -102,7 +102,8 @@ void main()
|
|||
vec3 remapedColorW = texture(warm1, palette).xyz;
|
||||
vec3 remapedColorC = texture(cold2, palette).xyz;
|
||||
float d = 50;
|
||||
float rate = smoothstep(500 - d, 500 + d, length(vPos.x - uHottest3d1.x) + simplex3d(vPos * vec3(0.001, 0.001, 0.1)) * 100);
|
||||
float D = 400;
|
||||
float rate = smoothstep(D - d, D + d, length(vPos.x - uHottest3d1.x) + simplex3d(vPos * vec3(0.001, 0.001, 0.1)) * 100);
|
||||
vec3 remapedColor = mix(remapedColorW, remapedColorC, rate);
|
||||
float alpha = max(0, 1 - pow(vAge,4));
|
||||
|
||||
|
|
|
@ -130,6 +130,7 @@ void ofApp::setupGui()
|
|||
gui.setPosition(10, 10);
|
||||
|
||||
debugGui.setup("DEBUG");
|
||||
debugGui.add(calibMode.setup("calib", false));
|
||||
debugGui.add(dummyMode.setup("dummy", true)); // should be false
|
||||
debugGui.add(dummyXY.setup("XY", {256, 256}, {0, 0}, {511, 511})); // should be false
|
||||
debugGui.add(debugFps.setup("FPS", "0"));
|
||||
|
@ -191,8 +192,8 @@ void ofApp::updateThermal()
|
|||
{
|
||||
for (int j = 0; j < 512; j++)
|
||||
{
|
||||
int x = j * registrationScale + registrationXY->x;
|
||||
int y = i * registrationScale + registrationXY->y;
|
||||
int x = (j - 256) * registrationScale + 256 + registrationXY->x;
|
||||
int y = (i - 256) * registrationScale + 256 + registrationXY->y;
|
||||
if (ofInRange(x, 0, camWidth - 1) == false || ofInRange(y, 0, camHeight - 1) == false)
|
||||
{
|
||||
continue;
|
||||
|
@ -288,6 +289,9 @@ void ofApp::drawMain()
|
|||
boundShader.setUniformTexture("u_depth", tex);
|
||||
boundShader.setUniformTexture("u_ofcam", fbos.at("ofcam"));
|
||||
boundShader.setUniformTexture("u_v4l2cam", v4l2Tex);
|
||||
boundShader.setUniform1i("u_calib", calibMode == true ? 1 : 0);
|
||||
boundShader.setUniform2f("u_calibXY", registrationXY);
|
||||
boundShader.setUniform1f("u_calibScale", registrationScale);
|
||||
boundShader.setUniform1i("u_init", 1);
|
||||
boundShader.render();
|
||||
boundShader.setUniform1i("u_init", 0);
|
||||
|
|
|
@ -68,6 +68,7 @@ private:
|
|||
ofxInputField<std::string> captureDeviceName;
|
||||
ofxPanel gui;
|
||||
|
||||
ofxToggle calibMode;
|
||||
ofxToggle dummyMode;
|
||||
ofxVec2Slider dummyXY;
|
||||
ofxLabel debugFps;
|
||||
|
|
Loading…
Reference in a new issue