Beispiel #1
0
void drawFillPoly( ipl_image_wrapper& ipl_image
                   , const curve_vec_t& curves
                   , PIXEL              color     )
{
    const std::size_t num_curves = curves.size();

    boost::scoped_array<int> num_points_per_curve( new int[num_curves] );

    std::size_t total_num_points = 0;
    for( std::size_t i = 0; i < num_curves; ++i )
    {
        num_points_per_curve[i] = curves[i].size();
    }

    // The curve array vector will deallocate all memory by itself.
    cvpoint_array_vec_t pp( num_curves );

    CvPoint** curve_array = new CvPoint*[num_curves];

    for( std::size_t i = 0; i < num_curves; ++i )
    {
        pp[i] = make_cvPoint_array( curves[i] );

        curve_array[i] = pp[i].get();
    }

    cvFillPoly( ipl_image.get()
                , curve_array                // needs to be pointer to C array of CvPoints.
                , num_points_per_curve.get() // int array that contains number of points of each curve.
                , curves.size()
                , make_cvScalar( color ));
}
Beispiel #2
0
void drawLine( ipl_image_wrapper& ipl_image
               , point_t            start
               , point_t            end
               , PIXEL              color
               , std::size_t        line_width )
{
    cvLine( ipl_image.get()
            , make_cvPoint( start )
            , make_cvPoint( end )
            , make_cvScalar( color )
            , line_width              );
}
Beispiel #3
0
void drawCircle( ipl_image_wrapper& ipl_image
                 , point_t            center
                 , std::size_t        radius
                 , PIXEL              color
                 , std::size_t        line_width )
{
    cvCircle( ipl_image.get()
              , make_cvPoint( center )
              , radius
              , make_cvScalar( color )
              , line_width             );
}
Beispiel #4
0
void drawRectangle( ipl_image_wrapper&  ipl_image
                    , point_t             start
                    , point_t             end
                    , PIXEL               pixel
                    , std::size_t         line_width )
{
    cvRectangle( ipl_image.get()
                 , make_cvPoint( start )
                 , make_cvPoint( end   )
                 , make_cvScalar( pixel )
                 , line_width             );
}
Beispiel #5
0
template< typename Color
        , typename Line_Type
        >
inline
void drawCircle( ipl_image_wrapper& ipl_image
               , const point_t&     center
               , std::size_t        radius
               , const Color&       color
               , std::size_t        thickness
               , const Line_Type&
               )
{
   cvCircle( ipl_image.get()
           , make_cvPoint( center )
           , radius
           , make_cvScalar( color )
           , thickness
           , typename Line_Type::type::value
           );
}

template< typename View
        , typename Line_Type
        >
inline
void drawCircle( View                      view
               , point_t                   center
               , std::size_t               radius
               , typename View::value_type color
               , std::size_t               thickness
               , const Line_Type&          line_type