|
From: Gustavo P. B. <gb...@us...> - 2005-07-02 19:11:21
|
Update of /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5525/src/libkimageprocess Modified Files: ktcalculation.cpp ktcalculation.h Log Message: - Fixing WIN_ALLPIX (again ehhe) Index: ktcalculation.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktcalculation.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ktcalculation.h 1 Jul 2005 00:37:19 -0000 1.5 +++ ktcalculation.h 2 Jul 2005 19:11:08 -0000 1.6 @@ -107,4 +107,6 @@ static KTCalculation *s_self; }; +QString& operator<<(QString& s, const QValueList<dataEntry> &l ); + #endif Index: ktcalculation.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktcalculation.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ktcalculation.cpp 1 Jul 2005 00:37:19 -0000 1.9 +++ ktcalculation.cpp 2 Jul 2005 19:11:08 -0000 1.10 @@ -31,6 +31,9 @@ #include <kstaticdeleter.h> #include <kdebug.h> +#include <qtextstream.h> +#include <qfile.h> + KTCalculation::KTCalculation(QObject *parent, const char *name) : QObject(parent, name) { @@ -93,10 +96,10 @@ { for ( int i=0; i < m_inputs; ++i ) { - (*it).inputs[i] = ((*it).inputs[i] - m_min[i]) * 1/*100*/ / dif[i]; + (*it).inputs[i] = ((*it).inputs[i] - m_min[i]) * 1000 / dif[i]; } } - + KTPluginManager::self()->classifier()->doTraining(m_data, m_inputs, m_outputs); emit updateProgress(); @@ -142,7 +145,7 @@ { for ( int i=0; i < m_inputs; ++i ) { - (*it).inputs[i] = ((*it).inputs[i] - m_min[i]) * 1/*100*/ / dif[i]; + (*it).inputs[i] = ((*it).inputs[i] - m_min[i]) * 1000 / dif[i]; } } @@ -223,8 +226,8 @@ } break; case WIN_ALLPIX: - int beginx = (m_window_size.width / 2); - int beginy = (m_window_size.height / 2); + int startx; + int starty; // Generate the pattern for Testing Image int width = img->width(); @@ -233,27 +236,8 @@ { for (y = 0; y < height; y++) { - int startx, starty; - - //handling windows that are partly or fully outside the image - - //the x side - if ( x - beginx < 0 ) - startx = 0; - else if ( x - beginx + m_window_size.width > width ) - startx = width - m_window_size.width; - else - startx = x - beginx; - - //the y side - if ( y - beginy < 0 ) - starty = 0; - else if ( y - beginy + m_window_size.height > height ) - starty = height - m_window_size.height; - else - starty = y - beginy; - - //kdDebug() << "Taking startx=" << startx << " starty=" << starty << " for x=" << x << " y=" << y << endl; + startx = x - (m_window_size.width / 2); + starty = y - (m_window_size.height / 2); tmpimg = img->returnWindow(startx, starty, m_window_size.width, m_window_size.height); m_method->calculate(tmpimg, imgClass); delete tmpimg; @@ -301,5 +285,18 @@ return m_window_size; } - +QString& operator<<(QString& s, const QValueList<dataEntry> &l ) +{ + QValueList<dataEntry>::const_iterator it; + QValueList<dataEntry>::const_iterator end = l.constEnd(); + for (it = l.constBegin(); it != end; ++it) + { + for (int i=0; i < (*it).inputs.count(); ++i) + { + s += QString::number((*it).inputs[i]) + " "; + } + s += "\n"; + } + return s; +} #include "ktcalculation.moc" |