資源簡介
將一組點用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語言實現包含實驗報告
評論
共有 條評論