在现有的图像处理软件中融合dxf格式输出

简介: 在现有的图像处理软件中融合dxf格式输出dxf格式是autocade的支持格式。如果将现有图像识别的结果导出到dxf格式,就能够使用autocad的强大功能进行后续处理。dxf的格式比较复杂,开源支持库为libdxf,使用起来也比较复杂。

在现有的图像处理软件中融合dxf格式输出

dxf格式是autocade的支持格式。如果将现有图像识别的结果导出到dxf格式,就能够使用autocad的强大功能进行后续处理。
dxf的格式比较复杂,开源支持库为libdxf,使用起来也比较复杂。经过一段时间融合,我将其修改为vs2012(mfc)能够直接调用的模式。
包含的类库都保存在一个文件夹下
调用方式
void testWriting() {
    DL_Dxfdxf = new DL_Dxf();
    DL_Codes::version exportVersion = DL_Codes::AC1015;
    DL_WriterAdw = dxf->out("myfile.dxf"exportVersion);
    if (dw==NULL) {
        printf("Cannot open file 'myfile.dxf' \
               for writing.");
        // abort function e.g. with return
    }
    dxf->writeHeader(*dw);
    // int variable:
    dw->dxfString(9, "$INSUNITS");
    dw->dxfInt(70, 4);
    // real (double, float) variable:
    dw->dxfString(9, "$DIMEXE");
    dw->dxfReal(40, 1.25);
    // string variable:
    dw->dxfString(9, "$TEXTSTYLE");
    dw->dxfString(7, "Standard");
    // vector variable:
    dw->dxfString(9, "$LIMMIN");
    dw->dxfReal(10, 0.0);
    dw->dxfReal(20, 0.0);
    dw->sectionEnd();
 
    dw->sectionTables();
    dxf->writeVPort(*dw);
    //创建线条开始
    dw->tableLineTypes(25);
    dxf->writeLineType(*dwDL_LineTypeData("BYBLOCK", 0));
    dxf->writeLineType(*dwDL_LineTypeData("BYLAYER", 0));
    dxf->writeLineType(*dw,
        DL_LineTypeData("CONTINUOUS", 0));
    dxf->writeLineType(*dw,
        DL_LineTypeData("ACAD_ISO02W100", 0));
    dxf->writeLineType(*dw,
        DL_LineTypeData("ACAD_ISO03W100", 0));
    dxf->writeLineType(*dw,
        DL_LineTypeData("ACAD_ISO04W100", 0));
    dxf->writeLineType(*dw,
        DL_LineTypeData("ACAD_ISO05W100", 0));
    dxf->writeLineType(*dwDL_LineTypeData("BORDER", 0));
    dxf->writeLineType(*dwDL_LineTypeData("BORDER2", 0));
    dxf->writeLineType(*dwDL_LineTypeData("BORDERX2", 0));
    dxf->writeLineType(*dwDL_LineTypeData("CENTER", 0));
    dxf->writeLineType(*dwDL_LineTypeData("CENTER2", 0));
    dxf->writeLineType(*dwDL_LineTypeData("CENTERX2", 0));
    dxf->writeLineType(*dwDL_LineTypeData("DASHDOT", 0));
    dxf->writeLineType(*dwDL_LineTypeData("DASHDOT2", 0));
    dxf->writeLineType(*dw,
        DL_LineTypeData("DASHDOTX2", 0));
    dxf->writeLineType(*dwDL_LineTypeData("DASHED", 0));
    dxf->writeLineType(*dwDL_LineTypeData("DASHED2", 0));
    dxf->writeLineType(*dwDL_LineTypeData("DASHEDX2", 0));
    dxf->writeLineType(*dwDL_LineTypeData("DIVIDE", 0));
    dxf->writeLineType(*dwDL_LineTypeData("DIVIDE2", 0));
    dxf->writeLineType(*dw,
        DL_LineTypeData("DIVIDEX2", 0));
    dxf->writeLineType(*dwDL_LineTypeData("DOT", 0));
    dxf->writeLineType(*dwDL_LineTypeData("DOT2", 0));
    dxf->writeLineType(*dwDL_LineTypeData("DOTX2", 0));
    dw->tableEnd();
    //创建线条结束
    int numberOfLayers = 3;
    dw->tableLayers(numberOfLayers);
 
    dxf->writeLayer(*dw,
        DL_LayerData("0", 0),
        DL_Attributes(
        std::string(""),      // leave empty
        DL_Codes::white,        // default color
        100,                  // default width
        "CONTINUOUS"));       // default line style
 
    dxf->writeLayer(*dw,
        DL_LayerData("mainlayer", 0),
        DL_Attributes(
        std::string(""),
        DL_Codes::red,
        100,
        "CONTINUOUS"));
 
    dxf->writeLayer(*dw,
        DL_LayerData("anotherlayer", 0),
        DL_Attributes(
        std::string(""),
        DL_Codes::black,
        100,
        "CONTINUOUS"));
 
    dw->tableEnd();
    dxf->writeStyle(*dw);
    dxf->writeView(*dw);
    dxf->writeUcs(*dw);
 
    dw->tableAppid(1);
    dw->tableAppidEntry(0x12);
    dw->dxfString(2, "ACAD");
    dw->dxfInt(70, 0);
    dw->tableEnd();
    dxf->writeDimStyle(*dw,
        1,
        1,
        1,
        1,
        1);
    dxf->writeBlockRecord(*dw);
    dxf->writeBlockRecord(*dw"myblock1");
    dxf->writeBlockRecord(*dw"myblock2");
    dw->tableEnd();
    dw->sectionEnd();
    dw->sectionBlocks();
 
    dxf->writeBlock(*dw,
        DL_BlockData("*Model_Space", 0, 0.0, 0.0, 0.0));
    dxf->writeEndBlock(*dw"*Model_Space");
 
    dxf->writeBlock(*dw,
        DL_BlockData("*Paper_Space", 0, 0.0, 0.0, 0.0));
    dxf->writeEndBlock(*dw"*Paper_Space");
 
    dxf->writeBlock(*dw,
        DL_BlockData("*Paper_Space0", 0, 0.0, 0.0, 0.0));
    dxf->writeEndBlock(*dw"*Paper_Space0");
 
    dxf->writeBlock(*dw,
        DL_BlockData("myblock1", 0, 0.0, 0.0, 0.0));
    // ...
    // write block entities e.g. with dxf->writeLine(), ..
    // ...
    dxf->writeEndBlock(*dw"myblock1");
 
    dxf->writeBlock(*dw,
        DL_BlockData("myblock2", 0, 0.0, 0.0, 0.0));
    // ...
    // write block entities e.g. with dxf->writeLine(), ..
    // ...
    dxf->writeEndBlock(*dw"myblock2");
 
    dw->sectionEnd();
    dw->sectionEntities();
 
    // write all your entities..
    //dxf->writePoint(
    //    *dw,
    //    DL_PointData(10.0,
    //                 45.0,
    //                 0.0),
    //    DL_Attributes("mainlayer", 256, -1, "BYLAYER"));
    dxf->writeLine(
        *dw,
        DL_LineData(0.0,   // start point
        0.0,
        0.0,
        500.0,   // end point
        0.0,
        0.0),
        DL_Attributes("mainlayer", 256, -1, "BYLAYER"));
 
    dxf->writeLine(
        *dw,
        DL_LineData(500.0,   // start point
        0.0,
        0.0,
        500.0,   // end point
        500.0,
        0.0),
        DL_Attributes("mainlayer", 256, -1, "BYLAYER"));
 
    dxf->writeLine(
        *dw,
        DL_LineData(500.0,   // start point
        500.0,
        0.0,
        0.0,   // end point
        500.0,
        0.0),
        DL_Attributes("mainlayer", 256, -1, "BYLAYER"));
 
    dxf->writeLine(
        *dw,
        DL_LineData(0.0,   // start point
        500.0,
        0.0,
        0.0,   // end point
        0.0,
        0.0),
        DL_Attributes("mainlayer", 256, -1, "BYLAYER"));
 
    dw->sectionEnd();
    dxf->writeObjects(*dw);
    dxf->writeObjectsEnd(*dw);
    dw->dxfEOF();
    dw->close();
    delete dw;
    delete dxf;
}
代码下载: 链接: http://pan.baidu.com/s/1kVRU3Dt 密码: iect





