栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > C/C++/C#

55、进行关键数据解析和boost函数应用

C/C++/C# 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

55、进行关键数据解析和boost函数应用

基本思想:最近涉及到一个项目,需要应用到boost的库使用,具体厂家提供数据文件,因为涉密原因,无法提供,因此只涉及代码编写和效果展示

#include 
#include 
#include 

#include "opencv2/core.hpp"
#include "opencv2/imgproc.hpp"
#include "opencv2/highgui.hpp"
#include "opencv2/videoio.hpp"
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 
#include 

#define PI 3.14159
#define  ArmLength 457
BOOST_GEOMETRY_REGISTER_BOOST_TUPLE_CS(cs::cartesian)
using namespace std;
using namespace cv;

typedef boost::geometry::model::polygon > Polygon;
typedef struct
{
    float x;
    float y;
} TS_Point2d;




string convertIntToString(int valueInt)
{

    stringstream ss;
    ss< vec ){


    string str="";
    for(int i=0;i>  &totalPoint){


    ifstream in_file(path, ios::in | ios::binary);
    unsigned char byte[4];
    vector vecData((istreambuf_iterator(in_file)),istreambuf_iterator());

    std::cout<<"版本号: "<<(unsigned int)vecData[0]< vecPoint;
        for(unsigned int j=0;j>> vecTotalPoint;




    const std::string& img_dir = "F:\processSVG\DRA";
    std::vector fn;

    cv::glob(img_dir, fn, true); // recurse
    for (int iter_k = 0; iter_k < fn.size(); ++iter_k)
    {
        int lastPosition = fn[iter_k].find_last_of('\'); //window 使用\ linux 使用/
        std::string fileName= fn[iter_k].substr(lastPosition +1, fn[iter_k].size());
        string suffixStr = fileName.substr(fileName.find_last_of('.') + 1);
        if(strcmp(suffixStr.c_str(),"dra")==0){
            vector> totalPoint;
            processDraFile( fn[iter_k],totalPoint);
            vecTotalPoint.push_back(totalPoint);
        }

    }


    stringstream outstream;
    string paramter0=convertStrPolgon(vecTotalPoint[0][0] );

    string paramter1=convertStrPolgon(vecTotalPoint[1][0]);


    Polygon green, blue;
    boost::geometry::read_wkt(paramter0, green);
    boost::geometry::read_wkt(paramter1, blue);

    boost::geometry::correct(green);
    boost::geometry::correct(blue);
    std::deque output;
    boost::geometry::union_(green, blue, output);


    BOOST_FOREACH(Polygon const& p, output)
                {
                    outstream<> unionPoint;
     vector  unionItemPoint;
    string str;
    while(outstream >> str){


        std::vector results;
        boost::split_regex(results, str, boost::regex(","));
        cout<<"x="< 

数据输出

F:processSVGcmake-build-debugprocessSVG.exe
版本号: 1
笔数: 12
总共元素数:32149
像素数:221 下一步数起始地址:1772
像素数:288 下一步数起始地址:4080
像素数:77 下一步数起始地址:4700
像素数:616 下一步数起始地址:9632
像素数:233 下一步数起始地址:11500
像素数:88 下一步数起始地址:12208
像素数:56 下一步数起始地址:12660
像素数:53 下一步数起始地址:13088
像素数:116 下一步数起始地址:14020
像素数:1139 下一步数起始地址:23136
像素数:1055 下一步数起始地址:31580
像素数:70 下一步数起始地址:32144

Process finished with exit code 0

初级结果展示

 

未完待续

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/312454.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号