1
0
mirror of https://github.com/opencv/opencv_contrib.git synced 2025-10-19 02:16:34 +08:00

Update plot module

This commit is contained in:
Suleyman TURKMEN
2017-09-19 04:39:35 +03:00
parent b9541897d8
commit 3496ed5917
3 changed files with 31 additions and 27 deletions

View File

@@ -6,13 +6,14 @@ using namespace cv;
int main()
{
Mat data_x(1, 50, CV_64F);
Mat data_y(1, 50, CV_64F);
Mat data_x( 1, 51, CV_64F );
Mat data_y( 1, 51, CV_64F );
for (int i = 0; i < 50; i++)
for ( int i = 0; i < data_x.cols; i++ )
{
data_x.at<double>(0, i) = (i - 25);
data_y.at<double>(0, i) = (i - 25)*(i - 25)*(i - 25);
double x = ( i - data_x.cols / 2 );
data_x.at<double>( 0, i ) = x;
data_y.at<double>( 0, i ) = x * x * x;
}
std::cout << "data_x : " << data_x << std::endl;
@@ -20,15 +21,20 @@ int main()
Mat plot_result;
Ptr<plot::Plot2d> plot = plot::Plot2d::create(data_x, data_y);
Ptr<plot::Plot2d> plot = plot::Plot2d::create( data_x, data_y );
plot->render(plot_result);
imshow("default orientation", plot_result);
imshow( "The plot rendered with default visualization options", plot_result );
plot = plot::Plot2d::create(data_x, data_y,true);
plot->render(plot_result);
plot->setShowText( false );
plot->setShowGrid( false );
plot->setPlotBackgroundColor( Scalar( 255, 200, 200 ) );
plot->setPlotLineColor( Scalar( 255, 0, 0 ) );
plot->setPlotLineWidth( 2 );
plot->setInvertOrientation( true );
plot->render( plot_result );
imshow("inverted orientation", plot_result);
imshow( "The plot rendered with some of custom visualization options", plot_result );
waitKey();
return 0;