目前方向:图像拼接融合、图像识别 联系方式:jsxyhelu@foxmail.com
目录
相关文章
|
C++ Python
VS+VTK+Dicom(dcm)+CT影像切片窗体界面显示源码
VS+VTK+Dicom(dcm)+CT影像切片窗体界面显示源码
290 0
|
6月前
|
编解码 定位技术
Google Earth Engine(GEE)——导出后的影像像素不同于原始Landsat影像的分辨率(投影差异)
Google Earth Engine(GEE)——导出后的影像像素不同于原始Landsat影像的分辨率(投影差异)
177 0
|
3月前
|
编解码
ENVI无缝镶嵌、拼接栅格数据的方法
【8月更文挑战第10天】使用ENVI进行无缝镶嵌的方法包括:准备具有一致空间参考的栅格数据;通过“File”菜单逐个加载数据;启动“Seamless Mosaic”工具;添加待镶嵌图像;调整几何校正、颜色平衡及羽化参数以平滑过渡;设定输出路径与格式;最后执行镶嵌并检查结果质量,必要时微调参数直至满意。
280 1
|
6月前
|
存储 编解码 API
基于GDAL命令行对遥感影像加以投影的方法
【2月更文挑战第3天】本文介绍基于gdal模块,在命令行中通过GDAL命令的方式(不是Python或者C++代码,就是gdal模块自身提供的命令行工具),对栅格遥感影像数据加以投影,即将原本的地理坐标系转为投影坐标系的方法~
212 5
基于GDAL命令行对遥感影像加以投影的方法
|
存储
ENVI_IDL: 对风云四号卫星数据波段合成和线性拉伸并分别生成TIFF格式和JPEG格式
ENVI_IDL: 对风云四号卫星数据波段合成和线性拉伸并分别生成TIFF格式和JPEG格式
214 0
成信大ENVI_IDL第二周实验内容:提取所有MODIS气溶胶产品中AOD+详细解析
成信大ENVI_IDL第二周实验内容:提取所有MODIS气溶胶产品中AOD+详细解析
207 0
|
6月前
|
定位技术
ENVI无缝镶嵌工具Seamless Mosaic实现栅格遥感影像镶嵌拼接的方法
ENVI无缝镶嵌工具Seamless Mosaic实现栅格遥感影像镶嵌拼接的方法
235 1
|
6月前
|
传感器 算法 定位技术
Python中gdal实现MODIS卫星遥感影像产品栅格数据读取处理与质量控制QC波段筛选掩膜
Python中gdal实现MODIS卫星遥感影像产品栅格数据读取处理与质量控制QC波段筛选掩膜
130 1
|
6月前
|
存储 定位技术 Python
Python中ArcPy实现对不同时相的栅格遥感影像依据其成像时间分别批量拼接
Python中ArcPy实现对不同时相的栅格遥感影像依据其成像时间分别批量拼接
|
6月前
|
定位技术 Python
ArcGIS批量拼接大量栅格遥感影像:Mosaic工具
ArcGIS批量拼接大量栅格遥感影像:Mosaic工具
249 1