[Wavelet-commit] Wavelet WaveletTransform.cc,1.6,1.7
Status: Beta
Brought to you by:
herbert
From: Herbert M. D. <he...@us...> - 2007-05-25 08:08:46
|
Update of /cvsroot/wavelet/Wavelet In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv18996 Modified Files: WaveletTransform.cc Log Message: Added WaveletTransform::highMax() method. Index: WaveletTransform.cc =================================================================== RCS file: /cvsroot/wavelet/Wavelet/WaveletTransform.cc,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** WaveletTransform.cc 10 Aug 2005 09:35:23 -0000 1.6 --- WaveletTransform.cc 25 May 2007 08:08:09 -0000 1.7 *************** *** 12,20 **** #include "WImage/tools.h" #include <stdexcept> ! #include <assert.h> ! #include <math.h> #ifndef _WIN32_WCE #include <iostream> ! #else #include "WImage/miscdefs.h" #endif --- 12,20 ---- #include "WImage/tools.h" #include <stdexcept> ! #include <cassert> ! #include <cmath> #ifndef _WIN32_WCE #include <iostream> ! #else #include "WImage/miscdefs.h" #endif *************** *** 27,31 **** WaveletTransform::sanity (void) { ! if (m_image->rows () != m_buffer->rows () || m_image->cols () != m_buffer->cols ()) { --- 27,31 ---- WaveletTransform::sanity (void) { ! if (m_image->rows () != m_buffer->rows () || m_image->cols () != m_buffer->cols ()) { *************** *** 34,43 **** } ! void WaveletTransform::expandImage (void) { int powerY = 0; int powerX = 0; ! if (!tools_powerOfTwo (m_image->rows (), powerY) || m_image->rows () != m_image->cols ()) --- 34,43 ---- } ! void WaveletTransform::expandImage (void) { int powerY = 0; int powerX = 0; ! if (!tools_powerOfTwo (m_image->rows (), powerY) || m_image->rows () != m_image->cols ()) *************** *** 56,60 **** ! void WaveletTransform::restoreImage (void) { --- 56,60 ---- ! void WaveletTransform::restoreImage (void) { *************** *** 64,68 **** ! void WaveletTransform::analysis (int steps) { --- 64,68 ---- ! void WaveletTransform::analysis (int steps) { *************** *** 78,82 **** } ! void WaveletTransform::synthesis (int steps, int prevSteps) { --- 78,82 ---- } ! void WaveletTransform::synthesis (int steps, int prevSteps) { *************** *** 98,105 **** WaveletTransform::WaveletTransform (Image &img, FilterSet &fil) ! { ! m_image = &img; m_filter = &fil; ! m_wavelet = NEW (Wavelet (fil)); m_buffer = m_image->clone (); m_rows = m_image->rows (); --- 98,105 ---- WaveletTransform::WaveletTransform (Image &img, FilterSet &fil) ! { ! m_image = &img; m_filter = &fil; ! m_wavelet = NEW (Wavelet (fil)); m_buffer = m_image->clone (); m_rows = m_image->rows (); *************** *** 119,128 **** int yoffs = 0, xoffs = 0, ysize = 0, xsize = 0; where (what, steps, yoffs, xoffs, ysize, xsize); ! DPRINTF (("crop (%d, %d, %d, %d)\n", yoffs, xoffs, ysize, xsize)); return m_image->crop (yoffs, xoffs, ysize, xsize); } ! ! void WaveletTransform::import (Image &img, area what, int steps) { --- 119,155 ---- int yoffs = 0, xoffs = 0, ysize = 0, xsize = 0; where (what, steps, yoffs, xoffs, ysize, xsize); ! DPRINTF (("crop (%d, %d, %d, %d)\n", yoffs, xoffs, ysize, xsize)); return m_image->crop (yoffs, xoffs, ysize, xsize); } ! ! ! Image * ! WaveletTransform::highMax (int steps) ! { ! int yoffs = 0, xoffs = 0, ysize = 0, xsize = 0; ! area what; ! Image *ret = subband (HL, steps); ! ! for (int a = (int)LH; a < (int)areaINVALID; a++) ! { ! what = (area)a; ! where (what, steps, yoffs, xoffs, ysize, xsize); ! for (int y = 0; y < ysize; y++) ! { ! for (int x = 0; x < xsize; x++) ! { ! if (fabs (m_image->at (y + yoffs, x + xoffs)) ! > fabs (ret->at (y, x))) ! { ! ret->to (y, x, m_image->at (y + yoffs, x + xoffs)); ! } ! } ! } ! } ! return ret; ! } ! ! void WaveletTransform::import (Image &img, area what, int steps) { *************** *** 134,148 **** "dimensions don't match the subband size."); } ! DPRINTF (("import: area: %d, yoffs: %d, xoffs: %d\n", (int)what, yoffs, xoffs)); m_image->paste (yoffs, xoffs, img); } ! void WaveletTransform::fill (coeff value, area what, int steps) { int yoffs = 0, xoffs = 0, ysize = 0, xsize = 0; where (what, steps, yoffs, xoffs, ysize, xsize); ! DPRINTF (("fill: area: %d, yoffs: %d, xoffs: %d, value: %f\n", (int)what, yoffs, xoffs, value)); for (int row = 0; row < ysize; row++) --- 161,175 ---- "dimensions don't match the subband size."); } ! DPRINTF (("import: area: %d, yoffs: %d, xoffs: %d\n", (int)what, yoffs, xoffs)); m_image->paste (yoffs, xoffs, img); } ! void WaveletTransform::fill (coeff value, area what, int steps) { int yoffs = 0, xoffs = 0, ysize = 0, xsize = 0; where (what, steps, yoffs, xoffs, ysize, xsize); ! DPRINTF (("fill: area: %d, yoffs: %d, xoffs: %d, value: %f\n", (int)what, yoffs, xoffs, value)); for (int row = 0; row < ysize; row++) *************** *** 156,160 **** void ! WaveletTransform::where (area what, int subband, int &yoffs, int &xoffs, int &ysize, int &xsize) const { --- 183,187 ---- void ! WaveletTransform::where (area what, int subband, int &yoffs, int &xoffs, int &ysize, int &xsize) const { *************** *** 166,173 **** xoffs = yoffs = 0; ! ! DPRINTF (("subband: %d, anasteps: %d, synsteps: %d\n", subband, m_image->anasteps (), m_image->synsteps ())); ! ysize = m_image->rows () / TWOPOW (subband); xsize = m_image->cols () / TWOPOW (subband); --- 193,200 ---- xoffs = yoffs = 0; ! ! DPRINTF (("subband: %d, anasteps: %d, synsteps: %d\n", subband, m_image->anasteps (), m_image->synsteps ())); ! ysize = m_image->rows () / TWOPOW (subband); xsize = m_image->cols () / TWOPOW (subband); *************** *** 193,198 **** xsize = m_image->cols () / TWOPOW (subband); } ! ! DPRINTF (("area: %d, yoffs: %d, xoffs: %d, ysize: %d, xsize: %d\n", (int)what, yoffs, xoffs, ysize, xsize)); assert (yoffs + ysize <= m_image->rows ()); --- 220,225 ---- xsize = m_image->cols () / TWOPOW (subband); } ! ! DPRINTF (("area: %d, yoffs: %d, xoffs: %d, ysize: %d, xsize: %d\n", (int)what, yoffs, xoffs, ysize, xsize)); assert (yoffs + ysize <= m_image->rows ()); *************** *** 200,205 **** } ! void ! WaveletTransform::where (int ypos, int xpos, int &subband, area &channel, int steps) const { --- 227,232 ---- } ! void ! WaveletTransform::where (int ypos, int xpos, int &subband, area &channel, int steps) const { *************** *** 226,232 **** } ! void ! WaveletTransform::mapPosition (int yOld, int xOld, int toSubband, ! area toChannel, int &yNew, int &xNew, int &sizeFactor, int steps) const { --- 253,259 ---- } ! void ! WaveletTransform::mapPosition (int yOld, int xOld, int toSubband, ! area toChannel, int &yNew, int &xNew, int &sizeFactor, int steps) const { *************** *** 235,239 **** int y1 = 0, x1 = 0, h1 = 0, w1 = 0; int y2 = 0, x2 = 0, h2 = 0, w2 = 0; ! where (yOld, xOld, fromSubband, fromChannel, steps); where (fromChannel, fromSubband, y1, x1, h1, w1); --- 262,266 ---- int y1 = 0, x1 = 0, h1 = 0, w1 = 0; int y2 = 0, x2 = 0, h2 = 0, w2 = 0; ! where (yOld, xOld, fromSubband, fromChannel, steps); where (fromChannel, fromSubband, y1, x1, h1, w1); *************** *** 241,245 **** sizeFactor = h2 / h1; ! /* calculate the destination (mapped) coordinates from their relative * channel position and the two channels' coordinates... */ --- 268,272 ---- sizeFactor = h2 / h1; ! /* calculate the destination (mapped) coordinates from their relative * channel position and the two channels' coordinates... */ *************** *** 250,254 **** } ! coeff WaveletTransform::ratio (int subband1, int subband2) { --- 277,281 ---- } ! coeff WaveletTransform::ratio (int subband1, int subband2) { *************** *** 256,260 **** } ! int WaveletTransform::getSubband (int ypos, int xpos, int steps) { --- 283,287 ---- } ! int WaveletTransform::getSubband (int ypos, int xpos, int steps) { *************** *** 274,278 **** } ! coeff WaveletTransform::saverage (int subband, area channel) const { --- 301,305 ---- } ! coeff WaveletTransform::saverage (int subband, area channel) const { *************** *** 283,287 **** ! coeff WaveletTransform::aaverage (int subband, area channel) const { --- 310,314 ---- ! coeff WaveletTransform::aaverage (int subband, area channel) const { *************** *** 292,296 **** ! coeff WaveletTransform::sqvariance (int subband, area channel) const { --- 319,323 ---- ! coeff WaveletTransform::sqvariance (int subband, area channel) const { *************** *** 300,304 **** } ! coeff WaveletTransform::variance (int subband, area channel, bool abs) const { --- 327,331 ---- } ! coeff WaveletTransform::variance (int subband, area channel, bool abs) const { *************** *** 309,313 **** ! coeff WaveletTransform::sdeviation (int subband, area channel, bool abs) const { --- 336,340 ---- ! coeff WaveletTransform::sdeviation (int subband, area channel, bool abs) const { |