[Wavelet-commit] Wavelet ImageComparison.cc,1.11,1.12
Status: Beta
Brought to you by:
herbert
From: Herbert M. D. <he...@us...> - 2009-07-15 15:45:03
|
Update of /cvsroot/wavelet/Wavelet In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv3507 Modified Files: ImageComparison.cc Log Message: Reorganised weights for Lq metric in image comparision. Index: ImageComparison.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ImageComparison.cc,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ImageComparison.cc 19 Jun 2009 13:45:54 -0000 1.11 --- ImageComparison.cc 15 Jul 2009 15:44:54 -0000 1.12 *************** *** 22,27 **** #endif ! #define MAX_WEIGHT_IDX 5 ! static const float gl_weights[][MAX_WEIGHT_IDX + 1] = { { 4.04, 0.79, 0.45, 0.42, 0.41, 0.32 }, { 15.25, 0.92, 0.53, 0.26, 0.14, 0.07 }, --- 22,32 ---- #endif ! const float ImageComparison::m_scWeights[][N_WEIGHTS] = { ! { 5.00, 0.83, 1.01, 0.52, 0.47, 0.30 }, ! { 19.21, 1.26, 0.44, 0.53, 0.28, 0.14 }, ! { 34.47, 0.36, 0.45, 0.14, 0.18, 0.27 } ! }; ! ! const float ImageComparison::m_drWeights[][N_WEIGHTS] = { { 4.04, 0.79, 0.45, 0.42, 0.41, 0.32 }, { 15.25, 0.92, 0.53, 0.26, 0.14, 0.07 }, *************** *** 53,62 **** } ! for (int row = 0; row < 2; row++) { ! for (int col = 0; col < MAX_WEIGHT_IDX + 1; col++) ! { ! m_weights[row][col] = gl_weights[3 * row][col]; ! } } } --- 58,70 ---- } ! for (int col = 0; col < N_WEIGHTS; col++) { ! m_lqDWeights[0][col] = m_drWeights[0][col]; ! std::cout << "draw: " << m_lqDWeights[0][col] << std::endl; ! } ! for (int col = 0; col < N_WEIGHTS; col++) ! { ! m_lqDWeights[1][col] = m_scWeights[0][col]; ! std::cout << "scan: " << m_lqDWeights[0][col] << std::endl; } } *************** *** 131,135 **** m_images[i] = truncateForLq (*origs[i], percent, flt); } ! score.colors = m_weights[type][0] * fabs (m_images[0]->at (0, 0) - m_images[1]->at (0, 0)); --- 139,143 ---- m_images[i] = truncateForLq (*origs[i], percent, flt); } ! score.colors = m_lqDWeights[type][0] * fabs (m_images[0]->at (0, 0) - m_images[1]->at (0, 0)); *************** *** 190,194 **** int l1 = level (y); int l2 = y == x? l1: level (x); ! return m_weights [type][MIN (MAX (l1, l2), 5)]; } --- 198,202 ---- int l1 = level (y); int l2 = y == x? l1: level (x); ! return m_lqDWeights [type][MIN (MAX (l1, l2), 5)]; } *************** *** 257,262 **** // << std::setprecision (5) << std::setw (11) // << truncated2.at (0) << std::endl; ! return gl_weights[colorChannel][0] * ::fabs (truncated1.at (0) - ! truncated2.at (0)); } --- 265,270 ---- // << std::setprecision (5) << std::setw (11) // << truncated2.at (0) << std::endl; ! return m_scWeights[colorChannel][0] * ::fabs (truncated1.at (0) - ! truncated2.at (0)); } *************** *** 293,298 **** (int)floor (log ((double)cacheEntry) / log ((double)2)); } ! res -= gl_weights[colorChannel][MIN (indexCache[cacheEntry], ! MAX_WEIGHT_IDX)]; } else if (c1 != 0) --- 301,306 ---- (int)floor (log ((double)cacheEntry) / log ((double)2)); } ! res -= m_scWeights[colorChannel][MIN (indexCache[cacheEntry], ! N_WEIGHTS - 1)]; } else if (c1 != 0) *************** *** 353,357 **** ImageInformation * ImageComparison::imageInfoForLq (const Image &image, ! int nKeptCoeffs, FilterSet &flt) { --- 361,365 ---- ImageInformation * ImageComparison::imageInfoForLq (const Image &image, ! int nKeptCoeffs, FilterSet &flt) { *************** *** 388,389 **** --- 396,410 ---- return result; } + + const float * + ImageComparison::getWeights (const imgtype imgType, int channel) + { + switch (imgType) + { + case DRAWN: + return m_drWeights[channel]; + case SCANNED: + return m_scWeights[channel]; + } + throw std::invalid_argument ("unknown image type."); + } |