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-07-03 01:42:22
|
Update of /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19388 Modified Files: ktpluginmanager.h Log Message: - really do something in the function ;) Index: ktpluginmanager.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktpluginmanager.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ktpluginmanager.h 27 Jun 2005 19:51:05 -0000 1.5 +++ ktpluginmanager.h 3 Jul 2005 01:42:13 -0000 1.6 @@ -54,7 +54,7 @@ KTClassifBackend *classifier(); - ClassifierList availableClassifiers() const; + ClassifierList availableClassifiers() const { return m_backends; } void setClassifier(const QString &classif); |
|
From: Gustavo P. B. <gb...@us...> - 2005-07-03 01:35:35
|
Update of /cvsroot/kimageprocess/kimageprocess/src/plugins/mindist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15258/mindist Added Files: Makefile.am kimageprocess_mindist.desktop mindist.cpp mindist.h Log Message: Added the minimum euclidean distance classifier --- NEW FILE: kimageprocess_mindist.desktop --- [Desktop Entry] Name=Minimun Euclidean Distance Backend Comment=A classifier that uses the minimun euclidean distance ServiceTypes=KImageProcess/Plugin Type=Service X-KDE-Library=kimageprocess_mindist --- NEW FILE: Makefile.am --- INCLUDES = $(all_includes) -I$(srcdir)/../../libkimageprocess METASOURCES = AUTO kde_module_LTLIBRARIES = kimageprocess_mindist.la kimageprocess_mindist_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) noinst_HEADERS = mindist.h kimageprocess_mindist_la_SOURCES = mindist.cpp kde_services_DATA = kimageprocess_mindist.desktop kimageprocess_mindist_la_LIBADD = $(top_builddir)/src/libkimageprocess/libkimageprocess.la \ -lkdeui $(LIB_KIO) --- NEW FILE: mindist.cpp --- /*************************************************************************** * Copyright (C) 2004-2005 by * * Gustavo Pichorim Boiko <gus...@kd...> * * Herton Ronaldo Krzesinski <he...@my...> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #include "mindist.h" #include <kgenericfactory.h> #include <kaction.h> #include <kdebug.h> #include <ktempfile.h> #include <kfiledialog.h> #include <kio/netaccess.h> #include <ktimage.h> #include <ktpluginmanager.h> #include <ktpatternmanager.h> #include <math.h> K_EXPORT_COMPONENT_FACTORY( kimageprocess_mindist, KGenericFactory<KTMinDistPlugin>( "kimageprocess_mindist" ) ) KTMinDistPlugin::KTMinDistPlugin(QObject *parent, const char* name, const QStringList&) : KTClassifBackend(parent, name) { m_mean = 0; } KTMinDistPlugin::~KTMinDistPlugin() { if (m_mean != 0) delete m_mean; } void KTMinDistPlugin::doTraining(const QValueList<dataEntry>& data, int inputs, int outputs) { int count[outputs]; if (m_mean != 0) delete m_mean; m_mean = new QValueVector<float>[outputs]; for (int i=0; i < outputs; ++i) { m_mean[i].resize(inputs, 0.); count[i] = 0; } QValueList<dataEntry>::ConstIterator end = data.constEnd(); for (QValueList<dataEntry>::ConstIterator it = data.constBegin(); it != end; ++it) { for ( int i=0; i < inputs; ++i ) { m_mean[(*it).sampleClass-1][i] += (*it).inputs[i]; ++count[(*it).sampleClass-1]; } } for (int i=0; i < outputs; ++i) for (int j=0; j < inputs; ++j) { m_mean[i][j] /= count[i]; //kdDebug() << "MINDIST: m_mean[" << i << "][" << j << "] = " << m_mean[i][j] << endl; } } void KTMinDistPlugin::doClassify(const QValueList<dataEntry>& data, int inputs, int outputs) { float minValue; int minClass; bool m_first = true; QValueList<dataEntry>::const_iterator end = data.constEnd(); QValueList<dataEntry>::const_iterator it; KTImage *c_img = KTImageManager::self()->testingImage(); QImage *img = new QImage(c_img->width(), c_img->height(), 32); int x = 0, y = 0; int colorStep = 255 / (outputs - 1); int level; float sum; for (it = data.constBegin(); it != end; ++it) { m_first = true; for (int j=0; j < outputs; ++j) { sum = 0; for (int i=0; i < inputs; ++i) sum += ((*it).inputs[i] - m_mean[j][i]) * ((*it).inputs[i] - m_mean[j][i]); sum = sqrt(sum); if (m_first) { m_first = false; minValue = sum; minClass = j; } else if (sum < minValue) { minValue = sum; minClass = j; } } //kdDebug() << "MINDIST_CLASS: Pixel is of class " << minClass << endl; level = minClass * colorStep; img->setPixel(x, y++, qRgb(level, level, level)); if (y >= c_img->height()) { kdDebug() << "y = " << y << endl; y = 0; x++; } } //save the image KURL dest = KFileDialog::getSaveURL(QString::null,i18n("*.pgm|PGM File"),0,i18n("Save classified image")); if (!dest.isEmpty()) { KTempFile tmpImg(QString::null, ".pgm"); tmpImg.close(); img->save(tmpImg.name(), "PGM"); KIO::NetAccess::upload(tmpImg.name(), dest, 0); KIO::NetAccess::removeTempFile(tmpImg.name()); delete img; } } void KTMinDistPlugin::setupPlugin() { //connect signals/slots here } #include "mindist.moc" --- NEW FILE: mindist.h --- /*************************************************************************** * Copyright (C) 2004-2005 by * * Gustavo Pichorim Boiko <gus...@kd...> * * Herton Ronaldo Krzesinski <he...@my...> * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef KIMAGEPROCESS_MINDIST_H #define KIMAGEPROCESS_MINDIST_H #include <ktclassifbackend.h> #include <qvaluelist.h> #include <qvaluevector.h> #include <qstring.h> class KTImage; /** A SNNS backend plugin @author Gustavo Pichorim Boiko */ class KTMinDistPlugin : public KTClassifBackend { Q_OBJECT public: KTMinDistPlugin(QObject *parent, const char *name, const QStringList&); ~KTMinDistPlugin(); 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 "mindist"; } private: QValueVector<float> *m_mean; }; #endif |
|
From: Gustavo P. B. <gb...@us...> - 2005-07-03 01:35:35
|
Update of /cvsroot/kimageprocess/kimageprocess/src/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15258 Modified Files: Makefile.am Log Message: Added the minimum euclidean distance classifier Index: Makefile.am =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/plugins/Makefile.am,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- Makefile.am 3 Jul 2005 01:09:16 -0000 1.8 +++ Makefile.am 3 Jul 2005 01:35:24 -0000 1.9 @@ -1,3 +1,3 @@ INCLUDES = $(all_includes) -I$(srcdir)/libkimageprocess -I$(srcdir)/libktimgview METASOURCES = AUTO -SUBDIRS = snns fann #lwnn +SUBDIRS = snns fann mindist #lwnn |
|
From: Gustavo P. B. <gb...@us...> - 2005-07-03 01:32:43
|
Update of /cvsroot/kimageprocess/kimageprocess/src/plugins/mindist In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14122/mindist Log Message: Directory /cvsroot/kimageprocess/kimageprocess/src/plugins/mindist added to the repository |
|
From: Herton R. K. <he...@us...> - 2005-07-03 01:09:27
|
Update of /cvsroot/kimageprocess/kimageprocess/src/plugins/fann In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1726/plugins/fann Modified Files: fann.cpp Log Message: - Reenabled fann plugin compilation. - Fixing compiling problems on fann plugin. Index: fann.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/plugins/fann/fann.cpp,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- fann.cpp 3 Jul 2005 00:31:40 -0000 1.6 +++ fann.cpp 3 Jul 2005 01:09:17 -0000 1.7 @@ -27,6 +27,7 @@ #include <ktimage.h> #include <ktpluginmanager.h> +#include <ktpatternmanager.h> K_EXPORT_COMPONENT_FACTORY( kimageprocess_fann, KGenericFactory<KTFANNPlugin>( "kimageprocess_fann" ) ) @@ -35,7 +36,6 @@ : KTClassifBackend(parent, name) { m_network = 0; - m_img = 0; m_iterations = 300000; m_hiddenLayers = 1; m_connectionRate = 1.0; @@ -60,7 +60,7 @@ //create the network unsigned int neurons[m_hiddenLayers + 2]; - neurons[0] = inputs + neurons[0] = inputs; for ( int i=1; i < m_hiddenLayers; ++i ) { neurons[i] = inputs; } @@ -72,35 +72,40 @@ fann_set_activation_function_output(m_network, m_activationFunctionOutput); struct fann_train_data fanndata; - float *out; - float error = 0.0; + float *in, *out; + in = new float[data.count() * inputs]; out = new float[data.count() * outputs]; fanndata.num_data = data.count(); fanndata.num_input = inputs; fanndata.num_output = outputs; fanndata.input = new float*[data.count()]; fanndata.output = new float*[data.count()]; - for ( int i=0; i < data.count(); ++i ) + for ( unsigned int i=0; i < data.count(); ++i ) { + fanndata.input[i] = in + i * inputs; fanndata.output[i] = out + i * outputs; - for ( int j=0; j < m_output; ++j ) + for ( int j=0; j < outputs; ++j ) { fanndata.output[i][j] = 0; } } QValueList<dataEntry>::ConstIterator end = data.constEnd(); + int c = 0; - for ( QValueList<dataEntry>::ConstIterator it = data.constBegin(), int c=0; it != end; ++it, ++c ) + for ( QValueList<dataEntry>::ConstIterator it = data.constBegin(); it != end; ++it ) { - fanndata.inputs[c] = (*it).inputs; + for ( int i=0; i < inputs; ++i ) + fanndata.input[c][i] = (*it).inputs[i]; fanndata.output[c][(*it).sampleClass-1] = 1; + c++; } fann_init_weights(m_network, &fanndata); fann_train_on_data(m_network, &fanndata, m_iterations, m_iterations / 100, m_desiredError); //clear data + delete in; delete out; delete fanndata.input; delete fanndata.output; @@ -113,23 +118,26 @@ KTImage *c_img = KTImageManager::self()->testingImage(); QImage *img = new QImage(c_img->width(), c_img->height(), 32); - float *outputs; + float input[inputs]; + float *output; QValueList<dataEntry>::ConstIterator end = data.constEnd(); - int x = 0, y = 0; + int x = 0, y = 0, i = 0; int colorStep = 255 / (outputs - 1); int level; - for ( QValueList<dataEntry>::ConstIterator it = data.constBegin(), int i=0; it != end; ++it, ++i ) + for ( QValueList<dataEntry>::ConstIterator it = data.constBegin(); it != end; ++it ) { - outputs = fann_run(m_network, (*it).inputs); + for ( int j=0; j < inputs; ++j ) + input[j] = (*it).inputs[j]; + output = fann_run(m_network, input); int maxclass = 0; - int maxvalue = outputs[0]; + float maxvalue = output[0]; for ( int j=1; j < outputs; ++j ) { - if (outputs[j] > maxvalue) + if (output[j] > maxvalue) { maxclass = j; - maxvalue = outputs[j]; + maxvalue = output[j]; } } level = maxclass * colorStep; @@ -139,6 +147,7 @@ x = 0; y++; } + i++; } //save the image @@ -148,7 +157,7 @@ { KTempFile tmpImg(QString::null, ".pgm"); tmpImg.close(); - m_img->save(tmpImg.name(), "PGM"); + img->save(tmpImg.name(), "PGM"); KIO::NetAccess::upload(tmpImg.name(), dest, 0); KIO::NetAccess::removeTempFile(tmpImg.name()); } |
|
From: Herton R. K. <he...@us...> - 2005-07-03 01:09:27
|
Update of /cvsroot/kimageprocess/kimageprocess/src/plugins In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1726/plugins Modified Files: Makefile.am Log Message: - Reenabled fann plugin compilation. - Fixing compiling problems on fann plugin. Index: Makefile.am =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/plugins/Makefile.am,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- Makefile.am 23 Jun 2005 23:19:42 -0000 1.7 +++ Makefile.am 3 Jul 2005 01:09:16 -0000 1.8 @@ -1,3 +1,3 @@ INCLUDES = $(all_includes) -I$(srcdir)/libkimageprocess -I$(srcdir)/libktimgview METASOURCES = AUTO -SUBDIRS = snns #lwnn fann +SUBDIRS = snns fann #lwnn |
|
From: Herton R. K. <he...@us...> - 2005-07-03 00:31:53
|
Update of /cvsroot/kimageprocess/kimageprocess/src/plugins/fann In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17042/fann Modified Files: fann.cpp fann.h Log Message: - Adapted fann plugin to the new plugin structure. Also added more variables to plugin class that handle more parameters of the fann network. - Misc cosmetics and cleanups at snns and fann plugins. Index: fann.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/plugins/fann/fann.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- fann.h 23 Jun 2005 18:30:06 -0000 1.4 +++ fann.h 3 Jul 2005 00:31:40 -0000 1.5 @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2004-2005 by * + * Copyright (C) 2004-2005 by * * Gustavo Pichorim Boiko <gus...@kd...> * * Herton Ronaldo Krzesinski <he...@my...> * * * @@ -27,20 +27,9 @@ #include <qvaluelist.h> -#include <kurl.h> - -class KAction; -class KTImage; -class QImage; - -typedef struct -{ - float *inputs; - int sampleClass; -} pattern; - /** A Fast Artificial Neural Network plugin + @author Gustavo Pichorim Boiko */ class KTFANNPlugin : public KTClassifBackend @@ -53,47 +42,23 @@ void setupPlugin(); - int iterations() { return m_iterations; } - void setIterations(int value) { m_iterations = value; } - - int hiddenLayers() { return m_hiddenLayers; } - void setHiddenLayers(int value) { m_hiddenLayers = value; } - // Reimplemented from KTClassifBackends - void parseResults(const QValueList<float> &results); - - void parseSampleResults(const QValueList<float> &results, int sampleClass); + void doTraining(const QValueList<dataEntry>& data, int inputs, int outputs); + void doClassify(const QValueList<dataEntry>& data, int inputs, int outputs); private: - KAction *m_trainNetwork; - KAction *m_classifyImage; - struct fann *m_network; - int m_input; - int m_output; + int m_hiddenLayers; float m_connectionRate; float m_learningRate; - - QImage *m_img; - int m_width; - int m_height; - int m_colorStep; - - int m_x; - int m_y; - + int m_activationFunctionHidden; + int m_activationFunctionOutput; + float m_steepnessHidden; + float m_steepnessOutput; int m_iterations; - int m_hiddenLayers; - - double m_error; - - QValueList<pattern> m_patterns; - -private slots: - void slotTrainNetwork(); - // for now assume we are using one test image for each project. - // TODO: Fix that (will require API change) - void slotClassifyImage(); + float m_desiredError; }; #endif + +// vim:et Index: fann.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/plugins/fann/fann.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- fann.cpp 23 Jun 2005 18:30:06 -0000 1.5 +++ fann.cpp 3 Jul 2005 00:31:40 -0000 1.6 @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2004-2005 by * + * Copyright (C) 2004-2005 by * * Gustavo Pichorim Boiko <gus...@kd...> * * Herton Ronaldo Krzesinski <he...@my...> * * * @@ -21,17 +21,12 @@ #include "fann.h" #include <kgenericfactory.h> -#include <kaction.h> -#include <kdebug.h> #include <kio/netaccess.h> #include <kfiledialog.h> #include <ktempfile.h> -#include <qfile.h> - #include <ktimage.h> #include <ktpluginmanager.h> -#include <ktpatternmanager.h> K_EXPORT_COMPONENT_FACTORY( kimageprocess_fann, KGenericFactory<KTFANNPlugin>( "kimageprocess_fann" ) ) @@ -39,24 +34,17 @@ KTFANNPlugin::KTFANNPlugin(QObject *parent, const char* name, const QStringList&) : KTClassifBackend(parent, name) { - m_trainNetwork = new KAction(i18n("Train &Network"), 0, - this, SLOT(slotTrainNetwork()), - actionCollection(), "fann_train_network"); - - m_classifyImage = new KAction(i18n("Classify &Image"), 0, - this, SLOT(slotClassifyImage()), - actionCollection(), "fann_classify_image"); - - setInstance(KGenericFactory<KTFANNPlugin>::instance()); - setXMLFile("kimageprocess_fann.rc"); - m_network = 0; m_img = 0; - m_iterations = 100000; + m_iterations = 300000; m_hiddenLayers = 1; - m_connectionRate = 1.0; m_learningRate = 0.7; + m_activationFunctionHidden = FANN_SIGMOID_SYMMETRIC; + m_activationFunctionOutput = FANN_SIGMOID_SYMMETRIC; + m_steepnessHidden = 1.0; + m_steepnessOutput = 1.0; + m_desiredError = 0.001; } KTFANNPlugin::~KTFANNPlugin() @@ -65,114 +53,103 @@ fann_destroy(m_network); } -void KTFANNPlugin::slotTrainNetwork() +void KTFANNPlugin::doTraining(const QValueList<dataEntry>& data, int inputs, int outputs) { if (m_network) fann_destroy(m_network); - m_input = KTImageManager::self()->activeFeaturesCount(); - m_output = KTImageManager::self()->sampleCount(); - //create the network - m_network = fann_create(m_connectionRate, m_learningRate, 3, m_input, m_input, m_output); - fann_set_activation_steepness_hidden(m_network, 1.0); - fann_set_activation_steepness_output(m_network, 1.0); - fann_set_activation_function_hidden(m_network, FANN_SIGMOID_SYMMETRIC_STEPWISE); - fann_set_activation_function_output(m_network, FANN_SIGMOID_SYMMETRIC_STEPWISE); - m_error = 0.0; - - //start training - KTImageManager::self()->calculateSampleData(0, this); + unsigned int neurons[m_hiddenLayers + 2]; + neurons[0] = inputs + for ( int i=1; i < m_hiddenLayers; ++i ) { + neurons[i] = inputs; + } + neurons[m_hiddenLayers + 1] = outputs; + m_network = fann_create_array(m_connectionRate, m_learningRate, m_hiddenLayers + 2, neurons); + fann_set_activation_steepness_hidden(m_network, m_steepnessHidden); + fann_set_activation_steepness_output(m_network, m_steepnessOutput); + fann_set_activation_function_hidden(m_network, m_activationFunctionHidden); + fann_set_activation_function_output(m_network, m_activationFunctionOutput); - struct fann_train_data tfanndata; - float *tempf_outputs; - int i, j; - QValueList<pattern>::size_type c_patcount; + struct fann_train_data fanndata; + float *out; + float error = 0.0; - c_patcount = m_patterns.count(); - tempf_outputs = new float[c_patcount * m_output]; - tfanndata.num_data = c_patcount; - tfanndata.num_input = m_input; - tfanndata.num_output = m_output; - tfanndata.input = new float*[c_patcount]; - tfanndata.output = new float*[c_patcount]; - for (i = 0; i < c_patcount; i++) + out = new float[data.count() * outputs]; + fanndata.num_data = data.count(); + fanndata.num_input = inputs; + fanndata.num_output = outputs; + fanndata.input = new float*[data.count()]; + fanndata.output = new float*[data.count()]; + for ( int i=0; i < data.count(); ++i ) { - tfanndata.output[i] = tempf_outputs + i * m_output; - for (j = 0; j < m_output; j++) + fanndata.output[i] = out + i * outputs; + for ( int j=0; j < m_output; ++j ) { - tfanndata.output[i][j] = 0; + fanndata.output[i][j] = 0; } } - j = 0; - QValueList<pattern>::iterator end = m_patterns.end(); - for (QValueList<pattern>::iterator it = m_patterns.begin(); it != end; ++it) - { - tfanndata.output[j][(*it).sampleClass-1] = 1; - tfanndata.input[j] = (*it).inputs; - j++; - } - fann_init_weights(m_network, &tfanndata); - fann_train_on_data(m_network, &tfanndata, m_iterations, m_iterations / 100, 0.001); - m_error = fann_get_MSE(m_network); - /*int print_debug = 0; - QValueList<pattern>::iterator end = m_patterns.end(); - for (i = 0; i < m_iterations; ++i) + QValueList<dataEntry>::ConstIterator end = data.constEnd(); + + for ( QValueList<dataEntry>::ConstIterator it = data.constBegin(), int c=0; it != end; ++it, ++c ) { - for (QValueList<pattern>::iterator it = m_patterns.begin(); it != end; ++it) - { - outputs[(*it).sampleClass-1] = 1; - fann_train(m_network, (*it).inputs, outputs); - outputs[(*it).sampleClass-1] = 0; - } - print_debug++; - if (print_debug == 1000) - { - m_error = fann_get_MSE(m_network); - kdDebug() << "Network output average error:" << m_error << endl; - print_debug = 0; - } - }*/ + fanndata.inputs[c] = (*it).inputs; + fanndata.output[c][(*it).sampleClass-1] = 1; + } + fann_init_weights(m_network, &fanndata); + fann_train_on_data(m_network, &fanndata, m_iterations, m_iterations / 100, m_desiredError); //clear data - end = m_patterns.end(); - for (QValueList<pattern>::iterator it = m_patterns.begin(); it != end; ++it) - delete (*it).inputs; - delete tfanndata.input; - delete tempf_outputs; - delete tfanndata.output; - m_patterns.clear(); + delete out; + delete fanndata.input; + delete fanndata.output; } -void KTFANNPlugin::slotClassifyImage() +void KTFANNPlugin::doClassify(const QValueList<dataEntry>& data, int inputs, int outputs) { if (!m_network) return; - KTImage *img = KTImageManager::self()->testingImage(); - - m_width = img->width(); - m_height = img->height(); - m_x = m_y = 0; + KTImage *c_img = KTImageManager::self()->testingImage(); + QImage *img = new QImage(c_img->width(), c_img->height(), 32); + float *outputs; + QValueList<dataEntry>::ConstIterator end = data.constEnd(); + int x = 0, y = 0; + int colorStep = 255 / (outputs - 1); + int level; - if (m_img) - delete m_img; - m_img = new QImage(m_width,m_height,32); - m_colorStep = 255/(m_output-1); - kdDebug() << "Color step is: " << m_colorStep << endl; - m_patterns.clear(); - KTImageManager::self()->calculateTestData(0, this); + for ( QValueList<dataEntry>::ConstIterator it = data.constBegin(), int i=0; it != end; ++it, ++i ) + { + outputs = fann_run(m_network, (*it).inputs); + int maxclass = 0; + int maxvalue = outputs[0]; + for ( int j=1; j < outputs; ++j ) + { + if (outputs[j] > maxvalue) + { + maxclass = j; + maxvalue = outputs[j]; + } + } + level = maxclass * colorStep; + img->setPixel(x++, y, qRgb(level, level, level)); + if (x >= c_img->width()) + { + x = 0; + y++; + } + } //save the image KURL dest = KFileDialog::getSaveURL(QString::null,i18n("*.pgm|PGM File"),0,i18n("Save classified image")); if (!dest.isEmpty()) { - KTempFile tmpImg(QString::null,".pgm"); + KTempFile tmpImg(QString::null, ".pgm"); tmpImg.close(); - m_img->save(tmpImg.name(),"PGM"); - KIO::NetAccess::upload(tmpImg.name(),dest,0); + m_img->save(tmpImg.name(), "PGM"); + KIO::NetAccess::upload(tmpImg.name(), dest, 0); KIO::NetAccess::removeTempFile(tmpImg.name()); } } @@ -182,61 +159,6 @@ //connect signals/slots here } -void KTFANNPlugin::parseResults(const QValueList<float> &results) -{ - float *inputs = new float[m_input]; - float *outputs; - - QValueList<float>::const_iterator it; - int i = 0; - kdDebug() << "------------------------" << endl; - //prepare the input - for ( it = results.begin(); it != results.end(); ++it) - { - kdDebug() << "inputs[" << i << "] = " << (*it) << endl; - inputs[i++] = (*it); - } - - outputs = fann_run(m_network, inputs); - - int maxclass = 0; - float maxvalue = 0; - for (i = 0; i < m_output; i++) - { - kdDebug() << "outputs[" << i << "] = " << outputs[i] << endl; - if (outputs[i] > maxvalue) - { - maxclass = i; - maxvalue = outputs[i]; - } - } - int level = maxclass * m_colorStep; - //kdDebug() << "Pixel x=" << m_x << " y=" << m_y << " is of class " << maxclass << " with value = " << maxvalue << endl; - m_img->setPixel(m_x++,m_y,qRgb(level,level,level)); - - if (m_x >= m_width) - { - m_x = 0; - m_y++; - } - -} - -void KTFANNPlugin::parseSampleResults(const QValueList<float> &results, int sampleClass) -{ - float *inputs = new float[m_input]; - - QValueList<float>::const_iterator it; - int i = 0; - - //prepare the input - for ( it = results.begin(); it != results.end(); ++it) - inputs[i++] = (*it); - - pattern pat; - pat.inputs = inputs; - pat.sampleClass = sampleClass; - m_patterns.append(pat); -} - #include "fann.moc" + +// vim:et |
|
From: Herton R. K. <he...@us...> - 2005-07-03 00:31:53
|
Update of /cvsroot/kimageprocess/kimageprocess/src/plugins/snns In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17042/snns Modified Files: snns.cpp snns.h Log Message: - Adapted fann plugin to the new plugin structure. Also added more variables to plugin class that handle more parameters of the fann network. - Misc cosmetics and cleanups at snns and fann plugins. Index: snns.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/plugins/snns/snns.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- snns.cpp 2 Jul 2005 23:42:52 -0000 1.11 +++ snns.cpp 3 Jul 2005 00:31:40 -0000 1.12 @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2004-2005 by * + * Copyright (C) 2004-2005 by * * Gustavo Pichorim Boiko <gus...@kd...> * * Herton Ronaldo Krzesinski <he...@my...> * * * @@ -42,7 +42,6 @@ m_tempFile = 0; } - KTSNNSPlugin::~KTSNNSPlugin() { } @@ -50,23 +49,22 @@ void KTSNNSPlugin::doTraining(const QValueList<dataEntry>& data, int inputs, int outputs) { KURL dest = KFileDialog::getSaveURL(QString::null,i18n("*.pat|Pattern files"),0,i18n("Save pattern")); - + if (!dest.isEmpty()) { - m_sampleImage = dest; m_tempFile = new KTempFile(); m_tempFile->setAutoDelete(false); if (m_tempFile->file()->isOpen()) - { + { 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; for ( QStringList::Iterator it = names.begin(); it != names.end(); ++it ) @@ -74,25 +72,25 @@ features += (*it) + " "; } m_stream << "#" << features << endl << endl; - + QValueList<dataEntry>::ConstIterator end = data.constEnd(); for (QValueList<dataEntry>::ConstIterator it = data.constBegin(); it != end; ++it) { QString line = ""; - + for ( int i=0; i < inputs; ++i ) line.sprintf("%s %.5f", line.ascii(), (*it).inputs[i]); - + m_stream << line.stripWhiteSpace() << endl; - + QString temp=""; for (int j = 1; j <= outputs; j++) if (j == (*it).sampleClass) temp += "1 "; else temp += "0 "; - + m_stream << temp.stripWhiteSpace() << endl << endl; } @@ -112,7 +110,6 @@ if (!dest.isEmpty()) { - m_sampleImage = dest; m_tempFile = new KTempFile(); m_tempFile->setAutoDelete(false); @@ -176,7 +173,10 @@ } void KTSNNSPlugin::setupPlugin() -{ -//connect signals/slots here +{ + //connect signals/slots here } + #include "snns.moc" + +// vim:et Index: snns.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/plugins/snns/snns.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- snns.h 29 Jun 2005 02:41:43 -0000 1.9 +++ snns.h 3 Jul 2005 00:31:40 -0000 1.10 @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2004-2005 by * + * Copyright (C) 2004-2005 by * * Gustavo Pichorim Boiko <gus...@kd...> * * Herton Ronaldo Krzesinski <he...@my...> * * * @@ -23,18 +23,14 @@ #include <ktclassifbackend.h> +#include <ktempfile.h> + #include <qvaluelist.h> -#include <qvaluevector.h> #include <qstring.h> -#include <kurl.h> - -class KAction; -class KTImage; -class KTempFile; - /** A SNNS backend plugin + @author Gustavo Pichorim Boiko */ class KTSNNSPlugin : public KTClassifBackend @@ -51,17 +47,11 @@ 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; + QString classifierName() { return "snns"; } +private: KTempFile *m_tempFile; QTextStream m_stream; - }; #endif |
|
From: Gustavo P. B. <gb...@us...> - 2005-07-02 23:43:01
|
Update of /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23941/src/libkimageprocess Modified Files: ktcalculation.cpp ktcalculation.h Log Message: Moved the normalization code to a function (reduce code duplication) Index: ktcalculation.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktcalculation.h,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- ktcalculation.h 2 Jul 2005 19:11:08 -0000 1.6 +++ ktcalculation.h 2 Jul 2005 23:42:52 -0000 1.7 @@ -72,6 +72,8 @@ void parseResults(const QValueList<float> &results, int sampleClass); + void normalize(); + public slots: void calculateSampleData(); Index: ktcalculation.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktcalculation.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ktcalculation.cpp 2 Jul 2005 19:11:08 -0000 1.10 +++ ktcalculation.cpp 2 Jul 2005 23:42:52 -0000 1.11 @@ -85,25 +85,10 @@ for ( it = list.first(); it; it = list.next()) generateWindowResults(it, imgClass++); - //normalize - QValueList<dataEntry>::iterator end = m_data.end(); - - float dif[m_inputs]; - for (int i=0; i < m_inputs; ++i) - dif[i] = m_max[i] - m_min[i]; - - for (QValueList<dataEntry>::iterator it = m_data.begin(); it != end; ++it) - { - for ( int i=0; i < m_inputs; ++i ) - { - (*it).inputs[i] = ((*it).inputs[i] - m_min[i]) * 1000 / dif[i]; - } - } + //normalize the values + normalize(); KTPluginManager::self()->classifier()->doTraining(m_data, m_inputs, m_outputs); - - emit updateProgress(); - sleep(1); emit finished(); } @@ -133,21 +118,9 @@ m_window_type = WIN_ALLPIX; generateWindowResults(img, 0); m_window_type = winType; - - //normalize - QValueList<dataEntry>::iterator end = m_data.end(); - - float dif[m_inputs]; - for (int i=0; i < m_inputs; ++i) - dif[i] = m_max[i] - m_min[i]; - - for (QValueList<dataEntry>::iterator it = m_data.begin(); it != end; ++it) - { - for ( int i=0; i < m_inputs; ++i ) - { - (*it).inputs[i] = ((*it).inputs[i] - m_min[i]) * 1000 / dif[i]; - } - } + + //normalize the values + normalize(); KTPluginManager::self()->classifier()->doClassify(m_data, m_inputs, m_outputs); @@ -175,6 +148,7 @@ while ( (x + m_window_size.width <= width) && (y + m_window_size.height <= height) && (i < m_iterations || m_iterations == 0) ) { + kdDebug() << "SEQ: using x=" << x << " y=" << y << " w=" << m_window_size.width << " h=" << m_window_size.height << endl; tmpimg = img->returnWindow(x, y, m_window_size.width, m_window_size.height); m_method->calculate(tmpimg, imgClass); delete tmpimg; @@ -195,6 +169,7 @@ while ( (x + m_window_size.width <= width) && (y + m_window_size.height <= height) && (i < m_iterations || m_iterations == 0) ) { + kdDebug() << "CASC: using x=" << x << " y=" << y << " w=" << m_window_size.width << " h=" << m_window_size.height << endl; tmpimg = img->returnWindow(x, y, m_window_size.width, m_window_size.height); m_method->calculate(tmpimg, imgClass); delete tmpimg; @@ -254,12 +229,15 @@ if (m_first) { for (int j = 0; j < m_inputs; ++j) - m_min[j] = m_max[j] = results[j]; + { + m_min[j] = results[j]; + m_max[j] = results[j]; + } m_first = false; } //prepare the input - for (int i=0; i < results.count(); ++i) + for (int i=0; i < m_inputs; ++i) { if (results[i] > m_max[i]) m_max[i] = results[i]; @@ -285,6 +263,24 @@ return m_window_size; } +void KTCalculation::normalize() +{ + //the upper limit + float uplimit = 1000.; + + QValueList<dataEntry>::iterator end = m_data.end(); + float dif[m_inputs]; + for (int i=0; i < m_inputs; ++i) + dif[i] = m_max[i] - m_min[i]; + + for (QValueList<dataEntry>::iterator it = m_data.begin(); it != end; ++it) + { + for ( int i=0; i < m_inputs; ++i ) + (*it).inputs[i] = ((*it).inputs[i] - m_min[i]) * uplimit / dif[i]; + + } +} + QString& operator<<(QString& s, const QValueList<dataEntry> &l ) { QValueList<dataEntry>::const_iterator it; @@ -299,4 +295,5 @@ } return s; } + #include "ktcalculation.moc" |
|
From: Gustavo P. B. <gb...@us...> - 2005-07-02 23:43:01
|
Update of /cvsroot/kimageprocess/kimageprocess/src/plugins/snns In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23941/src/plugins/snns Modified Files: snns.cpp Log Message: Moved the normalization code to a function (reduce code duplication) Index: snns.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/plugins/snns/snns.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- snns.cpp 29 Jun 2005 03:03:01 -0000 1.10 +++ snns.cpp 2 Jul 2005 23:42:52 -0000 1.11 @@ -46,6 +46,7 @@ KTSNNSPlugin::~KTSNNSPlugin() { } + void KTSNNSPlugin::doTraining(const QValueList<dataEntry>& data, int inputs, int outputs) { KURL dest = KFileDialog::getSaveURL(QString::null,i18n("*.pat|Pattern files"),0,i18n("Save pattern")); |
|
From: Gustavo P. B. <gb...@us...> - 2005-07-02 19:11:21
|
Update of /cvsroot/kimageprocess/kimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5525 Modified Files: kimageprocess.kdevelop Log Message: - Fixing WIN_ALLPIX (again ehhe) Index: kimageprocess.kdevelop =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/kimageprocess.kdevelop,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- kimageprocess.kdevelop 30 Jun 2005 02:37:47 -0000 1.14 +++ kimageprocess.kdevelop 2 Jul 2005 19:11:07 -0000 1.15 @@ -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> @@ -190,7 +190,6 @@ <kdevcppsupport> <references> <pcs>Qt</pcs> - <pcs>KDElibs</pcs> </references> <codecompletion> <includeGlobalFunctions>true</includeGlobalFunctions> @@ -210,7 +209,7 @@ </qtdesigner> </designerintegration> <creategettersetter> - <prefixGet/> + <prefixGet></prefixGet> <prefixSet>set</prefixSet> <prefixVariable>m_,_</prefixVariable> <parameterName>theValue</parameterName> |
|
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" |
|
From: Herton R. K. <he...@us...> - 2005-07-02 01:06:39
|
Update of /cvsroot/kimageprocess/kimageprocess/testclass In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20813 Removed Files: 5x5.net mos2.pgm mos2.res mos2_c.pat mos2_t.pat mosaico5.pgm Log Message: - Removing unused files, now test files belong to batchtests. --- mos2_c.pat DELETED --- --- 5x5.net DELETED --- --- mos2_t.pat DELETED --- --- mosaico5.pgm DELETED --- --- mos2.res DELETED --- --- mos2.pgm DELETED --- |
|
From: Herton R. K. <he...@us...> - 2005-07-02 01:03:11
|
Update of /cvsroot/kimageprocess/kimageprocess/batchtests/mosaic5 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19222/mosaic5 Added Files: class.pat img.size mosaico5.pgm train.pat Log Message: - Adding mosaic5 testcase; --- NEW FILE: class.pat --- SNNS pattern definition file V3.2 generated at Sex Mar 11 18:52:27 2005 No. of patterns : 16384 No. of input units : 5 No. of output units : 0 #Contrast Dissimilarity AngSecMom Variance Correlation #1 4.11562 1.35313 0.19637 7.81593 0.23459 #2 4.11562 1.35313 0.19637 7.81593 0.23459 #3 4.11562 1.35313 0.19637 7.81593 0.23459 [...49124 lines suppressed...] 0.27500 0.13750 0.91793 3.66725 0.22752 #16379 0.27500 0.13750 0.91793 3.66725 0.22752 #16380 0.45000 0.22500 0.83434 3.78998 0.22629 #16381 0.70000 0.35000 0.66695 4.09957 0.32297 #16382 1.05000 0.52500 0.47727 4.50851 0.41728 #16383 1.05000 0.52500 0.47727 4.50851 0.41728 #16384 1.05000 0.52500 0.47727 4.50851 0.41728 --- NEW FILE: train.pat --- SNNS pattern definition file V3.2 generated at Sex Mar 11 18:52:10 2005 No. of patterns : 150 No. of input units : 5 No. of output units : 5 #Contrast Dissimilarity AngSecMom Variance Correlation 0.16563 0.16563 0.68115 6.83959 0.18600 1 0 0 0 0 0.00000 0.00000 1.05062 6.84050 0.25000 1 0 0 0 0 0.00000 0.00000 1.05062 6.84050 0.25000 1 0 0 0 0 0.00000 0.00000 1.05062 6.84050 0.25000 1 0 0 0 0 0.00000 0.00000 1.05062 6.84050 0.25000 1 0 0 0 0 0.00000 0.00000 1.05062 6.84050 0.25000 1 0 0 0 0 0.17500 0.08750 0.95918 6.94910 0.23560 1 0 0 0 0 0.27500 0.13750 0.91793 7.01748 0.22813 1 0 0 0 0 0.27500 0.13750 0.91793 7.01748 0.22813 1 0 0 0 0 0.27500 0.13750 0.91793 7.01748 0.22813 1 0 0 0 0 0.16250 0.08125 0.96990 6.96408 0.24306 1 0 0 0 0 0.17500 0.08750 0.95918 6.94910 0.23560 1 0 0 0 0 0.27500 0.13750 0.91793 7.01748 0.22813 1 0 0 0 0 0.92500 0.46250 0.59609 7.67925 0.16724 1 0 0 0 0 1.52500 0.76250 0.47797 7.92612 0.07880 1 0 0 0 0 1.41250 0.70625 0.49443 7.89640 0.10290 1 0 0 0 0 1.25000 0.62500 0.53824 7.80357 0.11352 1 0 0 0 0 0.66250 0.33125 0.68115 7.51805 0.18471 1 0 0 0 0 0.00000 0.00000 1.05062 6.84050 0.25000 1 0 0 0 0 0.70000 0.35000 0.65750 7.62187 0.17622 1 0 0 0 0 1.40000 0.70000 0.51313 7.92612 0.07880 1 0 0 0 0 1.68750 0.84375 0.44076 8.06891 0.05228 1 0 0 0 0 1.85000 0.92500 0.43172 8.12398 0.02366 1 0 0 0 0 1.81250 0.90625 0.37240 8.28277 0.05228 1 0 0 0 0 1.71250 0.85625 0.39389 8.06891 0.19228 1 0 0 0 0 1.90000 0.95000 0.35164 8.20112 0.21543 1 0 0 0 0 2.23750 1.11875 0.30100 8.48046 0.12732 1 0 0 0 0 2.23750 1.11875 0.30100 8.48046 0.12732 1 0 0 0 0 0.12500 0.12500 0.76324 6.84573 0.20356 1 0 0 0 0 0.00000 0.00000 1.05062 6.84050 0.25000 1 0 0 0 0 14.79375 2.96250 0.07998 11.86494 0.26072 0 1 0 0 0 14.08438 2.84063 0.08793 11.70195 0.25378 0 1 0 0 0 11.01250 2.36875 0.09969 10.37847 0.25139 0 1 0 0 0 6.40938 1.67813 0.14533 8.59132 0.26694 0 1 0 0 0 2.49375 1.16250 0.19082 7.30994 0.27891 0 1 0 0 0 1.80313 0.90312 0.18398 7.07028 0.30963 0 1 0 0 0 2.19062 1.05938 0.13422 7.84930 0.37469 0 1 0 0 0 2.99375 1.29375 0.12205 8.16790 0.20777 0 1 0 0 0 2.85938 1.20312 0.16443 8.02593 0.11393 0 1 0 0 0 2.75000 1.17500 0.14611 7.95973 0.11301 0 1 0 0 0 2.30625 0.98125 0.17512 7.57873 0.07038 0 1 0 0 0 1.44375 0.73125 0.23760 6.94684 0.07994 0 1 0 0 0 0.84375 0.52500 0.34107 6.60863 0.26025 0 1 0 0 0 1.51562 0.67188 0.36359 6.81311 0.25169 0 1 0 0 0 2.33125 0.90000 0.27295 7.09430 0.22983 0 1 0 0 0 2.97500 1.08125 0.19766 7.61883 0.18965 0 1 0 0 0 3.75938 1.32812 0.14896 7.93344 0.13819 0 1 0 0 0 3.78437 1.41562 0.14463 7.91965 0.04878 0 1 0 0 0 3.26250 1.31875 0.15279 7.80534 0.07471 0 1 0 0 0 3.03750 1.31250 0.14029 7.72434 0.19534 0 1 0 0 0 2.33125 1.15000 0.16797 7.28912 0.25883 0 1 0 0 0 3.30312 1.35312 0.13104 7.66070 0.20860 0 1 0 0 0 4.75000 1.71875 0.11170 7.83484 0.10528 0 1 0 0 0 5.38438 1.86563 0.12584 7.93913 0.09046 0 1 0 0 0 6.85313 2.19062 0.10201 8.93816 0.09805 0 1 0 0 0 7.02187 2.26562 0.10100 9.86809 0.26599 0 1 0 0 0 7.51562 2.24062 0.10146 9.78758 0.26140 0 1 0 0 0 7.90938 2.24688 0.09414 9.93235 0.22545 0 1 0 0 0 15.08750 3.03750 0.07982 12.17235 0.25502 0 1 0 0 0 14.33438 2.86562 0.09504 11.98124 0.23977 0 1 0 0 0 1.81250 0.90625 0.27943 6.20031 0.32162 0 0 1 0 0 2.66250 1.21875 0.21180 6.56515 0.24747 0 0 1 0 0 2.46250 1.11875 0.23984 6.35547 0.20817 0 0 1 0 0 2.68750 1.23125 0.24695 6.19111 0.17270 0 0 1 0 0 2.93750 1.30625 0.21328 6.39059 0.24356 0 0 1 0 0 2.31250 1.10625 0.26463 6.21499 0.29581 0 0 1 0 0 2.02500 0.96250 0.30805 6.06126 0.31289 0 0 1 0 0 2.41875 1.12500 0.24352 6.36437 0.27743 0 0 1 0 0 2.69375 1.15000 0.28031 6.25616 0.14012 0 0 1 0 0 2.51875 1.06250 0.26500 6.33062 0.31653 0 0 1 0 0 3.10625 1.30625 0.18287 6.74094 0.30532 0 0 1 0 0 2.85313 1.22187 0.23070 6.43612 0.26828 0 0 1 0 0 1.86250 0.88125 0.33771 5.88297 0.32763 0 0 1 0 0 2.19375 1.03750 0.29016 6.24033 0.18289 0 0 1 0 0 2.80625 1.15625 0.24088 6.45835 0.13044 0 0 1 0 0 3.62188 1.35938 0.19668 6.75918 0.17396 0 0 1 0 0 4.26875 1.63125 0.14877 7.16337 0.14579 0 0 1 0 0 3.87812 1.46563 0.14377 7.19324 0.21047 0 0 1 0 0 3.03750 1.27500 0.18250 6.87160 0.23171 0 0 1 0 0 2.06250 1.00000 0.22477 6.52910 0.21598 0 0 1 0 0 2.26562 1.05312 0.21502 6.61098 0.31807 0 0 1 0 0 2.68750 1.24375 0.19896 6.73984 0.33927 0 0 1 0 0 3.18750 1.38125 0.18359 6.94599 0.30265 0 0 1 0 0 3.48750 1.46875 0.17494 6.99577 0.21878 0 0 1 0 0 3.13750 1.39375 0.18373 6.73766 0.22039 0 0 1 0 0 2.88750 1.26875 0.20330 6.51806 0.15892 0 0 1 0 0 2.63750 1.20625 0.22492 6.45102 0.20712 0 0 1 0 0 2.17500 1.03750 0.24480 6.33254 0.29714 0 0 1 0 0 1.81250 0.90625 0.30756 5.94560 0.31546 0 0 1 0 0 2.70000 1.23750 0.20525 6.47153 0.24723 0 0 1 0 0 0.51250 0.25625 0.77186 3.91742 0.42250 0 0 0 1 0 0.68750 0.34375 0.68818 4.05434 0.42600 0 0 0 1 0 0.70000 0.35000 0.68063 4.04300 0.41730 0 0 0 1 0 0.52500 0.26250 0.76324 3.90654 0.41449 0 0 0 1 0 0.80000 0.40000 0.67324 4.02192 0.29901 0 0 0 1 0 0.90000 0.45000 0.66312 4.00800 0.17488 0 0 0 1 0 0.76562 0.40312 0.66338 3.93631 0.20071 0 0 0 1 0 0.79375 0.43125 0.62227 3.95509 0.21683 0 0 0 1 0 0.69375 0.38125 0.64738 3.90840 0.23175 0 0 0 1 0 0.34375 0.20625 0.79539 3.69050 0.24431 0 0 0 1 0 0.31875 0.18125 0.83289 3.68466 0.24076 0 0 0 1 0 0.43750 0.21875 0.84576 3.77059 0.21915 0 0 0 1 0 0.45000 0.22500 0.83609 3.76016 0.21178 0 0 0 1 0 0.61250 0.30625 0.74334 3.92696 0.19385 0 0 0 1 0 0.78750 0.39375 0.57842 4.28219 0.38503 0 0 0 1 0 0.95000 0.47500 0.53605 4.34787 0.33750 0 0 0 1 0 0.77500 0.38750 0.59406 4.27954 0.38390 0 0 0 1 0 0.95000 0.47500 0.50953 4.44360 0.38280 0 0 0 1 0 1.05000 0.52500 0.45187 4.58050 0.39723 0 0 0 1 0 0.93750 0.46875 0.42193 4.70921 0.52033 0 0 0 1 0 1.11250 0.55625 0.34779 4.90641 0.51127 0 0 0 1 0 0.96250 0.48125 0.35014 4.99984 0.59895 0 0 0 1 0 0.88750 0.44375 0.39795 4.83434 0.55954 0 0 0 1 0 0.67500 0.33750 0.53480 4.48840 0.54160 0 0 0 1 0 0.50000 0.25000 0.68102 4.17132 0.50551 0 0 0 1 0 0.32500 0.16250 0.86559 3.78998 0.22629 0 0 0 1 0 0.00000 0.00000 1.05062 3.50503 0.25000 0 0 0 1 0 0.07187 0.07187 0.90545 3.51798 0.23530 0 0 0 1 0 0.00000 0.00000 1.05062 3.50503 0.25000 0 0 0 1 0 0.00000 0.00000 1.05062 3.50503 0.25000 0 0 0 1 0 15.37813 3.04063 0.05654 12.23425 0.25844 0 0 0 0 1 16.85312 3.27188 0.05490 11.96403 0.18334 0 0 0 0 1 20.93750 3.57500 0.04770 14.08777 0.17692 0 0 0 0 1 27.06875 4.00625 0.04717 17.21153 0.23843 0 0 0 0 1 27.80000 4.00625 0.05086 18.54457 0.25325 0 0 0 0 1 33.33750 4.46875 0.04693 23.88103 0.27529 0 0 0 0 1 35.89375 4.61250 0.04703 26.24989 0.26424 0 0 0 0 1 31.48750 4.48125 0.05135 23.45131 0.23394 0 0 0 0 1 27.15000 4.30000 0.05848 21.00421 0.21956 0 0 0 0 1 28.80000 4.43750 0.05545 20.05642 0.20968 0 0 0 0 1 26.27188 4.18438 0.05197 16.24743 0.13076 0 0 0 0 1 27.20312 4.28438 0.04744 17.30985 0.20365 0 0 0 0 1 30.74063 4.57188 0.05561 19.00939 0.14753 0 0 0 0 1 30.88750 4.61250 0.05539 18.17857 0.09654 0 0 0 0 1 24.36875 4.08125 0.04951 18.20360 0.21752 0 0 0 0 1 26.14688 4.08437 0.05021 20.69350 0.28099 0 0 0 0 1 21.65000 3.70625 0.05035 20.29083 0.36917 0 0 0 0 1 27.31875 4.04375 0.05316 23.04064 0.35487 0 0 0 0 1 30.35000 4.21875 0.05404 23.10764 0.29002 0 0 0 0 1 27.66562 4.03438 0.05246 19.39112 0.22031 0 0 0 0 1 25.52500 3.75000 0.06779 17.09824 0.18411 0 0 0 0 1 18.90000 3.14375 0.08008 13.11021 0.14657 0 0 0 0 1 10.70938 2.57812 0.08047 9.36651 0.23343 0 0 0 0 1 17.21250 3.15625 0.06301 13.27107 0.24927 0 0 0 0 1 18.42813 3.32188 0.05664 15.58348 0.30722 0 0 0 0 1 22.15000 3.70000 0.05389 16.99568 0.24521 0 0 0 0 1 24.80625 4.01875 0.05668 17.32798 0.21240 0 0 0 0 1 20.81250 3.84375 0.05615 15.83269 0.24374 0 0 0 0 1 14.09375 2.91250 0.06158 12.09141 0.25164 0 0 0 0 1 15.75937 3.18438 0.06158 11.60523 0.11885 0 0 0 0 1 --- NEW FILE: mosaico5.pgm --- (This appears to be a binary file; contents omitted.) --- NEW FILE: img.size --- WIDTH=128 HEIGHT=128 |
|
From: Herton R. K. <he...@us...> - 2005-07-02 01:03:10
|
Update of /cvsroot/kimageprocess/kimageprocess/batchtests In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19222 Modified Files: test Log Message: - Adding mosaic5 testcase; Index: test =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/batchtests/test,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- test 24 Jun 2005 11:09:59 -0000 1.2 +++ test 2 Jul 2005 01:03:00 -0000 1.3 @@ -8,7 +8,8 @@ FANN_SIGMOID_SYMMETRIC \ FANN_SIGMOID_SYMMETRIC_STEPWISE" -TESTS="2texturas" +TESTS="2texturas \ + mosaic5" mkdir -p results for test in $TESTS; do source $test/img.size |
|
From: Herton R. K. <he...@us...> - 2005-07-02 01:02:06
|
Update of /cvsroot/kimageprocess/kimageprocess/batchtests/mosaic5 In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18919/mosaic5 Log Message: Directory /cvsroot/kimageprocess/kimageprocess/batchtests/mosaic5 added to the repository |
|
From: Herton R. K. <he...@us...> - 2005-07-01 23:22:01
|
Update of /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30433/libkimageprocess Modified Files: ktproject.cpp Log Message: - Really fixing now the bug of opened projects that do not save. Index: ktproject.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktproject.cpp,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- ktproject.cpp 1 Jul 2005 21:58:30 -0000 1.17 +++ ktproject.cpp 1 Jul 2005 23:21:50 -0000 1.18 @@ -98,8 +98,9 @@ loadProject(&root); m_isSaved = true; m_changed = false; + m_url = project; } - } + } addToRecent(project); } @@ -135,6 +136,7 @@ KTImageManager::self()->clear(); m_isSaved = false; m_changed = false; + m_url = ""; } bool KTProject::isSaved() |
|
From: Herton R. K. <he...@us...> - 2005-07-01 23:22:01
|
Update of /cvsroot/kimageprocess/kimageprocess/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30433 Modified Files: kimageprocess.cpp pref.cpp Log Message: - Really fixing now the bug of opened projects that do not save. Index: pref.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/pref.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- pref.cpp 1 Jul 2005 22:15:11 -0000 1.9 +++ pref.cpp 1 Jul 2005 23:21:50 -0000 1.10 @@ -55,7 +55,6 @@ void KImageProcessPreferences::slotOk() { - KTProject::self()->setChanged(); save(); close(); } Index: kimageprocess.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/kimageprocess.cpp,v retrieving revision 1.25 retrieving revision 1.26 diff -u -d -r1.25 -r1.26 --- kimageprocess.cpp 29 Jun 2005 03:02:59 -0000 1.25 +++ kimageprocess.cpp 1 Jul 2005 23:21:50 -0000 1.26 @@ -300,7 +300,7 @@ if (!KTProject::self()->isSaved()) fileSaveAs(); else - KTProject::self()->saveProject(); + KTProject::self()->saveProject(KTProject::self()->url()); } void KImageProcess::fileSaveAs() |
|
From: Herton R. K. <he...@us...> - 2005-07-01 22:15:23
|
Update of /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26337/src/libkimageprocess Modified Files: ktproject.h Log Message: - Fix bug of not saving loaded project files when options are changed and save project is chosen. Index: ktproject.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktproject.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ktproject.h 23 Jun 2005 18:33:51 -0000 1.5 +++ ktproject.h 1 Jul 2005 22:15:13 -0000 1.6 @@ -65,6 +65,8 @@ /** Return true if the project has changed */ bool changed(); + + void setChanged() { m_changed = true; } /** Remove a training sample image */ void removeSampleImage(KTImage *image); |
|
From: Herton R. K. <he...@us...> - 2005-07-01 22:15:22
|
Update of /cvsroot/kimageprocess/kimageprocess/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26337/src Modified Files: pref.cpp Log Message: - Fix bug of not saving loaded project files when options are changed and save project is chosen. Index: pref.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/pref.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- pref.cpp 23 Jun 2005 18:33:49 -0000 1.8 +++ pref.cpp 1 Jul 2005 22:15:11 -0000 1.9 @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2004-2005 by * + * Copyright (C) 2004-2005 by * * Gustavo Pichorim Boiko <gus...@kd...> * * Herton Ronaldo Krzesinski <he...@my...> * * * @@ -19,14 +19,12 @@ * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ - #include "pref.h" #include "ktproject.h" #include "ktfeaturechooser.h" #include "kttextureoptions.h" #include "ktfeaturemanager.h" - #include <klocale.h> #include <qlayout.h> @@ -47,19 +45,18 @@ layout = new QHBoxLayout(frame); layout->setAutoAdd(true); m_featureChooser = new KTFeatureChooser(frame); - + // The texture options frame = addPage(i18n("Texture Options"), i18n("Texture Options")); layout = new QHBoxLayout(frame); layout->setAutoAdd(true); m_textureOptions = new KTTextureOptions(frame); - } void KImageProcessPreferences::slotOk() { + KTProject::self()->setChanged(); save(); - close(); } |
|
From: Herton R. K. <he...@us...> - 2005-07-01 21:58:43
|
Update of /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18517/src/libkimageprocess Modified Files: ktproject.cpp Log Message: - Code to save project is already present at method, no need to duplicate this on ktproject.cpp Index: ktproject.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktproject.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- ktproject.cpp 1 Jul 2005 00:37:20 -0000 1.16 +++ ktproject.cpp 1 Jul 2005 21:58:30 -0000 1.17 @@ -32,11 +32,6 @@ #include <qfile.h> #include "ktcalculation.h" -#include "ktfeature.h" -#include "ktfeaturemanager.h" -#include "ktmethod.h" -#include "ktmethodmanager.h" -#include "ktpatternmanager.h" KTProject::KTProject(QObject *parent, const char *name) : QObject(parent, name)/*, @@ -214,25 +209,6 @@ window_size temp; QDomElement option; - QString active_method; - - option = m_doc.createElement("activeMethod"); - active_method = KTMethodManager::self()->activeMethod()->methodName(); - option.setAttribute("name", active_method); - options.appendChild(option); - - QDomElement method_options; - method_options = m_doc.createElement("method_options"); - FeatureList features = KTFeatureManager::self()->features(active_method); - - for (QDictIterator<KTFeature> it(features); it.current(); ++it) - { - QDomElement feature = m_doc.createElement("feature"); - method_options.appendChild(feature); - feature.setAttribute("name", it.current()->featureName()); - feature.setAttribute("enabled", it.current()->enabled() ? "true" : "false"); - } - option.appendChild(method_options); option = m_doc.createElement("windowType"); option.setAttribute("value", QString::number(KTCalculation::self()->windowType(), 10)); @@ -315,11 +291,7 @@ QDomElement option = options.item(i).toElement(); QDomElement methodOptionsGroup; - if (option.nodeName() == "activeMethod") - KTMethodManager::self()->setActiveMethod(option.attribute("name", "glcm")); - else if (option.nodeName() == "method_options") - methodOptionsGroup = options.item(i).toElement(); - else if (option.nodeName() == "windowType") + if (option.nodeName() == "windowType") KTCalculation::self()->setWindowType(option.attribute("value").toInt(&ok, 10)); else if (option.nodeName() == "numberIterations") KTCalculation::self()->setNumberIterations(option.attribute("value").toInt(&ok, 10)); @@ -328,21 +300,6 @@ option.attribute("x").toInt(&ok, 10), option.attribute("y").toInt(&ok, 10)); - QDomNodeList features = methodOptionsGroup.childNodes(); - for (j=0; j < features.count(); ++j) - { - if (features.item(i).nodeName() == "feature") - { - QDomElement feature = features.item(i).toElement(); - QString feature_name = feature.attribute("name", QString::null); - if (feature_name == QString::null) - continue; - QString active_method = KTMethodManager::self()->activeMethod()->methodName(); - KTFeature *feature_option = - KTFeatureManager::self()->getFeature(active_method, feature_name); - feature_option->setEnabled((feature.attribute("enabled", "true") == "true") ? true : false); - } - } } m_isSaved = true; m_changed = false; |
|
From: Gustavo P. B. <bo...@co...> - 2005-07-01 13:28:04
|
Em Qui 30 Jun 2005 21:37, Herton Ronaldo Krzesinski escreveu: > Update of /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess > In directory > sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6681/src/libkimageprocess > > Modified Files: > ktcalculation.cpp ktcalculation.h ktfeaturemanager.cpp > ktmethod.h ktmethodmanager.h ktproject.cpp > Log Message: > - Cosmetics. > - Added code to save current selected method and its features on the > project file that is saved. Why? This code is already there. The project emits a signal telling it is going to save itself, and then the KTMethodManager adds what it want to be saved to the project file. -- Gustavo Pichorim Boiko ---------------------- boiko @ conectiva . com . br Mandriva - http://www.mandriva.com |
|
From: Herton R. K. <he...@us...> - 2005-07-01 00:37:40
|
Update of /cvsroot/kimageprocess/kimageprocess/src/methods/glcm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6681/src/methods/glcm Modified Files: glcm.cpp glcm.h Log Message: - Cosmetics. - Added code to save current selected method and its features on the project file that is saved. Index: glcm.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/methods/glcm/glcm.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- glcm.cpp 30 Jun 2005 02:37:48 -0000 1.12 +++ glcm.cpp 1 Jul 2005 00:37:20 -0000 1.13 @@ -18,6 +18,7 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #include "glcm.h" #include <kgenericfactory.h> @@ -32,7 +33,7 @@ K_EXPORT_COMPONENT_FACTORY( kimageprocess_glcm, KGenericFactory<KTGLCM>( "kimageprocess_glcm" ) ) - + KTGLCM::KTGLCM(QObject *parent, const char* name, const QStringList&) : KTMethod() { @@ -49,7 +50,6 @@ if (256 % m_quantization != 0) m_glcmSize++; } - KTGLCM::~KTGLCM() { } @@ -57,18 +57,18 @@ void KTGLCM::calculate(KTImage *img, int imgClass) { m_img = img; - + // create matrices - for (int i=0; i < 4; i++) + for (int i=0; i < 4; ++i) { m_glcm[i] = new float*[m_glcmSize]; - for (int j=0;j < m_glcmSize; j++) + for (int j=0;j < m_glcmSize; ++j) m_glcm[i][j] = new float[m_glcmSize]; } - + calculateGLCM(); - int i,j,k; + int i, j, k; QValueList<float> results[4]; /* FIXME: Hardcoded values just for testing */ int begin = 0, end = 3; Index: glcm.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/methods/glcm/glcm.h,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- glcm.h 23 Jun 2005 23:19:42 -0000 1.7 +++ glcm.h 1 Jul 2005 00:37:20 -0000 1.8 @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2004-2005 by * + * Copyright (C) 2004-2005 by * * Gustavo Pichorim Boiko <gus...@kd...> * * Herton Ronaldo Krzesinski <he...@my...> * * * @@ -18,6 +18,7 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #ifndef KIMAGEPROCESS_GLCM_H #define KIMAGEPROCESS_GLCM_H @@ -36,22 +37,21 @@ KTGLCM(QObject *parent, const char *name, const QStringList&); ~KTGLCM(); - - void calculate(KTImage *img, int imgClass = 0); - + + void calculate(KTImage *img, int imgClass = 0); + void *data(int direction) const; int dataSize(int index = 0) { return m_glcmSize; } private: void calculateGLCM(); - + KTImage *m_img; int m_quantization; int m_glcmSize; /** the glcm in 4 directions */ float **m_glcm[4]; - }; #endif |
|
From: Herton R. K. <he...@us...> - 2005-07-01 00:37:33
|
Update of /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6681/src/libkimageprocess Modified Files: ktcalculation.cpp ktcalculation.h ktfeaturemanager.cpp ktmethod.h ktmethodmanager.h ktproject.cpp Log Message: - Cosmetics. - Added code to save current selected method and its features on the project file that is saved. Index: ktproject.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktproject.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- ktproject.cpp 23 Jun 2005 23:19:41 -0000 1.15 +++ ktproject.cpp 1 Jul 2005 00:37:20 -0000 1.16 @@ -31,8 +31,12 @@ #include <qstringlist.h> #include <qfile.h> -#include "ktpatternmanager.h" #include "ktcalculation.h" +#include "ktfeature.h" +#include "ktfeaturemanager.h" +#include "ktmethod.h" +#include "ktmethodmanager.h" +#include "ktpatternmanager.h" KTProject::KTProject(QObject *parent, const char *name) : QObject(parent, name)/*, @@ -112,15 +116,15 @@ void KTProject::saveProject(const KURL &url) { QString doc(generateDoc()); - + KTempFile tmpfile; QTextStream stream(tmpfile.file()); - + tmpfile.setAutoDelete(false); - + stream << doc; tmpfile.close(); - + if (KIO::NetAccess::upload(tmpfile.name(),url,0)) { m_isSaved = true; @@ -165,26 +169,26 @@ m_changed = true; KTImageManager::self()->removeTestingImage(image); } - + void KTProject::addTestingImage(const KURL &url) { m_changed = true; KTImageManager::self()->addTestingImage(url); } - + QString KTProject::generateDoc() { QDomDocument m_doc; - + QDomElement rootElem = m_doc.createElement("kimageprocess"); m_doc.appendChild(rootElem); - + emit aboutToSave(&m_doc, &rootElem); //saving the sample images QDomElement samplesGroup = m_doc.createElement("sample_images"); rootElem.appendChild(samplesGroup); - + QStringList samples = KTImageManager::self()->sampleFileNames(); for (QStringList::Iterator it = samples.begin(); it != samples.end(); ++it) { @@ -195,7 +199,7 @@ //saving the testing images QDomElement testingGroup = m_doc.createElement("testing_images"); rootElem.appendChild(testingGroup); - + QStringList images = KTImageManager::self()->testingFileNames(); for (QStringList::Iterator it = images.begin(); it != images.end(); ++it) { @@ -207,37 +211,57 @@ //saving the texture options QDomElement options = m_doc.createElement("texture_options"); rootElem.appendChild(options); - + window_size temp; QDomElement option; - option = m_doc.createElement("windowType"); - option.setAttribute("value", QString::number(KTCalculation::self()->windowType(), 10)); - options.appendChild(option); - - option = m_doc.createElement("numberIterations"); - option.setAttribute("value", QString::number(KTCalculation::self()->numberIterations(), 10)); - options.appendChild(option); - - temp = KTCalculation::self()->windowSize(); - option = m_doc.createElement("windowSize"); - option.setAttribute("type", temp.type?"true":"false"); - option.setAttribute("x", QString::number(temp.width, 10)); - option.setAttribute("y", QString::number(temp.height, 10)); - options.appendChild(option); - + QString active_method; + + option = m_doc.createElement("activeMethod"); + active_method = KTMethodManager::self()->activeMethod()->methodName(); + option.setAttribute("name", active_method); + options.appendChild(option); + + QDomElement method_options; + method_options = m_doc.createElement("method_options"); + FeatureList features = KTFeatureManager::self()->features(active_method); + + for (QDictIterator<KTFeature> it(features); it.current(); ++it) + { + QDomElement feature = m_doc.createElement("feature"); + method_options.appendChild(feature); + feature.setAttribute("name", it.current()->featureName()); + feature.setAttribute("enabled", it.current()->enabled() ? "true" : "false"); + } + option.appendChild(method_options); + + option = m_doc.createElement("windowType"); + option.setAttribute("value", QString::number(KTCalculation::self()->windowType(), 10)); + options.appendChild(option); + + option = m_doc.createElement("numberIterations"); + option.setAttribute("value", QString::number(KTCalculation::self()->numberIterations(), 10)); + options.appendChild(option); + + temp = KTCalculation::self()->windowSize(); + option = m_doc.createElement("windowSize"); + option.setAttribute("type", temp.type?"true":"false"); + option.setAttribute("x", QString::number(temp.width, 10)); + option.setAttribute("y", QString::number(temp.height, 10)); + options.appendChild(option); + return m_doc.toString(3); } void KTProject::loadProject(QDomElement *rootElem) { bool ok; - unsigned int i; + unsigned int i, j; QDomNodeList nodes = rootElem->childNodes(); - + QDomElement samplesGroup; QDomElement testingGroup; QDomElement trOptions; - + for (i=0; i < nodes.count(); i++) { QString nodeName = nodes.item(i).nodeName(); @@ -249,10 +273,10 @@ else if (nodeName == "texture_options") trOptions = nodes.item(i).toElement(); } - + emit aboutToLoad(rootElem); - KTImageManager::self()->clear(); + KTImageManager::self()->clear(); // load the sample images from the project QDomNodeList samples = samplesGroup.childNodes(); @@ -284,21 +308,41 @@ } } - //load the texture options QDomNodeList options = trOptions.childNodes(); for (i=0; i < options.count(); i++) { QDomElement option = options.item(i).toElement(); - - if (option.nodeName() == "windowType") + QDomElement methodOptionsGroup; + + if (option.nodeName() == "activeMethod") + KTMethodManager::self()->setActiveMethod(option.attribute("name", "glcm")); + else if (option.nodeName() == "method_options") + methodOptionsGroup = options.item(i).toElement(); + else if (option.nodeName() == "windowType") KTCalculation::self()->setWindowType(option.attribute("value").toInt(&ok, 10)); else if (option.nodeName() == "numberIterations") KTCalculation::self()->setNumberIterations(option.attribute("value").toInt(&ok, 10)); else if (option.nodeName() == "windowSize") KTCalculation::self()->setWindowSize((option.attribute("type","true")=="true")? true : false, - option.attribute("x").toInt(&ok, 10), - option.attribute("y").toInt(&ok, 10)); + option.attribute("x").toInt(&ok, 10), + option.attribute("y").toInt(&ok, 10)); + + QDomNodeList features = methodOptionsGroup.childNodes(); + for (j=0; j < features.count(); ++j) + { + if (features.item(i).nodeName() == "feature") + { + QDomElement feature = features.item(i).toElement(); + QString feature_name = feature.attribute("name", QString::null); + if (feature_name == QString::null) + continue; + QString active_method = KTMethodManager::self()->activeMethod()->methodName(); + KTFeature *feature_option = + KTFeatureManager::self()->getFeature(active_method, feature_name); + feature_option->setEnabled((feature.attribute("enabled", "true") == "true") ? true : false); + } + } } m_isSaved = true; m_changed = false; Index: ktcalculation.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktcalculation.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ktcalculation.h 28 Jun 2005 22:11:34 -0000 1.4 +++ ktcalculation.h 1 Jul 2005 00:37:19 -0000 1.5 @@ -18,6 +18,7 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #ifndef KTCALCULATION_H #define KTCALCULATION_H @@ -27,11 +28,10 @@ class KTImage; class KTMethod; - // texture window types -#define WIN_SEQ 0 // windows are gathered in sequential iterations -#define WIN_CASC 1 // windows are gathered in sequential cascated iterations -#define WIN_RAND 2 // windows are gathered in random iterations +#define WIN_SEQ 0 // windows are gathered in sequential iterations +#define WIN_CASC 1 // windows are gathered in sequential cascated iterations +#define WIN_RAND 2 // windows are gathered in random iterations #define WIN_ALLPIX 3 //windows are generated for all pixels from the image typedef struct @@ -49,7 +49,6 @@ /** A class that actually does the calculation for the images at all - */ class KTCalculation : public QObject { @@ -60,14 +59,14 @@ ~KTCalculation(); static KTCalculation *self(); - + /* functions to handle texture options */ void setWindowType(int type) { m_window_type = type; } int windowType() { return m_window_type; } - + void setNumberIterations(int number) { m_iterations = number; } int numberIterations() { return m_iterations; } - + void setWindowSize(bool type, int height, int width); window_size windowSize(); @@ -76,8 +75,7 @@ public slots: void calculateSampleData(); - void calculateTestData(); - + void calculateTestData(); signals: void updateProgress(); @@ -107,7 +105,6 @@ KTMethod *m_method; static KTCalculation *s_self; - }; #endif Index: ktmethodmanager.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktmethodmanager.h,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ktmethodmanager.h 23 Jun 2005 18:33:51 -0000 1.5 +++ ktmethodmanager.h 1 Jul 2005 00:37:20 -0000 1.6 @@ -49,7 +49,7 @@ KTMethod *activeMethod(); void setActiveMethod(const QString &method); - + static KTMethodManager *self(); KTMethod *getMethod(const QString &name); @@ -60,7 +60,7 @@ private: void resolveDeps(); - + MethodList m_methods; KTMethod *m_activeMethod; static KTMethodManager *s_self; Index: ktmethod.h =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktmethod.h,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -r1.9 -r1.10 --- ktmethod.h 23 Jun 2005 23:19:41 -0000 1.9 +++ ktmethod.h 1 Jul 2005 00:37:19 -0000 1.10 @@ -18,6 +18,7 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #ifndef KTMETHOD_H #define KTMETHOD_H @@ -43,7 +44,7 @@ ///must be reimplemented by child classes virtual void calculate(KTImage *img, int imgClass = 0); - + QString methodName(); QString longName(); @@ -56,9 +57,8 @@ protected: QString m_methodName; QString m_longName; - + bool m_testingData; - }; #endif Index: ktfeaturemanager.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktfeaturemanager.cpp,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -r1.10 -r1.11 --- ktfeaturemanager.cpp 23 Jun 2005 18:33:50 -0000 1.10 +++ ktfeaturemanager.cpp 1 Jul 2005 00:37:19 -0000 1.11 @@ -82,7 +82,7 @@ kdDebug() << "Loaded " << category << " feature: " << feature->featureName() << endl; } } - + resolveDeps(); } @@ -91,7 +91,7 @@ FeatureList *list = m_features.find(type); if (list) return *list; - + return FeatureList(); } @@ -110,7 +110,7 @@ { int count = 0; FeatureList *features = m_features[type]; - + if (features) { QDictIterator<KTFeature> it(*features); Index: ktcalculation.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/libkimageprocess/ktcalculation.cpp,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- ktcalculation.cpp 30 Jun 2005 02:37:47 -0000 1.8 +++ ktcalculation.cpp 1 Jul 2005 00:37:19 -0000 1.9 @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2004-2005 by * + * Copyright (C) 2004-2005 by * * Gustavo Pichorim Boiko <gus...@kd...> * * Herton Ronaldo Krzesinski <he...@my...> * * * @@ -18,6 +18,7 @@ * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ + #include "ktimage.h" #include "ktcalculation.h" #include "ktfeaturemanager.h" @@ -39,10 +40,8 @@ m_window_size.width = 5; m_window_size.height = 5; m_iterations = 0; - } - KTCalculation::~KTCalculation() { } @@ -68,7 +67,7 @@ m_testing = false; m_method = KTMethodManager::self()->activeMethod(); - + m_inputs = KTFeatureManager::self()->enabledFeaturesCount(m_method->methodName()); m_outputs = KTImageManager::self()->sampleCount(); |
|
From: Gustavo P. B. <gb...@us...> - 2005-06-30 02:38:00
|
Update of /cvsroot/kimageprocess/kimageprocess/src/methods/glcm In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16403/src/methods/glcm Modified Files: glcm.cpp Log Message: Fixed errors reported by Valgrind's memcheck. I still want to do a corecheck Index: glcm.cpp =================================================================== RCS file: /cvsroot/kimageprocess/kimageprocess/src/methods/glcm/glcm.cpp,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- glcm.cpp 28 Jun 2005 22:16:28 -0000 1.11 +++ glcm.cpp 30 Jun 2005 02:37:48 -0000 1.12 @@ -105,7 +105,7 @@ { for (int j=0;j < m_glcmSize; j++) delete [] m_glcm[i][j]; - delete m_glcm[i]; + delete [] m_glcm[i]; } } |