pull/3471/head
kallaballa 2 years ago
parent 7aa430f3d5
commit 2300f979b6
  1. 2
      modules/viz2d/include/opencv2/viz2d/viz2d.hpp
  2. 2
      modules/viz2d/samples/cpp/font/font-demo.cpp
  3. 6
      modules/viz2d/samples/cpp/nanovg/nanovg-demo.cpp
  4. 2
      modules/viz2d/samples/cpp/pedestrian/pedestrian-demo.cpp
  5. 12
      modules/viz2d/src/viz2d.cpp

@ -99,7 +99,7 @@ template<typename T> void find_widgets(nanogui::Widget* parent, std::vector<T>&
* @param code The color converions code
* @return The color converted scalar
*/
CV_EXPORTS cv::Scalar color_convert(const cv::Scalar& src, cv::ColorConversionCodes code);
CV_EXPORTS cv::Scalar colorConvert(const cv::Scalar& src, cv::ColorConversionCodes code);
using namespace cv::viz::detail;

@ -24,7 +24,7 @@ const unsigned long DIAG = hypot(double(WIDTH), double(HEIGHT));
constexpr bool OFFSCREEN = false;
constexpr const char* OUTPUT_FILENAME = "font-demo.mkv";
constexpr double FPS = 60;
const cv::Scalar_<float> INITIAL_COLOR = cv::viz::color_convert(cv::Scalar(0.15 * 180.0, 128, 255, 255), cv::COLOR_HLS2BGR);
const cv::Scalar_<float> INITIAL_COLOR = cv::viz::colorConvert(cv::Scalar(0.15 * 180.0, 128, 255, 255), cv::COLOR_HLS2BGR);
/** Visualization parameters **/
float min_star_size = 0.5f;

@ -42,8 +42,8 @@ void draw_color_wheel(float x, float y, float w, float h, float hue) {
bx = cx + cosf(a1) * (r0 + r1) * 0.5f;
by = cy + sinf(a1) * (r0 + r1) * 0.5f;
paint = linearGradient(ax, ay, bx, by,
cv::viz::color_convert(cv::Scalar((a0 / (CV_PI * 2.0)) * 180.0, 0.55 * 255.0, 255.0, 255.0), cv::COLOR_HLS2BGR),
cv::viz::color_convert(cv::Scalar((a1 / (CV_PI * 2.0)) * 180.0, 0.55 * 255, 255, 255), cv::COLOR_HLS2BGR));
cv::viz::colorConvert(cv::Scalar((a0 / (CV_PI * 2.0)) * 180.0, 0.55 * 255.0, 255.0, 255.0), cv::COLOR_HLS2BGR),
cv::viz::colorConvert(cv::Scalar((a1 / (CV_PI * 2.0)) * 180.0, 0.55 * 255, 255, 255), cv::COLOR_HLS2BGR));
fillPaint(paint);
fill();
}
@ -86,7 +86,7 @@ void draw_color_wheel(float x, float y, float w, float h, float hue) {
lineTo(ax, ay);
lineTo(bx, by);
closePath();
paint = linearGradient(r, 0, ax, ay, cv::viz::color_convert(cv::Scalar(hue, 128, 255, 255), cv::COLOR_HLS2BGR_FULL), cv::Scalar(255, 255, 255, 255));
paint = linearGradient(r, 0, ax, ay, cv::viz::colorConvert(cv::Scalar(hue, 128, 255, 255), cv::COLOR_HLS2BGR_FULL), cv::Scalar(255, 255, 255, 255));
fillPaint(paint);
fill();
paint = linearGradient((r + ax) * 0.5f, (0 + ay) * 0.5f, bx, by, cv::Scalar(0, 0, 0, 0), cv::Scalar(0, 0, 0, 255));

@ -200,7 +200,7 @@ int main(int argc, char **argv) {
v2d->clear();
beginPath();
strokeWidth(std::fmax(2.0, WIDTH / 960.0));
strokeColor(cv::viz::color_convert(cv::Scalar(0, 127, 255, 200), cv::COLOR_HLS2BGR));
strokeColor(cv::viz::colorConvert(cv::Scalar(0, 127, 255, 200), cv::COLOR_HLS2BGR));
float width = tracked.width * WIDTH_FACTOR;
float height = tracked.height * HEIGHT_FACTOR;
float cx = tracked.x * WIDTH_FACTOR + (width / 2.0f);

@ -36,7 +36,7 @@ bool contains_absolute(nanogui::Widget* w, const nanogui::Vector2i& p) {
}
}
cv::Scalar color_convert(const cv::Scalar& src, cv::ColorConversionCodes code) {
cv::Scalar colorConvert(const cv::Scalar& src, cv::ColorConversionCodes code) {
cv::Mat tmpIn(1, 1, CV_8UC3);
cv::Mat tmpOut(1, 1, CV_8UC3);
@ -184,11 +184,11 @@ bool Viz2D::initializeWindowing() {
find_widgets(&v2d->screen(), widgets);
for (auto* w : widgets) {
auto mousePos = nanogui::Vector2i(v2d->getMousePosition()[0] / v2d->getXPixelRatio(), v2d->getMousePosition()[1] / v2d->getYPixelRatio());
if(contains_absolute(w, mousePos)) {
v2d->screen().scroll_callback_event(x, y);
return;
}
}
if(contains_absolute(w, mousePos)) {
v2d->screen().scroll_callback_event(x, y);
return;
}
}
v2d->zoom(y < 0 ? 1.1 : 0.9);
}

Loading…
Cancel
Save