struct image_difference
{
typedef void result_type;
template<typename OutputViewType, typename ViewType1, typename ViewType2>
result_type operator()(OutputViewType &out, const ViewType1 &v1, const ViewType2 &v2) const
{
typedef typename get_pixel_type<ViewType1>::type v1_pixel_t;
typedef typename get_pixel_type<ViewType2>::type v2_pixel_t;
typedef typename get_pixel_type<OutputViewType>::type out_pixel_t;
typename ViewType1::iterator v1_it = v1.begin();
typename ViewType2::iterator v2_it = v2.begin();
typename OutputViewType::iterator out_it = out.begin();
for(;v1_it!=v1.end();++v1_it, ++v2_it, ++out_it)
*out_it = pixel_minus_t<v1_pixel_t, v2_pixel_t, out_pixel_t>()(*v1_it, *v2_it);
}
};
int main(int argc, char** argv)
{
gray16s_image_t mns;
gray32F_image_t mnt, mne;
read_image( "/home/olivier/work/data/ZTerrain_c3/ZTerrain_c3.tif", mns , tiff_tag() );
read_image( "/home/olivier/work/data/ZTerrain_c3/ZTerrain_c3_MNT.tif", mnt , tiff_tag() );
mne.recreate( mns.width(), mns.height() );
image_difference()( view(mne) , view(mns) , view(mnt) );
write_view( "/home/olivier/work/data/ZTerrain_c3/ZTerrain_c3_MNE.tif", view(mne), tiff_tag() );
} |
|