#include "base/data_types/color_space/ossimRgbVector.h"
#include "base/data_types/color_space/ossimJpegYCbCrVector.h"
#include "base/data_types/color_space/ossimHsiVector.h"
#include "base/data_types/color_space/ossimHsvVector.h"
#include <stdlib.h>
#include <math.h>
Go to the source code of this file.
Functions |
|
void | randomTestHsv () |
void | randomTestYCbCr () |
void | randomTestHsi () |
int | main () |
|
Definition at line 225 of file color_vec_test.cc. 00226 { 00227 cout << "Running tests on Hsv" << endl; 00228 randomTestHsv(); 00229 cout << "Running tests on YCbCr" << endl; 00230 randomTestYCbCr(); 00231 cout << "Running tests on HSI" << endl; 00232 randomTestHsi(); 00233 } |
|
Definition at line 153 of file color_vec_test.cc. Referenced by main(). 00154 { 00155 bool passed = true; 00156 00157 cout << "Testing assignment conversion" << endl; 00158 for(long count = 0; count < 100000; ++count) 00159 { 00160 ossimRgbVector rgb(rand()%256, rand()%256, rand()%256); 00161 00162 ossimRgbVector rgbResult; 00163 ossimHsiVector hsi; 00164 00165 hsi = rgb; 00166 rgbResult = hsi; 00167 00168 double r1 = rgb.getR(); 00169 double g1 = rgb.getG(); 00170 double b1 = rgb.getB(); 00171 00172 double r2 = rgbResult.getR(); 00173 double g2 = rgbResult.getG(); 00174 double b2 = rgbResult.getB(); 00175 00176 if( (fabs(r1-r2) > 2) || 00177 (fabs(g1-g2) > 2) || 00178 (fabs(b1-b2) > 2)) 00179 { 00180 cout << "WARNING: result is different in Hsi conversion\n" 00181 << "original: " << rgb << " result: " << rgbResult << endl; 00182 00183 passed = false; 00184 } 00185 } 00186 00187 cout << "Testing constructor conversion" << endl; 00188 for(long count = 0; count < 100000; ++count) 00189 { 00190 ossimRgbVector rgb(rand()%256, rand()%256, rand()%256); 00191 00192 ossimHsiVector hsi(rgb); 00193 ossimRgbVector rgbResult(hsi); 00194 00195 double r1 = rgb.getR(); 00196 double g1 = rgb.getG(); 00197 double b1 = rgb.getB(); 00198 00199 double r2 = rgbResult.getR(); 00200 double g2 = rgbResult.getG(); 00201 double b2 = rgbResult.getB(); 00202 00203 if( (fabs(r1-r2) > 2) || 00204 (fabs(g1-g2) > 2) || 00205 (fabs(b1-b2) > 2)) 00206 { 00207 cout << "WARNING: result is different in Hsi constructor conversion\n" 00208 << "original: " << rgb << " result: " << rgbResult << endl; 00209 00210 passed = false; 00211 } 00212 } 00213 00214 if(!passed) 00215 { 00216 cout << "Hsi Test did not pass!!!!!!!" << endl; 00217 } 00218 else 00219 { 00220 cout << "Hsi Test passed!!!!!!!" << endl; 00221 00222 } 00223 } |
|
Definition at line 8 of file color_vec_test.cc. Referenced by main(). 00009 { 00010 bool passed = true; 00011 00012 cout << "Testing assignment conversion" << endl; 00013 for(long count = 0; count < 100000; ++count) 00014 { 00015 ossimRgbVector rgb(rand()%256, rand()%256, rand()%256); 00016 00017 ossimRgbVector rgbResult; 00018 ossimJpegYCbCrVector YCbCr; 00019 00020 YCbCr = rgb; 00021 rgbResult = YCbCr; 00022 00023 double r1 = rgb.getR(); 00024 double g1 = rgb.getG(); 00025 double b1 = rgb.getB(); 00026 00027 double r2 = rgbResult.getR(); 00028 double g2 = rgbResult.getG(); 00029 double b2 = rgbResult.getB(); 00030 00031 if( (fabs(r1-r2) > 2) || 00032 (fabs(g1-g2) > 2) || 00033 (fabs(b1-b2) > 2)) 00034 { 00035 cout << "WARNING: result is different in hsv conversion\n" 00036 << "original: " << rgb << " result: " << rgbResult << endl; 00037 00038 passed = false; 00039 } 00040 } 00041 00042 cout << "Testing constructor conversion" << endl; 00043 for(long count = 0; count < 100000; ++count) 00044 { 00045 ossimRgbVector rgb(rand()%256, rand()%256, rand()%256); 00046 00047 ossimHsvVector hsv(rgb); 00048 00049 ossimRgbVector rgbResult(hsv); 00050 00051 double r1 = rgb.getR(); 00052 double g1 = rgb.getG(); 00053 double b1 = rgb.getB(); 00054 00055 double r2 = rgbResult.getR(); 00056 double g2 = rgbResult.getG(); 00057 double b2 = rgbResult.getB(); 00058 00059 if( (fabs(r1-r2) > 2) || 00060 (fabs(g1-g2) > 2) || 00061 (fabs(b1-b2) > 2)) 00062 { 00063 cout << "WARNING: result is different in hsv conversion\n" 00064 << "original: " << rgb << " result: " << rgbResult << endl; 00065 00066 passed = false; 00067 } 00068 } 00069 00070 if(!passed) 00071 { 00072 cout << "Hsv Test did not pass!!!!!!!" << endl; 00073 } 00074 else 00075 { 00076 cout << "Hsv Test passed!!!!!!!" << endl; 00077 00078 } 00079 } |
|
Definition at line 81 of file color_vec_test.cc. Referenced by main(). 00082 { 00083 bool passed = true; 00084 00085 cout << "Testing assignment conversion" << endl; 00086 for(long count = 0; count < 100000; ++count) 00087 { 00088 ossimRgbVector rgb(rand()%256, rand()%256, rand()%256); 00089 00090 ossimRgbVector rgbResult; 00091 ossimJpegYCbCrVector YCbCr; 00092 00093 YCbCr = rgb; 00094 rgbResult = YCbCr; 00095 00096 double r1 = rgb.getR(); 00097 double g1 = rgb.getG(); 00098 double b1 = rgb.getB(); 00099 00100 double r2 = rgbResult.getR(); 00101 double g2 = rgbResult.getG(); 00102 double b2 = rgbResult.getB(); 00103 00104 if( (fabs(r1-r2) > 2) || 00105 (fabs(g1-g2) > 2) || 00106 (fabs(b1-b2) > 2)) 00107 { 00108 cout << "WARNING: result is different in YCbCr conversion\n" 00109 << "original: " << rgb << " result: " << rgbResult << endl; 00110 00111 passed = false; 00112 } 00113 } 00114 00115 cout << "Testing constructor conversion" << endl; 00116 for(long count = 0; count < 100000; ++count) 00117 { 00118 ossimRgbVector rgb(rand()%256, rand()%256, rand()%256); 00119 00120 ossimJpegYCbCrVector YCbCr(rgb); 00121 ossimRgbVector rgbResult(YCbCr); 00122 00123 double r1 = rgb.getR(); 00124 double g1 = rgb.getG(); 00125 double b1 = rgb.getB(); 00126 00127 double r2 = rgbResult.getR(); 00128 double g2 = rgbResult.getG(); 00129 double b2 = rgbResult.getB(); 00130 00131 if( (fabs(r1-r2) > 2) || 00132 (fabs(g1-g2) > 2) || 00133 (fabs(b1-b2) > 2)) 00134 { 00135 cout << "WARNING: result is different in YCbCr conversion\n" 00136 << "original: " << rgb << " result: " << rgbResult << endl; 00137 00138 passed = false; 00139 } 00140 } 00141 00142 if(!passed) 00143 { 00144 cout << "YCbCr Test did not pass!!!!!!!" << endl; 00145 } 00146 else 00147 { 00148 cout << "YCbCr Test passed!!!!!!!" << endl; 00149 00150 } 00151 } |