精华内容
下载资源
问答
  • boost::locale::boundary用法的测试程序实现功能C++实现代码 实现功能 boost::locale::boundary用法的测试程序 C++实现代码 #include <boost/locale.hpp> #include <iostream> #include <cassert>...

    boost::locale::boundary用法的测试程序

    实现功能

    boost::locale::boundary用法的测试程序

    C++实现代码

    #include <boost/locale.hpp>
    #include <iostream>
    #include <cassert>
    #include <ctime>
    int main()
    {
        using namespace boost::locale;
        using namespace std;
        generator gen;
        locale loc=gen("");
        locale::global(loc); 
        wcout.imbue(loc);  
        std::ios_base::sync_with_stdio(false);
        wstring text=L"Hello World! あにま! Linux2.6 and Windows7 is word and number. שָלוֹם עוֹלָם!";
        wcout<<text<<endl;
        boundary::wssegment_index index(boundary::word,text.begin(),text.end());
        boundary::wssegment_index::iterator p,e;
        for(p=index.begin(),e=index.end();p!=e;++p) {
            wcout<<L"Part ["<<*p<<L"] has ";
            if(p->rule() & boundary::word_number)
                wcout<<L"number(s) ";
            if(p->rule() & boundary::word_letter)
                wcout<<L"letter(s) ";
            if(p->rule() & boundary::word_kana)
                wcout<<L"kana character(s) ";
            if(p->rule() & boundary::word_ideo)
                wcout<<L"ideographic character(s) ";
            if(p->rule() & boundary::word_none)
                wcout<<L"no word characters";
            wcout<<endl;
        }
    
        index.map(boundary::character,text.begin(),text.end());
    
        for(p=index.begin(),e=index.end();p!=e;++p) {
            wcout<<L"|" <<*p ;
        }
        wcout<<L"|\n\n";
    
        index.map(boundary::line,text.begin(),text.end());
    
        for(p=index.begin(),e=index.end();p!=e;++p) {
            wcout<<L"|" <<*p ;
        }
        wcout<<L"|\n\n";
    
        index.map(boundary::sentence,text.begin(),text.end());
    
        for(p=index.begin(),e=index.end();p!=e;++p) {
            wcout<<L"|" <<*p ;
        }
        wcout<<"|\n\n";    
    }
    
    展开全文
  • boost::gil::extend_boundary用法的测试程序实现功能C++实现代码 实现功能 boost::gil::extend_boundary用法的测试程序 C++实现代码 #include <boost/gil.hpp> #include <boost/gil/extension/numeric/...

    boost::gil::extend_boundary用法的测试程序

    实现功能

    boost::gil::extend_boundary用法的测试程序

    C++实现代码

    #include <boost/gil.hpp>
    #include <boost/gil/extension/numeric/algorithm.hpp>
    #include <boost/gil/extension/numeric/convolve.hpp>
    #include <boost/core/lightweight_test.hpp>
    namespace gil = boost::gil;
    std::uint8_t img[] =
    {
        1, 2, 3, 4, 5, 6, 7, 8, 9,
        10, 0, 0, 0, 0, 0, 0, 0, 32,
        11, 0, 255, 0, 0, 0, 255, 0, 31,
        12, 0, 0, 255, 0, 255, 0, 0, 30,
        13, 0, 0, 0, 255, 0, 0, 0, 29,
        14, 0, 0, 255, 0, 255, 0, 0, 28,
        15, 0, 255, 0, 0, 0, 255, 0, 27,
        16, 0, 0, 0, 0, 0, 0, 0, 26,
        17, 18, 19, 20, 21, 22, 23, 24, 25
    };
    
    std::uint8_t row_output_constant[] =
    {
        1, 2, 3, 4, 5, 6, 7, 8, 9,
        1, 2, 3, 4, 5, 6, 7, 8, 9,
        1, 2, 3, 4, 5, 6, 7, 8, 9,
        10, 0, 0, 0, 0, 0, 0, 0, 32,
        11, 0, 255, 0, 0, 0, 255, 0, 31,
        12, 0, 0, 255, 0, 255, 0, 0, 30,
        13, 0, 0, 0, 255, 0, 0, 0, 29,
        14, 0, 0, 255, 0, 255, 0, 0, 28,
        15, 0, 255, 0, 0, 0, 255, 0, 27,
        16, 0, 0, 0, 0, 0, 0, 0, 26,
        17, 18, 19, 20, 21, 22, 23, 24, 25,
        17, 18, 19, 20, 21, 22, 23, 24, 25,
        17, 18, 19, 20, 21, 22, 23, 24, 25
    };
    
    std::uint8_t row_output_zero[] =
    {
        0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0,
        1, 2, 3, 4, 5, 6, 7, 8, 9,
        10, 0, 0, 0, 0, 0, 0, 0, 32,
        11, 0, 255, 0, 0, 0, 255, 0, 31,
        12, 0, 0, 255, 0, 255, 0, 0, 30,
        13, 0, 0, 0, 255, 0, 0, 0, 29,
        14, 0, 0, 255, 0, 255, 0, 0, 28,
        15, 0, 255, 0, 0, 0, 255, 0, 27,
        16, 0, 0, 0, 0, 0, 0, 0, 26,
        17, 18, 19, 20, 21, 22, 23, 24, 25,
        0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0,
    };
    
    std::uint8_t col_output_constant[] =
    {
        1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9,
        10, 10, 0, 0, 0, 0, 0, 0, 0, 32, 32,
        11, 11, 0, 255, 0, 0, 0, 255, 0, 31, 31,
        12, 12, 0, 0, 255, 0, 255, 0, 0, 30, 30,
        13, 13, 0, 0, 0, 255, 0, 0, 0, 29, 29,
        14, 14, 0, 0, 255, 0, 255, 0, 0, 28, 28,
        15, 15, 0, 255, 0, 0, 0, 255, 0, 27, 27,
        16, 16, 0, 0, 0, 0, 0, 0, 0, 26, 26,
        17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25
    };
    
    std::uint8_t col_output_zero[] =
    {
        0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0,
        0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0,
        0, 0, 11, 0, 255, 0, 0, 0, 255, 0, 31, 0, 0,
        0, 0, 12, 0, 0, 255, 0, 255, 0, 0, 30, 0, 0,
        0, 0, 13, 0, 0, 0, 255, 0, 0, 0, 29, 0, 0,
        0, 0, 14, 0, 0, 255, 0, 255, 0, 0, 28, 0, 0,
        0, 0, 15, 0, 255, 0, 0, 0, 255, 0, 27, 0, 0,
        0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0,
        0, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0
    };
    
    std::uint8_t boundary_output_constant[] =
    {
        1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 9,
        1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 9,
        1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 9, 9,
        10, 10, 10, 0, 0, 0, 0, 0, 0, 0, 32, 32, 32,
        11, 11, 11, 0, 255, 0, 0, 0, 255, 0, 31, 31, 31,
        12, 12, 12, 0, 0, 255, 0, 255, 0, 0, 30, 30, 30,
        13, 13, 13, 0, 0, 0, 255, 0, 0, 0, 29, 29, 29,
        14, 14, 14, 0, 0, 255, 0, 255, 0, 0, 28, 28, 28,
        15, 15, 15, 0, 255, 0, 0, 0, 255, 0, 27, 27, 27,
        16, 16, 16, 0, 0, 0, 0, 0, 0, 0, 26, 26, 26,
        17, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25, 25,
        17, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25, 25,
        17, 17, 17, 18, 19, 20, 21, 22, 23, 24, 25, 25, 25
    };
    
    std::uint8_t boundary_output_zero[] =
    {
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0,
        0, 0, 10, 0, 0, 0, 0, 0, 0, 0, 32, 0, 0,
        0, 0, 11, 0, 255, 0, 0, 0, 255, 0, 31, 0, 0,
        0, 0, 12, 0, 0, 255, 0, 255, 0, 0, 30, 0, 0,
        0, 0, 13, 0, 0, 0, 255, 0, 0, 0, 29, 0, 0,
        0, 0, 14, 0, 0, 255, 0, 255, 0, 0, 28, 0, 0,
        0, 0, 15, 0, 255, 0, 0, 0, 255, 0, 27, 0, 0,
        0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 26, 0, 0,
        0, 0, 17, 18, 19, 20, 21, 22, 23, 24, 25, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
    };
    
    void test_extend_row_with_constant()
    {
        gil::gray8c_view_t src_view =
            gil::interleaved_view(9, 9, reinterpret_cast<const gil::gray8_pixel_t *>(img), 9);
    
        gil::gray8c_view_t out_view =
            gil::interleaved_view(9, 13, reinterpret_cast<const gil::gray8_pixel_t *>(row_output_constant), 9);
    
        auto output = gil::extend_row(src_view, 2, gil::boundary_option::extend_constant);
    
        BOOST_TEST(gil::equal_pixels(out_view, gil::view(output)));
    }
    
    void test_extend_row_with_zero()
    {
        gil::gray8c_view_t src_view =
            gil::interleaved_view(9, 9, reinterpret_cast<const gil::gray8_pixel_t *>(img), 9);
    
        gil::gray8c_view_t out_view =
            gil::interleaved_view(9, 15, reinterpret_cast<const gil::gray8_pixel_t *>(row_output_zero), 9);
    
        auto output = gil::extend_row(src_view, 3, gil::boundary_option::extend_zero);
    
        BOOST_TEST(gil::equal_pixels(out_view, gil::view(output)));
    }
    
    void test_extend_row_with_padded()
    {
        gil::gray8c_view_t src_view =
            gil::interleaved_view(9, 9, reinterpret_cast<const gil::gray8_pixel_t *>(img), 9);
    
        auto src_sub_view = gil::subimage_view(src_view, 0, 1, 9, 7);
    
        auto output = gil::extend_row(src_sub_view, 1, gil::boundary_option::extend_padded);
    
        BOOST_TEST(gil::equal_pixels(src_view, gil::view(output)));
    }
    
    void test_extend_col_with_constant()
    {
        gil::gray8c_view_t src_view =
            gil::interleaved_view(9, 9, reinterpret_cast<const gil::gray8_pixel_t *>(img), 9);
    
        gil::gray8c_view_t out_view =
            gil::interleaved_view(11, 9, reinterpret_cast<const gil::gray8_pixel_t *>(col_output_constant), 11);
    
        auto output = gil::extend_col(src_view, 1, gil::boundary_option::extend_constant);
    
        BOOST_TEST(gil::equal_pixels(out_view, gil::view(output)));
    }
    
    void test_extend_col_with_zero()
    {
        gil::gray8c_view_t src_view =
            gil::interleaved_view(9, 9, reinterpret_cast<const gil::gray8_pixel_t *>(img), 9);
    
        gil::gray8c_view_t out_view =
            gil::interleaved_view(13, 9, reinterpret_cast<const gil::gray8_pixel_t *>(col_output_zero), 13);
    
        auto output = gil::extend_col(src_view, 2, gil::boundary_option::extend_zero);
    
        BOOST_TEST(gil::equal_pixels(out_view, gil::view(output)));
    }
    
    void test_extend_col_with_padded()
    {
        gil::gray8c_view_t src_view =
            gil::interleaved_view(9, 9, reinterpret_cast<const gil::gray8_pixel_t *>(img), 9);
    
        auto src_sub_view = gil::subimage_view(src_view, 1, 0, 7, 9);
    
        auto output = gil::extend_col(src_sub_view, 1, gil::boundary_option::extend_padded);
    
        BOOST_TEST(gil::equal_pixels(src_view, gil::view(output)));
    }
    
    void test_extend_img_with_constant()
    {
        gil::gray8c_view_t src_view =
            gil::interleaved_view(9, 9, reinterpret_cast<const gil::gray8_pixel_t *>(img), 9);
    
        gil::gray8c_view_t out_view =
            gil::interleaved_view(13, 13, reinterpret_cast<const gil::gray8_pixel_t *>(boundary_output_constant), 13);
    
        auto output = gil::extend_boundary(src_view, 2, gil::boundary_option::extend_constant);
    
        BOOST_TEST(gil::equal_pixels(out_view, gil::view(output)));
    }
    
    void test_extend_img_with_zero()
    {
        gil::gray8c_view_t src_view =
            gil::interleaved_view(9, 9, reinterpret_cast<const gil::gray8_pixel_t *>(img), 9);
    
        gil::gray8c_view_t out_view =
            gil::interleaved_view(13, 13, reinterpret_cast<const gil::gray8_pixel_t *>(boundary_output_zero), 13);
    
        auto output = gil::extend_boundary(src_view, 2, gil::boundary_option::extend_zero);
    
        BOOST_TEST(gil::equal_pixels(out_view, gil::view(output)));
    }
    
    void test_extend_img_with_padded()
    {
        gil::gray8c_view_t src_view =
            gil::interleaved_view(9, 9, reinterpret_cast<const gil::gray8_pixel_t *>(img), 9);
    
        auto src_sub_view = gil::subimage_view(src_view, 1, 1, 7, 7);
    
        auto output = gil::extend_boundary(src_sub_view, 1, gil::boundary_option::extend_padded);
    
        BOOST_TEST(gil::equal_pixels(src_view, gil::view(output)));
    }
    
    int main()
    {
        test_extend_row_with_constant();
        test_extend_row_with_zero();
        test_extend_row_with_padded();
        test_extend_col_with_constant();
        test_extend_col_with_zero();
        test_extend_col_with_padded();
        test_extend_img_with_constant();
        test_extend_img_with_zero();
        test_extend_img_with_padded();
        return ::boost::report_errors();
    }
    
    展开全文
  • boundary用法

    千次阅读 2010-02-01 17:20:00
    acedCommand(RTSTR,"-boundary",RTSTR,PAUSE,RTSTR,"",RTNONE))  return 3; //调用命令生成边界  for(;;) //边界可能是嵌套型的,也就是有孤岛,所以进行循环  {  int rc = acdbEntNext(en,en); //获取...

    ads_name en;
       AcDbObjectId eId;
       AcDbEntity *pEntity;
       int rc = acdbEntLast(en);  //获取数据库中任意一个实体
       if (rc != RTNORM)
       {
        acutPrintf("the database has nothing./n", rc);
        return 2;
       }
         if(!acedCommand(RTSTR,"-boundary",RTSTR,PAUSE,RTSTR,"",RTNONE))
        return 3;     //调用命令生成边界

       for(;;)                        //边界可能是嵌套型的,也就是有孤岛,所以进行循环
       {
        int rc = acdbEntNext(en,en);          //获取生成的边界
        if (rc != RTNORM)
         break;       //已经没有边界实体,退出循环
        acdbGetObjectId(eId, en);

        acdbOpenObject(pEntity, eId,AcDb::kForRead);
        if(pEntity->isKindOf(AcDbPolyline::desc())) //生成的应是AcDbPolyline实体
        {
         pEntity ->highlight();

          //这边处理
        }
        else
        {
         pEntity->close();
        }
        //eraseAEntity(eId);
        //..................
        //create region object                //这时就可以根据AcDbPolyline
       };  

    展开全文
  • React错误边界 React组件的直接轻量误差边界 这种易于实现的错误边界组件可...import ErrorBoundary from 'react-err-boundary' ; ... < ErrorBoundary> < / ErrorBoundary > 道具 ErrorBoundary . propTypes = {
  • React错误边界 简单的可重用的React错误边界组件 问题 React 引入了的概念。 这个解决方案 该组件提供了一个简单且可重复使用的包装器,可用于包装组件。... 用法 使用<ErrorBoundary>的最简单方法是将其包装在
  • 用法 基本的 import { Boundary , useResource } from 'react-suspense-boundary' ; // Create or import an async function const fetchInfo = ( { id } ) => fetch ( `/info/ ${ id } ` ) . then ( response => ...
  • 使用错误边界 在功能组件中使用错误边界的React钩子。 通过将子组件包装在提供的ErrorBoundary组件中,可以跟踪子组件的错...例子和用法 导入钩子: // Named import { useErrorBoundary } from "use-error-boundary
  • 用法 要使用此组件,只需包装可能引发错误的任何其他组件。 子组件中引发的错误将自动冒泡到ErrorBoundary组件。 < ErrorBoundary> </ ErrorBoundary> 道具 属性 描述 类型 需要 默认 倒退 发生错误时呈现的后备
  • imfilter用法

    2014-05-19 09:12:00
    用法:B = imfilter(A,H) B = imfilter(A,H,option1,option2,...) 或写作g = imfilter(f, w, filtering_mode, boundary_options, size_options) 其中,f为输入图像,w为滤波掩模,g为滤波后图像。filtering_mod...

    功能:对任意类型数组或多维图像进行滤波

    用法:B = imfilter(A,H)    B = imfilter(A,H,option1,option2,...)    或写作g = imfilter(f, w, filtering_mode, boundary_options, size_options) 其中,f输入图像,w为滤波掩模,g为滤波后图像。filtering_mode用于指定在滤波过程中是使用“相关”还是“卷积”。boundary_options用于处理边界充零问题,边界的大小由滤波器的大小确定。具体参数选项见下表:
      选项 描述
    filtering_mode ‘corr’ 通过使用相关来完成,该值为默认。
      ‘conv’ 通过使用卷积来完成
    boundary_options ‘X’ 输入图像的边界通过用值X(无引号)来填充扩展 其默认值为0
      ‘replicate’ 图像大小通过复制外边界的值来扩展
      ‘symmetric’ 图像大小通过镜像反射其边界来扩展
      ‘circular’ 图像大小通过将图像看成是一个二维周期函数的一个周期来扩展
    size_options ‘full’ 输出图像的大小与被扩展图像的大小相同
      ‘same’ 输出图像的大小与输入图像的大小相同。这可通过将滤波掩模的中心点的偏移限制到原图像中包含的点来实现,该值为默认值。
    举例:originalRGB = imread('peppers.png'); imshow(originalRGB) h = fspecial('motion', 50, 45);%创建一个滤波器 filteredRGB = imfilter(originalRGB, h); figure, imshow(filteredRGB)

    转载于:https://www.cnblogs.com/yiranlaobaitu/p/3736136.html

    展开全文
  • matlab imfilter 用法

    2019-11-12 14:40:12
    用法:B = imfilter(A,H)  B = imfilter(A,H,option1,option2,...)  或写作g = imfilter(f, w, filtering_mode, boundary_options, size_options) 其中,f为输入图像,w为滤波掩模,g为滤波后图像。filtering_mode...
  • 在做吴恩达老师的深度学习课程作业时,发现决策边界函数不好理解plot_decision_boundary(model , X , y)。将此函数理解记录下: 作业地址:https://blog.csdn.net/u013733326/article/details/79702148 绘制梯度下降...
  • 用法 您可以在每个脚本上使用选项-h以获得具有可用选项的帮助指示。 获取数据集 (大约压缩一个200Mo,未压缩大约600Mo)最多可能需要10分钟才能从源中检索数据集(远程服务器速度很慢) python scripts/acquire.py...
  • React哨兵错误边界 使用Raven JS集成了Sentry错误...用法 import MyWidget from './MyWidget' import SentryErrorBoundary from 'react-sentry-error-boundary' import React from 'react' const App = ( ) => <
  • 基本用法 要使用此库,您首先需要定义项目的边界。 边界是一个或多个模块的命名组。 每个边界导出其模块的一部分(但不是全部!),并且可以依赖于其他边界。 在编译期间,边界编译器将查找并报告根据边界配置不允许...
  • 用法 import React from "react" import ReactDOM from "react-dom" import LoggingErrorBoundary from "react-logging-error-boundary" import GivesError from "./GivesError" import { ErrorPage } from "./Error...
  • imfilter用法以及滤波讲解

    万次阅读 多人点赞 2017-03-29 21:58:16
    用法:B = imfilter(A,H)  B = imfilter(A,H,option1,option2,…)  或写作g = imfilter(f, w, filtering_mode, boundary_options, size_options) 其中,f为输入图像,w为滤波掩模,g为滤波后图像。f
  • Matlab的imfilter函数用法 功能:对任意类型数组或多维图像进行滤波。 用法:B = imfilter(A,H) ... 或写作g = imfilter(f, w, filtering_mode, boundary_options, size_options) 其中,f为输入图像,w为滤波掩
  • 用法: ITopologicalOperator pTopologBoundary = pGeo as ITopologicalOperator; IGeometry pGeometry = pTopologBoundary.Boundary;(1)多边形Polygon的边界获取的是Polyline (2)Polyline获得的是IP.
  • WSE Configuration Tool的正确用法, VS2005是可以签入到IDE中使用的。 以后的版本可以单独使用配置工具,原理是配置项目的app.config 或者web.config文件。 所以需要file-open,配置文件,配置后再保存。 ...
  • Matlab的imfilter函数用法详解

    千次阅读 2014-09-10 11:06:28
    Matlab的imfilter函数用法功能...用法:B = imfilter(A,H) B = imfilter(A,H,option1,option2,...) 或写作g = imfilter(f, w, filtering_mode, boundary_options, size_options)其中,f为输入图像,w为滤波掩模,g...

空空如也

空空如也

1 2 3 4 5
收藏数 87
精华内容 34
关键字:

boundary用法