|
From: Herton R. K. <he...@us...> - 2005-07-13 01:44:30
|
Update of /cvsroot/kimageprocess/kimageprocess/src/methods/glcm/features/absolute In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24048/absolute Added Files: Makefile.am absolute.cpp absolute.h kimageprocess_glcm_absolute.desktop Log Message: - Added absolute value glcm feature. --- NEW FILE: kimageprocess_glcm_absolute.desktop --- [Desktop Entry] Name=absolute Comment=Absolute Value calculation over GLCM ServiceTypes=KImageProcess/Feature Type=Service X-KDE-Library=kimageprocess_glcm_absolute X-Category=glcm --- NEW FILE: absolute.h --- /*************************************************************************** * Copyright (C) 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_GLCM_ABSOLUTE_H #define KIMAGEPROCESS_GLCM_ABSOLUTE_H #include <ktfeature.h> class KAction; class KTImage; /** * absolute calculation * @author Gustavo Pichorim Boiko * */ class KTGLCMabsolute : public KTFeature { Q_OBJECT public: KTGLCMabsolute(QObject *parent, const char *name, const QStringList&); ~KTGLCMabsolute(); float _calculate(KTImage *img, int direction); }; #endif --- NEW FILE: Makefile.am --- INCLUDES = $(all_includes) -I$(srcdir)/../../../../libkimageprocess METASOURCES = AUTO kde_module_LTLIBRARIES = kimageprocess_glcm_absolute.la kimageprocess_glcm_absolute_la_LDFLAGS = -module $(KDE_PLUGIN) $(all_libraries) noinst_HEADERS = absolute.h kimageprocess_glcm_absolute_la_SOURCES = absolute.cpp kde_services_DATA = kimageprocess_glcm_absolute.desktop kimageprocess_glcm_absolute_la_LIBADD = $(top_builddir)/src/libkimageprocess/libkimageprocess.la \ -lkdeui --- NEW FILE: absolute.cpp --- /*************************************************************************** * Copyright (C) 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 "absolute.h" #include <kgenericfactory.h> #include <kaction.h> #include <klocale.h> #include <kdebug.h> #include <ktimage.h> #include <ktfeaturemanager.h> #include <ktmethod.h> K_EXPORT_COMPONENT_FACTORY( kimageprocess_glcm_absolute, KGenericFactory<KTGLCMabsolute>( "kimageprocess_glcm_absolute" ) ) KTGLCMabsolute::KTGLCMabsolute(QObject *parent, const char* name, const QStringList&) : KTFeature("glcm") { Q_UNUSED(parent); Q_UNUSED(name); //check dependencies m_featureName = i18n("absolute"); m_longName = i18n("Absolute Value"); } KTGLCMabsolute::~KTGLCMabsolute() { } float KTGLCMabsolute::_calculate(KTImage *img, int direction) { int glcmSize = method()->dataSize(); float **glcm = (float**) method()->data(direction); int i, j; float result = 0.0; for (i = 0; i < glcmSize; ++i) for (j = 0; j < glcmSize; ++j) result += abs(i - j) * glcm[i][j]; return result; } #include "absolute.moc" |