Boost logo

Boost Users :

Subject: Re: [Boost-users] [GIL] any_image difference
From: Christian Henning (chhenning_at_[hidden])
Date: 2010-11-06 15:24:30


Hi Olivier,

>
> Great, thank you! What about my first solution?

Yes. I think it's the right way. Here is what I have which uses
transform_pixels.

#include <boost\gil\gil_all.hpp>
#include <boost\gil\extension\numeric\pixel_numeric_operations.hpp>

namespace boost { namespace gil {

typedef double bits64F;

GIL_DEFINE_BASE_TYPEDEFS(64F,gray)

typedef float bits32F;

GIL_DEFINE_BASE_TYPEDEFS(32F,gray)

} }

using namespace boost;
using namespace gil;

template< typename DST, typename SRC1, typename SRC2 >
DST generate_diff( const SRC1& src1, const SRC2& src2 )
{
    return pixel_minus_t<SRC1, SRC2, DST>()(src1, src1);
}

int main(int argc, char** argv)
{

    gray16s_image_t mns( 10, 10 );

    gray32F_image_t mnt( 10, 10 ), mne( 10, 10 );

    fill_pixels( view( mns ), gray16s_image_t::value_type( 12 ));
    fill_pixels( view( mnt ), gray32F_image_t::value_type( 5 ));
    fill_pixels( view( mne ), gray32F_image_t::value_type( 0 ));

    auto fun = generate_diff< gray16s_image_t::value_type
                            , gray32F_image_t::value_type
                            , gray32F_image_t::value_type
>;

    transform_pixels( view(mne), view(mns), view(mnt), fun );

    return 0;
}

Next I'll try dynamic_image.

Regards,
Christian


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net