claraty::Gamma_Op Class Reference
#include <gamma_op.h>
Public Member Functions | |
| Gamma_Op () | |
| template<class TS, class TD> | |
| void | gamma_correct (Image< TS > &src_image, Image< TD > &dest_image, double gamma) |
Detailed Description
An operation to apply gamma correction to an Image with the specified gamma value.
Definition at line 39 of file gamma_op.h.
Constructor & Destructor Documentation
| claraty::Gamma_Op::Gamma_Op | ( | ) | [inline] |
Creates a rescaling operation that rescales an Image to values between min and max (if a value is not specified, zero is used).
Definition at line 48 of file gamma_op.h.
Member Function Documentation
template<class TS, class TD>
| void claraty::Gamma_Op::gamma_correct | ( | Image< TS > & | src_image, | |
| Image< TD > & | dest_image, | |||
| double | gamma | |||
| ) |
Applies the gamma correction value on the source image pixels and writes them to the dest image
- Parameters:
-
src_image the image to be apply gamma to dest_image the image to be save the gamma corrected image gamma the gamma correction value std::cout << "max_pix_val_src: " << max_pix_val_src << std::endl; std::cout << "max_pix_val_dest: " << max_pix_val_dest << std::endl;
Definition at line 65 of file gamma_op.h.
References claraty::Image< T >::get_height(), claraty::Image< T >::get_width(), and claraty::N_2D_Array< T >::resize().
00065 { 00066 00067 // std::cout << "sizeof(TS): " << sizeof(TS) << std::endl; 00068 // std::cout << "sizeof(TD): " << sizeof(TD) << std::endl; 00069 00070 // get the size of source and dest images in bits 00071 unsigned int size_of_src = sizeof(TS) * 8; 00072 unsigned int size_of_dest = sizeof(TD) * 8; 00073 // get the max range value of the source and dest image 00074 double max_pix_val_src = pow((double)2,(double)size_of_src); 00075 double max_pix_val_dest = pow((double)2,(double)size_of_dest); 00076 00077 // std::cout << "max_pix_val_src: " << max_pix_val_src << std::endl; 00078 // std::cout << "max_pix_val_dest: " << max_pix_val_dest << std::endl; 00079 00080 dest_image.resize(src_image.get_height(), src_image.get_width()); 00081 00082 for(int r=0; r<src_image.get_height(); r++) { 00083 for(int c=0; c<src_image.get_width(); c++) { 00084 dest_image(r,c) = (TD) (max_pix_val_dest * pow((double)(src_image(r,c)/max_pix_val_src), (double)(1/gamma))); 00085 } 00086 } 00087 00088 }
Here is the call graph for this function:

The documentation for this class was generated from the following file: