Skip to content

ideas about improving plot module #1306

@sturkmen72

Description

@sturkmen72

test code

#include <opencv2/highgui.hpp>
#include <opencv2/plot.hpp>
#include <iostream>

using namespace cv;

int main(int argc, char** argv)
{
	Mat data_x(1, 11, CV_64F);
	Mat data_y(1, 11, CV_64F);

	for (int i = 0; i < 11; i++)
	{
		data_x.at<double>(0, i) = i - 5;
		data_y.at<double>(0, i) = i - 5;
	}

	std::cout << "data_x : " << data_x << std::endl;
	std::cout << "data_y : " << data_y << std::endl;

	Mat plot_result0, plot_result1, plot_result2;

	Ptr<plot::Plot2d> plot = plot::createPlot2d(data_x, data_y);
	plot->render(plot_result0);
	plot->setPlotSize(500, 500);
	plot->render(plot_result1);

	//plot->setPlotAxisColor( Scalar(0, 0, 0) );
	plot->setPlotGridColor( Scalar(0, 0, 0) );
	plot->setPlotTextColor( Scalar(0, 0, 0) );
	plot->render(plot_result2);

	imshow("plot0", plot_result0);
	imshow("plot1", plot_result1);
	imshow("plot2", plot_result2);
	waitKey();

	return 0;
}

1

output plot0 (PlotSize is 600x400 default)

plot0

output plot1 (PlotSize is 500x500)
plot1

two graphs with same data and different size. i think there is a problem to be solved.

2

actually by setting PlotGridColor,PlotTextColor etc. you can do some customization on display like
plot2

probably adding some more functions to customization like setShowGrid(), setShowText() etc. will be fine

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions