From ffbed97a4fe2f434fa7e8abfffd2c3b73cdaf349 Mon Sep 17 00:00:00 2001 From: Nicolas Pope <nwpope@utu.fi> Date: Wed, 5 Jun 2019 19:16:28 +0300 Subject: [PATCH] More warning fixes --- components/common/cpp/include/ftl/cuda_common.hpp | 6 +++--- components/net/cpp/src/peer.cpp | 2 +- components/rgbd-sources/src/algorithms/rtcensus.cpp | 4 ++-- components/rgbd-sources/src/calibrate.cpp | 2 +- components/rgbd-sources/src/disparity.hpp | 4 ++-- components/rgbd-sources/src/local.cpp | 4 ++-- components/rgbd-sources/src/rgbd_source.cpp | 5 +++-- components/rgbd-sources/src/stereovideo_source.cpp | 2 +- 8 files changed, 15 insertions(+), 14 deletions(-) diff --git a/components/common/cpp/include/ftl/cuda_common.hpp b/components/common/cpp/include/ftl/cuda_common.hpp index 91d5a28c3..1df4b1b2f 100644 --- a/components/common/cpp/include/ftl/cuda_common.hpp +++ b/components/common/cpp/include/ftl/cuda_common.hpp @@ -34,7 +34,7 @@ class TextureObject { TextureObject(const TextureObject &t); ~TextureObject(); - int pitch() const { return pitch_; } + size_t pitch() const { return pitch_; } T *devicePtr() { return ptr_; }; __host__ __device__ T *devicePtr(int v) { return &ptr_[v*pitch2_]; } __host__ __device__ int width() const { return width_; } @@ -148,8 +148,8 @@ TextureObject<T>::TextureObject(size_t width, size_t height) { cudaTextureObject_t tex = 0; cudaCreateTextureObject(&tex, &resDesc, &texDesc, NULL); texobj_ = tex; - width_ = width; - height_ = height; + width_ = (int)width; + height_ = (int)height; needsfree_ = true; pitch2_ = pitch_ / sizeof(T); //needsdestroy_ = true; diff --git a/components/net/cpp/src/peer.cpp b/components/net/cpp/src/peer.cpp index 55c5990d8..bb29691e5 100644 --- a/components/net/cpp/src/peer.cpp +++ b/components/net/cpp/src/peer.cpp @@ -111,7 +111,7 @@ static SOCKET tcpConnect(URI &uri) { // TODO(Nick) - Check all returned addresses. auto addr = addrs; - rc = ::connect(csocket, addr->ai_addr, addr->ai_addrlen); + rc = ::connect(csocket, addr->ai_addr, (socklen_t)addr->ai_addrlen); if (rc < 0) { if (errno == EINPROGRESS) { diff --git a/components/rgbd-sources/src/algorithms/rtcensus.cpp b/components/rgbd-sources/src/algorithms/rtcensus.cpp index dbafd2d37..b288045e0 100644 --- a/components/rgbd-sources/src/algorithms/rtcensus.cpp +++ b/components/rgbd-sources/src/algorithms/rtcensus.cpp @@ -43,8 +43,8 @@ static vector<uint64_t> sparse_census_16x16(const Mat &arr) { result.resize(arr.cols*arr.rows, 0); /* Loops adapted to avoid edge out-of-bounds checks */ - for (size_t v=7; v < arr.rows-7; v++) { - for (size_t u=7; u < arr.cols-7; u++) { + for (int v=7; v < arr.rows-7; v++) { + for (int u=7; u < arr.cols-7; u++) { uint64_t r = 0; /* 16x16 sparse kernel to 8x8 mask (64 bits) */ diff --git a/components/rgbd-sources/src/calibrate.cpp b/components/rgbd-sources/src/calibrate.cpp index 7e94ac9ef..05364c507 100644 --- a/components/rgbd-sources/src/calibrate.cpp +++ b/components/rgbd-sources/src/calibrate.cpp @@ -78,7 +78,7 @@ void Calibrate::Settings::write(FileStorage& fs) const { void Calibrate::Settings::read(ftl::Configurable *node) { boardSize.width = node->value<vector<int>>("board_size", {10,10})[0]; boardSize.height = node->value<vector<int>>("board_size", {10,10})[1]; - squareSize = node->value("square_size", 50); + squareSize = node->value("square_size", 50.0f); nrFrames = node->value("num_frames", 20); aspectRatio = node->value("fix_aspect_ratio", false); calibZeroTangentDist = node->value("assume_zero_tangential_distortion", false); diff --git a/components/rgbd-sources/src/disparity.hpp b/components/rgbd-sources/src/disparity.hpp index f5c98f399..c8e363692 100644 --- a/components/rgbd-sources/src/disparity.hpp +++ b/components/rgbd-sources/src/disparity.hpp @@ -53,8 +53,8 @@ class Disparity : public ftl::Configurable { protected: //nlohmann::json &config_; - size_t min_disp_; - size_t max_disp_; + int min_disp_; + int max_disp_; cv::Mat mask_l_; private: diff --git a/components/rgbd-sources/src/local.cpp b/components/rgbd-sources/src/local.cpp index e66396597..d3d33d735 100644 --- a/components/rgbd-sources/src/local.cpp +++ b/components/rgbd-sources/src/local.cpp @@ -263,9 +263,9 @@ bool LocalSource::get(cv::Mat &l, cv::Mat &r) { } if (downsize_ != 1.0f) { - cv::resize(l, l, cv::Size(l.cols * downsize_, l.rows * downsize_), + cv::resize(l, l, cv::Size((int)(l.cols * downsize_), (int)(l.rows * downsize_)), 0, 0, cv::INTER_LINEAR); - cv::resize(r, r, cv::Size(r.cols * downsize_, r.rows * downsize_), + cv::resize(r, r, cv::Size((int)(r.cols * downsize_), (int)(r.rows * downsize_)), 0, 0, cv::INTER_LINEAR); } diff --git a/components/rgbd-sources/src/rgbd_source.cpp b/components/rgbd-sources/src/rgbd_source.cpp index 83ded9fcd..a216529aa 100644 --- a/components/rgbd-sources/src/rgbd_source.cpp +++ b/components/rgbd-sources/src/rgbd_source.cpp @@ -32,8 +32,8 @@ void RGBDSource::getRGBD(cv::Mat &rgb, cv::Mat &depth) { Eigen::Vector4f RGBDSource::point(uint ux, uint uy) { const auto ¶ms = getParameters(); - const float x = ((float)ux-params.width/2) / params.fx; - const float y = ((float)uy-params.height/2) / params.fy; + const float x = ((float)ux-params.width/2) / (float)params.fx; + const float y = ((float)uy-params.height/2) / (float)params.fy; unique_lock<mutex> lk(mutex_); const float depth = depth_.at<float>(uy,ux); @@ -50,6 +50,7 @@ bool RGBDSource::snapshot(const std::string &fileprefix) { cv::imwrite(fileprefix+"-RGB.jpg", rgb); cv::imwrite(fileprefix+"-DEPTH.png",depth); + return true; } RGBDSource *RGBDSource::create(nlohmann::json &config, ftl::net::Universe *net) { diff --git a/components/rgbd-sources/src/stereovideo_source.cpp b/components/rgbd-sources/src/stereovideo_source.cpp index daff717e7..1b2248679 100644 --- a/components/rgbd-sources/src/stereovideo_source.cpp +++ b/components/rgbd-sources/src/stereovideo_source.cpp @@ -103,7 +103,7 @@ static void disparityToDepth(const cv::Mat &disparity, cv::Mat &depth, const cv: cv::Vec4d homg_pt = _Q*cv::Vec4d(x, y, d, 1.0); //dptr[x] = Vec3d(homg_pt.val); //dptr[x] /= homg_pt[3]; - dptr[x] = (homg_pt[2] / homg_pt[3]) / 1000.0f; // Depth in meters + dptr[x] = (float)(homg_pt[2] / homg_pt[3]) / 1000.0f; // Depth in meters if( fabs(d) <= FLT_EPSILON ) dptr[x] = 1000.0f; -- GitLab