Go to the documentation of this file.00001
00002 #include "vepl1_gradient_mag.h"
00003 #include <vcl_iostream.h>
00004 #include <vipl/accessors/vipl_accessors_vil1_image.h>
00005 #include <vipl/vipl_gradient_mag.h>
00006 #include <vil1/vil1_memory_image_of.h>
00007 #include <vxl_config.h>
00008
00009 vil1_image vepl1_gradient_mag(vil1_image const& image, double scale, double shift)
00010 {
00011
00012 if (vil1_pixel_format(image) == VIL1_BYTE) {
00013 vil1_memory_image_of<vxl_byte> mem(image);
00014 vil1_memory_image_of<vxl_byte> out(image);
00015 vipl_gradient_mag<vil1_image,vil1_image,vxl_byte,vxl_byte> op(scale, shift);
00016 op.put_in_data_ptr(&mem);
00017 op.put_out_data_ptr(&out);
00018 op.filter();
00019 return out;
00020 }
00021
00022
00023 else if (vil1_pixel_format(image) == VIL1_RGB_BYTE) {
00024 vcl_cerr << __FILE__ ": vepl1_gradient_mag() cannot be implemented for colour images\n";
00025 return 0;
00026 }
00027
00028
00029 else if (vil1_pixel_format(image) == VIL1_UINT16) {
00030 vil1_memory_image_of<vxl_uint_16> mem(image);
00031 vil1_memory_image_of<vxl_uint_16> out(image);
00032 vipl_gradient_mag<vil1_image,vil1_image,vxl_uint_16,vxl_uint_16> op(scale, shift);
00033 op.put_in_data_ptr(&mem);
00034 op.put_out_data_ptr(&out);
00035 op.filter();
00036 return out;
00037 }
00038
00039
00040 else if (vil1_pixel_format(image) == VIL1_FLOAT) {
00041 vil1_memory_image_of<float> mem(image);
00042 vil1_memory_image_of<float> out(image);
00043 vipl_gradient_mag<vil1_image,vil1_image,float,float> op(scale, shift);
00044 op.put_in_data_ptr(&mem);
00045 op.put_out_data_ptr(&out);
00046 op.filter();
00047 return out;
00048 }
00049
00050
00051 else if (vil1_pixel_format(image) == VIL1_DOUBLE) {
00052 vil1_memory_image_of<double> mem(image);
00053 vil1_memory_image_of<double> out(image);
00054 vipl_gradient_mag<vil1_image,vil1_image,double,double> op(scale, shift);
00055 op.put_in_data_ptr(&mem);
00056 op.put_out_data_ptr(&out);
00057 op.filter();
00058 return out;
00059 }
00060
00061
00062 else {
00063 vcl_cerr << __FILE__ ": vepl1_gradient_mag() not implemented for " << image << vcl_endl;
00064 return 0;
00065 }
00066 }
00067