Commit 1a362ef6 authored by Zhiping Jiang (蒋志平)'s avatar Zhiping Jiang (蒋志平) 💬

update Cplot.h

parent 6fb871ad
//
// CPlot.hpp
// dlibxx
//
// Created by 蒋志平 on 2017/12/6.
//
//
// CPlot.hpp
// dlibxx
//
// Created by 蒋志平 on 2017/12/6.
//
#ifndef CPlot_h
#define CPlot_h
......@@ -58,10 +58,8 @@ public:
//±flΩÁ¥Û–°
int border_size;
template<class T>
void plot(T *y, size_t Cnt, CvScalar color, char type = '*', bool is_need_lined = true);
template<class T>
void plot(T *x, T *y, size_t Cnt, CvScalar color, char type = '*', bool is_need_lined = true);
template<class T> void plot(T *y, size_t Cnt, CvScalar color, char type = '*', bool is_need_lined = true);
template<class T> void plot(T *x, T *y, size_t Cnt, CvScalar color, char type = '*', bool is_need_lined = true);
void xlabel(string xlabel_name, CvScalar label_color);
void ylabel(string ylabel_name, CvScalar label_color);
......@@ -74,5 +72,52 @@ public:
};
//∑∂–Յ˺∆
template<class T>
void CPlot::plot(T *X, T *Y, size_t Cnt, CvScalar color, char type, bool is_need_lined)
{
//∂‘ ˝æ›Ω¯––¥Ê¥¢
T tempX, tempY;
vector<CvPoint2D64f>data;
for (int i = 0; i < Cnt; i++)
{
tempX = X[i];
tempY = Y[i];
data.push_back(cvPoint2D64f((double)tempX, (double)tempY));
}
this->dataset.push_back(data);
LineType LT;
LT.type = type;
LT.color = color;
LT.is_need_lined = is_need_lined;
this->lineTypeSet.push_back(LT);
//printf("data count:%d\n", this->dataset.size());
this->DrawData(this->Figure); //√ø¥Œ∂º «÷ÿ–¬ªÊ÷∆
}
template<class T>
void CPlot::plot(T *Y, size_t Cnt, CvScalar color, char type, bool is_need_lined)
{
//∂‘ ˝æ›Ω¯––¥Ê¥¢
T tempX, tempY;
vector<CvPoint2D64f>data;
for (int i = 0; i < Cnt; i++)
{
tempX = i;
tempY = Y[i];
data.push_back(cvPoint2D64f((double)tempX, (double)tempY));
}
this->dataset.push_back(data);
LineType LT;
LT.type = type;
LT.color = color;
LT.is_need_lined = is_need_lined;
this->lineTypeSet.push_back(LT);
this->DrawData(this->Figure);
}
#endif /* CPlot_h */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment