fine work on examples

pull/3471/head
kallaballa 2 years ago
parent 64242f0c3f
commit 410a0ea238
  1. 2
      modules/viz2d/samples/cpp/font_rendering.cpp
  2. 2
      modules/viz2d/samples/cpp/font_with_gui.cpp
  3. 8
      modules/viz2d/samples/cpp/vector_graphics.cpp
  4. 8
      modules/viz2d/samples/cpp/vector_graphics_and_fb.cpp
  5. 9
      modules/viz2d/samples/cpp/video_editing.cpp

@ -21,7 +21,7 @@ int main(int argc, char** argv) {
fontFace("sans-bold");
fillColor(Scalar(255, 0, 0, 255));
textAlign(NVG_ALIGN_CENTER | NVG_ALIGN_TOP);
text(WIDTH / 2.0, HEIGHT / 2.0, hw.c_str(), hw.c_str() + hw.size());
text(sz.width / 2.0, sz.height / 2.0, hw.c_str(), hw.c_str() + hw.size());
});
//Display the framebuffer in the native window in an endless loop

@ -36,7 +36,7 @@ int main(int argc, char** argv) {
fontFace("sans-bold");
fillColor(Scalar(textColor.b() * 255, textColor.g() * 255, textColor.r() * 255, 255));
textAlign(NVG_ALIGN_CENTER | NVG_ALIGN_TOP);
text(WIDTH / 2.0, HEIGHT / 2.0, hw.c_str(), hw.c_str() + hw.size());
text(sz.width / 2.0, sz.height / 2.0, hw.c_str(), hw.c_str() + hw.size());
});
return v2d->display();
});

@ -16,10 +16,10 @@ int main(int argc, char** argv) {
beginPath();
strokeWidth(3.0);
strokeColor(Scalar(0,0,255,255)); //BGRA
moveTo(WIDTH/2.0, 0);
lineTo(WIDTH/2.0, HEIGHT);
moveTo(0, HEIGHT/2.0);
lineTo(WIDTH, HEIGHT/2.0);
moveTo(sz.width/2.0, 0);
lineTo(sz.width/2.0, sz.height);
moveTo(0, sz.height/2.0);
lineTo(sz.width, sz.height/2.0);
stroke();
});

@ -16,10 +16,10 @@ int main(int argc, char** argv) {
beginPath();
strokeWidth(3.0);
strokeColor(Scalar(0,0,255,255)); //BGRA
moveTo(WIDTH/2.0, 0);
lineTo(WIDTH/2.0, HEIGHT);
moveTo(0, HEIGHT/2.0);
lineTo(WIDTH, HEIGHT/2.0);
moveTo(sz.width/2.0, 0);
lineTo(sz.width/2.0, sz.height);
moveTo(0, sz.height/2.0);
lineTo(sz.width, sz.height/2.0);
stroke();
});

@ -21,7 +21,8 @@ int main(int argc, char** argv) {
v2d->run([=]() {
if(!v2d->capture())
return false;
return false; //end of input video
v2d->nvg([=](const Size& sz) {
using namespace cv::viz::nvg;
@ -29,10 +30,10 @@ int main(int argc, char** argv) {
fontFace("sans-bold");
fillColor(Scalar(255, 0, 0, 255));
textAlign(NVG_ALIGN_CENTER | NVG_ALIGN_TOP);
text(WIDTH / 2.0, HEIGHT / 2.0, hv.c_str(), hv.c_str() + hv.size());
text(sz.width / 2.0, sz.height / 2.0, hv.c_str(), hv.c_str() + hv.size());
});
v2d->write();
return v2d->display();
v2d->write(); //write the output video
return v2d->display(); //display the framebuffer in the native window
});
}

Loading…
Cancel
Save