Commit 6fb871ad authored by Zhiping Jiang (蒋志平)'s avatar Zhiping Jiang (蒋志平) 💬

replace plot.h with CPlot and CPlotWrapper.

parent b8e0c0f6
This diff is collapsed.
//
// CPlot.hpp
// dlibxx
//
// Created by 蒋志平 on 2017/12/6.
//
#ifndef CPlot_h
#define CPlot_h
#include <opencv2/opencv.hpp>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <vector>
#include <math.h>
#define WINDOW_WIDTH 600
#define WINDOW_HEIGHT 600
using namespace cv;
using namespace std;
struct LineType
{
char type;
bool is_need_lined;
Scalar color;
};
class CPlot
{
public:
void DrawAxis(IplImage *image);
void DrawData(IplImage *image);
int window_height;
int window_width;
vector< vector<CvPoint2D64f> >dataset;
vector<LineType> lineTypeSet;
CvScalar backgroud_color;
CvScalar axis_color;
CvScalar text_color;
IplImage* Figure;
// manual or automatic range
bool custom_range_y;
double y_max;
double y_min;
double y_scale;
bool custom_range_x;
double x_max;
double x_min;
double x_scale;
//±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);
void xlabel(string xlabel_name, CvScalar label_color);
void ylabel(string ylabel_name, CvScalar label_color);
//«Âø’Õº∆¨…œµƒ ˝æ›
void clear();
void title(string title_name, CvScalar title_color);
CPlot();
~CPlot();
};
#endif /* CPlot_h */
//
// CPlotWrapper.h
// OpenCVExtensions
//
// Created by 蒋志平 on 2017/12/6.
//
#ifndef CPlotWrapper_h
#define CPlotWrapper_h
#include "CPlot.h"
class Cv2Plot : public CPlot
{
public:
template<class T> void plot(vector<T> Y, CvScalar color, char type = '*', bool is_need_lined = true);
template<class T> void plot(vector< Point_<T> > p, CvScalar color, char type = '*', bool is_need_lined = true);
Mat figure()
{
return cv::cvarrToMat(this->Figure);
}
};
template<class T>
void Cv2Plot::plot(vector<T> Y, CvScalar color, char type, bool is_need_lined)
{
T tempX, tempY;
vector<CvPoint2D64f>data;
for (int i = 0; i < Y.size(); 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);
}
template<class T>
void Cv2Plot::plot(vector< Point_<T> > p, CvScalar color, char type, bool is_need_lined)
{
T tempX, tempY;
vector<CvPoint2D64f>data;
for (int i = 0; i < p.size(); i++)
{
tempX = p[i].x;
tempY = p[i].y;
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 /* CPlotWrapper_h */
//
// CvTypeConversions.h
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2016/9/29.
// Copyright © 2016年 JiangZhiping. All rights reserved.
......
//
// MatxGeometry.hpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2017/1/18.
// Copyright © 2017年 JiangZhping. All rights reserved.
......
//
// CoreOpenCVExtensions.h
// CoreOpenCVExtensions
// OpenCVExtensions.h
// OpenCVExtensions
//
// Created by JiangZhping on 2016/9/29.
// Copyright © 2016年 JiangZhping. All rights reserved.
......@@ -32,6 +32,9 @@
#include "ScreenCameraInfo.h"
#include "KalmanFilter.h"
#include "KalmanDataTracker.h"
#include "PlotManager.h"
#define debugcout(x) std::cout<<#x<<x<<std::endl
......
//
// OpencvMatxExtensions.hpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2017/1/7.
// Copyright © 2017年 JiangZhping. All rights reserved.
......
#pragma once
#include "plot.h"
#include "jzplib_image.h"
#ifndef __PLOT_MANAGER_H__
#define __PLOT_MANAGER_H__
#include <opencv2/opencv.hpp>
#include <map>
#include <iostream>
#include "CPlotWrapper.h"
#include "jzplib_image.h"
using namespace std;
using namespace cv;
......@@ -14,7 +17,7 @@ using namespace cve;
class PlotManager
{
private:
map<string, Plot> plots;
map<string, Cv2Plot> plots;
map<string, vector<vector<Point2d>>> pointdata;
map<string, vector<Scalar>> colordata;
......@@ -144,4 +147,6 @@ public:
colordata.erase(name);
}
};
\ No newline at end of file
};
#endif
//
// PreferenceManager.cpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2017/1/30.
// Copyright © 2017年 JiangZhping. All rights reserved.
......
//
// PreferenceManager.hpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2017/1/30.
// Copyright © 2017年 JiangZhping. All rights reserved.
......
//
// ScreenCameraInfo.cpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2017/2/2.
// Copyright © 2017年 JiangZhping. All rights reserved.
......@@ -287,4 +287,4 @@ cv::Vec2d ScreenCameraInfo::pixelFromFrontCameraPoint(cv::Vec3d point) {
}
cv::Vec3d ScreenCameraInfo::sceneModelScreenCenterFramePointFromFrontCamearPoint(cv::Vec3d point) {
return cve::matx::transformVectorWithTransformMat(transformFromFrontCameraFrameToSceneModelCenteredOnScreenCenter(), point);
}
\ No newline at end of file
}
//
// ScreenCameraInfo.hpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2017/2/2.
// Copyright © 2017年 JiangZhping. All rights reserved.
......
//
// Singleton.hpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2017/2/1.
// Copyright © 2017年 JiangZhping. All rights reserved.
......
//
// jzplib_utilities.cpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2017/1/30.
// Copyright © 2017年 JiangZhping. All rights reserved.
......
//
// jzplib_utilities.hpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2017/1/30.
// Copyright © 2017年 JiangZhping. All rights reserved.
......
//
// jzplib_analysis.cpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2017/1/3.
// Copyright © 2017年 JiangZhping. All rights reserved.
......
//
// jzplib_analysis.hpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2017/1/3.
// Copyright © 2017年 JiangZhping. All rights reserved.
......
//
// jzplib_core.cpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2016/12/30.
// Copyright © 2016年 JiangZhping. All rights reserved.
......
//
// jzplib_core.hpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2016/12/30.
// Copyright © 2016年 JiangZhping. All rights reserved.
......
//
// jzplib_image.cpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2016/12/29.
// Copyright © 2016年 JiangZhping. All rights reserved.
......
//
// jzplib_image.hpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2016/12/29.
// Copyright © 2016年 JiangZhping. All rights reserved.
......
//
// ScreenCameraInfo.cpp
// CoreOpenCVExtensions
// OpenCVExtensions
//
// Created by JiangZhping on 2017/2/2.
// Copyright © 2017年 JiangZhping. All rights reserved.
......
This diff is collapsed.
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