00001 #ifndef image_ops__INCLUDED
00002 #define image_ops__INCLUDED
00003
00004 #include <vil1/vil1_memory_image_of.h>
00005 #include "image_convert.h"
00006
00007 template <class T>
00008 vil1_memory_image_of<T> &operator -=
00009 (
00010 vil1_memory_image_of<T> &im1,
00011 vil1_memory_image_of<T> &im2
00012 );
00013
00014 template <class T>
00015 vil1_memory_image_of<T> &operator +=
00016 (
00017 vil1_memory_image_of<T> &im1,
00018 T constant_add
00019 );
00020
00021 template <class T>
00022 void threshold_abs(vil1_memory_image_of<T> &image,
00023 vil1_memory_image_of<T> &source_vals,
00024 T threshold, T zero_val);
00025
00026 template <class T>
00027 T max_val(const vil1_memory_image_of<T> &image, T min);
00028
00029 template <class T>
00030 T min_val(const vil1_memory_image_of<T> &image, T max);
00031
00032 template <class T>
00033 vil1_memory_image_of<T> *normalise_image(const vil1_memory_image_of<T> &src,
00034 T low, T high, T min, T max,
00035 T epsilon=(T)0);
00036
00037 typedef vil1_memory_image_of<int> IntImage;
00038 typedef vil1_memory_image_of<vxl_byte> ByteImage;
00039
00040 inline void save_intimage_asbyte(vil1_memory_image_of<int> &src,
00041 char *filename)
00042 {
00043 IntImage *normal = normalise_image(src, 0, 255, INT_MIN, INT_MAX);
00044 vxl_byte b;
00045 ByteImage *byte_im = convert_image(*normal, b);
00046 vil1_save(*byte_im, filename);
00047 delete byte_im;
00048 delete normal;
00049 }
00050
00051
00052
00053
00054 inline void save_intimage_asbyte_nonorm(vil1_memory_image_of<int> &src,
00055 char *filename)
00056 {
00057 vxl_byte b;
00058 ByteImage *byte_im = convert_image(src, b);
00059 vil1_save(*byte_im, filename);
00060 delete byte_im;
00061 }
00062
00063 #endif // image_ops__INCLUDED