Skip to content
Snippets Groups Projects
Commit f716407a authored by Sebastian Hahta's avatar Sebastian Hahta
Browse files

Merge branch 'master' into feature/registration

parents 44f72468 7e1e2795
No related branches found
No related tags found
1 merge request!4Feature/registration
Pipeline #10728 passed
......@@ -164,3 +164,13 @@ configure_file(${CMAKE_SOURCE_DIR}/common/cpp/src/config.cpp.in
${CMAKE_SOURCE_DIR}/common/cpp/src/config.cpp
)
# For issue #17
# https://gitlab.kitware.com/cmake/cmake/issues/16915#note_456382
if ( TARGET Qt5::Core )
get_property( core_options TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_OPTIONS )
string( REPLACE "-fPIC" "" new_core_options "${core_options}" )
set_property( TARGET Qt5::Core PROPERTY INTERFACE_COMPILE_OPTIONS ${new_core_options} )
set_property( TARGET Qt5::Core PROPERTY INTERFACE_POSITION_INDEPENDENT_CODE "ON" )
set( CMAKE_CXX_COMPILE_OPTIONS_PIE "-fPIC" )
endif()
......@@ -10,7 +10,10 @@
"nostereo": false,
"scale": 1.0,
"flip_vert": false,
"max_fps": 25
"max_fps": 25,
"width": 640,
"height": 480,
"crosshair": false
},
"calibrate": false,
"calibration": {
......@@ -55,7 +58,8 @@
"points": true,
"depth": false,
"left": false,
"right": false
"right": false,
"crosshair": false
},
"net": {
"listen": "tcp://*:9001",
......
......@@ -33,7 +33,8 @@ class Display {
explicit Display(nlohmann::json &config, std::string name);
~Display();
bool render(const cv::Mat &rgb, const cv::Mat &depth, const cv::Mat &q);
inline bool render(const cv::Mat &rgb, const cv::Mat &depth, const cv::Mat &q) { return render(rgb, cv::Mat(), q); }
bool render(const cv::Mat &rgb, const cv::Mat &rgbr, const cv::Mat &depth, const cv::Mat &q);
#if defined HAVE_PCL
bool render(pcl::PointCloud<pcl::PointXYZRGB>::ConstPtr);
......
......@@ -85,7 +85,7 @@ Display::~Display() {
#endif // HAVE_VIZ
}
bool Display::render(const cv::Mat &rgb, const cv::Mat &depth, const cv::Mat &q) {
bool Display::render(const cv::Mat &rgb, const cv::Mat &rgbr, const cv::Mat &depth, const cv::Mat &q) {
Mat idepth;
if (config_["points"] && q.rows != 0) {
......@@ -125,7 +125,20 @@ bool Display::render(const cv::Mat &rgb, const cv::Mat &depth, const cv::Mat &q)
}
if (config_["left"]) {
cv::imshow("RGB: " + name_, rgb);
if (config_["crosshair"]) {
cv::line(rgb, cv::Point(0, rgb.rows/2), cv::Point(rgb.cols-1, rgb.rows/2), cv::Scalar(0,0,255), 1);
cv::line(rgb, cv::Point(rgb.cols/2, 0), cv::Point(rgb.cols/2, rgb.rows-1), cv::Scalar(0,0,255), 1);
}
cv::namedWindow("Left: " + name_, cv::WINDOW_KEEPRATIO);
cv::imshow("Left: " + name_, rgb);
}
if (config_["right"]) {
if (config_["crosshair"]) {
cv::line(rgbr, cv::Point(0, rgbr.rows/2), cv::Point(rgbr.cols-1, rgbr.rows/2), cv::Scalar(0,0,255), 1);
cv::line(rgbr, cv::Point(rgbr.cols/2, 0), cv::Point(rgbr.cols/2, rgbr.rows-1), cv::Scalar(0,0,255), 1);
}
cv::namedWindow("Right: " + name_, cv::WINDOW_KEEPRATIO);
cv::imshow("Right: " + name_, rgbr);
}
if (config_["depth"]) {
......@@ -197,7 +210,7 @@ void Display::wait(int ms) {
#endif // HAVE_VIZ
}
if (config_["disparity"]) {
if (config_["disparity"] || config_["left"] || config_["right"]) {
if(cv::waitKey(ms) == 27) {
// exit if ESC is pressed
active_ = false;
......
......@@ -58,6 +58,15 @@ LocalSource::LocalSource(nlohmann::json &config)
stereo_ = false;
LOG(WARNING) << "Not able to find second camera for stereo";
} else {
camera_a_->set(cv::CAP_PROP_FRAME_WIDTH,(int)config["width"]);
camera_a_->set(cv::CAP_PROP_FRAME_HEIGHT,(int)config["height"]);
camera_b_->set(cv::CAP_PROP_FRAME_WIDTH,(int)config["width"]);
camera_b_->set(cv::CAP_PROP_FRAME_HEIGHT,(int)config["height"]);
Mat frame;
camera_a_->grab();
camera_a_->retrieve(frame);
LOG(INFO) << "Video size : " << frame.cols << "x" << frame.rows;
stereo_ = true;
}
......
......@@ -184,7 +184,7 @@ static void run(const string &file) {
});
// Send RGB+Depth images for local rendering
if (pl.rows > 0) display.render(pl, pdisp, Q_32F);
if (pl.rows > 0) display.render(pl, r, pdisp, Q_32F);
display.wait(1);
// Wait for both pipelines to complete
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment