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