[Wavelet-commit] Wavelet Image.cc, 1.30, 1.31 ImageComparison.cc, 1.9, 1.10
Status: Beta
Brought to you by:
herbert
From: Herbert M. D. <he...@us...> - 2009-04-13 19:29:43
|
Update of /cvsroot/wavelet/Wavelet In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv19015 Modified Files: Image.cc ImageComparison.cc Log Message: Fixed a minor bug in the ColorImage's fitInto() method. Index: Image.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/Image.cc,v retrieving revision 1.30 retrieving revision 1.31 diff -C2 -d -r1.30 -r1.31 *** Image.cc 12 Apr 2009 16:57:53 -0000 1.30 --- Image.cc 13 Apr 2009 19:29:38 -0000 1.31 *************** *** 859,863 **** { SimpleFill fillFunc (fill); ! return fitInto (rows, cols, &fillFunc, function); } --- 859,863 ---- { SimpleFill fillFunc (fill); ! return fitInto (rows, cols, fill < 0? NULL: &fillFunc, function); } Index: ImageComparison.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/ImageComparison.cc,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** ImageComparison.cc 12 Apr 2009 16:57:53 -0000 1.9 --- ImageComparison.cc 13 Apr 2009 19:29:38 -0000 1.10 *************** *** 9,13 **** #include "Wave/StandardTransform.hh" #include "WTools/ImageComparison.hh" - #include "WTools/ImageInformation.hh" #ifdef _WIN32_WCE #undef DELETE --- 9,12 ---- *************** *** 37,41 **** } ! m_lqcachesize = MAX(m_ysize, m_xsize); m_lqcache = NEW (logvals [m_lqcachesize]); --- 36,40 ---- } ! m_lqcachesize = MAX (m_ysize, m_xsize); m_lqcache = NEW (logvals [m_lqcachesize]); *************** *** 284,285 **** --- 283,322 ---- return result; } + + ImageInformation * + ImageComparison::imageInfoForLq (const Image &image, + int nKeptCoeffs, FilterSet &flt) + { + + Image *tmp = image.clone (); + WaveletTransform *transform = NEW (StandardTransform (*tmp, flt)); + transform->analysis (0); + DELETE (transform); + + ImageInformation *ii = NEW (ImageInformation (*tmp)); + DELETE (tmp); + CoeffInformation atZero; + + bool found = false; + for (int i = 0; ! found && i < ii->size (); ++i) + { + // make sure there's nothing to truncate on the overall average + if (PII_YPOS (ii, i) == 0 && PII_XPOS (ii, i) == 0) + { + atZero = ii->at (i); + ii->at(i).val (0.0); + found = true; + } + } + + ii->asort (); + ii->shrink (nKeptCoeffs, false); + ImageInformation *result = new ImageInformation (nKeptCoeffs + 1); + result->to (atZero, 0); + for (int i = 0; i < nKeptCoeffs; ++i) + { + result->to (ii->at (i), i + 1); + } + DELETE (ii); + return result; + } |