You can subscribe to this list here.
| 2004 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(28) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2005 |
Jan
(11) |
Feb
(51) |
Mar
(219) |
Apr
(63) |
May
(7) |
Jun
(91) |
Jul
(97) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
| 2006 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
|
Dec
|
|
From: Gustavo P. B. <gb...@us...> - 2005-06-30 02:37:59
|
Update of /cvsroot/kimageprocess/kimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16403 Modified Files: kimageprocess.kdevelop Log Message: Fixed errors reported by Valgrind's memcheck. I still want to do a corecheck Index: kimageprocess.kdevelop =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/kimageprocess.kdevelop,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- kimageprocess.kdevelop 27 Jun 2005 19:51:02 -0000 1.13 +++ kimageprocess.kdevelop 30 Jun 2005 02:37:47 -0000 1.14 @@ -14,7 +14,7 @@ </keywords> <projectdirectory>.</projectdirectory> <absoluteprojectpath>false</absoluteprojectpath> - <description></description> + <description/> <ignoreparts/> <secondaryLanguages/> </general> @@ -120,15 +120,15 @@ <kdevdebugger> <general> <dbgshell>libtool</dbgshell> - <programargs></programargs> - <gdbpath></gdbpath> + <programargs/> + <gdbpath/> <breakonloadinglibs>true</breakonloadinglibs> <separatetty>false</separatetty> <floatingtoolbar>false</floatingtoolbar> <runappinappdirectory>true</runappinappdirectory> - <configGdbScript></configGdbScript> - <runShellScript></runShellScript> - <runGdbScript></runGdbScript> + <configGdbScript/> + <runShellScript/> + <runGdbScript/> </general> <display> <staticmembers>false</staticmembers> @@ -210,7 +210,7 @@ </qtdesigner> </designerintegration> <creategettersetter> - <prefixGet></prefixGet> + <prefixGet/> <prefixSet>set</prefixSet> <prefixVariable>m_,_</prefixVariable> <parameterName>theValue</parameterName> |
|
From: Gustavo P. B. <gb...@us...> - 2005-06-30 02:37:59
|
Update of /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16403/src/libkimageprocess Modified Files: ktcalculation.cpp ktfeature.cpp Log Message: Fixed errors reported by Valgrind's memcheck. I still want to do a corecheck Index: ktfeature.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktfeature.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ktfeature.cpp 23 Jun 2005 18:33:50 -0000 1.7 +++ ktfeature.cpp 30 Jun 2005 02:37:47 -0000 1.8 @@ -29,6 +29,7 @@ //all features enabled by default m_enabled = true; m_method = KTMethodManager::self()->getMethod(type); + m_img = 0; } KTFeature::~KTFeature() Index: ktcalculation.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktcalculation.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- ktcalculation.cpp 29 Jun 2005 03:03:00 -0000 1.7 +++ ktcalculation.cpp 30 Jun 2005 02:37:47 -0000 1.8 @@ -75,6 +75,7 @@ m_data.clear(); m_min.resize(m_inputs, 0); m_max.resize(m_inputs, 0); + m_first = true; int imgClass = 1; KTImage *it; @@ -116,6 +117,7 @@ m_data.clear(); m_min.resize(m_inputs, 0); m_max.resize(m_inputs, 0); + m_first = true; KTImage *img = KTImageManager::self()->testingImage(); |
|
From: Gustavo P. B. <gb...@us...> - 2005-06-29 03:03:10
|
Update of /cvsroot/kimageprocess/kimageprocess/src/plugins/snns In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23304/plugins/snns Modified Files: snns.cpp Log Message: Fixed WIN_ALLPIX navigation Removed obsolete code Index: snns.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/plugins/snns/snns.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- snns.cpp 28 Jun 2005 22:15:15 -0000 1.9 +++ snns.cpp 29 Jun 2005 03:03:01 -0000 1.10 @@ -122,7 +122,7 @@ for (int i=0; i < height; ++i) lines[i] = ""; - int h = 0; + int h = 0, w = 0; if (m_tempFile->file()->isOpen()) { m_stream.setDevice(m_tempFile->file()); @@ -141,23 +141,24 @@ } m_stream << "#" << features << endl << endl; - QValueList<dataEntry>::ConstIterator end = data.constEnd(); - int m_patternCount = 0; - for (QValueList<dataEntry>::ConstIterator it = data.constBegin(); it != end; ++it) + QValueList<dataEntry>::const_iterator end = data.constEnd(); + QValueList<dataEntry>::const_iterator it; + for (it = data.constBegin(); it != end; ++it) { QString line = ""; //append the count (just for debuggin purposes ) - lines[h] += "#" + QString::number(++m_patternCount) + " line: " + QString::number(h) + "\n"; + lines[h] += "#x=" + QString::number(w) + " y=" + QString::number(h) + "\n"; for ( int i=0; i < inputs; ++i) line.sprintf("%s %.5f", line.ascii(), (*it).inputs[i]); line = line + "\n"; - lines[h++] += line.stripWhiteSpace() + "\n\n"; + lines[h++] += line.stripWhiteSpace() + "\n"; if (h >= height) { h = 0; + w++; } } @@ -177,5 +178,4 @@ { //connect signals/slots here } - #include "snns.moc" |
|
From: Gustavo P. B. <gb...@us...> - 2005-06-29 03:03:10
|
Update of /cvsroot/kimageprocess/kimageprocess/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23304 Modified Files: kimageprocess.cpp kimageprocess.h Log Message: Fixed WIN_ALLPIX navigation Removed obsolete code Index: kimageprocess.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/kimageprocess.h,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- kimageprocess.h 23 Jun 2005 19:39:00 -0000 1.11 +++ kimageprocess.h 29 Jun 2005 03:02:59 -0000 1.12 @@ -99,8 +99,6 @@ void fileSaveAs(); void fileQuit(); - void optionsShowToolbar(); - void optionsShowStatusbar(); void optionsConfigureKeys(); void optionsConfigureToolbars(); void optionsPreferences(); Index: kimageprocess.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/kimageprocess.cpp,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- kimageprocess.cpp 23 Jun 2005 23:19:39 -0000 1.24 +++ kimageprocess.cpp 29 Jun 2005 03:02:59 -0000 1.25 @@ -107,10 +107,6 @@ // position, icon size, etc. setAutoSaveSettings(); - //show toolbar and statusbar - optionsShowStatusbar(); - optionsShowToolbar(); - KTImageManager *imgmng = KTImageManager::self(); connect(imgmng, SIGNAL(trPatternAdded(KTImage* )), m_sideBar, SLOT(slotSampleAdded(KTImage* ))); @@ -186,9 +182,6 @@ KStdAction::saveAs(this, SLOT(fileSaveAs()), actionCollection(),"project_save_as"); KStdAction::quit(this, SLOT(fileQuit()), actionCollection(), "project_quit"); - m_toolbarAction = KStdAction::showToolbar(this, SLOT(optionsShowToolbar()), actionCollection()); - m_statusbarAction = KStdAction::showStatusbar(this, SLOT(optionsShowStatusbar()), actionCollection()); - KStdAction::keyBindings(this, SLOT(optionsConfigureKeys()), actionCollection()); KStdAction::preferences(this, SLOT(optionsPreferences()), actionCollection()); @@ -333,26 +326,6 @@ kapp->quit(); } -void KImageProcess::optionsShowToolbar() -{ - // this is all very cut and paste code for showing/hiding the - // toolbar - if (m_toolbarAction->isChecked()) - toolBar()->show(); - else - toolBar()->hide(); -} - -void KImageProcess::optionsShowStatusbar() -{ - // this is all very cut and paste code for showing/hiding the - // statusbar - if (m_statusbarAction->isChecked()) - statusBar()->show(); - else - statusBar()->hide(); -} - void KImageProcess::optionsConfigureKeys() { KKeyDialog::configure(actionCollection()); |
|
From: Gustavo P. B. <gb...@us...> - 2005-06-29 03:03:10
|
Update of /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23304/libkimageprocess Modified Files: ktcalculation.cpp ktpatternmanager.h Log Message: Fixed WIN_ALLPIX navigation Removed obsolete code Index: ktpatternmanager.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktpatternmanager.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- ktpatternmanager.h 23 Jun 2005 23:19:41 -0000 1.15 +++ ktpatternmanager.h 29 Jun 2005 03:03:00 -0000 1.16 @@ -95,19 +95,6 @@ */ KTImage *testingImage(); - /** - * Extract data from samples - * The file format can be found in the JavaNNS documentation - * @param img The pattern image that will be used to generate the pattern file. - * @param backend The classification backend to be used - * Note that when no @ref img is specified, the pattern file will be generated - * using all available pattern images. - */ - void calculateSampleData(KTImage *img = 0, KTClassifBackend *backend = 0); - - /** Extract data from testing images */ - void calculateTestData(KTImage *img, KTClassifBackend *backend = 0); - /** count the active features */ int activeFeaturesCount(); Index: ktcalculation.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktcalculation.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ktcalculation.cpp 28 Jun 2005 22:11:33 -0000 1.6 +++ ktcalculation.cpp 29 Jun 2005 03:03:00 -0000 1.7 @@ -222,20 +222,8 @@ } break; case WIN_ALLPIX: - int cols_right, cols_left, rows_below, rows_above; - - // Calculate the outer borders of the image, because we're using centered windows - // (The window cross image boundaries) - cols_right = m_window_size.width / 2; - rows_below = m_window_size.height / 2; - if (m_window_size.width % 2 == 0) - cols_left = cols_right; - else - cols_left = cols_right + 1; - if (m_window_size.height % 2 == 0) - rows_above = rows_below; - else - rows_above = rows_below + 1; + int beginx = (m_window_size.width / 2); + int beginy = (m_window_size.height / 2); // Generate the pattern for Testing Image int width = img->width(); @@ -249,21 +237,22 @@ //handling windows that are partly or fully outside the image //the x side - if ( x - cols_left < 0 ) + if ( x - beginx < 0 ) startx = 0; - else if ( x + cols_right >= width ) - startx = width - m_window_size.width - 1; + else if ( x - beginx + m_window_size.width > width ) + startx = width - m_window_size.width; else - startx = x - cols_left; + startx = x - beginx; //the y side - if ( y - rows_above < 0 ) + if ( y - beginy < 0 ) starty = 0; - else if ( y + rows_below >= height ) - starty = height - m_window_size.height - 1; + else if ( y - beginy + m_window_size.height > height ) + starty = height - m_window_size.height; else - starty = y - rows_above; + starty = y - beginy; + //kdDebug() << "Taking startx=" << startx << " starty=" << starty << " for x=" << x << " y=" << y << endl; tmpimg = img->returnWindow(startx, starty, m_window_size.width, m_window_size.height); m_method->calculate(tmpimg, imgClass); delete tmpimg; |
|
From: Herton R. K. <he...@us...> - 2005-06-29 02:41:52
|
Update of /cvsroot/kimageprocess/kimageprocess/src/plugins/snns In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13385/src/plugins/snns Modified Files: snns.h Log Message: - Cosmetics. - Removed unused private parameter m_patternCount. Index: snns.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/plugins/snns/snns.h,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- snns.h 28 Jun 2005 22:15:15 -0000 1.8 +++ snns.h 29 Jun 2005 02:41:43 -0000 1.9 @@ -44,25 +44,24 @@ KTSNNSPlugin(QObject *parent, const char *name, const QStringList&); ~KTSNNSPlugin(); - + void setupPlugin(); - + // Reimplemented from KTClassifBackends void doTraining(const QValueList<dataEntry>& data, int inputs, int outputs); void doClassify(const QValueList<dataEntry>& data, int inputs, int outputs); - + QString classifierName() { return "snns"; } private: KAction *m_generateTrainingPattern; KAction *m_generateTesingPattern; - + KURL m_sampleImage; KURL m_testingImage; - int m_patternCount; - + KTempFile *m_tempFile; QTextStream m_stream; - + }; #endif |
|
From: Gustavo P. B. <gb...@us...> - 2005-06-28 22:16:39
|
Update of /cvsroot/kimageprocess/kimageprocess/src/methods/hsvcm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2377/methods/hsvcm Modified Files: hsvcm.cpp Log Message: Using now just one function when parsing data Index: hsvcm.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/methods/hsvcm/hsvcm.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- hsvcm.cpp 23 Jun 2005 23:19:42 -0000 1.13 +++ hsvcm.cpp 28 Jun 2005 22:16:28 -0000 1.14 @@ -105,10 +105,7 @@ result.append(results[0][j]); KTCalculation *calc = KTCalculation::self(); - if (m_testingData) - calc->parseResults(result); - else - calc->parseSampleResults(result, imgClass); + calc->parseResults(result, imgClass); //delete the GLCM's after calculating for (int dir=0; dir < 9; dir++) |
|
From: Gustavo P. B. <gb...@us...> - 2005-06-28 22:16:36
|
Update of /cvsroot/kimageprocess/kimageprocess/src/methods/glcm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2377/methods/glcm Modified Files: glcm.cpp Log Message: Using now just one function when parsing data Index: glcm.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/methods/glcm/glcm.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- glcm.cpp 23 Jun 2005 23:19:42 -0000 1.10 +++ glcm.cpp 28 Jun 2005 22:16:28 -0000 1.11 @@ -97,10 +97,7 @@ for (j=0; j < results[k].count(); ++j) result.append(results[k][j]); - if (m_testingData) - calc->parseResults(result); - else - calc->parseSampleResults(result, imgClass); + calc->parseResults(result, imgClass); } //delete the GLCM's after calculating |
|
From: Gustavo P. B. <gb...@us...> - 2005-06-28 22:15:27
|
Update of /cvsroot/kimageprocess/kimageprocess/src/plugins/snns In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1645 Modified Files: snns.cpp snns.h Log Message: No need for two files now (we know how many patterns the file will have before writing the header) Index: snns.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/plugins/snns/snns.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- snns.cpp 27 Jun 2005 19:51:06 -0000 1.8 +++ snns.cpp 28 Jun 2005 22:15:15 -0000 1.9 @@ -53,23 +53,18 @@ if (!dest.isEmpty()) { m_sampleImage = dest; - KTempFile tmpHeaderFile; - tmpHeaderFile.setAutoDelete(false); m_tempFile = new KTempFile(); m_tempFile->setAutoDelete(false); - if (tmpHeaderFile.file()->isOpen() && m_tempFile->file()->isOpen()) + if (m_tempFile->file()->isOpen()) { - QTextStream streamData(tmpHeaderFile.file()); - QString temp; - m_contents = "SNNS pattern definition file V3.2\n"; - m_contents += "generated at " + QDateTime::currentDateTime().toString(); - m_contents += "\n\n\n"; - m_contents += "No. of patterns : %1\n"; - m_contents += "No. of input units : " + QString::number( inputs ); - m_contents += "\n"; - m_contents += "No. of output units : " + QString::number( outputs ); - m_contents += "\n\n"; + m_stream.setDevice(m_tempFile->file()); + + m_stream << "SNNS pattern definition file V3.2" << endl; + m_stream << "generated at " << QDateTime::currentDateTime().toString() << endl << endl << endl; + m_stream << "No. of patterns : " << data.count() << endl; + m_stream << "No. of input units : " << inputs << endl; + m_stream << "No. of output units : " << outputs << endl << endl; QStringList names = KTImageManager::self()->activeFeatureNames(); QString features; @@ -77,10 +72,8 @@ { features += (*it) + " "; } - m_contents += "#" + features + "\n\n"; + m_stream << "#" << features << endl << endl; - m_stream.setDevice(m_tempFile->file()); - QValueList<dataEntry>::ConstIterator end = data.constEnd(); for (QValueList<dataEntry>::ConstIterator it = data.constBegin(); it != end; ++it) @@ -104,18 +97,8 @@ } //save the pattern file - QTextStream streamHeader(tmpHeaderFile.file()); - streamHeader << m_contents.arg(data.count()); - m_tempFile->file()->reset(); // place the cursor in the beginning of file - while (!m_stream.atEnd()) - { - temp = m_stream.readLine(); - streamHeader << temp << endl; - } - tmpHeaderFile.close(); m_tempFile->close(); - KIO::NetAccess::upload(tmpHeaderFile.name(),dest,0); - KIO::NetAccess::removeTempFile(tmpHeaderFile.name()); + KIO::NetAccess::upload(m_tempFile->name(),dest,0); KIO::NetAccess::removeTempFile(m_tempFile->name()); delete m_tempFile; } @@ -129,8 +112,6 @@ if (!dest.isEmpty()) { m_sampleImage = dest; - KTempFile tmpHeaderFile; - tmpHeaderFile.setAutoDelete(false); m_tempFile = new KTempFile(); m_tempFile->setAutoDelete(false); @@ -142,18 +123,15 @@ for (int i=0; i < height; ++i) lines[i] = ""; int h = 0; - if (tmpHeaderFile.file()->isOpen() && m_tempFile->file()->isOpen()) + if (m_tempFile->file()->isOpen()) { - QTextStream streamData(tmpHeaderFile.file()); - QString temp; - m_contents = "SNNS pattern definition file V3.2\n"; - m_contents += "generated at " + QDateTime::currentDateTime().toString(); - m_contents += "\n\n\n"; - m_contents += "No. of patterns : %1\n"; - m_contents += "No. of input units : " + QString::number( inputs ); - m_contents += "\n"; - m_contents += "No. of output units : 0\n"; - m_contents += "\n\n"; + m_stream.setDevice(m_tempFile->file()); + + m_stream << "SNNS pattern definition file V3.2" << endl; + m_stream << "generated at " << QDateTime::currentDateTime().toString() << endl << endl << endl; + m_stream << "No. of patterns : " << data.count() << endl; + m_stream << "No. of input units : " << inputs << endl; + m_stream << "No. of output units : 0" << endl << endl << endl; QStringList names = KTImageManager::self()->activeFeatureNames(); QString features; @@ -161,9 +139,7 @@ { features += (*it) + " "; } - m_contents += "#" + features + "\n\n"; - - m_stream.setDevice(m_tempFile->file()); + m_stream << "#" << features << endl << endl; QValueList<dataEntry>::ConstIterator end = data.constEnd(); int m_patternCount = 0; @@ -188,17 +164,9 @@ for (int i = 0; i < height; ++i) m_stream << lines[i]; //save the pattern file - QTextStream streamHeader(tmpHeaderFile.file()); - streamHeader << m_contents.arg(data.count()); - m_tempFile->file()->reset(); // place the cursor in the beginning of file - while (!m_stream.atEnd()) { - temp = m_stream.readLine(); - streamHeader << temp << endl; - } - tmpHeaderFile.close(); + m_tempFile->close(); - KIO::NetAccess::upload(tmpHeaderFile.name(),dest,0); - KIO::NetAccess::removeTempFile(tmpHeaderFile.name()); + KIO::NetAccess::upload(m_tempFile->name(),dest,0); KIO::NetAccess::removeTempFile(m_tempFile->name()); delete m_tempFile; } Index: snns.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/plugins/snns/snns.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- snns.h 23 Jun 2005 23:19:44 -0000 1.7 +++ snns.h 28 Jun 2005 22:15:15 -0000 1.8 @@ -58,7 +58,6 @@ KURL m_sampleImage; KURL m_testingImage; - QString m_contents; int m_patternCount; KTempFile *m_tempFile; |
|
From: Gustavo P. B. <gb...@us...> - 2005-06-28 22:11:44
|
Update of /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32105 Modified Files: ktcalculation.cpp ktcalculation.h Log Message: No need for two functions for parsing the results (just one gives us problems enough already) No need for a float array too. Using QValueList the data gets automatically deleted. Index: ktcalculation.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktcalculation.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ktcalculation.h 23 Jun 2005 23:19:41 -0000 1.3 +++ ktcalculation.h 28 Jun 2005 22:11:34 -0000 1.4 @@ -43,7 +43,7 @@ typedef struct { - float *inputs; + QValueList<float> inputs; int sampleClass; } dataEntry; @@ -71,8 +71,7 @@ void setWindowSize(bool type, int height, int width); window_size windowSize(); - void parseResults(const QValueList<float> &results); - void parseSampleResults(const QValueList<float> &results, int sampleClass); + void parseResults(const QValueList<float> &results, int sampleClass); public slots: void calculateSampleData(); Index: ktcalculation.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktcalculation.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ktcalculation.cpp 27 Jun 2005 19:51:05 -0000 1.5 +++ ktcalculation.cpp 28 Jun 2005 22:11:33 -0000 1.6 @@ -275,71 +275,28 @@ } } -void KTCalculation::parseResults(const QValueList<float> &results) -{ - float *inputs = new float[m_inputs]; - - QValueList<float>::const_iterator it; - - if (m_first) - { - for (int j = 0; j < m_inputs; ++j) - m_min[j] = m_max[j] = inputs[j]; - m_first = false; - } - - int i = 0; - - //prepare the input - for ( it = results.begin(); it != results.end(); ++it) - { - inputs[i] = (*it); - if (inputs[i] > m_max[i]) - m_max[i] = inputs[i]; - else if (inputs[i] < m_min[i]) - m_min[i] = inputs[i]; - ++i; - } - - dataEntry entry ; - entry.inputs = inputs; - entry.sampleClass = 0; - m_data.append(entry); - -} - -void KTCalculation::parseSampleResults(const QValueList<float> &results, int sampleClass) +void KTCalculation::parseResults(const QValueList<float> &results, int sampleClass) { - float *inputs = new float[m_inputs]; - - QValueList<float>::const_iterator it; - - if (m_first) { for (int j = 0; j < m_inputs; ++j) - m_min[j] = m_max[j] = inputs[j]; + m_min[j] = m_max[j] = results[j]; m_first = false; } - int i = 0; - //prepare the input - for ( it = results.begin(); it != results.end(); ++it) + for (int i=0; i < results.count(); ++i) { - inputs[i] = (*it); - if (inputs[i] > m_max[i]) - m_max[i] = inputs[i]; - else if (inputs[i] < m_min[i]) - m_min[i] = inputs[i]; - ++i; + if (results[i] > m_max[i]) + m_max[i] = results[i]; + else if (results[i] < m_min[i]) + m_min[i] = results[i]; } dataEntry entry; - entry.inputs = inputs; + entry.inputs = results; entry.sampleClass = sampleClass; m_data.append(entry); - } void KTCalculation::setWindowSize(bool type, int height, int width) |
|
From: Gustavo P. B. <gb...@us...> - 2005-06-27 19:51:54
|
Update of /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32175/src/libkimageprocess Modified Files: ktcalculation.cpp ktpluginmanager.h Log Message: Fixed the sliding direction when generating snns pattern files Index: ktcalculation.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktcalculation.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ktcalculation.cpp 25 Jun 2005 21:12:32 -0000 1.4 +++ ktcalculation.cpp 27 Jun 2005 19:51:05 -0000 1.5 @@ -147,10 +147,6 @@ KTPluginManager::self()->classifier()->doClassify(m_data, m_inputs, m_outputs); - emit updateProgress(); - sleep(1); - emit updateProgress(); - sleep(2); emit finished(); } Index: ktpluginmanager.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktpluginmanager.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ktpluginmanager.h 23 Jun 2005 23:19:41 -0000 1.4 +++ ktpluginmanager.h 27 Jun 2005 19:51:05 -0000 1.5 @@ -31,7 +31,7 @@ #include "ktclassifbackend.h" -typedef QDict<KTClassifBackend> BackendList; +typedef QDict<KTClassifBackend> ClassifierList; /** A class to manage KImageProcess plugins @@ -53,9 +53,14 @@ static KTPluginManager *self(); KTClassifBackend *classifier(); + + ClassifierList availableClassifiers() const; + + void setClassifier(const QString &classif); + private: //KMainWindow *m_window; - BackendList m_backends; + ClassifierList m_backends; static KTPluginManager *s_self; }; |
|
From: Gustavo P. B. <gb...@us...> - 2005-06-27 19:51:45
|
Update of /cvsroot/kimageprocess/kimageprocess/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32175/src Modified Files: kimageprocessoptions_ui.ui kttextureoptions.cpp Log Message: Fixed the sliding direction when generating snns pattern files Index: kimageprocessoptions_ui.ui =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/kimageprocessoptions_ui.ui,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- kimageprocessoptions_ui.ui 31 Mar 2005 23:56:36 -0000 1.2 +++ kimageprocessoptions_ui.ui 27 Jun 2005 19:51:04 -0000 1.3 @@ -30,6 +30,14 @@ <property name="name"> <cstring>unnamed</cstring> </property> + <widget class="QLabel" row="1" column="0"> + <property name="name"> + <cstring>textLabel1_2</cstring> + </property> + <property name="text"> + <string>Classifier:</string> + </property> + </widget> <widget class="QLabel" row="0" column="0"> <property name="name"> <cstring>textLabel1</cstring> @@ -51,6 +59,19 @@ </sizepolicy> </property> </widget> + <widget class="QComboBox" row="1" column="1"> + <property name="name"> + <cstring>cmbClassifier</cstring> + </property> + <property name="sizePolicy"> + <sizepolicy> + <hsizetype>7</hsizetype> + <vsizetype>0</vsizetype> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + </widget> </grid> </widget> <widget class="QButtonGroup" row="1" column="0" rowspan="1" colspan="2"> @@ -69,7 +90,7 @@ <cstring>rbnSlideAll</cstring> </property> <property name="text"> - <string>Slide through all image</string> + <string>Slide throu&gh all image</string> </property> <property name="checked"> <bool>true</bool> @@ -80,7 +101,7 @@ <cstring>rbnSlideIterations</cstring> </property> <property name="text"> - <string>Do only the following number of iterations:</string> + <string>Do only the following &number of iterations:</string> </property> </widget> <widget class="QSpinBox" row="2" column="0"> @@ -176,7 +197,7 @@ <cstring>rbnSequential</cstring> </property> <property name="text"> - <string>Sequential</string> + <string>Se&quential</string> </property> <property name="checked"> <bool>true</bool> Index: kttextureoptions.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/kttextureoptions.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- kttextureoptions.cpp 23 Jun 2005 23:19:40 -0000 1.6 +++ kttextureoptions.cpp 27 Jun 2005 19:51:04 -0000 1.7 @@ -36,6 +36,8 @@ #include <ktimage.h> #include <ktmethodmanager.h> #include <ktmethod.h> +#include <ktpluginmanager.h> +#include <ktclassifbackend.h> KTTextureOptions::KTTextureOptions( QWidget * parent, const char *name) |
|
From: Gustavo P. B. <gb...@us...> - 2005-06-27 19:51:42
|
Update of /cvsroot/kimageprocess/kimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32175 Modified Files: kimageprocess.kdevelop Log Message: Fixed the sliding direction when generating snns pattern files Index: kimageprocess.kdevelop =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/kimageprocess.kdevelop,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- kimageprocess.kdevelop 24 Jun 2005 05:06:07 -0000 1.12 +++ kimageprocess.kdevelop 27 Jun 2005 19:51:02 -0000 1.13 @@ -14,7 +14,7 @@ </keywords> <projectdirectory>.</projectdirectory> <absoluteprojectpath>false</absoluteprojectpath> - <description/> + <description></description> <ignoreparts/> <secondaryLanguages/> </general> @@ -120,15 +120,15 @@ <kdevdebugger> <general> <dbgshell>libtool</dbgshell> - <programargs/> - <gdbpath/> + <programargs></programargs> + <gdbpath></gdbpath> <breakonloadinglibs>true</breakonloadinglibs> <separatetty>false</separatetty> <floatingtoolbar>false</floatingtoolbar> <runappinappdirectory>true</runappinappdirectory> - <configGdbScript/> - <runShellScript/> - <runGdbScript/> + <configGdbScript></configGdbScript> + <runShellScript></runShellScript> + <runGdbScript></runGdbScript> </general> <display> <staticmembers>false</staticmembers> @@ -188,7 +188,10 @@ <dest>/home/gustavo/textura/texture/kimageprocess</dest> </substmap> <kdevcppsupport> - <references/> + <references> + <pcs>Qt</pcs> + <pcs>KDElibs</pcs> + </references> <codecompletion> <includeGlobalFunctions>true</includeGlobalFunctions> <includeTypes>true</includeTypes> @@ -207,7 +210,7 @@ </qtdesigner> </designerintegration> <creategettersetter> - <prefixGet/> + <prefixGet></prefixGet> <prefixSet>set</prefixSet> <prefixVariable>m_,_</prefixVariable> <parameterName>theValue</parameterName> |
|
From: Gustavo P. B. <gb...@us...> - 2005-06-27 19:51:32
|
Update of /cvsroot/kimageprocess/kimageprocess/src/plugins/snns In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32175/src/plugins/snns Modified Files: snns.cpp Log Message: Fixed the sliding direction when generating snns pattern files Index: snns.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/plugins/snns/snns.cpp,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- snns.cpp 23 Jun 2005 23:19:43 -0000 1.7 +++ snns.cpp 27 Jun 2005 19:51:06 -0000 1.8 @@ -134,6 +134,14 @@ m_tempFile = new KTempFile(); m_tempFile->setAutoDelete(false); + KTImage *img = KTImageManager::self()->testingImage(); + + int height = img->height(); + QString lines[height]; + + for (int i=0; i < height; ++i) + lines[i] = ""; + int h = 0; if (tmpHeaderFile.file()->isOpen() && m_tempFile->file()->isOpen()) { QTextStream streamData(tmpHeaderFile.file()); @@ -164,16 +172,21 @@ QString line = ""; //append the count (just for debuggin purposes ) - m_stream << "#" << ++m_patternCount << endl; + lines[h] += "#" + QString::number(++m_patternCount) + " line: " + QString::number(h) + "\n"; for ( int i=0; i < inputs; ++i) line.sprintf("%s %.5f", line.ascii(), (*it).inputs[i]); line = line + "\n"; - m_stream << line.stripWhiteSpace() << endl << endl; - + lines[h++] += line.stripWhiteSpace() + "\n\n"; + if (h >= height) + { + h = 0; + } } + for (int i = 0; i < height; ++i) + m_stream << lines[i]; //save the pattern file QTextStream streamHeader(tmpHeaderFile.file()); streamHeader << m_contents.arg(data.count()); |
|
From: Gustavo P. B. <gb...@us...> - 2005-06-25 21:12:46
|
Update of /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25599/src/libkimageprocess Modified Files: ktcalculation.cpp Log Message: - normalize values between 0 and 1 - invert calculation order - fix image iterator Index: ktcalculation.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktcalculation.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ktcalculation.cpp 23 Jun 2005 23:19:41 -0000 1.3 +++ ktcalculation.cpp 25 Jun 2005 21:12:32 -0000 1.4 @@ -78,7 +78,8 @@ int imgClass = 1; KTImage *it; - for ( it = KTImageManager::self()->sampleImages().first(); it; it = KTImageManager::self()->sampleImages().next()) + KTImageList list = KTImageManager::self()->sampleImages(); + for ( it = list.first(); it; it = list.next()) generateWindowResults(it, imgClass++); //normalize @@ -92,7 +93,7 @@ { for ( int i=0; i < m_inputs; ++i ) { - (*it).inputs[i] = ((*it).inputs[i] - m_min[i]) * 100 / dif[i]; + (*it).inputs[i] = ((*it).inputs[i] - m_min[i]) * 1/*100*/ / dif[i]; } } @@ -140,7 +141,7 @@ { for ( int i=0; i < m_inputs; ++i ) { - (*it).inputs[i] = ((*it).inputs[i] - m_min[i]) * 100 / dif[i]; + (*it).inputs[i] = ((*it).inputs[i] - m_min[i]) * 1/*100*/ / dif[i]; } } @@ -243,9 +244,9 @@ // Generate the pattern for Testing Image int width = img->width(); int height = img->height(); - for (y = 0; y < height; y++) + for (x = 0; x < width; x++) { - for (x = 0; x < width; x++) + for (y = 0; y < height; y++) { int startx, starty; |
|
From: Herton R. K. <he...@us...> - 2005-06-24 11:10:11
|
Update of /cvsroot/kimageprocess/kimageprocess/batchtests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24952 Modified Files: test Log Message: - Fixing naming of test files generated. Index: test =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/batchtests/test,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- test 24 Jun 2005 05:06:07 -0000 1.1 +++ test 24 Jun 2005 11:09:59 -0000 1.2 @@ -14,8 +14,8 @@ source $test/img.size for act in $FANN_ACT; do testclass -t $test/train.pat -c $test/class.pat \ - -r results/$test_$act.res -a $act - res2pgm -r results/$test_$act.res -p results/$test_$act.pgm \ + -r results/$test\_$act.res -a $act + res2pgm -r results/$test\_$act.res -p results/$test\_$act.pgm \ -w $WIDTH -h $HEIGHT done done |
|
From: Herton R. K. <he...@us...> - 2005-06-24 05:06:31
|
Update of /cvsroot/kimageprocess/kimageprocess/testclass In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12115/testclass Modified Files: Makefile.am Log Message: - Added batchtests, script and files to test neural networks in batch mode. - testclass now is installed on the system with make install. Index: Makefile.am =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/testclass/Makefile.am,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- Makefile.am 6 Apr 2005 04:32:11 -0000 1.5 +++ Makefile.am 24 Jun 2005 05:06:08 -0000 1.6 @@ -2,7 +2,7 @@ SUBDIRS = libfann . # this is the program that gets installed. it's name is used for all # of the other Makefile.am variables -noinst_PROGRAMS = testclass +bin_PROGRAMS = testclass # set the include path for X, qt and KDE INCLUDES = $(all_includes) \ |
|
From: Herton R. K. <he...@us...> - 2005-06-24 05:06:22
|
Update of /cvsroot/kimageprocess/kimageprocess/batchtests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12115/batchtests Added Files: test Log Message: - Added batchtests, script and files to test neural networks in batch mode. - testclass now is installed on the system with make install. --- NEW FILE: test --- #!/bin/sh -x FANN_ACT="FANN_THRESHOLD \ FANN_THRESHOLD_SYMMETRIC \ FANN_LINEAR \ FANN_SIGMOID \ FANN_SIGMOID_STEPWISE \ FANN_SIGMOID_SYMMETRIC \ FANN_SIGMOID_SYMMETRIC_STEPWISE" TESTS="2texturas" mkdir -p results for test in $TESTS; do source $test/img.size for act in $FANN_ACT; do testclass -t $test/train.pat -c $test/class.pat \ -r results/$test_$act.res -a $act res2pgm -r results/$test_$act.res -p results/$test_$act.pgm \ -w $WIDTH -h $HEIGHT done done |
|
From: Herton R. K. <he...@us...> - 2005-06-24 05:06:22
|
Update of /cvsroot/kimageprocess/kimageprocess/batchtests/2texturas In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12115/batchtests/2texturas Added Files: 2texturas.kimageprocess 2texturas.png class.pat img.size train.pat Log Message: - Added batchtests, script and files to test neural networks in batch mode. - testclass now is installed on the system with make install. --- NEW FILE: class.pat --- (This appears to be a binary file; contents omitted.) --- NEW FILE: train.pat --- (This appears to be a binary file; contents omitted.) --- NEW FILE: 2texturas.png --- (This appears to be a binary file; contents omitted.) --- NEW FILE: 2texturas.kimageprocess --- <kimageprocess> <Features> <FeatureGroup EnabledFeatures="AngSecMom,Contrast,Entropy,Correlation" Name="hsvcm" /> <FeatureGroup EnabledFeatures="AngSecMom,Deviation,Mean,Contrast,Energy,Entropy,Correlation,IMCorrelation,SumAverage,Variance,DiffEntropy,MaxCorrelationCoef,SumVariance,DiffVariance,SumEntropy,InvDiffMom,Dissimilarity" Name="glcm" /> </Features> <Methods> <ActiveMethod Name="hsvcm" /> </Methods> <sample_images> <sample url="file:///home/gustavo/textures/colortex/textura1.png" /> <sample url="file:///home/gustavo/textures/colortex/textura2.png" /> </sample_images> <testing_images> <image url="file:///home/gustavo/textures/2texturas/2texturas.png" /> </testing_images> <texture_options> <windowType value="1" /> <numberIterations value="0" /> <windowSize x="11" y="11" type="true" /> </texture_options> </kimageprocess> --- NEW FILE: img.size --- WIDTH=64 HEIGHT=32 |
|
From: Herton R. K. <he...@us...> - 2005-06-24 05:06:19
|
Update of /cvsroot/kimageprocess/kimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12115 Modified Files: kimageprocess.kdevelop Log Message: - Added batchtests, script and files to test neural networks in batch mode. - testclass now is installed on the system with make install. Index: kimageprocess.kdevelop =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/kimageprocess.kdevelop,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- kimageprocess.kdevelop 17 Mar 2005 03:46:54 -0000 1.11 +++ kimageprocess.kdevelop 24 Jun 2005 05:06:07 -0000 1.12 @@ -188,10 +188,7 @@ <dest>/home/gustavo/textura/texture/kimageprocess</dest> </substmap> <kdevcppsupport> - <references> - <pcs>Qt</pcs> - <pcs>KDElibs</pcs> - </references> + <references/> <codecompletion> <includeGlobalFunctions>true</includeGlobalFunctions> <includeTypes>true</includeTypes> @@ -206,7 +203,7 @@ </codecompletion> <designerintegration> <qtdesigner> - <implementation class="KTTextureOptions" path="/home/herton/repositorio/textura/texture/kimageprocess/src/kimageprocessoptions_ui.ui" implementationpath="/home/herton/repositorio/textura/texture/kimageprocess/src/kttextureoptions.h" /> + <implementation class="ktprogressbar" path="src/ktprogressbar.ui" implementationpath="src/ktprogressbar.h" /> </qtdesigner> </designerintegration> <creategettersetter> |
|
From: Herton R. K. <he...@us...> - 2005-06-24 05:04:15
|
Update of /cvsroot/kimageprocess/kimageprocess/batchtests/2texturas In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11650/2texturas Log Message: Directory /cvsroot/kimageprocess/kimageprocess/batchtests/2texturas added to the repository |
|
From: Herton R. K. <he...@us...> - 2005-06-24 05:00:48
|
Update of /cvsroot/kimageprocess/kimageprocess/batchtests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv10559/batchtests Log Message: Directory /cvsroot/kimageprocess/kimageprocess/batchtests added to the repository |
|
From: Herton R. K. <he...@us...> - 2005-06-24 03:58:08
|
Update of /cvsroot/kimageprocess/kimageprocess/res2pgm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11970 Modified Files: res2pgm.c Log Message: - Fixing some nasty bugs. Index: res2pgm.c =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/res2pgm/res2pgm.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- res2pgm.c 24 Jun 2005 03:41:47 -0000 1.2 +++ res2pgm.c 24 Jun 2005 03:57:59 -0000 1.3 @@ -144,17 +144,21 @@ } static int get_class(float *values, int n) { - int max; + float max; + int r; if (n <= 0) return 0; --n; max = values[n]; + r = n; while (n >= 0) { - if (max < values[n]) + if (max < values[n]) { max = values[n]; + r = n; + } --n; } - return max; + return r; } int main(int argc, char **argv) |
|
From: Herton R. K. <he...@us...> - 2005-06-24 03:41:57
|
Update of /cvsroot/kimageprocess/kimageprocess/res2pgm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4158 Modified Files: lex.yy.c res.l res2pgm.c Added Files: Makefile.am Log Message: - Finished res2pgm, fixed bugs. Index: lex.yy.c =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/res2pgm/lex.yy.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- lex.yy.c 23 Jun 2005 23:27:16 -0000 1.1 +++ lex.yy.c 24 Jun 2005 03:41:47 -0000 1.2 @@ -1,85 +1,32 @@ - -#line 3 "lex.yy.c" - -#define YY_INT_ALIGNED short int - /* A lexical scanner generated by flex */ +/* Scanner skeleton version: + * $Header$ + */ + [...2190 lines suppressed...] + { + free( ptr ); + } +#if YY_MAIN +int main() + { + yylex(); + return 0; + } +#endif +#line 121 "res.l" void yyerror(char *s) { fprintf(stderr, " %s at line: %d, column: %d.\n", s, row, col); @@ -1902,4 +1737,3 @@ /* * vim:noet */ - Index: res.l =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/res2pgm/res.l,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- res.l 23 Jun 2005 23:27:16 -0000 1.1 +++ res.l 24 Jun 2005 03:41:47 -0000 1.2 @@ -2,15 +2,17 @@ #include <stdio.h> #include <math.h> -#define DEBUG 0 -#define INTNUMBER 1 -#define FLOATNUMBER 2 -#define RESHEADER 3 -#define RESDATE 4 -#define NUMPAT 5 -#define NUMIN 6 -#define NUMOUT 7 -#define END 8 +#define DEBUG 0 +#define INTNUMBER 1 +#define FLOATNUMBER 2 +#define RESHEADER 3 +#define RESDATE 4 +#define NUMPAT 5 +#define NUMIN 6 +#define NUMOUT 7 +#define STARTPATTERN 8 +#define ENDPATTERN 9 +#define END 10 int row=1, col=1; --- NEW FILE: Makefile.am --- ## Makefile.am for testclass SUBDIRS = . # this is the program that gets installed. it's name is used for all # of the other Makefile.am variables bin_PROGRAMS = res2pgm # set the include path for X, qt and KDE INCLUDES = $(all_includes) \ -I$(srcdir)/../res2pgm # the library search path. res2pgm_LDFLAGS = $(all_libraries) # the libraries to link against. res2pgm_LDADD = -lfl -lm # which sources should be compiled for testclass res2pgm_SOURCES = res2pgm.c Index: res2pgm.c =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/res2pgm/res2pgm.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- res2pgm.c 23 Jun 2005 23:27:16 -0000 1.1 +++ res2pgm.c 24 Jun 2005 03:41:47 -0000 1.2 @@ -14,7 +14,7 @@ float **resultValues; int numInputUnits; int numOutputUnits; - int numPatterns; + int numResults; int startPattern; int endPattern; } res; @@ -69,11 +69,10 @@ resLoadFail(PARSER_ERROR, fileName); resInf->numInputUnits = -1; resInf->numOutputUnits = -1; - resInf->numPatterns = -1; + resInf->numResults = -1; resInf->startPattern = -1; resInf->endPattern = -1; - resInf->inputValues = NULL; - resInf->outputValues = NULL; + resInf->resultValues = NULL; tok = yylex(); while (tok != END) { @@ -83,7 +82,7 @@ tok = yylex(); if (tok != INTNUMBER) resLoadFail(PARSER_ERROR, fileName); - resInf->numPatterns = atoi(yytext); + resInf->numResults = atoi(yytext); break; case NUMIN: tok = yylex(); @@ -111,29 +110,31 @@ break; case FLOATNUMBER: case INTNUMBER: - if (resInf->numPatterns <= 0 || curPat == resInf->numPatterns) + if (resInf->numResults <= 0 || curRes == resInf->numResults) resLoadFail(CHECK_ERROR, fileName); if (resInf->resultValues == NULL && resInf->numOutputUnits > 0) { - tempp = malloc(sizeof(float) * resInf->numPatterns * resInf->numOutputUnits); + tempp = malloc(sizeof(float) * resInf->numResults * resInf->numOutputUnits); if (tempp == NULL) fatal(errno); - resInf->resultValues = malloc(sizeof(float *) * resInf->numPatterns); + resInf->resultValues = malloc(sizeof(float *) * resInf->numResults); if (resInf->resultValues == NULL) fatal(errno); - for (i = 0; i < resInf->numPatterns; i++) + for (i = 0; i < resInf->numResults; i++) resInf->resultValues[i] = tempp + (i * resInf->numOutputUnits); } - i = 0; + resInf->resultValues[curRes][0] = atof(yytext); + i = 1; while (i < resInf->numOutputUnits) { tok = yylex(); - if (tok != FLOATNUMBER && tok != INTNUMBER) + if (tok != FLOATNUMBER && tok != INTNUMBER) { resLoadFail(CHECK_ERROR, fileName); - resInf->resultValues[curPat][i] = atof(yytext); + } + resInf->resultValues[curRes][i] = atof(yytext); ++i; } - curPat++; + curRes++; break; default: resLoadFail(PARSER_ERROR, fileName); @@ -142,6 +143,20 @@ } } +static int get_class(float *values, int n) { + int max; + if (n <= 0) + return 0; + --n; + max = values[n]; + while (n >= 0) { + if (max < values[n]) + max = values[n]; + --n; + } + return max; +} + int main(int argc, char **argv) { int c; @@ -159,7 +174,7 @@ FILE *pr_file, *pp_file; res resData; int cols = -1, rows = -1; - int npat, t; + int npat, t, j; char p_buf[BUF_LEN]; if (argc == 1) @@ -211,66 +226,29 @@ if (fprintf(pp_file, "P5\n%d %d\n%d\n", cols, rows, resData.numOutputUnits) < 0) fatal(errno); npat = 0; - while (npat < resData.numPatterns) { - t = (npat + NUM_BUF) > resData.numPatterns ? resData.numPatters - npat : NUM_BUF; - while (npat < t) { - - ++npat; + while (npat < resData.numResults) { + t = (npat + 1 + BUF_LEN) >= resData.numResults ? resData.numResults - npat - 1 : BUF_LEN - 1; + j = t + 1; + while (t >= 0) { + p_buf[t] = get_class(resData.resultValues[npat+t], resData.numOutputUnits); + --t; } - ++npat; - } - for (npat = 0; npat < resData.numPatterns; npat++) - { - if (fprintf(pr_file, "#%d.1\n", npat + 1) < 0) + if (fwrite(p_buf, j, 1, pp_file) != 1) fatal(errno); - result = fann_run(tfann, c_patData.inputValues[npat]); - for (c = 0; c < t_patData.numOutputUnits; c++) - { - if (fprintf(pr_file, "%.5f ", result[c]) < 0) - fatal(errno); - } - fseek(pr_file, -1, SEEK_CUR); /* remove extra space */ - fprintf(pr_file, "\n"); - } - fann_destroy(tfann); - if (t_patData.inputValues != NULL) - { - /* free only first element because is a contiguous allocated memory - space (see loadNetwork) */ - if (t_patData.inputValues[0] != NULL) - free(t_patData.inputValues[0]); - free(t_patData.inputValues); - } - if (t_patData.outputValues != NULL) - { - /* free only first element because is a contiguous allocated memory - space (see loadNetwork) */ - if (t_patData.outputValues[0] != NULL) - free(t_patData.outputValues[0]); - free(t_patData.outputValues); - } - if (c_patData.inputValues != NULL) - { - /* free only first element because is a contiguous allocated memory - space (see loadNetwork) */ - if (c_patData.inputValues[0] != NULL) - free(c_patData.inputValues[0]); - free(c_patData.inputValues); + npat += j; } - if (c_patData.outputValues != NULL) + if (resData.resultValues != NULL) { /* free only first element because is a contiguous allocated memory - space (see loadNetwork) */ - if (c_patData.outputValues[0] != NULL) - free(c_patData.outputValues[0]); - free(c_patData.outputValues); + space (see loadResults) */ + if (resData.resultValues[0] != NULL) + free(resData.resultValues[0]); + free(resData.resultValues); } - if (fclose(pt_file) != 0) - fatal(errno); - if (fclose(pc_file) != 0) - fatal(errno); if (fclose(pr_file) != 0) fatal(errno); + if (fclose(pp_file) != 0) + fatal(errno); return 0; } |
|
From: Herton R. K. <he...@us...> - 2005-06-23 23:27:25
|
Update of /cvsroot/kimageprocess/kimageprocess/res2pgm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3557/res2pgm Added Files: lex.yy.c res.l res2pgm.c Log Message: - Added first files of res2pgm new version. --- NEW FILE: lex.yy.c --- #line 3 "lex.yy.c" #define YY_INT_ALIGNED short int /* A lexical scanner generated by flex */ #define FLEX_SCANNER #define YY_FLEX_MAJOR_VERSION 2 #define YY_FLEX_MINOR_VERSION 5 #define YY_FLEX_SUBMINOR_VERSION 31 #if YY_FLEX_SUBMINOR_VERSION > 0 #define FLEX_BETA #endif /* First, we deal with platform-specific or compiler-specific issues. */ /* begin standard C headers. */ #include <stdio.h> [...1866 lines suppressed...] #undef yy_new_buffer #undef yy_set_interactive #undef yytext_ptr #undef YY_DO_BEFORE_ACTION #ifdef YY_DECL_IS_OURS #undef YY_DECL_IS_OURS #undef YY_DECL #endif #line 119 "res.l" void yyerror(char *s) { fprintf(stderr, " %s at line: %d, column: %d.\n", s, row, col); } /* * vim:noet */ --- NEW FILE: res.l --- %{ #include <stdio.h> #include <math.h> #define DEBUG 0 #define INTNUMBER 1 #define FLOATNUMBER 2 #define RESHEADER 3 #define RESDATE 4 #define NUMPAT 5 #define NUMIN 6 #define NUMOUT 7 #define END 8 int row=1, col=1; /* function prototypes */ void yyerror(char *s); %} INTNUMBER [0-9]+ FLOATNUMBER [0-9]+"."[0-9]* WHITESPACE [ \t\r] COMMENT [#]+.*[\n] RESHEADER "SNNS result file V1.4-3D" RESDATE "generated at".*[\n] NUMPAT "No. of patterns"[ ]*":"[ ]* NUMIN "No. of input units"[ ]*":"[ ]* NUMOUT "No. of output units"[ ]*":"[ ]* STARTPATTERN "startpattern"[ ]*":"[ ]* ENDPATTERN "endpattern"[ ]*":"[ ]* %% \n ++row; col=1; {INTNUMBER} { #if DEBUG printf("INTNUMBER: %d\n", atoi(yytext)); #endif col += yyleng; return INTNUMBER; } {FLOATNUMBER} { #if DEBUG printf("FLOATNUMBER: %f\n", atof(yytext)); #endif col += yyleng; return FLOATNUMBER; } {RESHEADER} { #if DEBUG printf("RESHEADER\n"); #endif col += yyleng; return RESHEADER; } {RESDATE} { #if DEBUG printf("RESDATE\n"); #endif col = 1; row++; return RESDATE; } {NUMPAT} { #if DEBUG printf("NUMPAT\n"); #endif col += yyleng; return NUMPAT; } {NUMIN} { #if DEBUG printf("NUMIN\n"); #endif col += yyleng; return NUMIN; } {NUMOUT} { #if DEBUG printf("NUMOUT\n"); #endif col += yyleng; return NUMOUT; } {STARTPATTERN} { #if DEBUG printf("STARTPATTERN\n"); #endif col += yyleng; return STARTPATTERN; } {ENDPATTERN} { #if DEBUG printf("ENDPATTERN\n"); #endif col += yyleng; return ENDPATTERN; } {WHITESPACE}+ { #if DEBUG printf("WHITESPACE\n"); #endif col += yyleng; } {COMMENT} { #if DEBUG printf("COMMENT\n"); #endif col = 1; row++; } <<EOF>> { #if DEBUG printf("END\n"); #endif return END; } . { ++col; } %% void yyerror(char *s) { fprintf(stderr, " %s at line: %d, column: %d.\n", s, row, col); } /* * vim:noet */ --- NEW FILE: res2pgm.c --- #include <errno.h> #include <getopt.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <lex.yy.c> #define RES2PGM_VERSION "2" #define PARSER_ERROR 1 #define CHECK_ERROR 2 #define BUF_LEN 32767 typedef struct { float **resultValues; int numInputUnits; int numOutputUnits; int numPatterns; int startPattern; int endPattern; } res; static void usage(char *progname) { fprintf(stderr, "res2pgm version %s\n", RES2PGM_VERSION); fprintf(stderr, "Copyright (C) 2005 by\n"); fprintf(stderr, " Gustavo Pichorim Boiko <gus...@kd...>\n"); fprintf(stderr, " Herton Ronaldo Krzesinski <he...@my...>\n\n"); fprintf(stderr, "Usage: %s [options]\n", progname); fprintf(stderr, "Options: -r,--res-file resfile\n"); fprintf(stderr, " -p,--pgm-file pgm image\n"); fprintf(stderr, " -w,--width image width\n"); fprintf(stderr, " -h,--height image height\n"); exit(1); } static void fatal(int err) { fprintf(stderr, "%s\n", strerror(err)); exit(err); } static void resLoadFail(int code, char *fileName) { switch(code) { case PARSER_ERROR: fprintf(stderr, "Error: Invalid results file format.\n"); yyerror(fileName); break; case CHECK_ERROR: fprintf(stderr, "Error: Consistency check error on %s,\n", fileName); fprintf(stderr, " number of patterns or units informed is different\n"); fprintf(stderr, " from what's expected.\n"); break; } exit(1); } static void loadResults(res *resInf, FILE *resFile, char *fileName) { int tok, curRes = 0, i; float *tempp; yyin = resFile; tok = yylex(); if (tok != RESHEADER) resLoadFail(PARSER_ERROR, fileName); tok = yylex(); if (tok != RESDATE) resLoadFail(PARSER_ERROR, fileName); resInf->numInputUnits = -1; resInf->numOutputUnits = -1; resInf->numPatterns = -1; resInf->startPattern = -1; resInf->endPattern = -1; resInf->inputValues = NULL; resInf->outputValues = NULL; tok = yylex(); while (tok != END) { switch(tok) { case NUMPAT: tok = yylex(); if (tok != INTNUMBER) resLoadFail(PARSER_ERROR, fileName); resInf->numPatterns = atoi(yytext); break; case NUMIN: tok = yylex(); if (tok != INTNUMBER) resLoadFail(PARSER_ERROR, fileName); resInf->numInputUnits = atoi(yytext); break; case NUMOUT: tok = yylex(); if (tok != INTNUMBER) resLoadFail(PARSER_ERROR, fileName); resInf->numOutputUnits = atoi(yytext); break; case STARTPATTERN: tok = yylex(); if (tok != INTNUMBER) resLoadFail(PARSER_ERROR, fileName); resInf->startPattern = atoi(yytext); break; case ENDPATTERN: tok = yylex(); if (tok != INTNUMBER) resLoadFail(PARSER_ERROR, fileName); resInf->endPattern = atoi(yytext); break; case FLOATNUMBER: case INTNUMBER: if (resInf->numPatterns <= 0 || curPat == resInf->numPatterns) resLoadFail(CHECK_ERROR, fileName); if (resInf->resultValues == NULL && resInf->numOutputUnits > 0) { tempp = malloc(sizeof(float) * resInf->numPatterns * resInf->numOutputUnits); if (tempp == NULL) fatal(errno); resInf->resultValues = malloc(sizeof(float *) * resInf->numPatterns); if (resInf->resultValues == NULL) fatal(errno); for (i = 0; i < resInf->numPatterns; i++) resInf->resultValues[i] = tempp + (i * resInf->numOutputUnits); } i = 0; while (i < resInf->numOutputUnits) { tok = yylex(); if (tok != FLOATNUMBER && tok != INTNUMBER) resLoadFail(CHECK_ERROR, fileName); resInf->resultValues[curPat][i] = atof(yytext); ++i; } curPat++; break; default: resLoadFail(PARSER_ERROR, fileName); } tok = yylex(); } } int main(int argc, char **argv) { int c; int option_index = 0; static struct option long_options[] = { {"res-file", 1, NULL, 'r'}, {"pgm-file", 1, NULL, 'p'}, {"width", 1, NULL, 'w'}, {"height", 1, NULL, 'h'}, {0, 0, 0, 0} }; opterr = 0; char *r_file, *p_file; FILE *pr_file, *pp_file; res resData; int cols = -1, rows = -1; int npat, t; char p_buf[BUF_LEN]; if (argc == 1) usage(argv[0]); r_file = NULL; p_file = NULL; while (1) { c = getopt_long (argc, argv, "+r:p:w:h:", long_options, &option_index); if (c == -1 && optind != argc) usage(argv[0]); if (c == -1) break; switch (c) { case 'r': r_file = optarg; break; case 'p': p_file = optarg; break; case 'w': cols = atoi(optarg); break; case 'h': rows = atoi(optarg); break; case ':': case '?': usage(argv[0]); break; default: printf ("?? getopt returned character code 0%o ??\n", c); exit(1); } } if (!r_file || !p_file) usage(argv[0]); if (cols < 0 || rows < 0) usage(argv[0]); pr_file = fopen(r_file, "r"); if (pr_file == NULL) fatal(errno); loadResults(&resData, pr_file, r_file); pp_file = fopen(p_file, "w"); if (pp_file == NULL) fatal(errno); if (fprintf(pp_file, "P5\n%d %d\n%d\n", cols, rows, resData.numOutputUnits) < 0) fatal(errno); npat = 0; while (npat < resData.numPatterns) { t = (npat + NUM_BUF) > resData.numPatterns ? resData.numPatters - npat : NUM_BUF; while (npat < t) { ++npat; } ++npat; } for (npat = 0; npat < resData.numPatterns; npat++) { if (fprintf(pr_file, "#%d.1\n", npat + 1) < 0) fatal(errno); result = fann_run(tfann, c_patData.inputValues[npat]); for (c = 0; c < t_patData.numOutputUnits; c++) { if (fprintf(pr_file, "%.5f ", result[c]) < 0) fatal(errno); } fseek(pr_file, -1, SEEK_CUR); /* remove extra space */ fprintf(pr_file, "\n"); } fann_destroy(tfann); if (t_patData.inputValues != NULL) { /* free only first element because is a contiguous allocated memory space (see loadNetwork) */ if (t_patData.inputValues[0] != NULL) free(t_patData.inputValues[0]); free(t_patData.inputValues); } if (t_patData.outputValues != NULL) { /* free only first element because is a contiguous allocated memory space (see loadNetwork) */ if (t_patData.outputValues[0] != NULL) free(t_patData.outputValues[0]); free(t_patData.outputValues); } if (c_patData.inputValues != NULL) { /* free only first element because is a contiguous allocated memory space (see loadNetwork) */ if (c_patData.inputValues[0] != NULL) free(c_patData.inputValues[0]); free(c_patData.inputValues); } if (c_patData.outputValues != NULL) { /* free only first element because is a contiguous allocated memory space (see loadNetwork) */ if (c_patData.outputValues[0] != NULL) free(c_patData.outputValues[0]); free(c_patData.outputValues); } if (fclose(pt_file) != 0) fatal(errno); if (fclose(pc_file) != 0) fatal(errno); if (fclose(pr_file) != 0) fatal(errno); return 0; } /* * vim:noet */ |