mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-19 02:16:34 +08:00
Update plot module (#1367)
* Update plot.hpp * update * plot_demo * remove_tabs * Update plot_demo.cpp * Update plot.hpp * Update plot.hpp
This commit is contained in:

committed by
Vadim Pisarevsky

parent
eef53c29eb
commit
97ea5bf97d
35
modules/plot/samples/plot_demo.cpp
Normal file
35
modules/plot/samples/plot_demo.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include <opencv2/highgui.hpp>
|
||||
#include <opencv2/plot.hpp>
|
||||
#include <iostream>
|
||||
|
||||
using namespace cv;
|
||||
|
||||
int main()
|
||||
{
|
||||
Mat data_x(1, 50, CV_64F);
|
||||
Mat data_y(1, 50, CV_64F);
|
||||
|
||||
for (int i = 0; i < 50; i++)
|
||||
{
|
||||
data_x.at<double>(0, i) = (i - 25);
|
||||
data_y.at<double>(0, i) = (i - 25)*(i - 25)*(i - 25);
|
||||
}
|
||||
|
||||
std::cout << "data_x : " << data_x << std::endl;
|
||||
std::cout << "data_y : " << data_y << std::endl;
|
||||
|
||||
Mat plot_result;
|
||||
|
||||
Ptr<plot::Plot2d> plot = plot::Plot2d::create(data_x, data_y);
|
||||
plot->render(plot_result);
|
||||
|
||||
imshow("default orientation", plot_result);
|
||||
|
||||
plot = plot::Plot2d::create(data_x, data_y,true);
|
||||
plot->render(plot_result);
|
||||
|
||||
imshow("inverted orientation", plot_result);
|
||||
waitKey();
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user