diff --git a/wrappers/opencv/depth-filter/rs-depth-filter.cpp b/wrappers/opencv/depth-filter/rs-depth-filter.cpp index 2c56b8bbec..dc4923c050 100644 --- a/wrappers/opencv/depth-filter/rs-depth-filter.cpp +++ b/wrappers/opencv/depth-filter/rs-depth-filter.cpp @@ -10,7 +10,7 @@ #include "tiny-profiler.h" #include "downsample.h" -rs2_intrinsics operator/(const rs2_intrinsics& i, float f) +rs2_intrinsics operator/(const rs2_intrinsics& i, int f) { rs2_intrinsics res = i; res.width /= f; res.height /= f; diff --git a/wrappers/opencv/dnn/rs-dnn.cpp b/wrappers/opencv/dnn/rs-dnn.cpp index c14028a537..f9525e84c2 100644 --- a/wrappers/opencv/dnn/rs-dnn.cpp +++ b/wrappers/opencv/dnn/rs-dnn.cpp @@ -67,7 +67,7 @@ int main(int argc, char** argv) try // but the color did not update, continue static int last_frame_number = 0; if (color_frame.get_frame_number() == last_frame_number) continue; - last_frame_number = color_frame.get_frame_number(); + last_frame_number = static_cast(color_frame.get_frame_number()); // Convert RealSense frame to OpenCV matrix: auto color_mat = frame_to_mat(color_frame); diff --git a/wrappers/opencv/latency-tool/latency-detector.h b/wrappers/opencv/latency-tool/latency-detector.h index f5d6ba53ba..de98a3e616 100644 --- a/wrappers/opencv/latency-tool/latency-detector.h +++ b/wrappers/opencv/latency-tool/latency-detector.h @@ -172,7 +172,7 @@ class detector void end_render() { auto duration = std::chrono::high_resolution_clock::now() - _render_start; - _render_time.add(std::chrono::duration_cast(duration).count()); + _render_time.add(static_cast(std::chrono::duration_cast(duration).count())); } ~detector() @@ -193,7 +193,7 @@ class detector // to this point in time (when it is first accessible to the application) auto toa = f.get_frame_metadata(RS2_FRAME_METADATA_TIME_OF_ARRIVAL); rs2_error* e; - _processing_time.add(rs2_get_time(&e) - toa); + _processing_time.add(static_cast(rs2_get_time(&e) - toa)); auto duration = std::chrono::high_resolution_clock::now() - _start_time; auto ms = std::chrono::duration_cast(duration).count(); @@ -212,7 +212,7 @@ class detector { auto now = std::chrono::high_resolution_clock::now(); auto duration = now - _start_time; - auto ms = std::chrono::duration_cast(duration).count(); + auto ms = static_cast(std::chrono::duration_cast(duration).count()); auto next = ms % (1 << (_digits - 2)); if (next == _next_value) next++; _next_value = next; @@ -333,8 +333,8 @@ class detector }); if (circles.size() > 1) { - int min_x = circles[0][0]; - int max_x = circles[circles.size() - 1][0]; + int min_x = static_cast(circles[0][0]); + int max_x = static_cast(circles[circles.size() - 1][0]); int circle_est_size = (max_x - min_x) / (_digits + 1); min_x += circle_est_size / 2; @@ -343,8 +343,8 @@ class detector _packer.reset(); for (int i = 1; i < circles.size() - 1; i++) { - const int x = circles[i][0]; - const int idx = _digits * ((float)(x - min_x) / (max_x - min_x)); + const int x = static_cast(circles[i][0]); + const int idx = static_cast(_digits * ((float)(x - min_x) / (max_x - min_x))); if (idx >= 0 && idx < _packer.get().size()) _packer.get()[idx] = true; } @@ -354,11 +354,11 @@ class detector { if (res == _next_value) { - auto cropped = r.ms % (1 << (_digits - 2)); + auto cropped = static_cast(r.ms) % (1 << (_digits - 2)); if (cropped > res) { auto avg_render_time = _render_time.avg(); - _latency.add((cropped - res) - avg_render_time); + _latency.add(static_cast((cropped - res) - avg_render_time)); update_instructions(); } } diff --git a/wrappers/opencv/rotate-pointcloud/rs-rotate-pc.cpp b/wrappers/opencv/rotate-pointcloud/rs-rotate-pc.cpp index 148df01fea..86f43e4d7e 100644 --- a/wrappers/opencv/rotate-pointcloud/rs-rotate-pc.cpp +++ b/wrappers/opencv/rotate-pointcloud/rs-rotate-pc.cpp @@ -60,8 +60,8 @@ int main(int argc, char * argv[]) try // Declare threshold filter for work with dots in range rs2::threshold_filter threshold; - float threshold_min = 0.3; - float threshold_max = 1.5; + float threshold_min = 0.3f; + float threshold_max = 1.5f; // Keep dots on the depth frame in range threshold.set_option(RS2_OPTION_MIN_DISTANCE, threshold_min); @@ -84,7 +84,7 @@ int main(int argc, char * argv[]) try rotated = image; if ( is_yaw ) { - int rotWidth(threshold_max * 1000); + int rotWidth(static_cast(threshold_max * 1000)); rotated = cv::Mat::zeros(cv::Size(rotWidth, image.size().height), CV_16UC1 );