You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
708 B
28 lines
708 B
#include <opencv2/viz2d/viz2d.hpp> |
|
#include <opencv2/viz2d/nvg.hpp> |
|
|
|
using namespace cv; |
|
using namespace cv::viz; |
|
|
|
constexpr int WIDTH = 1280; |
|
constexpr int HEIGHT = 720; |
|
|
|
int main(int argc, char** argv) { |
|
Ptr<Viz2D> v2d = Viz2D::make(Size(WIDTH, HEIGHT), "Vector Graphics"); |
|
//Creates a NanoVG context and draws a cross-hair on the framebuffer |
|
v2d->nvg([](const Size& sz) { |
|
//Calls from this namespace may only be used inside a nvg context |
|
using namespace cv::viz::nvg; |
|
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); |
|
stroke(); |
|
}); |
|
|
|
while(v2d->display()); |
|
} |
|
|
|
|