-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
LAPTOP-IA7I9L7L\hiroy
committed
Apr 16, 2019
1 parent
a002a70
commit 0b5dd46
Showing
30 changed files
with
272 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 0 additions & 1 deletion
1
example/simple/addons.make → example/aligned_example/addons.make
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
ofxGui | ||
ofxLibRealSense2P |
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#include "ofApp.h" | ||
|
||
//-------------------------------------------------------------- | ||
void ofApp::setup(){ | ||
realsense.setupDevice(0); | ||
//setup different resolution | ||
realsense.enableDepth(1280, 720); | ||
realsense.enableColor(640, 480); | ||
realsense.startStream(); | ||
|
||
//align depth and color pixel size | ||
realsense.setAligned(true); | ||
} | ||
|
||
//-------------------------------------------------------------- | ||
void ofApp::update(){ | ||
realsense.update(); | ||
} | ||
|
||
//-------------------------------------------------------------- | ||
void ofApp::draw(){ | ||
//pixel size is aligned even if it setup different resolution! | ||
realsense.drawDepth(0, 0); | ||
realsense.drawColor(640, 0); | ||
} | ||
|
||
//-------------------------------------------------------------- | ||
void ofApp::keyPressed(int key){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void ofApp::keyReleased(int key){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void ofApp::mouseMoved(int x, int y ){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void ofApp::mouseDragged(int x, int y, int button){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void ofApp::mousePressed(int x, int y, int button){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void ofApp::mouseReleased(int x, int y, int button){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void ofApp::mouseEntered(int x, int y){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void ofApp::mouseExited(int x, int y){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void ofApp::windowResized(int w, int h){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void ofApp::gotMessage(ofMessage msg){ | ||
|
||
} | ||
|
||
//-------------------------------------------------------------- | ||
void ofApp::dragEvent(ofDragInfo dragInfo){ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
example/recorder/addons.make → example/playback_example/addons.make
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
ofxGui | ||
ofxLibRealSense2P |
Empty file.
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
ofxLibRealSense2P |
Binary file not shown.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
File renamed without changes.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#include "ofMain.h" | ||
#include "ofApp.h" | ||
|
||
//======================================================================== | ||
int main( ){ | ||
ofSetupOpenGL(1024,768,OF_WINDOW); // <-------- setup the GL context | ||
|
||
// this kicks off the running of my app | ||
// can be OF_WINDOW or OF_FULLSCREEN | ||
// pass in width and height too: | ||
ofRunApp(new ofApp()); | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#pragma once | ||
|
||
#include "ofMain.h" | ||
#include "ofxLibRealSense2P.h" | ||
#include "ofxLRS2/GuiUtils.h" | ||
#include "ofxGui.h" | ||
|
||
class ofApp : public ofBaseApp{ | ||
|
||
public: | ||
void setup(); | ||
void update(); | ||
void draw(); | ||
|
||
void keyPressed(int key); | ||
void keyReleased(int key); | ||
void mouseMoved(int x, int y ); | ||
void mouseDragged(int x, int y, int button); | ||
void mousePressed(int x, int y, int button); | ||
void mouseReleased(int x, int y, int button); | ||
void mouseEntered(int x, int y); | ||
void mouseExited(int x, int y); | ||
void windowResized(int w, int h); | ||
void dragEvent(ofDragInfo dragInfo); | ||
void gotMessage(ofMessage msg); | ||
|
||
ofxLibRealSense2P realsense; | ||
GuiUtils guiUtils; | ||
ofxPanel gui; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#include "GuiUtils.h" | ||
|
||
|
||
|
||
GuiUtils::GuiUtils() | ||
{ | ||
} | ||
|
||
|
||
GuiUtils::~GuiUtils() | ||
{ | ||
} | ||
|
||
ofParameterGroup& GuiUtils::setupGUI(ofxLibRealSense2P* realsense) | ||
{ | ||
rs2::sensor sensor = realsense->rs2device.query_sensors()[realsense->deviceId]; | ||
rs2::option_range orExp = sensor.get_option_range(RS2_OPTION_EXPOSURE); | ||
rs2::option_range orGain = sensor.get_option_range(RS2_OPTION_GAIN); | ||
rs2::option_range orMinDist = realsense->rs2colorizer.get_option_range(RS2_OPTION_MIN_DISTANCE); | ||
rs2::option_range orMaxDist = realsense->rs2colorizer.get_option_range(RS2_OPTION_MAX_DISTANCE); | ||
|
||
_D400Params.setName("D400_" + realsense->rs2config.getDeviceSerial()); | ||
_D400Params.add(_autoExposure.set("Auto exposure", (bool)sensor.get_option(RS2_OPTION_EXPOSURE))); | ||
_D400Params.add(_enableEmitter.set("Emitter", (bool)sensor.get_option(RS2_OPTION_EMITTER_ENABLED))); | ||
_D400Params.add(_irExposure.set("IR Exposure", orExp.def, orExp.min, 26000)); | ||
_D400Params.add(_depthMin.set("Min Depth", orMinDist.def, orMinDist.min, orMinDist.max)); | ||
_D400Params.add(_depthMax.set("Max Depth", orMaxDist.def, orMaxDist.min, orMaxDist.max)); | ||
|
||
for (auto filter : realsense->filters) | ||
{ | ||
ofParameterGroup group; | ||
group.setName(filter->getFilterName()); | ||
group.add(*filter->getIsEnabled()); | ||
for (auto s : filter->getSliders()) | ||
{ | ||
group.add(*s); | ||
} | ||
_D400Params.add(group); | ||
} | ||
|
||
_autoExposure.addListener(this, &GuiUtils::onD400BoolParamChanged); | ||
_enableEmitter.addListener(this, &GuiUtils::onD400BoolParamChanged); | ||
_irExposure.addListener(this, &GuiUtils::onD400IntParamChanged); | ||
_depthMin.addListener(this, &GuiUtils::onD400ColorizerParamChanged); | ||
_depthMax.addListener(this, &GuiUtils::onD400ColorizerParamChanged); | ||
|
||
return _D400Params; | ||
} | ||
|
||
|
||
void GuiUtils::onD400BoolParamChanged(bool &value) | ||
{ | ||
rs2::sensor sensor = realsense->rs2_pipeline->get_active_profile().get_device().first<rs2::depth_sensor>(); | ||
if (sensor.supports(RS2_OPTION_ENABLE_AUTO_EXPOSURE)) | ||
sensor.set_option(RS2_OPTION_ENABLE_AUTO_EXPOSURE, _autoExposure ? 1.0f : 0.0f); | ||
if (sensor.supports(RS2_OPTION_EMITTER_ENABLED)) | ||
sensor.set_option(RS2_OPTION_EMITTER_ENABLED, _enableEmitter ? 1.0f : 0.0f); | ||
} | ||
|
||
|
||
void GuiUtils::onD400IntParamChanged(int &value) | ||
{ | ||
rs2::sensor sensor = realsense->rs2_pipeline->get_active_profile().get_device().first<rs2::depth_sensor>(); | ||
if (sensor.supports(RS2_OPTION_EXPOSURE)) | ||
sensor.set_option(RS2_OPTION_EXPOSURE, (float)_irExposure); | ||
} | ||
|
||
|
||
void GuiUtils::onD400ColorizerParamChanged(float &value) | ||
{ | ||
realsense->rs2colorizer.set_option(RS2_OPTION_HISTOGRAM_EQUALIZATION_ENABLED, 0); | ||
|
||
if (realsense->rs2colorizer.supports(RS2_OPTION_MIN_DISTANCE)) | ||
realsense->rs2colorizer.set_option(RS2_OPTION_MIN_DISTANCE, _depthMin); | ||
if (realsense->rs2colorizer.supports(RS2_OPTION_MAX_DISTANCE)) | ||
realsense->rs2colorizer.set_option(RS2_OPTION_MAX_DISTANCE, _depthMax); | ||
} | ||
|
||
|
||
ofParameterGroup& GuiUtils::getGui() | ||
{ | ||
return _D400Params; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#pragma once | ||
#include "ofxLibRealSense2P.h" | ||
#include <librealsense2/rs.hpp> | ||
#include <librealsense2/rsutil.h> | ||
|
||
class GuiUtils | ||
{ | ||
public: | ||
GuiUtils(); | ||
~GuiUtils(); | ||
|
||
ofParameterGroup& setupGUI(ofxLibRealSense2P* realsense); | ||
ofParameterGroup& getGui(); | ||
private: | ||
|
||
void onD400BoolParamChanged(bool &value); | ||
void onD400IntParamChanged(int &value); | ||
void onD400ColorizerParamChanged(float &value); | ||
//attribute | ||
ofParameterGroup _D400Params; | ||
ofParameter<bool> _autoExposure; | ||
ofParameter<bool> _enableEmitter; | ||
ofParameter<int> _irExposure; | ||
ofParameter<float> _depthMin; | ||
ofParameter<float> _depthMax; | ||
ofxLibRealSense2P* realsense; | ||
}; | ||
|
Oops, something went wrong.