资源简介
将一组点用opencv绘制并连线,绘制相应的坐标系与刻度
代码片段和文件信息
#include
#include
#include
#include
#include
#include
using namespace cv;
using namespace std;
bool cmp1(Point2d &s1Point2d&s2)
{
return s1.x }
bool cmp2(Point2d &s1Point2d&s2)
{
return s1.y }
int paint(vector points)
{
sort(points.begin()points.end()cmp2);
double minY=points[0].y;
double maxY=points[points.size()-1].y;
double scaleY=maxY-minY;
sort(points.begin()points.end()cmp1);
double minX=points[0].x;
double maxX=points[points.size()-1].x;
double scaleX=maxX-minX;
Mat back(480*0.8640*0.8CV_8UScalar(0));
vector coorPoint;
for(auto var:points)
{
coorPoint.push_back(Point((var.x-minX)/scaleX*back.cols(var.y-minY)/scaleY*back.rows));
circle(backcoorPoint[coorPoint.size()-1]3Scalar(255)-1);
}
polylines(backcoorPointfalse
- 上一篇:房屋销售管理系统C++
- 下一篇:八数码C语言实现包含实验报告
评论
共有 条评论