mirror of
https://github.com/opencv/opencv_contrib.git
synced 2025-10-19 19:44:14 +08:00
Removed doxygen comments.
This commit is contained in:
@@ -56,7 +56,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
///This plot class allows you to easily plot data from a Mat or a vector. You can plot 1D or 2D plots, change the window size and the axis limits. It's simple yet very effective and usefull.
|
//This plot class allows you to easily plot data from a Mat or a vector. You can plot 1D or 2D plots, change the window size and the axis limits. It's simple yet very effective and usefull.
|
||||||
|
|
||||||
namespace cv
|
namespace cv
|
||||||
{
|
{
|
||||||
@@ -69,7 +69,7 @@ namespace cv
|
|||||||
cv::Mat plotDataY_plusZero;
|
cv::Mat plotDataY_plusZero;
|
||||||
const char * plotName;
|
const char * plotName;
|
||||||
|
|
||||||
///dimensions and limits of the plot
|
//dimensions and limits of the plot
|
||||||
int plotSizeWidth;
|
int plotSizeWidth;
|
||||||
int plotSizeHeight;
|
int plotSizeHeight;
|
||||||
double plotMinX;
|
double plotMinX;
|
||||||
@@ -82,19 +82,19 @@ namespace cv
|
|||||||
double plotMaxY_plusZero;
|
double plotMaxY_plusZero;
|
||||||
int plotLineWidth;
|
int plotLineWidth;
|
||||||
|
|
||||||
///colors of each plot element
|
//colors of each plot element
|
||||||
cv::Scalar plotLineColor;
|
cv::Scalar plotLineColor;
|
||||||
cv::Scalar plotBackgroundColor;
|
cv::Scalar plotBackgroundColor;
|
||||||
cv::Scalar plotAxisColor;
|
cv::Scalar plotAxisColor;
|
||||||
cv::Scalar plotGridColor;
|
cv::Scalar plotGridColor;
|
||||||
cv::Scalar plotTextColor;
|
cv::Scalar plotTextColor;
|
||||||
|
|
||||||
///the final plot result
|
//the final plot result
|
||||||
cv::Mat plotResult;
|
cv::Mat plotResult;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
///constructor accepting only Y data to be plotted
|
//constructor accepting only Y data to be plotted
|
||||||
Plot(cv::Mat _plotData)
|
Plot(cv::Mat _plotData)
|
||||||
{
|
{
|
||||||
//if the matrix is not Nx1 or 1xN
|
//if the matrix is not Nx1 or 1xN
|
||||||
@@ -124,11 +124,11 @@ namespace cv
|
|||||||
plotDataX.at<double>(i,0) = i;
|
plotDataX.at<double>(i,0) = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
///calling the main constructor
|
//calling the main constructor
|
||||||
plotHelper(plotDataX, plotDataY);
|
plotHelper(plotDataX, plotDataY);
|
||||||
}
|
}
|
||||||
|
|
||||||
///constructor accepting X data and Y data to be plotted
|
//constructor accepting X data and Y data to be plotted
|
||||||
Plot(cv::Mat _plotDataX, cv::Mat _plotDataY)
|
Plot(cv::Mat _plotDataX, cv::Mat _plotDataY)
|
||||||
{
|
{
|
||||||
//f the matrix is not Nx1 or 1xN
|
//f the matrix is not Nx1 or 1xN
|
||||||
@@ -158,7 +158,7 @@ namespace cv
|
|||||||
plotHelper(_plotDataX, _plotDataY);
|
plotHelper(_plotDataX, _plotDataY);
|
||||||
}
|
}
|
||||||
|
|
||||||
///set functions
|
//set functions
|
||||||
void setMinX(double _plotMinX)
|
void setMinX(double _plotMinX)
|
||||||
{
|
{
|
||||||
plotMinX = _plotMinX;
|
plotMinX = _plotMinX;
|
||||||
@@ -216,18 +216,18 @@ namespace cv
|
|||||||
plotSizeHeight = 300;
|
plotSizeHeight = 300;
|
||||||
}
|
}
|
||||||
|
|
||||||
///render the plotResult to a Mat
|
//render the plotResult to a Mat
|
||||||
void render(cv::Mat &_plotResult);
|
void render(cv::Mat &_plotResult);
|
||||||
|
|
||||||
///show the plotResult from within the class
|
//show the plotResult from within the class
|
||||||
void show(const char * _plotName);
|
void show(const char * _plotName);
|
||||||
|
|
||||||
///save the plotResult as a .png image
|
//save the plotResult as a .png image
|
||||||
void save(const char * _plotFileName);
|
void save(const char * _plotFileName);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
///a helper method to be used in the constructor
|
//a helper method to be used in the constructor
|
||||||
void plotHelper(cv::Mat _plotDataX, cv::Mat _plotDataY)
|
void plotHelper(cv::Mat _plotDataX, cv::Mat _plotDataY)
|
||||||
{
|
{
|
||||||
plotDataX=_plotDataX;
|
plotDataX=_plotDataX;
|
||||||
@@ -252,19 +252,19 @@ namespace cv
|
|||||||
double MinY_plusZero;
|
double MinY_plusZero;
|
||||||
double MaxY_plusZero;
|
double MaxY_plusZero;
|
||||||
|
|
||||||
///Obtain the minimum and maximum values of Xdata
|
//Obtain the minimum and maximum values of Xdata
|
||||||
minMaxLoc(plotDataX,&MinX,&MaxX);
|
minMaxLoc(plotDataX,&MinX,&MaxX);
|
||||||
|
|
||||||
///Obtain the minimum and maximum values of Ydata
|
//Obtain the minimum and maximum values of Ydata
|
||||||
minMaxLoc(plotDataY,&MinY,&MaxY);
|
minMaxLoc(plotDataY,&MinY,&MaxY);
|
||||||
|
|
||||||
///Obtain the minimum and maximum values of Xdata plus zero
|
//Obtain the minimum and maximum values of Xdata plus zero
|
||||||
minMaxLoc(plotDataX_plusZero,&MinX_plusZero,&MaxX_plusZero);
|
minMaxLoc(plotDataX_plusZero,&MinX_plusZero,&MaxX_plusZero);
|
||||||
|
|
||||||
///Obtain the minimum and maximum values of Ydata plus zero
|
//Obtain the minimum and maximum values of Ydata plus zero
|
||||||
minMaxLoc(plotDataY_plusZero,&MinY_plusZero,&MaxY_plusZero);
|
minMaxLoc(plotDataY_plusZero,&MinY_plusZero,&MaxY_plusZero);
|
||||||
|
|
||||||
///setting the min and max values for each axis
|
//setting the min and max values for each axis
|
||||||
plotMinX = MinX;
|
plotMinX = MinX;
|
||||||
plotMaxX = MaxX;
|
plotMaxX = MaxX;
|
||||||
plotMinY = MinY;
|
plotMinY = MinY;
|
||||||
@@ -274,13 +274,13 @@ namespace cv
|
|||||||
plotMinY_plusZero = MinY_plusZero;
|
plotMinY_plusZero = MinY_plusZero;
|
||||||
plotMaxY_plusZero = MaxY_plusZero;
|
plotMaxY_plusZero = MaxY_plusZero;
|
||||||
|
|
||||||
///setting the default size of a plot figure
|
//setting the default size of a plot figure
|
||||||
setPlotSize(600, 400);
|
setPlotSize(600, 400);
|
||||||
|
|
||||||
///setting the default plot line size
|
//setting the default plot line size
|
||||||
setPlotLineWidth(1);
|
setPlotLineWidth(1);
|
||||||
|
|
||||||
///setting default colors for the different elements of the plot
|
//setting default colors for the different elements of the plot
|
||||||
setPlotAxisColor(cv::Scalar(0, 0, 255));
|
setPlotAxisColor(cv::Scalar(0, 0, 255));
|
||||||
setPlotGridColor(cv::Scalar(255, 255, 255));
|
setPlotGridColor(cv::Scalar(255, 255, 255));
|
||||||
setPlotBackgroundColor(cv::Scalar(0, 0, 0));
|
setPlotBackgroundColor(cv::Scalar(0, 0, 0));
|
||||||
|
@@ -50,10 +50,10 @@
|
|||||||
using namespace cv;
|
using namespace cv;
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
///render the plotResult to a Mat
|
//render the plotResult to a Mat
|
||||||
void Plot::render(cv::Mat &_plotResult){
|
void Plot::render(cv::Mat &_plotResult){
|
||||||
|
|
||||||
///create the plot result
|
//create the plot result
|
||||||
plotResult = cv::Mat::zeros(plotSizeHeight, plotSizeWidth, CV_8UC3);
|
plotResult = cv::Mat::zeros(plotSizeHeight, plotSizeWidth, CV_8UC3);
|
||||||
|
|
||||||
int NumVecElements = plotDataX.rows;
|
int NumVecElements = plotDataX.rows;
|
||||||
@@ -61,7 +61,7 @@ void Plot::render(cv::Mat &_plotResult){
|
|||||||
Mat InterpXdata = linearInterpolation(plotMinX, plotMaxX, 0, plotSizeWidth, plotDataX);
|
Mat InterpXdata = linearInterpolation(plotMinX, plotMaxX, 0, plotSizeWidth, plotDataX);
|
||||||
Mat InterpYdata = linearInterpolation(plotMinY, plotMaxY, 0, plotSizeHeight, plotDataY);
|
Mat InterpYdata = linearInterpolation(plotMinY, plotMaxY, 0, plotSizeHeight, plotDataY);
|
||||||
|
|
||||||
///Find the zeros in image coordinates
|
//Find the zeros in image coordinates
|
||||||
Mat InterpXdataFindZero = linearInterpolation(plotMinX_plusZero, plotMaxX_plusZero, 0, plotSizeWidth, plotDataX_plusZero);
|
Mat InterpXdataFindZero = linearInterpolation(plotMinX_plusZero, plotMaxX_plusZero, 0, plotSizeWidth, plotDataX_plusZero);
|
||||||
Mat InterpYdataFindZero = linearInterpolation(plotMinY_plusZero, plotMaxY_plusZero, 0, plotSizeHeight, plotDataY_plusZero);
|
Mat InterpYdataFindZero = linearInterpolation(plotMinY_plusZero, plotMaxY_plusZero, 0, plotSizeHeight, plotDataY_plusZero);
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ void Plot::render(cv::Mat &_plotResult){
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
///show the plotResult from within the class
|
//show the plotResult from within the class
|
||||||
void Plot::show(const char * _plotName)
|
void Plot::show(const char * _plotName)
|
||||||
{
|
{
|
||||||
namedWindow(_plotName);
|
namedWindow(_plotName);
|
||||||
@@ -102,7 +102,7 @@ void Plot::show(const char * _plotName)
|
|||||||
waitKey(5);
|
waitKey(5);
|
||||||
}
|
}
|
||||||
|
|
||||||
///save the plotResult as a .png image
|
//save the plotResult as a .png image
|
||||||
void Plot::save(const char * _plotFileName)
|
void Plot::save(const char * _plotFileName)
|
||||||
{
|
{
|
||||||
imwrite(_plotFileName, plotResult);
|
imwrite(_plotFileName, plotResult);
|
||||||
|
Reference in New Issue
Block a user