Skip to content

Commit

Permalink
demo fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
nohayassin committed May 10, 2021
1 parent da17b5b commit 8f20392
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 15 deletions.
1 change: 0 additions & 1 deletion examples/align/rs-align.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <librealsense2/rs.hpp>
#include "example-imgui.hpp"
#include "../examples/example-utils.hpp"

/*
This example introduces the concept of spatial stream alignment.
Expand Down
1 change: 0 additions & 1 deletion examples/ar-advanced/rs-ar-advanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include <fstream>
#include <vector>
#include "example.hpp"
#include "../examples/example-utils.hpp"

struct point3d {
float f[3];
Expand Down
1 change: 1 addition & 0 deletions examples/example.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <functional>

#include "../third-party/stb_easy_font.h"
#include "example-utils.hpp"

#ifndef PI
#define PI 3.14159265358979323846
Expand Down
1 change: 0 additions & 1 deletion examples/measure/rs-measure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#include <thread>
#include <atomic>
#include <mutex>
#include "../examples/example-utils.hpp"

using pixel = std::pair<int, int>;

Expand Down
1 change: 1 addition & 0 deletions examples/pose-and-image/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ endif()
if(BUILD_EXAMPLES)
add_executable(rs-pose-and-image rs-pose-and-image.cpp)
target_link_libraries(rs-pose-and-image ${DEPENDENCIES})
include_directories(../../examples)
set_target_properties (rs-pose-and-image PROPERTIES FOLDER Examples)
install(TARGETS rs-pose-and-image RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
2 changes: 1 addition & 1 deletion examples/pose-and-image/rs-pose-and-image.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <chrono>
#include <thread>
#include <mutex>
#include "../examples/example-utils.hpp"
#include "example.hpp"

int main(int argc, char * argv[]) try
{
Expand Down
1 change: 1 addition & 0 deletions examples/pose-predict/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if(BUILD_EXAMPLES)
add_executable(rs-pose-predict rs-pose-predict.cpp)
set_property(TARGET rs-pose-predict PROPERTY CXX_STANDARD 11)
target_link_libraries(rs-pose-predict ${DEPENDENCIES})
include_directories(../../examples)
set_target_properties (rs-pose-predict PROPERTIES FOLDER Examples)
install(TARGETS rs-pose-predict RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
2 changes: 1 addition & 1 deletion examples/pose-predict/rs-pose-predict.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <math.h>
#include <float.h>
#include "../examples/example-utils.hpp"
#include "example.hpp"

inline rs2_quaternion quaternion_exp(rs2_vector v)
{
Expand Down
1 change: 1 addition & 0 deletions examples/pose/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if(BUILD_EXAMPLES)
add_executable(rs-pose rs-pose.cpp)
set_property(TARGET rs-pose PROPERTY CXX_STANDARD 11)
target_link_libraries(rs-pose ${DEPENDENCIES})
include_directories(../../examples)
set_target_properties (rs-pose PROPERTIES FOLDER Examples)
install(TARGETS rs-pose RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
endif()
2 changes: 1 addition & 1 deletion examples/pose/rs-pose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <librealsense2/rs.hpp>
#include <iostream>
#include <iomanip>
#include "../examples/example-utils.hpp"
#include "example.hpp"

int main(int argc, char * argv[]) try
{
Expand Down
1 change: 0 additions & 1 deletion examples/trajectory/rs-trajectory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <librealsense2/rs.hpp>
#include "example.hpp" // Include short list of convenience functions for rendering
#include <cstring>
#include "../examples/example-utils.hpp"

struct short3
{
Expand Down
2 changes: 1 addition & 1 deletion tools/benchmark/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ endif()
if(BUILD_GRAPHICAL_EXAMPLES)
add_executable(rs-benchmark rs-benchmark.cpp ../../third-party/glad/glad.c)
target_link_libraries(rs-benchmark ${DEPENDENCIES} realsense2-gl)
include_directories(../../third-party/tclap/include ../../third-party/glad)
include_directories(../../third-party/tclap/include ../../third-party/glad ../../examples)
set_target_properties (rs-benchmark PROPERTIES
FOLDER Tools
)
Expand Down
24 changes: 21 additions & 3 deletions tools/benchmark/rs-benchmark.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <fstream>

#include "tclap/CmdLine.h"
#include "../examples/example-utils.hpp"
#include "example-utils.hpp"

using namespace std;
using namespace chrono;
Expand Down Expand Up @@ -208,9 +208,24 @@ class gl_blocks : public suite
int main(int argc, char** argv) try
{
std::string serial;
if (!device_with_streams({ RS2_STREAM_COLOR,RS2_STREAM_DEPTH }, serial))
enum second_stream {
rgb_stream,
ir_stream
};
second_stream second_stream;
if (!device_with_streams({ RS2_STREAM_DEPTH }, serial))
return EXIT_SUCCESS;

if (device_with_streams({ RS2_STREAM_COLOR }, serial))
second_stream = rgb_stream;
else if (device_with_streams({ RS2_STREAM_INFRARED }, serial))
second_stream = ir_stream;
else
{
std::cout<< " Connect a device that supports either RGB stream or Infrared stream." <<std::endl;
return EXIT_SUCCESS;
}

CmdLine cmd("librealsense rs-benchmark tool", ' ', RS2_API_VERSION_STR);
cmd.parse(argc, argv);

Expand Down Expand Up @@ -244,7 +259,10 @@ int main(int argc, char** argv) try
if (!serial.empty())
cfg.enable_device(serial);
cfg.enable_stream(RS2_STREAM_DEPTH);
cfg.enable_stream(RS2_STREAM_COLOR, RS2_FORMAT_YUYV, 30);
if(second_stream == rgb_stream)
cfg.enable_stream(RS2_STREAM_COLOR, RS2_FORMAT_YUYV, 30);
else
cfg.enable_stream(RS2_STREAM_INFRARED);
auto prof = p.start(cfg);
auto dev = prof.get_device();
auto name = dev.get_info(RS2_CAMERA_INFO_NAME);
Expand Down
2 changes: 1 addition & 1 deletion wrappers/python/examples/align-depth2color.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
found_rgb = True
break
if not found_rgb:
print("The connected device does not support RGB stream")
print("The demo requires Depth camera with Color sensor")
exit(0)

config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
Expand Down
2 changes: 1 addition & 1 deletion wrappers/python/examples/opencv_pointcloud_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def pivot(self):
found_rgb = True
break
if not found_rgb:
print("The connected device does not support RGB stream")
print("The demo requires Depth camera with Color sensor")
exit(0)

config.enable_stream(rs.stream.depth, rs.format.z16, 30)
Expand Down
2 changes: 1 addition & 1 deletion wrappers/python/examples/opencv_viewer_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
found_rgb = True
break
if not found_rgb:
print("The connected device does not support RGB stream")
print("The demo requires Depth camera with Color sensor")
exit(0)

config.enable_stream(rs.stream.depth, 640, 480, rs.format.z16, 30)
Expand Down
2 changes: 1 addition & 1 deletion wrappers/python/examples/pyglet_pointcloud_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def rotation(self):
found_rgb = True
break
if not found_rgb:
print("The connected device does not support RGB stream")
print("The demo requires Depth camera with Color sensor")
exit(0)

config.enable_stream(rs.stream.depth, rs.format.z16, 30)
Expand Down

0 comments on commit 8f20392

Please sign in to comment.