claraty::Rescale_Op< T > Class Template Reference
#include <rescale_op.h>
Collaboration diagram for claraty::Rescale_Op< T >:

Public Member Functions | |
| Rescale_Op (T min=0, T max=0) | |
| template<class TS, class TD> | |
| void | filter (Image< TS > src_image, Image< TD > &dest_image) |
| void | set_min (T min) |
| void | set_max (T max) |
| void | set_min_max (T min, T max) |
| T | get_min () |
| T | get_max () |
Private Attributes | |
| T | _min |
| T | _max |
Detailed Description
template<class T>
class claraty::Rescale_Op< T >
An operation to rescale all pixels in an Image to be between a specified minimun and maximum value.
Definition at line 40 of file rescale_op.h.
Constructor & Destructor Documentation
| claraty::Rescale_Op< T >::Rescale_Op | ( | T | min = 0, |
|
| T | max = 0 | |||
| ) | [inline] |
Creates a rescaling operation that rescales an Image to values between min and max (if a value is not specified, zero is used).
- Parameters:
-
min the minimum value to rescale to max the maximum value to rescale to
Definition at line 51 of file rescale_op.h.
Member Function Documentation
| void claraty::Rescale_Op< T >::filter | ( | Image< TS > | src_image, | |
| Image< TD > & | dest_image | |||
| ) |
Rescales the src_image to be between the operation's min and max value and places the result in dest_image. If dest_image is not the same size as src_image, it is resized.
- Parameters:
-
src_image the image to be rescaled dest_image the output (scaled image)
Definition at line 83 of file rescale_op.h.
References claraty::Rescale_Op< T >::_max, claraty::Rescale_Op< T >::_min, claraty::Image< T >::get_height(), claraty::Image< T >::get_width(), claraty::Matrix< T >::max_value(), claraty::Matrix< T >::min_value(), and claraty::N_2D_Array< T >::resize().
Referenced by claraty::Image_IO_Factory::save_image().
00083 { 00084 00085 00086 dest_image.resize(src_image.get_height(), src_image.get_width()); 00087 00088 //tmp_image = (TD) ((_max-_min)/(src_image.max_value()-src_image.min_value())*(src_image - src_image.min_value())+_min); 00089 00090 T src_min = src_image.min_value(); 00091 T src_max = src_image.max_value(); 00092 00093 for(int r=0; r<src_image.get_height(); r++) { 00094 for(int c=0; c<src_image.get_width(); c++) { 00095 dest_image(r,c) = (TD) (((_max-_min)/(src_max-src_min))*((T)src_image(r,c) - src_min)+_min); 00096 //cout << src_image(r,c) << " " << dest_image(r,c) << endl; 00097 00098 } 00099 } 00100 00101 }
Here is the call graph for this function:

| void claraty::Rescale_Op< T >::set_min | ( | T | min | ) |
Sets the minimum value.
- Parameters:
-
min the minimum value to rescale to
Definition at line 108 of file rescale_op.h.
References claraty::Rescale_Op< T >::_min.
00108 { 00109 00110 _min = min; 00111 }
| void claraty::Rescale_Op< T >::set_max | ( | T | max | ) |
Sets the maximum value.
- Parameters:
-
max the maximum value to rescale to
Definition at line 120 of file rescale_op.h.
References claraty::Rescale_Op< T >::_max.
00120 { 00121 00122 _max = max; 00123 }
| void claraty::Rescale_Op< T >::set_min_max | ( | T | min, | |
| T | max | |||
| ) |
Sets the minimum and maximum values.
- Parameters:
-
min the minimum value to rescale to max the maximum value to rescale to
Definition at line 132 of file rescale_op.h.
References claraty::Rescale_Op< T >::_max, and claraty::Rescale_Op< T >::_min.
| T claraty::Rescale_Op< T >::get_min | ( | ) |
Returns the minimum value.
- Returns:
- min the minimum value to rescale to
Definition at line 145 of file rescale_op.h.
References claraty::Rescale_Op< T >::_min.
00145 { 00146 00147 return _min; 00148 }
| T claraty::Rescale_Op< T >::get_max | ( | ) |
Returns the maximum value.
- Returns:
- max the maximum value to rescale to
Definition at line 156 of file rescale_op.h.
References claraty::Rescale_Op< T >::_max.
00156 { 00157 00158 return _max; 00159 }
Member Data Documentation
T claraty::Rescale_Op< T >::_min [private] |
Definition at line 69 of file rescale_op.h.
Referenced by claraty::Rescale_Op< T >::filter(), claraty::Rescale_Op< T >::get_min(), claraty::Rescale_Op< T >::set_min(), and claraty::Rescale_Op< T >::set_min_max().
T claraty::Rescale_Op< T >::_max [private] |
Definition at line 70 of file rescale_op.h.
Referenced by claraty::Rescale_Op< T >::filter(), claraty::Rescale_Op< T >::get_max(), claraty::Rescale_Op< T >::set_max(), and claraty::Rescale_Op< T >::set_min_max().
The documentation for this class was generated from the following file: