pkg://kfourier-1.1c-1.src.rpm:157073/kfourier-1.1c.tar.gz
info downloads
kfourier-1.1/ 40755 1750 144 0 6501726641 12202 5 ustar antonio users kfourier-1.1/kfourier/ 40755 1750 144 0 6520664707 14035 5 ustar antonio users kfourier-1.1/kfourier/Makefile.in 100644 1750 144 4477 6473663603 16214 0 ustar antonio users # This is a sample Makefile.in
# @CXXFLAGS@ : is set to -g -Wall (when debuging) or -O2 -Wall (when not)
# @all_includes@ : is set to all needed include paths for QT, KDE and X11
# -I.. : needed for config.h
CXXFLAGS= @CXXFLAGS@ @all_includes@ -DHAVE_CONFIG_H -I..
# @LDFLAGS@ : is set to -s (when not debuging) for stripping
# @all_libra.@ : is set to all needed libraries paths for QT, KDE and X11
# you need also @LIBSOCKET@, if you link with -lkfm
LDFLAGS = @LDFLAGS@ @all_libraries@ -lkdecore -lkdeui -lqt -lXext -lX11
# both are clear, I think
CXX = @CXX@
MOC = @MOC@
############# INSTALL #################
install = @INSTALL@
INSTALL = $(install) -m 0755
INSTALL_DATA = $(install) -m 0644
INSTALL_DIR = $(install) -d -m 0755
INSTALL_DIR_PRIVATE = $(install) -d -m 0700
prefix = @prefix@
install_root = @install_root@
exec_prefix = @exec_prefix@
kde_libraries = @kde_libraries@
qt_libraries = @qt_libraries@
top_builddir = ..
LIBTOOL = @LIBTOOL@
KDE_RPATH = @KDE_RPATH@
BINDIR = @kde_bindir@
DATADIR = @kde_datadir@/kmid
########### File Formats ###########
.SUFFIXES: .cpp
.cpp.o:
$(CXX) -c $(CXXFLAGS) $<
.cc.o:
$(CXX) -c $(CXXFLAGS) $<
%.moc: %.h
$(MOC) $< -o $@
########## Files #####################
OBJECTS = kclient.o kframe.o cfgdlg.o tfourier.o fft1d.o fft2d.o pow2.o main.o
SRCMETA = kframe.moc kclient.moc cfgdlg.moc
TARGET = kfourier
######### build rules ################
all: Makefile $(TARGET)
Makefile: Makefile.in
cd .. && CONFIG_FILES=kfourier/$@ CONFIG_HEADERS= $(SHELL) ./config.status
$(TARGET): $(SRCMETA) $(OBJECTS)
$(LIBTOOL) --mode=link $(CXX) $(OBJECTS) -o $(TARGET) $(LDFLAGS) $(KDE_RPATH)
#install:
# ./install.sh
install: $(TARGET)
$(INSTALL) $(TARGET) $(BINDIR)
$(INSTALL_DATA) kfourier.kdelnk $(prefix)/share/applnk/Graphics
$(INSTALL_DIR) $(prefix)/share/doc/HTML/en/kfourier
$(INSTALL_DATA) help/kfourier.html $(prefix)/share/doc/HTML/default/kfourier
# $(INSTALL_DATA) help/*.xpm $(prefix)/share/doc/HTML/default/kfourier
$(INSTALL_DIR) $(prefix)/share/icons
$(INSTALL_DATA) kfourier.xpm $(prefix)/share/icons
clean:
rm -f *.o *.bak *~ *% #* *.moc
rm -f $(TARGET)
distclean: clean
rm -f Makefile
#install:
# $(INSTALL_DIR) $(BINDIR)
# $(INSTALL) $(TARGET) $(BINDIR)
uninstall:
rm -f $(BINDIR)/$(TARGET)
# DO NOT DELETE THIS LINE -- make depend depends on it.
kfourier-1.1/kfourier/main.cpp 100644 1750 144 3570 6473663442 15571 0 ustar antonio users /**************************************************************************
main.cpp - The main function for kfourier
Copyright (C) 1998 Antonio Larrosa Jimenez
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., 675 Mass Ave, Cambridge, MA 02139, USA.
Send comments and bug fixes to antlarr@arrakis.es
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
***************************************************************************/
#include "kframe.h"
#include <stdlib.h>
#include <string.h>
//#include <qapp.h>
#include <kapp.h>
#include <qwidget.h>
#include <signal.h>
int main(int argc, char **argv)
{
printf("kfourier 1.1 Copyright (C) 1998 Antonio Larrosa Jimenez. Malaga (Spain)\n");
printf("kfourier comes with ABSOLUTELY NO WARRANTY; for details view file COPYING\n"
);
printf("This is free software, and you are welcome to redistribute it\n");
printf("under certain conditions\n");
KApplication *app=new KApplication(argc,argv);
kFrame *kframe=new kFrame("Fourier transform");
app->setMainWidget ( kframe );
kframe->show();
if (app->isRestored())
{
if (kframe->canBeRestored(1)) kframe->restore(1);
}
int ret= app->exec();
delete kframe;
delete app;
printf("Bye !\n");
return ret;
};
kfourier-1.1/kfourier/kframe.cpp 100644 1750 144 27161 6473663427 16137 0 ustar antonio users /**************************************************************************
kframe.cpp - The main widget of kfourier
Copyright (C) 1998 Antonio Larrosa Jimenez
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., 675 Mass Ave, Cambridge, MA 02139, USA.
Send comments and bug fixes to antlarr@arrakis.es
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
***************************************************************************/
#include "kframe.moc"
#include <qkeycode.h>
#include <stdio.h>
#include <qfiledlg.h>
#include <kapp.h>
#include <qstring.h>
#include <unistd.h>
#include <kmsgbox.h>
#include <ktoolbar.h>
#include <kiconloader.h>
#include "kclient.h"
#include <kurl.h>
#include <drag.h>
#include <kfontdialog.h>
kFrame::kFrame(const char *name)
:KTopLevelWidget(name)
{
kclient=new kClient(this,"Fourier Transform");
kclient->show();
setView(kclient,FALSE);
connect( kclient, SIGNAL( centerPlaced() ),
this, SLOT( draw_placecenter() ) );
connect( kclient, SIGNAL( imageSaved_xpm() ),
this, SLOT( file_Save_xpm() ) );
connect( kclient, SIGNAL( imageSaved_bmp() ),
this, SLOT( file_Save_bmp() ) );
m_file = new QPopupMenu;
m_file->setCheckable(TRUE);
m_file->insertItem( "&Open ...", this, SLOT(file_Open()), CTRL+Key_O );
m_file->insertItem( "&Save (XPM)...", this, SLOT(file_Save_xpm()) );
m_file->setId(1,1);
m_file->setItemChecked(1,FALSE);
m_file->insertItem( "&Save (BMP)...", this, SLOT(file_Save_bmp()) );
m_file->setId(2,2);
m_file->setItemChecked(2,FALSE);
m_file->insertSeparator();
m_file->insertItem( "E&xit", qApp, SLOT(quit()), CTRL+Key_Q );
m_t = new QPopupMenu;
m_t->insertItem( "Forward FT", this, SLOT(t_Direct()) );
m_t->insertItem( "Inverse FT", this, SLOT(t_Inverse()) );
m_t->insertItem( "Forward FFT", this, SLOT(fft_Direct()), Key_Space );
m_t->insertItem( "Inverse FFT", this, SLOT(fft_Inverse()) ,Key_Backspace);
m_draw=new QPopupMenu;
m_draw->setCheckable(TRUE);
m_draw->insertItem("Low Pass", this,SLOT(draw_LowPass()) );
m_draw->setId(0,0);
m_draw->setItemChecked(0,TRUE);
m_draw->insertItem("High Pass", this,SLOT(draw_HighPass()) );
m_draw->setId(1,1);
m_draw->setItemChecked(1,FALSE);
m_draw->insertItem("Band Pass", this,SLOT(draw_BandPass()) );
m_draw->setId(2,2);
m_draw->setItemChecked(2,FALSE);
m_draw->insertItem("Band Stop", this,SLOT(draw_BandStop()) );
m_draw->setId(3,3);
m_draw->setItemChecked(3,FALSE);
m_draw->insertItem("Linear interpolation",this,SLOT(draw_Butterworth()) );
m_draw->setId(4,4);
m_draw->setItemChecked(4,FALSE);
m_draw->insertSeparator();
m_cuad = new QPopupMenu;
m_cuad->setCheckable(TRUE);
m_cuad->insertItem("1st cuadrant",this,SLOT(cuad_1()) );
m_cuad->setId(0,0);
m_cuad->setItemChecked(0,TRUE);
m_cuad->insertItem("2nd cuadrant",this,SLOT(cuad_2()) );
m_cuad->setId(1,1);
m_cuad->setItemChecked(1,TRUE);
m_cuad->insertItem("3rd cuadrant",this,SLOT(cuad_3()) );
m_cuad->setId(2,2);
m_cuad->setItemChecked(2,TRUE);
m_cuad->insertItem("4th cuadrant",this,SLOT(cuad_4()) );
m_cuad->setId(3,3);
m_cuad->setItemChecked(3,TRUE);
m_draw->insertItem("Cuadrants",m_cuad);
m_draw->insertSeparator();
m_draw->insertItem("Change Center",this,SLOT(draw_placecenter()));
m_draw->setId(8,8);
m_draw->setItemChecked(8,FALSE);
m_draw->insertSeparator();
m_draw->insertItem("Configure values",this,SLOT(draw_configvalues()));
m_opt = new QPopupMenu;
m_opt->setCheckable(TRUE);
m_opt->insertItem( "&RGB", this, SLOT(opt_RGB()) );
m_opt->setId(0,0);
m_opt->setItemChecked(0,TRUE);
m_opt->insertItem( "&HSV", this, SLOT(opt_HSV()) );
m_opt->setId(1,1);
m_opt->setItemChecked(1,FALSE);
m_help = new QPopupMenu;
m_help->insertItem( "Help", this, SLOT(help_Help()), Key_F1 );
m_help->insertSeparator();
m_help->insertItem( "About ...", this, SLOT(help_About()), CTRL+Key_H );
menu = new KMenuBar(this);
menu->insertItem("&File",m_file);
menu->insertItem("&Transform",m_t);
menu->insertItem("&Filters",m_draw);
menu->insertItem("&Options",m_opt);
menu->insertSeparator();
menu->insertItem("&Help",m_help);
menu->show();
setMenu(menu);
toolbar=new KToolBar(this);
KIconLoader *loader = (KApplication::getKApplication())->getIconLoader();
toolbar->insertButton(loader->loadIcon("fileopen.xpm"),1,SIGNAL(clicked(int)),this,SLOT(buttonClicked(int)),TRUE,"Open file");
toolbar->insertButton(loader->loadIcon("forward.xpm"),2,SIGNAL(clicked(int)),this,SLOT(buttonClicked(int)),TRUE,"Fourier Transform (Slow)");
toolbar->insertButton(loader->loadIcon("back.xpm"),3,SIGNAL(clicked(int)),this,SLOT(buttonClicked(int)),TRUE,"Inverse Fourier Transform (Slow)");
toolbar->insertButton(loader->loadIcon("finish.xpm"),4,SIGNAL(clicked(int)),this,SLOT(buttonClicked(int)),TRUE,"Forward Fast Fourier Transform");
toolbar->insertButton(loader->loadIcon("start.xpm"),5,SIGNAL(clicked(int)),this,SLOT(buttonClicked(int)),TRUE,"Inverse Fast Fourier Transform");
toolbar->insertButton(loader->loadIcon("help.xpm"),6,SIGNAL(clicked(int)),this,SLOT(buttonClicked(int)),TRUE,"Help");
toolbar->setBarPos(KToolBar::Top);
toolbar->enable(KToolBar::Show);
addToolBar(toolbar);
KDNDDropZone * dropZone = new KDNDDropZone( this , DndURL);
connect( dropZone, SIGNAL( dropAction( KDNDDropZone *) ),
this, SLOT( slotDropEvent( KDNDDropZone *) ) );
if ((kapp->argc()>1)&& (kapp->argv()[1][0]!='-') )
{
openURL((kapp->argv())[1]);
};
};
kFrame::~kFrame()
{
delete kclient;
delete m_file;
delete m_t;
delete m_draw;
delete m_cuad;
delete m_opt;
delete m_help;
delete menu;
delete toolbar;
};
void kFrame::buttonClicked(int i)
{
printf("Button : %d\n",i);
switch (i)
{
case (1) : file_Open();break;
case (2) : t_Direct();break;
case (3) : t_Inverse();break;
case (4) : fft_Direct();break;
case (5) : fft_Inverse();break;
case (6) : help_Help();break;
};
};
void kFrame::extractFilename(const char *in,char *out)
{
char *p=(char *)in;
char *filename=(char *)in;
while (*p!=0)
{
if (*p=='/') filename=p+1;
p++;
};
while (*filename!=0)
{ *out=*filename;
out++;
filename++;
};
*out=0;
};
void kFrame::file_Open()
{
char name[200];
name[0]=0;
QString filename;
filename=QFileDialog::getOpenFileName(0,"*.*",this,name);
if (!filename.isNull())
{
kclient->openFile((char *)(const char *)filename);
char *fn=new char[strlen(filename)+40];
extractFilename((const char *)filename,fn);
char *capt=new char[strlen(fn)+40];
sprintf(capt,"Fourier Transform- %s",fn);
topLevelWidget()->setCaption(capt);
delete capt;
};
};
void kFrame::file_Save_xpm()
{
int r=kclient->saveFile(0);
m_file->setItemChecked(2,FALSE);
if (r) m_file->setItemChecked(1,TRUE);
else m_file->setItemChecked(1,FALSE);
};
void kFrame::file_Save_bmp()
{
int r=kclient->saveFile(1);
m_file->setItemChecked(1,FALSE);
if (r) m_file->setItemChecked(2,TRUE);
else m_file->setItemChecked(2,FALSE);
};
void kFrame::help_Help()
{
KApplication *kappp=KApplication::getKApplication();
kappp->invokeHTMLHelp("kfourier/kfourier.html",NULL);
};
void kFrame::t_Direct()
{
kclient->t_Direct();
};
void kFrame::t_Inverse()
{
kclient->t_Inverse();
};
void kFrame::fft_Direct()
{
kclient->fft_Direct();
};
void kFrame::fft_Inverse()
{
kclient->fft_Inverse();
};
void kFrame::draw_LowPass()
{
kclient->setDrawMode(0);
m_draw->setItemChecked(0,TRUE);
m_draw->setItemChecked(1,FALSE);
m_draw->setItemChecked(2,FALSE);
m_draw->setItemChecked(3,FALSE);
m_draw->setItemChecked(4,FALSE);
};
void kFrame::draw_HighPass()
{
kclient->setDrawMode(1);
m_draw->setItemChecked(0,FALSE);
m_draw->setItemChecked(1,TRUE);
m_draw->setItemChecked(2,FALSE);
m_draw->setItemChecked(3,FALSE);
m_draw->setItemChecked(4,FALSE);
};
void kFrame::draw_BandPass()
{
kclient->setDrawMode(2);
m_draw->setItemChecked(0,FALSE);
m_draw->setItemChecked(1,FALSE);
m_draw->setItemChecked(2,TRUE);
m_draw->setItemChecked(3,FALSE);
m_draw->setItemChecked(4,FALSE);
};
void kFrame::draw_BandStop()
{
kclient->setDrawMode(3);
m_draw->setItemChecked(0,FALSE);
m_draw->setItemChecked(1,FALSE);
m_draw->setItemChecked(2,FALSE);
m_draw->setItemChecked(3,TRUE);
m_draw->setItemChecked(4,FALSE);
};
void kFrame::draw_Butterworth()
{
kclient->setDrawMode(4);
m_draw->setItemChecked(0,FALSE);
m_draw->setItemChecked(1,FALSE);
m_draw->setItemChecked(2,FALSE);
m_draw->setItemChecked(3,FALSE);
m_draw->setItemChecked(4,TRUE);
};
void kFrame::draw_placecenter()
{
int r=kclient->placeCenter();
if (r) m_draw->setItemChecked(8,TRUE);
else m_draw->setItemChecked(8,FALSE);
};
void kFrame::draw_configvalues()
{
kclient->configvalues();
};
void kFrame::cuad_1()
{
int i=kclient->cuadrant(1);
if (i==1) m_cuad->setItemChecked(0,TRUE);
else m_cuad->setItemChecked(0,FALSE);
};
void kFrame::cuad_2()
{
int i=kclient->cuadrant(2);
if (i==1) m_cuad->setItemChecked(1,TRUE);
else m_cuad->setItemChecked(1,FALSE);
};
void kFrame::cuad_3()
{
int i=kclient->cuadrant(3);
if (i==1) m_cuad->setItemChecked(2,TRUE);
else m_cuad->setItemChecked(2,FALSE);
};
void kFrame::cuad_4()
{
int i=kclient->cuadrant(4);
if (i==1) m_cuad->setItemChecked(3,TRUE);
else m_cuad->setItemChecked(3,FALSE);
};
void kFrame::opt_RGB()
{
kclient->opt_RGB();
m_opt->setItemChecked(0,TRUE);
m_opt->setItemChecked(1,FALSE);
};
void kFrame::opt_HSV()
{
kclient->opt_HSV();
m_opt->setItemChecked(0,FALSE);
m_opt->setItemChecked(1,TRUE);
};
void kFrame::help_About()
{
printf("kfourier 1.1 Copyright (C) 1998 Antonio Larrosa Jimenez. Malaga (Spain)\n");
printf("kfourier comes with ABSOLUTELY NO WARRANTY; for details view file COPYING\n");
printf("This is free software, and you are welcome to redistribute it\n");
printf("under certain conditions\n");
KMsgBox::message( 0, "About kfourier", "Fourier Transform 1.1\n(C) 1998 by Antonio Larrosa Jimenez\n(antlarr@arrakis.es)\nMalaga (Spain)", KMsgBox::INFORMATION, "OK" );
};
int kFrame::openURL(char *s)
{
KURL kurldropped(s);
if (kurldropped.isMalformed()) return -1;
if (strcmp(kurldropped.protocol(),"file")!=0) return -1;
char *filename=kurldropped.path();
QString qsfilename(filename);
KURL::decodeURL(qsfilename);
filename=(char *)(const char *)qsfilename;
int r=-1;
if (filename!=NULL)
{
r=kclient->openFile(filename);
}
if (r==-1)
{
char *capt=new char[40];
sprintf(capt,"Fourier Transform");
topLevelWidget()->setCaption(capt);
delete capt;
}
else
{
char *fn=new char[strlen(filename)+40];
extractFilename(filename,fn);
char *capt=new char[strlen(fn)+40];
sprintf(capt,"Fourier Transform - %s",fn);
topLevelWidget()->setCaption(capt);
delete capt;
};
return r;
};
void kFrame::slotDropEvent( KDNDDropZone * _dropZone )
{
QStrList & list = _dropZone->getURLList();
char *s=list.first();
if (openURL(s)==-1)
{
return;
};
};
kfourier-1.1/kfourier/kframe.h 100644 1750 144 4362 6462736342 15555 0 ustar antonio users /**************************************************************************
kframe.h - The main widget of tfourier
Copyright (C) 1998 Antonio Larrosa Jimenez
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., 675 Mass Ave, Cambridge, MA 02139, USA.
Send comments and bug fixes to antlarr@arrakis.es
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
***************************************************************************/
#ifndef _KMIDFRAME_H
#define _KMIDFRAME_H
#include <ktopwidget.h>
#include <kmenubar.h>
class KApplication;
class kClient;
class KToolBar;
class KDNDDropZone;
class kFrame : public KTopLevelWidget
{
Q_OBJECT
private:
QPopupMenu *m_file;
QPopupMenu *m_t;
QPopupMenu *m_draw;
QPopupMenu *m_cuad;
QPopupMenu *m_opt;
QPopupMenu *m_help;
protected:
void extractFilename(const char *in,char *out);
public:
kFrame(const char *name=0);
~kFrame();
int openURL(char *s);
public slots:
void buttonClicked(int i);
void file_Open();
void file_Save_xpm();
void file_Save_bmp();
void t_Direct();
void t_Inverse();
void fft_Direct();
void fft_Inverse();
void draw_LowPass();
void draw_HighPass();
void draw_BandPass();
void draw_BandStop();
void draw_Butterworth();
void draw_configvalues();
void draw_placecenter();
void cuad_1();
void cuad_2();
void cuad_3();
void cuad_4();
void opt_RGB();
void opt_HSV();
void help_Help();
void help_About();
void slotDropEvent( KDNDDropZone * _dropZone );
private:
KMenuBar *menu;
kClient *kclient;
KToolBar *toolbar;
};
#endif
kfourier-1.1/kfourier/kclient.h 100644 1750 144 7100 6463702652 15730 0 ustar antonio users /**************************************************************************
kclient.h - The main client widget of tfourier
Copyright (C) 1998 Antonio Larrosa Jimenez
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., 675 Mass Ave, Cambridge, MA 02139, USA.
Send comments and bug fixes to antlarr@arrakis.es
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
***************************************************************************/
#ifndef _KCLIENT_H
#define _KCLIENT_H
#include <unistd.h>
#include <sys/types.h>
#include <g++/complex.h>
class KApplication;
class KConfig;
class QLCDNumber;
class QLabel;
class kClient : public QWidget
{
Q_OBJECT
private:
int imgwidth;
int imgheight;
QPixmap *source_img;
QPixmap *fourier_img;
QPixmap *target_img;
u_int **source_data[3];
double_complex **fourier_data[3];
u_int **fourier_u_int_data[3];
double fourier_ratio[3];
u_int **target_data[3];
QPixmap *source_imgs[3];
QPixmap *fourier_imgs[3];
QPixmap *target_imgs[3];
int drawmode;
int cuad[5];
virtual void paintEvent(QPaintEvent *qpe);
u_int **AllocateIntImg(int w,int h,int clear=0);
double_complex **AllocateComplexImg(int w,int h,int clear=0);
void convertQPixmapToInt(QPixmap *qpixmap,u_int **out,int rgb);
void convertIntToQPixmap(int w,int h,u_int **r,u_int **g,u_int **b,QPixmap *out);
void convertComplexToInt(int w,int h,double_complex **in,u_int **out, double &ratio);
void convertComplexToQPixmap(int w,int h,double_complex **in,u_int **tmp,QPixmap *out,int opt);
void DeallocateComplexImg(int w,int h,double_complex **img);
void DeallocateIntImg(int ,int h,u_int **img);
void deallocate_all_memory(void);
void clearImages(void);
void center_image(int w,int h,u_int **img);
int Pixmap_at_pto(int &x,int &y,int &col);
int type_of_decomposition; // 0 es RGB y 1 es HSV
double pass_value,stop_value;
int r1,r2;
int placecenter;
int cx,cy;
int saveimage;
int saveimageformat;
void drawIn(int p);
void DoLowPass(int w,int h,double_complex **data);
void DoHighPass(int w,int h,double_complex **data);
void DoBandPass(int w,int h,double_complex **data);
void DoBandStop(int w,int h,double_complex **data);
void DoButterworth(int w,int h,double_complex **data);
public:
kClient(QWidget *parent,const char *name=0);
~kClient();
int openFile(char *filename);
int saveFile(int format); // 0 is xpm, 1 is bmp
void reallySaveImage(int col,int p);
int t_Direct(void);
int t_Inverse(void);
int fft_Direct(void);
int fft_Inverse(void);
void setDrawMode(int i);
int cuadrant(int i);
void configvalues(void);
int placeCenter(void);
void decompose(void);
void opt_RGB(void);
void opt_HSV(void);
void setDrawMode(int mode,int degrading);
protected:
virtual void mousePressEvent(QMouseEvent *qme);
virtual void mouseMoveEvent(QMouseEvent *qme);
signals:
void centerPlaced();
void imageSaved_xpm();
void imageSaved_bmp();
};
#endif
kfourier-1.1/kfourier/kclient.cpp 100644 1750 144 65515 6501726170 16313 0 ustar antonio users /**************************************************************************
kclient.cpp - The main client widget of kfourier
Copyright (C) 1998 Antonio Larrosa Jimenez
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., 675 Mass Ave, Cambridge, MA 02139, USA.
Send comments and bug fixes to antlarr@arrakis.es
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
***************************************************************************/
#include <qkeycode.h>
#include <stdio.h>
#include <qfiledlg.h>
#include <kapp.h>
#include <qstring.h>
#include <unistd.h>
#include <kmsgbox.h>
#include <sys/signal.h>
#include <qlcdnum.h>
#include <kurl.h>
#include <qlabel.h>
#include <qpainter.h>
#include <qimage.h>
#include "tfourier.h"
#include "fft2d.h"
#include <stdlib.h>
#include "pow2.h"
#include "cfgdlg.h"
#include "kclient.moc"
// Define only one of next two:
#define SHOW_NORM
//#define SHOW_ANGLE
#define SCALE_RIGHT
kClient::kClient(QWidget *parent,const char *name)
:QWidget(parent,name)
{
type_of_decomposition=0;
source_img=new QPixmap();
fourier_img=new QPixmap();
target_img=new QPixmap();
for (int i=0;i<3;i++)
{
source_imgs[i]=new QPixmap();
fourier_imgs[i]=new QPixmap();
target_imgs[i]=new QPixmap();
source_data[i]=NULL;
fourier_data[i]=NULL;
fourier_u_int_data[i]=NULL;
target_data[i]=NULL;
};
drawmode=0;
placecenter=0;
saveimage=0;
cuad[0]=cuad[1]=cuad[2]=cuad[3]=cuad[4]=1;
pass_value=1.0;
stop_value=0.0;
fourier_ratio[0]=fourier_ratio[1]=fourier_ratio[2]=-1;
setMouseTracking(TRUE);
};
kClient::~kClient()
{
setMouseTracking(FALSE);
deallocate_all_memory();
for (int i=0;i<3;i++)
{
delete target_imgs[i];
delete fourier_imgs[i];
delete source_imgs[i];
};
delete target_img;
delete fourier_img;
delete source_img;
};
void kClient::deallocate_all_memory(void)
{
printf("Releasing memory ...\n");
int w=imgwidth;
int h=imgheight;
for (int i=0;i<3;i++)
{
if (source_data[i]!=NULL) DeallocateIntImg(w,h,source_data[i]);
source_data[i]=NULL;
if (fourier_data[i]!=NULL) DeallocateComplexImg(w,h,fourier_data[i]);
fourier_data[i]=NULL;
if (fourier_u_int_data[i]!=NULL) DeallocateIntImg(w,h,fourier_u_int_data[i]);
fourier_u_int_data[i]=NULL;
if (target_data[i]!=NULL) DeallocateIntImg(w,h,target_data[i]);
target_data[i]=NULL;
};
};
void kClient::clearImages(void)
{
for (int i=0;i<3;i++)
{
delete target_imgs[i];
delete fourier_imgs[i];
delete source_imgs[i];
source_imgs[i]=new QPixmap();
fourier_imgs[i]=new QPixmap();
target_imgs[i]=new QPixmap();
};
delete target_img;
delete fourier_img;
delete source_img;
source_img=new QPixmap();
fourier_img=new QPixmap();
target_img=new QPixmap();
};
int kClient::openFile(char *filename)
{
deallocate_all_memory();
clearImages();
printf("Open : %s\n",filename);
source_img->load(filename);
imgwidth=source_img->width();
imgheight=source_img->height();
cx=is2pow(imgwidth)/2;
cy=is2pow(imgheight)/2;
decompose();
repaint(TRUE);
printf("file opened\n");
return 0;
};
void kClient::reallySaveImage(int col,int p)
{
char name[200];
name[0]=0;
QString filename;
filename=QFileDialog::getSaveFileName(0,"*.*",this,name);
if (!filename.isNull())
{
QPixmap *qpxmp;
if (col==0)
{
switch (p)
{
case (0) : qpxmp=source_imgs[0];break;
case (1) : qpxmp=source_imgs[1];break;
case (2) : qpxmp=source_imgs[2];break;
case (3) : qpxmp=source_img;break;
default : return;
};
}
else if (col==1)
{
switch (p)
{
case (0) : qpxmp=fourier_imgs[0];break;
case (1) : qpxmp=fourier_imgs[1];break;
case (2) : qpxmp=fourier_imgs[2];break;
case (3) : qpxmp=fourier_img;break;
default : return;
};
}
else if (col==2)
{
switch (p)
{
case (0) : qpxmp=target_imgs[0];break;
case (1) : qpxmp=target_imgs[1];break;
case (2) : qpxmp=target_imgs[2];break;
case (3) : qpxmp=target_img;break;
default : return;
};
}
else return;
qpxmp->save((char *)(const char *)filename,
((saveimageformat==0)?("XPM"):("BMP")));
};
};
void kClient::paintEvent(QPaintEvent *)
{
QPainter *qpaint=new QPainter(this);
int w=is2pow(imgwidth);
int h=is2pow(imgheight);
qpaint->drawPixmap(0,0,*source_img);
qpaint->drawPixmap(w+5,0,*fourier_img);
qpaint->drawPixmap((w+5)*2,0,*target_img);
int y=h+5;
for (int i=0;i<3;i++)
{
qpaint->drawPixmap(0,y,*source_imgs[i]);
qpaint->drawPixmap(w+5,y,*fourier_imgs[i]);
qpaint->drawPixmap((w+5)*2,y,*target_imgs[i]);
y+=h+5;
};
delete qpaint;
};
void kClient::convertQPixmapToInt(QPixmap *qpixmap,u_int **out,int rgb)
// rgb indicates which colour to put in output (0 R, 1 G, 2 B)
// or if type_of_decomposition is 1 (HSV) then rgb indicates (0 H, 1 S, 2 V)
{
QImage img;
img=*qpixmap;
QColor col;
int i,j;
if (type_of_decomposition==0)
{
if (rgb==0)
{
for (j=0;j<img.height();j++)
for (i=0;i<img.width();i++)
{
col.setRgb(img.pixel(i,j));
out[j][i]=col.red();
};
};
if (rgb==1)
{
for (j=0;j<img.height();j++)
for (i=0;i<img.width();i++)
{
col.setRgb(img.pixel(i,j));
out[j][i]=col.green();
};
};
if (rgb==2)
{
for (j=0;j<img.height();j++)
for (i=0;i<img.width();i++)
{
col.setRgb(img.pixel(i,j));
out[j][i]=col.blue();
};
};
} else // HSV
{
int h,s,v;
if (rgb==0)
{
for (j=0;j<img.height();j++)
for (i=0;i<img.width();i++)
{
col.setRgb(img.pixel(i,j));
col.hsv(&h,&s,&v);
out[j][i]=h;
};
};
if (rgb==1)
{
for (j=0;j<img.height();j++)
for (i=0;i<img.width();i++)
{
col.setRgb(img.pixel(i,j));
col.hsv(&h,&s,&v);
out[j][i]=s;
};
};
if (rgb==2)
{
for (j=0;j<img.height();j++)
for (i=0;i<img.width();i++)
{
col.setRgb(img.pixel(i,j));
col.hsv(&h,&s,&v);
out[j][i]=v;
};
};
};
};
void kClient::convertIntToQPixmap(int w,int h,u_int **r,u_int **g,u_int **b,QPixmap *out)
{
QImage img(w,h,32);
QColor col;
if (type_of_decomposition==0)
{
for (int j=0;j<h;j++)
for (int i=0;i<w;i++)
{
col.setRgb((r==NULL)?0:(r[j][i]%256),(g==NULL)?0:(g[j][i]%256),(b==NULL)?0:(b[j][i]%256));
img.setPixel(i,j,col.rgb());
};
} else
{
double ratio=255.0/360.0;
int temp;
for (int j=0;j<h;j++)
for (int i=0;i<w;i++)
{
if ((r==NULL)&&(g==NULL))
{
temp=b[j][i]%256;
col.setRgb(temp,temp,temp);
}
else if ((r==NULL)&&(b==NULL))
{
temp=g[j][i]%256;
col.setRgb(temp,temp,temp);
}
else if ((g==NULL)&&(b==NULL)) {
temp=(int)((double)(r[j][i]%361)*ratio)%256;
col.setRgb(temp,temp,temp);
}
else
col.setHsv((r==NULL)?0:(r[j][i]%360),(g==NULL)?0:(g[j][i]%256),(b==NULL)?0:(b[j][i]%256));
img.setPixel(i,j,col.rgb());
};
};
printf("QImage to QPixmap ... \n");
*out=img;
printf("done\n");
};
int compare(const u_int *a,const u_int *b)
{
if (*a<*b) return -1;
if (*a>*b) return 1;
return 0;
};
void kClient::convertComplexToInt(int w,int h,double_complex **in,u_int **out,double &ratio)
{
#ifndef SCALE_RIGHT
double maximum=0;
double minimum=10000000;
#endif
int i,j;
#ifdef SHOW_ANGLE
double temp;
#endif
for (j=0;j<h;j++)
for (i=0;i<w;i++)
{
#ifdef SHOW_NORM
out[j][i]=(u_int)sqrt(norm(in[j][i]));
#endif
#ifdef SHOW_ANGLE
// out[j][i]=((in[j][i].real()==0)?(PI):(atan(in[j][i].imag()/in[j][i].real())+PI/2))*(255.0/PI);
temp=atan2(in[j][i].imag(),in[j][i].real());
if (temp<0) temp+=2*PI;
out[j][i]=(u_int)(temp*255.0/(2*PI));
#endif
#ifndef SCALE_RIGHT
if (out[j][i]>maximum)
{
maximum=out[j][i];
};
if (out[j][i]<minimum)
{
minimum=out[j][i];
};
#endif
};
#ifdef SCALE_RIGHT
if (ratio==-1)
{
printf("Guessing median ... ");
u_int *temp=new u_int[w*h];
for (j=0;j<h;j++)
for (i=0;i<w;i++)
temp[j*w+i]=out[j][i];
qsort(temp,w*h,sizeof(u_int),&compare);
ratio=(temp[(w*h)/2]!=0)? (90.0/temp[(w*h)/2]) : (1);
printf("median : %d , ratio:%g\n",temp[(w*h)/2],ratio);
delete temp;
};
#else
ratio=252.0/maximum;
printf("min : %g, max : %g , ratio:%g\n",minimum,maximum,ratio);
#endif
double tmp;
for (j=0;j<h;j++)
for (i=0;i<w;i++)
{
// out[j][i]=(u_int)(out[j][i])%255;
tmp=(((double)out[j][i])*ratio);
if (tmp>254) tmp=254;
out[j][i]=(u_int)tmp;
// if (out[j][i]>30) printf("%d x %d = %d\n",i,j,out[j][i]);
};
};
void kClient::convertComplexToQPixmap(int w,int h,double_complex **in,u_int **tmp,QPixmap *out,int opt)
{
if (in==NULL) return;
convertComplexToInt(w,h,in,tmp,fourier_ratio[opt]);
center_image(w,h,tmp);
printf("ConvertingIntToPixmap ...\n");
if (opt==0) convertIntToQPixmap(w,h,tmp,NULL,NULL,out);
else if (opt==1) convertIntToQPixmap(w,h,NULL,tmp,NULL,out);
else if (opt==2) convertIntToQPixmap(w,h,NULL,NULL,tmp,out);
};
u_int **kClient::AllocateIntImg(int w,int h,int clear)
{
int i,j;
int wt=is2pow(w);
int ht=is2pow(h);
if ((wt!=w)||(ht!=h))
{
printf("Changing size from %dx%d to %dx%d\n",w,h,wt,ht);
w=wt;
h=ht;
clear=1;
};
u_int **img;
img=new u_int *[h];
for (j=0;j<h;j++)
img[j]=new u_int[w];
if (clear)
{
for (j=0;j<h;j++)
for (i=0;i<w;i++)
img[j][i]=0;
};
return img;
};
double_complex **kClient::AllocateComplexImg(int w,int h,int clear=0)
{
int i,j;
int wt=is2pow(w);
int ht=is2pow(h);
if ((wt!=w)||(ht!=h))
{
printf("Changing size from %dx%d to %dx%d\n",w,h,wt,ht);
w=wt;
h=ht;
clear=1;
};
double_complex **img;
img=new double_complex *[h];
for (j=0;j<h;j++)
img[j]=new double_complex[w];
if (clear)
{
for (j=0;j<h;j++)
for (i=0;i<w;i++)
img[j][i]*=0;
};
return img;
};
void kClient::DeallocateComplexImg(int ,int h,double_complex **img)
{
int j;
for (j=0;j<h;j++)
delete img[j];
delete img;
};
void kClient::DeallocateIntImg(int ,int h,u_int **img)
{
int j;
for (j=0;j<h;j++)
delete img[j];
delete img;
};
void kClient::center_image(int w,int h,u_int **img)
{
u_int **tmp=new u_int*[h];
int i,j;
for (i=0;i<h;i++)
{
tmp[i]=new u_int[w];
for (j=0;j<w;j++)
{
tmp[i][j]=img[i][j];
};
};
int h2=h/2;
int w2=w/2;
for (j=0;j<h2;j++)
{
for (i=0;i<w2;i++)
{
img[j][i]=tmp[j+h2][i+w2];
};
};
for (j=0;j<h2;j++)
{
for (i=w2;i<w;i++)
{
img[j][i]=tmp[j+h2][i-w2];
};
};
for (j=h2;j<h;j++)
{
for (i=0;i<w2;i++)
{
img[j][i]=tmp[j-h2][i+w2];
};
};
for (j=h2;j<h;j++)
{
for (i=w2;i<w;i++)
{
img[j][i]=tmp[j-h2][i-w2];
};
};
for (i=0;i<h;i++)
{
delete tmp[i];
};
delete tmp;
};
int kClient::t_Direct(void)
{
if (source_data[0]==NULL) return 1;
if (source_data[1]==NULL) return 1;
if (source_data[2]==NULL) return 1;
printf("Allocating memory ...\n");
int w=imgwidth;
int h=imgheight;
for (int i=0;i<3;i++)
{
printf("Pass %d ...\n",i);
if (fourier_data[i]!=NULL) DeallocateComplexImg(w,h,fourier_data[i]);
fourier_data[i]=AllocateComplexImg(w,h);
fourier_u_int_data[i]=AllocateIntImg(w,h);
printf("Doing Fourier Transform ... \n");
FT_Direct(is2pow(w),is2pow(h),source_data[i],fourier_data[i]);
printf("Converting Complex to image ...\n");
fourier_ratio[i]=-1;
convertComplexToQPixmap(is2pow(w),is2pow(h),fourier_data[i],fourier_u_int_data[i],fourier_imgs[i],i);
printf("Done (Direct FT)\n");
repaint(TRUE);
};
convertIntToQPixmap(is2pow(w),is2pow(h),fourier_u_int_data[0],fourier_u_int_data[1],fourier_u_int_data[2],fourier_img);
return 0;
};
int kClient::t_Inverse(void)
{
if (fourier_data[0]==NULL) return 1;
if (fourier_data[1]==NULL) return 1;
if (fourier_data[2]==NULL) return 1;
printf("Allocating memory ...\n");
int w=imgwidth;
int h=imgheight;
for (int i=0;i<3;i++)
{
printf("Pass %d ...\n",i);
if (target_data[i]!=NULL) DeallocateIntImg(w,h,target_data[i]);
target_data[i]=AllocateIntImg(w,h);
printf("Doing Inverse Fourier Transform ... \n");
FT_Inverse(is2pow(w),is2pow(h),fourier_data[i],target_data[i]);
printf("ConvertingIntToPixmap ...\n");
if (i==0) convertIntToQPixmap(w,h,target_data[i],NULL,NULL,target_imgs[i]);
else if (i==1) convertIntToQPixmap(w,h,NULL,target_data[i],NULL,target_imgs[i]);
else if (i==2) convertIntToQPixmap(w,h,NULL,NULL,target_data[i],target_imgs[i]);
};
printf("ConvertingIntToPixmap ...\n");
convertIntToQPixmap(w,h,target_data[0],target_data[1],target_data[2],target_img);
printf("Done (Inv FT)\n");
repaint(TRUE);
return 0;
};
int kClient::fft_Direct(void)
{
if (source_data[0]==NULL) return 1;
if (source_data[1]==NULL) return 1;
if (source_data[2]==NULL) return 1;
int w=imgwidth;
int h=imgheight;
for (int i=0;i<3;i++)
{
printf("Pass %d ...\n",i);
if (fourier_data[i]!=NULL) DeallocateComplexImg(w,h,fourier_data[i]);
fourier_data[i]=AllocateComplexImg(w,h);
fourier_u_int_data[i]=AllocateIntImg(w,h);
printf("Doing Fourier Transform ... \n");
FFT2D_real(source_data[i],fourier_data[i],w,h,1);
printf("Converting Complex to image ...\n");
fourier_ratio[i]=-1;
convertComplexToQPixmap(is2pow(w),is2pow(h),fourier_data[i],fourier_u_int_data[i],fourier_imgs[i],i);
printf("Done (Direct FFT)\n");
repaint(TRUE);
};
convertIntToQPixmap(is2pow(w),is2pow(h),fourier_u_int_data[0],fourier_u_int_data[1],fourier_u_int_data[2],fourier_img);
repaint(TRUE);
return 0;
};
int kClient::fft_Inverse(void)
{
if (fourier_data[0]==NULL) return 1;
if (fourier_data[1]==NULL) return 1;
if (fourier_data[2]==NULL) return 1;
int w=imgwidth;
int h=imgheight;
for (int i=0;i<3;i++)
{
printf("Pass %d ...\n",i);
if (target_data[i]!=NULL) DeallocateIntImg(w,h,target_data[i]);
target_data[i]=AllocateIntImg(w,h);
printf("Doing Inverse Fourier Transform ... \n");
FFT2D_real(fourier_data[i],target_data[i],w,h,0);
printf("ConvertingIntToPixmap ...\n");
if (i==0) convertIntToQPixmap(w,h,target_data[i],NULL,NULL,target_imgs[i]);
else if (i==1) convertIntToQPixmap(w,h,NULL,target_data[i],NULL,target_imgs[i]);
else if (i==2) convertIntToQPixmap(w,h,NULL,NULL,target_data[i],target_imgs[i]);
};
printf("ConvertingIntToPixmap ...\n");
convertIntToQPixmap(w,h,target_data[0],target_data[1],target_data[2],target_img);
printf("Done (Inv FT)\n");
repaint(TRUE);
return 0;
};
void kClient::decompose(void)
{
int w=imgwidth;
int h=imgheight;
printf("Decomposing ...\n");
for (int i=0;i<3;i++)
{
if (source_data[i]!=NULL) DeallocateIntImg(w,h,source_data[i]);
source_data[i]=AllocateIntImg(w,h);
convertQPixmapToInt(source_img,source_data[i],i);
if (i==0) convertIntToQPixmap(w,h,source_data[i],NULL,NULL,source_imgs[i]);
else if (i==1) convertIntToQPixmap(w,h,NULL,source_data[i],NULL,source_imgs[i]);
else if (i==2) convertIntToQPixmap(w,h,NULL,NULL,source_data[i],source_imgs[i]);
};
printf("Done ...\n");
};
void kClient::opt_RGB(void)
{
type_of_decomposition=0;
decompose();
repaint(TRUE);
};
void kClient::opt_HSV(void)
{
type_of_decomposition=1;
decompose();
repaint(TRUE);
};
int kClient::saveFile(int format)
{
saveimageformat=format;
if (saveimage==1) saveimage=0;
else saveimage=1;
return saveimage;
};
int kClient::Pixmap_at_pto(int &x,int &y,int &col)
// Return values :
// -1 is none, 0,1,2 is R,G,B component and 3 is the main picture of the column
// In col, it's returned 0 (source), 1 (fourier transform) or 2 (target)
// value returned in x and y is position inside that pixmap
{
int xcorner,ycorner;
int res=3;
int w=is2pow(imgwidth);
int h=is2pow(imgheight);
xcorner=0;
if (y<h)
{
ycorner=0;
if (x<w) {xcorner=0;col=0;}
else if (x<w+5) res=-1;
else if (x<w*2+5) {xcorner=w+5;col=1;}
else if (x<(w+5)*2) res=-1;
else if (x<(w*3)+10) {xcorner=(w+5)*2;col=2;}
else res=-1;
x-=xcorner;
y-=ycorner;
return res;
};
ycorner=h+5;
if (y<ycorner) return -1;
res=-1;
for (res=0;res<3;res++)
{
if (y<ycorner+h)
{
if (x<w) {xcorner=0;col=0;}
else if (x<w+5) res=-1;
else if (x<w*2+5) {xcorner=w+5;col=1;}
else if (x<(w+5)*2) res=-1;
else if (x<(w*3)+10) {xcorner=(w+5)*2;col=2;}
else res=-1;
x-=xcorner;
y-=ycorner;
return res;
};
ycorner+=h+5;
if (y<ycorner) return -1;
};
return -1;
};
void kClient::mouseMoveEvent(QMouseEvent *qme)
{
int x=qme->x();
int y=qme->y();
int col;
int p=Pixmap_at_pto(x,y,col);
if ((p==-1)||(p==3)) return;
if (col!=1) return;
if (fourier_data[p]==NULL) return;
int xt=x;
int yt=y;
int w=imgwidth;
int h=imgheight;
int w2=w/2;
int h2=h/2;
if (y<h2)
y+=h2;
else
y-=h2;
if (x<w2)
x+=w2;
else
x-=w2;
double re=fourier_data[p][y][x].real();
double im=fourier_data[p][y][x].imag();
double norma=sqrt(re*re+im*im);
double fi;
if (re==0)
{
if (im>0)
fi=PI/2;
else
fi=-PI/2;
}
else
fi=atan2(im,re);
if (norma==0) fi=0;
double figrados=fi*180/PI;
printf("(%d,%d,%d)= %g + %gi ,\t|X| %g ,\tang %g\t=%g\n",xt,yt,p,re,im,norma,fi,figrados);
};
void kClient::mousePressEvent(QMouseEvent *qme)
{
//printf("Click at : %d x %d\n",qme->x(),qme->y());
int x=qme->x();
int y=qme->y();
int col;
int p=Pixmap_at_pto(x,y,col);
int d=(int)sqrt((x-cx)*(x-cx)+(y-cy)*(y-cy));
//printf("Pixmap is : %d . %d and relative pos is : %d x %d\n",p,col,x,y);
//printf("Distance is : %d\n",d);
if (p==-1) return;
if ((qme->button()==LeftButton)&&(saveimage))
{
reallySaveImage(col,p);
if (saveimageformat==0) emit imageSaved_xpm();
else emit imageSaved_bmp();
return;
};
if (col!=1) return;
if (qme->button()==LeftButton)
{
if (placecenter)
{
cx=x;
cy=y;
emit centerPlaced();
return;
};
r1=d;
printf("A\n");
drawIn(p);
printf("B\n");
};
if (qme->button()==RightButton) r2=d;
};
int kClient::placeCenter(void)
{
if (placecenter==1) placecenter=0;
else placecenter=1;
return placecenter;
};
void kClient::setDrawMode(int mode)
// mode can be:
// 0. Low Pass
// 1. High Pass
// 2. Band Pass
// 3. Band Stop
// 4. Butterworth
{
drawmode=mode;
};
void kClient::drawIn(int p)
{
int w=is2pow(imgwidth);
int h=is2pow(imgheight);
if (p==3)
{
switch (drawmode)
{
case (0) : DoLowPass(w,h,fourier_data[0]);
DoLowPass(w,h,fourier_data[1]);
DoLowPass(w,h,fourier_data[2]);
break;
case (1) : DoHighPass(w,h,fourier_data[0]);
DoHighPass(w,h,fourier_data[1]);
DoHighPass(w,h,fourier_data[2]);
break;
case (2) : DoBandPass(w,h,fourier_data[0]);
DoBandPass(w,h,fourier_data[1]);
DoBandPass(w,h,fourier_data[2]);
break;
case (3) : DoBandStop(w,h,fourier_data[0]);
DoBandStop(w,h,fourier_data[1]);
DoBandStop(w,h,fourier_data[2]);
break;
case (4) : DoButterworth(w,h,fourier_data[0]);
DoButterworth(w,h,fourier_data[1]);
DoButterworth(w,h,fourier_data[2]);
break;
};
convertComplexToQPixmap(w,h,fourier_data[0],fourier_u_int_data[0],fourier_imgs[0],0);
convertComplexToQPixmap(w,h,fourier_data[1],fourier_u_int_data[1],fourier_imgs[1],1);
convertComplexToQPixmap(w,h,fourier_data[2],fourier_u_int_data[2],fourier_imgs[2],2);
}
else
{
switch (drawmode)
{
case (0) : DoLowPass(w,h,fourier_data[p]);break;
case (1) : DoHighPass(w,h,fourier_data[p]);break;
case (2) : DoBandPass(w,h,fourier_data[p]);break;
case (3) : DoBandStop(w,h,fourier_data[p]);break;
case (4) : DoButterworth(w,h,fourier_data[p]);break;
};
convertComplexToQPixmap(w,h,fourier_data[p],fourier_u_int_data[p],fourier_imgs[p],p);
};
convertIntToQPixmap(w,h,fourier_u_int_data[0],fourier_u_int_data[1],fourier_u_int_data[2],fourier_img);
repaint(TRUE);
};
void kClient::DoLowPass(int w,int h,double_complex **data)
{
if (data==NULL) return;
int i,j;
int w2=w/2;
int h2=h/2;
int d;
int r1r1=r1*r1;
if (cuad[3]==1)
{
printf("1 cuad\n");
for (i=0;i<h2;i++)
for (j=w2;j<w;j++)
{
// d=(int)sqrt((w-j)*(w-j)+(i*i));
d=(int)((j-w2-cx)*(j-w2-cx)+(i+h2-cy)*(i+h2-cy));
if (d<r1r1) data[i][j]*=pass_value;
else data[i][j]*=stop_value;
};
};
if (cuad[4]==1)
{
printf("2 cuad\n");
for (i=0;i<h2;i++)
for (j=0;j<w2;j++)
{
// d=(int)sqrt((j*j)+(i*i));
d=(int)((j+w2-cx)*(j+w2-cx)+(i+h2-cy)*(i+h2-cy));
if (d<r1r1) data[i][j]*=pass_value;
else data[i][j]*=stop_value;
};
};
if (cuad[1]==1)
{
printf("3 cuad\n");
for (i=h2;i<h;i++)
for (j=0;j<w2;j++)
{
// d=(int)sqrt((j*j)+(h-i)*(h-i));
d=(int)((j+w2-cx)*(j+w2-cx)+(i-h2-cy)*(i-h2-cy));
if (d<r1r1) data[i][j]*=pass_value;
else data[i][j]*=stop_value;
};
};
if (cuad[2]==1)
{
printf("4 cuad\n");
for (i=h2;i<h;i++)
for (j=w2;j<w;j++)
{
// d=(int)sqrt((w-j)*(w-j)+(h-i)*(h-i));
d=(int)((j-w2-cx)*(j-w2-cx)+(i-h2-cy)*(i-h2-cy));
if (d<r1r1) data[i][j]*=pass_value;
else data[i][j]*=stop_value;
};
};
};
void kClient::DoHighPass(int w,int h,double_complex **data)
{
if (data==NULL) return;
int i,j;
int w2=w/2;
int h2=h/2;
int d;
int r1r1=r1*r1;
if (cuad[3]==1)
{
printf("1 cuad\n");
for (i=0;i<h2;i++)
for (j=w2;j<w;j++)
{
d=(int)((j-w2-cx)*(j-w2-cx)+(i+h2-cy)*(i+h2-cy));
if (d<r1r1) data[i][j]*=stop_value;
else data[i][j]*=pass_value;
};
};
if (cuad[4]==1)
{
printf("2 cuad\n");
for (i=0;i<h2;i++)
for (j=0;j<w2;j++)
{
d=(int)((j+w2-cx)*(j+w2-cx)+(i+h2-cy)*(i+h2-cy));
if (d<r1r1) data[i][j]*=stop_value;
else data[i][j]*=pass_value;
};
};
if (cuad[1]==1)
{
printf("3 cuad\n");
for (i=h2;i<h;i++)
for (j=0;j<w2;j++)
{
d=(int)((j+w2-cx)*(j+w2-cx)+(i-h2-cy)*(i-h2-cy));
if (d<r1r1) data[i][j]*=stop_value;
else data[i][j]*=pass_value;
};
};
if (cuad[2]==1)
{
printf("4 cuad\n");
for (i=h2;i<h;i++)
for (j=w2;j<w;j++)
{
d=(int)((j-w2-cx)*(j-w2-cx)+(i-h2-cy)*(i-h2-cy));
if (d<r1r1) data[i][j]*=stop_value;
else data[i][j]*=pass_value;
};
};
};
void kClient::DoBandPass(int w,int h,double_complex **data)
{
if (data==NULL) return;
int i,j;
int w2=w/2;
int h2=h/2;
int d;
int r1r1=r1*r1;
int r2r2=r2*r2;
if (cuad[3]==1)
{
printf("1 cuad\n");
for (i=0;i<h2;i++)
for (j=w2;j<w;j++)
{
d=(int)((j-w2-cx)*(j-w2-cx)+(i+h2-cy)*(i+h2-cy));
if ((d<r1r1)||(d>r2r2)) data[i][j]*=stop_value;
else data[i][j]*=pass_value;
};
};
if (cuad[4]==1)
{
printf("2 cuad\n");
for (i=0;i<h2;i++)
for (j=0;j<w2;j++)
{
d=(int)((j+w2-cx)*(j+w2-cx)+(i+h2-cy)*(i+h2-cy));
if ((d<r1r1)||(d>r2r2)) data[i][j]*=stop_value;
else data[i][j]*=pass_value;
};
};
if (cuad[1]==1)
{
printf("3 cuad\n");
for (i=h2;i<h;i++)
for (j=0;j<w2;j++)
{
d=(int)((j+w2-cx)*(j+w2-cx)+(i-h2-cy)*(i-h2-cy));
if ((d<r1r1)||(d>r2r2)) data[i][j]*=stop_value;
else data[i][j]*=pass_value;
};
};
if (cuad[2]==1)
{
printf("4 cuad\n");
for (i=h2;i<h;i++)
for (j=w2;j<w;j++)
{
d=(int)((j-w2-cx)*(j-w2-cx)+(i-h2-cy)*(i-h2-cy));
if ((d<r1r1)||(d>r2r2)) data[i][j]*=stop_value;
else data[i][j]*=pass_value;
};
};
};
void kClient::DoBandStop(int w,int h,double_complex **data)
{
if (data==NULL) return;
int i,j;
int w2=w/2;
int h2=h/2;
int d;
int r1r1=r1*r1;
int r2r2=r2*r2;
if (cuad[3]==1)
{
printf("1 cuad\n");
for (i=0;i<h2;i++)
for (j=w2;j<w;j++)
{
d=(int)((j-w2-cx)*(j-w2-cx)+(i+h2-cy)*(i+h2-cy));
if ((d<r1r1)||(d>r2r2)) data[i][j]*=pass_value;
else data[i][j]*=stop_value;
};
};
if (cuad[2]==1)
{
printf("2 cuad\n");
for (i=h2;i<h;i++)
for (j=w2;j<w;j++)
{
d=(int)((j-w2-cx)*(j-w2-cx)+(i-h2-cy)*(i-h2-cy));
if ((d<r1r1)||(d>r2r2)) data[i][j]*=pass_value;
else data[i][j]*=stop_value;
};
};
if (cuad[1]==1)
{
printf("3 cuad\n");
for (i=h2;i<h;i++)
for (j=0;j<w2;j++)
{
d=(int)((j+w2-cx)*(j+w2-cx)+(i-h2-cy)*(i-h2-cy));
if ((d<r1r1)||(d>r2r2)) data[i][j]*=pass_value;
else data[i][j]*=stop_value;
};
};
if (cuad[4]==1)
{
printf("4 cuad\n");
for (i=0;i<h2;i++)
for (j=0;j<w2;j++)
{
d=(int)((j+w2-cx)*(j+w2-cx)+(i+h2-cy)*(i+h2-cy));
if ((d<r1r1)||(d>r2r2)) data[i][j]*=pass_value;
else data[i][j]*=stop_value;
};
};
};
void kClient::DoButterworth(int w,int h,double_complex **data)
{
if (data==NULL) return;
int i,j;
int w2=w/2;
int h2=h/2;
int d;
double pv,sv; //passvalue,stopvalue
int rr1,rr2;
if (r1<r2)
{
pv=pass_value;
sv=stop_value;
rr1=r1;
rr2=r2;
}
else
{
pv=stop_value;
sv=pass_value;
rr1=r2;
rr2=r1;
};
double tempvalue;
double m=(double)(sv-pv)/(double)(rr2-rr1);
if (cuad[3]==1)
{
printf("1 cuad\n");
for (i=0;i<h2;i++)
for (j=w2;j<w;j++)
{
d=(int)sqrt((j-w2-cx)*(j-w2-cx)+(i+h2-cy)*(i+h2-cy));
if (d<rr1) data[i][j]*=pv;
else if (d>rr2) data[i][j]*=sv;
else
{
tempvalue=m*(double)(d-rr1)+(double)pv;
data[i][j]*=tempvalue;
};
};
};
if (cuad[2]==1)
{
printf("2 cuad\n");
for (i=h2;i<h;i++)
for (j=w2;j<w;j++)
{
d=(int)sqrt((j-w2-cx)*(j-w2-cx)+(i-h2-cy)*(i-h2-cy));
if (d<rr1) data[i][j]*=pv;
else if (d>rr2) data[i][j]*=sv;
else
{
tempvalue=m*(double)(d-rr1)+(double)pv;
data[i][j]*=tempvalue;
};
};
};
if (cuad[1]==1)
{
printf("3 cuad\n");
for (i=h2;i<h;i++)
for (j=0;j<w2;j++)
{
d=(int)sqrt((j+w2-cx)*(j+w2-cx)+(i-h2-cy)*(i-h2-cy));
if (d<rr1) data[i][j]*=pv;
else if (d>rr2) data[i][j]*=sv;
else
{
tempvalue=m*(double)(d-rr1)+(double)pv;
data[i][j]*=tempvalue;
};
};
};
if (cuad[4]==1)
{
printf("4 cuad\n");
for (i=0;i<h2;i++)
for (j=0;j<w2;j++)
{
d=(int)sqrt((j+w2-cx)*(j+w2-cx)+(i+h2-cy)*(i+h2-cy));
if (d<rr1) data[i][j]*=pv;
else if (d>rr2) data[i][j]*=sv;
else
{
tempvalue=m*(double)(d-rr1)+(double)pv;
data[i][j]*=tempvalue;
};
};
};
};
int kClient::cuadrant(int i)
{
int r;
if (cuad[i]==1) {cuad[i]=0;r=0;}
else {cuad[i]=1;r=1;};
return r;
};
void kClient::configvalues(void)
{
ConfigDialog *dlg;
dlg=new ConfigDialog(pass_value,stop_value,NULL,"CfgDialog");
if (dlg->exec() == QDialog::Accepted)
{
pass_value=dlg->passvalue;
stop_value=dlg->stopvalue;
};
};
kfourier-1.1/kfourier/kframe.moc 100644 1750 144 11526 6462736343 16125 0 ustar antonio users /****************************************************************************
** kFrame meta object code from reading C++ file 'kframe.h'
**
** Created: Sun Jan 25 23:29:55 1998
** by: The Qt Meta Object Compiler ($Revision: 2.18 $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#if !defined(Q_MOC_OUTPUT_REVISION)
#define Q_MOC_OUTPUT_REVISION 2
#elif Q_MOC_OUTPUT_REVISION != 2
#error Moc format conflict - please regenerate all moc files
#endif
#include "kframe.h"
#include <qmetaobj.h>
const char *kFrame::className() const
{
return "kFrame";
}
QMetaObject *kFrame::metaObj = 0;
void kFrame::initMetaObject()
{
if ( metaObj )
return;
if ( strcmp(KTopLevelWidget::className(), "KTopLevelWidget") != 0 )
badSuperclassWarning("kFrame","KTopLevelWidget");
if ( !KTopLevelWidget::metaObject() )
KTopLevelWidget::initMetaObject();
typedef void(kFrame::*m1_t0)(int);
typedef void(kFrame::*m1_t1)();
typedef void(kFrame::*m1_t2)();
typedef void(kFrame::*m1_t3)();
typedef void(kFrame::*m1_t4)();
typedef void(kFrame::*m1_t5)();
typedef void(kFrame::*m1_t6)();
typedef void(kFrame::*m1_t7)();
typedef void(kFrame::*m1_t8)();
typedef void(kFrame::*m1_t9)();
typedef void(kFrame::*m1_t10)();
typedef void(kFrame::*m1_t11)();
typedef void(kFrame::*m1_t12)();
typedef void(kFrame::*m1_t13)();
typedef void(kFrame::*m1_t14)();
typedef void(kFrame::*m1_t15)();
typedef void(kFrame::*m1_t16)();
typedef void(kFrame::*m1_t17)();
typedef void(kFrame::*m1_t18)();
typedef void(kFrame::*m1_t19)();
typedef void(kFrame::*m1_t20)();
typedef void(kFrame::*m1_t21)();
typedef void(kFrame::*m1_t22)();
typedef void(kFrame::*m1_t23)(KDNDDropZone*);
m1_t0 v1_0 = &kFrame::buttonClicked;
m1_t1 v1_1 = &kFrame::file_Open;
m1_t2 v1_2 = &kFrame::file_Save_xpm;
m1_t3 v1_3 = &kFrame::file_Save_bmp;
m1_t4 v1_4 = &kFrame::t_Direct;
m1_t5 v1_5 = &kFrame::t_Inverse;
m1_t6 v1_6 = &kFrame::fft_Direct;
m1_t7 v1_7 = &kFrame::fft_Inverse;
m1_t8 v1_8 = &kFrame::draw_LowPass;
m1_t9 v1_9 = &kFrame::draw_HighPass;
m1_t10 v1_10 = &kFrame::draw_BandPass;
m1_t11 v1_11 = &kFrame::draw_BandStop;
m1_t12 v1_12 = &kFrame::draw_Butterworth;
m1_t13 v1_13 = &kFrame::draw_configvalues;
m1_t14 v1_14 = &kFrame::draw_placecenter;
m1_t15 v1_15 = &kFrame::cuad_1;
m1_t16 v1_16 = &kFrame::cuad_2;
m1_t17 v1_17 = &kFrame::cuad_3;
m1_t18 v1_18 = &kFrame::cuad_4;
m1_t19 v1_19 = &kFrame::opt_RGB;
m1_t20 v1_20 = &kFrame::opt_HSV;
m1_t21 v1_21 = &kFrame::help_Help;
m1_t22 v1_22 = &kFrame::help_About;
m1_t23 v1_23 = &kFrame::slotDropEvent;
QMetaData *slot_tbl = new QMetaData[24];
slot_tbl[0].name = "buttonClicked(int)";
slot_tbl[1].name = "file_Open()";
slot_tbl[2].name = "file_Save_xpm()";
slot_tbl[3].name = "file_Save_bmp()";
slot_tbl[4].name = "t_Direct()";
slot_tbl[5].name = "t_Inverse()";
slot_tbl[6].name = "fft_Direct()";
slot_tbl[7].name = "fft_Inverse()";
slot_tbl[8].name = "draw_LowPass()";
slot_tbl[9].name = "draw_HighPass()";
slot_tbl[10].name = "draw_BandPass()";
slot_tbl[11].name = "draw_BandStop()";
slot_tbl[12].name = "draw_Butterworth()";
slot_tbl[13].name = "draw_configvalues()";
slot_tbl[14].name = "draw_placecenter()";
slot_tbl[15].name = "cuad_1()";
slot_tbl[16].name = "cuad_2()";
slot_tbl[17].name = "cuad_3()";
slot_tbl[18].name = "cuad_4()";
slot_tbl[19].name = "opt_RGB()";
slot_tbl[20].name = "opt_HSV()";
slot_tbl[21].name = "help_Help()";
slot_tbl[22].name = "help_About()";
slot_tbl[23].name = "slotDropEvent(KDNDDropZone*)";
slot_tbl[0].ptr = *((QMember*)&v1_0);
slot_tbl[1].ptr = *((QMember*)&v1_1);
slot_tbl[2].ptr = *((QMember*)&v1_2);
slot_tbl[3].ptr = *((QMember*)&v1_3);
slot_tbl[4].ptr = *((QMember*)&v1_4);
slot_tbl[5].ptr = *((QMember*)&v1_5);
slot_tbl[6].ptr = *((QMember*)&v1_6);
slot_tbl[7].ptr = *((QMember*)&v1_7);
slot_tbl[8].ptr = *((QMember*)&v1_8);
slot_tbl[9].ptr = *((QMember*)&v1_9);
slot_tbl[10].ptr = *((QMember*)&v1_10);
slot_tbl[11].ptr = *((QMember*)&v1_11);
slot_tbl[12].ptr = *((QMember*)&v1_12);
slot_tbl[13].ptr = *((QMember*)&v1_13);
slot_tbl[14].ptr = *((QMember*)&v1_14);
slot_tbl[15].ptr = *((QMember*)&v1_15);
slot_tbl[16].ptr = *((QMember*)&v1_16);
slot_tbl[17].ptr = *((QMember*)&v1_17);
slot_tbl[18].ptr = *((QMember*)&v1_18);
slot_tbl[19].ptr = *((QMember*)&v1_19);
slot_tbl[20].ptr = *((QMember*)&v1_20);
slot_tbl[21].ptr = *((QMember*)&v1_21);
slot_tbl[22].ptr = *((QMember*)&v1_22);
slot_tbl[23].ptr = *((QMember*)&v1_23);
metaObj = new QMetaObject( "kFrame", "KTopLevelWidget",
slot_tbl, 24,
0, 0 );
}
kfourier-1.1/kfourier/kclient.moc 100644 1750 144 3476 6463702725 16274 0 ustar antonio users /****************************************************************************
** kClient meta object code from reading C++ file 'kclient.h'
**
** Created: Wed Jan 28 20:24:05 1998
** by: The Qt Meta Object Compiler ($Revision: 2.18 $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#if !defined(Q_MOC_OUTPUT_REVISION)
#define Q_MOC_OUTPUT_REVISION 2
#elif Q_MOC_OUTPUT_REVISION != 2
#error Moc format conflict - please regenerate all moc files
#endif
#include "kclient.h"
#include <qmetaobj.h>
const char *kClient::className() const
{
return "kClient";
}
QMetaObject *kClient::metaObj = 0;
void kClient::initMetaObject()
{
if ( metaObj )
return;
if ( strcmp(QWidget::className(), "QWidget") != 0 )
badSuperclassWarning("kClient","QWidget");
if ( !QWidget::metaObject() )
QWidget::initMetaObject();
typedef void(kClient::*m2_t0)();
typedef void(kClient::*m2_t1)();
typedef void(kClient::*m2_t2)();
m2_t0 v2_0 = &kClient::centerPlaced;
m2_t1 v2_1 = &kClient::imageSaved_xpm;
m2_t2 v2_2 = &kClient::imageSaved_bmp;
QMetaData *signal_tbl = new QMetaData[3];
signal_tbl[0].name = "centerPlaced()";
signal_tbl[1].name = "imageSaved_xpm()";
signal_tbl[2].name = "imageSaved_bmp()";
signal_tbl[0].ptr = *((QMember*)&v2_0);
signal_tbl[1].ptr = *((QMember*)&v2_1);
signal_tbl[2].ptr = *((QMember*)&v2_2);
metaObj = new QMetaObject( "kClient", "QWidget",
0, 0,
signal_tbl, 3 );
}
// SIGNAL centerPlaced
void kClient::centerPlaced()
{
activate_signal( "centerPlaced()" );
}
// SIGNAL imageSaved_xpm
void kClient::imageSaved_xpm()
{
activate_signal( "imageSaved_xpm()" );
}
// SIGNAL imageSaved_bmp
void kClient::imageSaved_bmp()
{
activate_signal( "imageSaved_bmp()" );
}
kfourier-1.1/kfourier/cfgdlg.moc 100644 1750 144 2321 6461613014 16043 0 ustar antonio users /****************************************************************************
** ConfigDialog meta object code from reading C++ file 'cfgdlg.h'
**
** Created: Thu Jan 22 10:49:00 1998
** by: The Qt Meta Object Compiler ($Revision: 2.18 $)
**
** WARNING! All changes made in this file will be lost!
*****************************************************************************/
#if !defined(Q_MOC_OUTPUT_REVISION)
#define Q_MOC_OUTPUT_REVISION 2
#elif Q_MOC_OUTPUT_REVISION != 2
#error Moc format conflict - please regenerate all moc files
#endif
#include "cfgdlg.h"
#include <qmetaobj.h>
const char *ConfigDialog::className() const
{
return "ConfigDialog";
}
QMetaObject *ConfigDialog::metaObj = 0;
void ConfigDialog::initMetaObject()
{
if ( metaObj )
return;
if ( strcmp(QDialog::className(), "QDialog") != 0 )
badSuperclassWarning("ConfigDialog","QDialog");
if ( !QDialog::metaObject() )
QDialog::initMetaObject();
typedef void(ConfigDialog::*m1_t0)();
m1_t0 v1_0 = &ConfigDialog::accept;
QMetaData *slot_tbl = new QMetaData[1];
slot_tbl[0].name = "accept()";
slot_tbl[0].ptr = *((QMember*)&v1_0);
metaObj = new QMetaObject( "ConfigDialog", "QDialog",
slot_tbl, 1,
0, 0 );
}
kfourier-1.1/kfourier/fft2d.h 100644 1750 144 2544 6461474044 15312 0 ustar antonio users /**************************************************************************
fft2d.h - The 2D FFT algorithm headers
Copyright (C) 1998 Antonio Larrosa Jimenez
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., 675 Mass Ave, Cambridge, MA 02139, USA.
Send comments and bug fixes to antlarr@arrakis.es
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
***************************************************************************/
#ifndef FFT2D_H
#define FFT2D_H
#include <complex.h>
#include <sys/types.h>
void FFT2D(double_complex **in, double_complex **out,int w,int h, int Dir);
void FFT2D_real(u_int **in, double_complex **out,int w,int h, int Dir);
void FFT2D_real(double_complex **in, u_int **out,int w,int h, int Dir);
#endif
kfourier-1.1/kfourier/tfourier.h 100644 1750 144 2720 6501726223 16132 0 ustar antonio users /**************************************************************************
tfourier.h - The functions that do the Fourier transform by its definition
Copyright (C) 1998 Antonio Larrosa Jimenez
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., 675 Mass Ave, Cambridge, MA 02139, USA.
Send comments and bug fixes to antlarr@arrakis.es
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
***************************************************************************/
#ifndef TFOURIER_H
#define TFOURIER_H
#include <sys/types.h>
#include <complex.h>
#ifndef PI
#define PI 3.14159265358979323846
#endif
/*
Keep in mind that images are stored with
[h][w], thus first index is height and second is width
*/
int FT_Direct(int w,int h,u_int **in,double_complex **out);
int FT_Inverse(int w,int h,double_complex **in,u_int **out);
#endif
kfourier-1.1/kfourier/kfourier.xpm 100644 1750 144 27226 6463157463 16541 0 ustar antonio users /* XPM */
static char *tfourier[] = {
/* width height num_colors chars_per_pixel */
" 32 32 240 2",
/* colors */
".. c #2c2c30",
".# c #849694",
".a c #546254",
".b c #b4ced4",
".c c #5c4858",
".d c #3c4741",
".e c #5c7a7c",
".f c #bc9c94",
".g c #6c6462",
".h c #4c5648",
".i c #343b3b",
".j c #94ae9c",
".k c #848284",
".l c #dcd6c4",
".m c #4c4843",
".n c #9c9b8a",
".o c #6c7068",
".p c #a4828c",
".q c #b4b9b1",
".r c #848e7c",
".s c #ecece0",
".t c #5c6e5c",
".u c #ccb8b4",
".v c #747b6f",
".w c #443d40",
".x c #f4d6e4",
".y c #4c4954",
".z c #a496b4",
".A c #ecf8e8",
".B c #34323d",
".C c #5c5752",
".D c #dce2dc",
".E c #6c7284",
".F c #5c656c",
".G c #8c8a94",
".H c #7c8878",
".I c #b4c2c4",
".J c #9ca39c",
".K c #2c3532",
".L c #747e8c",
".M c #745a54",
".N c #d4e6dc",
".O c #4c5043",
".P c #5c5e67",
".Q c #dce4e8",
".R c #ccd2cc",
".S c #444f45",
".T c #7c696f",
".U c #3c423b",
".V c #6c766c",
".W c #948d8c",
".X c #646461",
".Y c #4c5660",
".Z c #fcf8fb",
".0 c #8ca27c",
".1 c #848494",
".2 c #fcf1f8",
".3 c #74827c",
".4 c #444241",
".5 c #343e44",
".6 c #ac9e9c",
".7 c #c4b9b9",
".8 c #84928c",
".9 c #6c6a5f",
"#. c #9c969f",
"## c #7c7d71",
"#a c #4c5055",
"#b c #6c5e5c",
"#c c #b4ada9",
"#d c #948488",
"#e c #6c7274",
"#f c #ecf2f4",
"#g c #5c5e5a",
"#h c #d4d1dc",
"#i c #3c2d31",
"#j c #94989a",
"#k c #dcdaf4",
"#l c #b4beac",
"#m c #848d89",
"#n c #ccc2e4",
"#o c #5c6a70",
"#p c #3c3633",
"#q c #545155",
"#r c #546264",
"#s c #5c5257",
"#t c #3c3b3b",
"#u c #acbeb4",
"#v c #848681",
"#w c #ecd4d8",
"#x c #54494b",
"#y c #a4a2b0",
"#z c #f4fef0",
"#A c #34363c",
"#B c #ece6c4",
"#C c #c4c5c4",
"#D c #54504b",
"#E c #ece4e4",
"#F c #342e31",
"#G c #84767c",
"#H c #545751",
"#I c #948c94",
"#J c #aca8a0",
"#K c #d4dad4",
"#L c #545e5f",
"#M c #44424d",
"#N c #9c9ea0",
"#O c #aca9af",
"#P c #444743",
"#Q c #6c867c",
"#R c #e4f2ec",
"#S c #a4afb1",
"#T c #dcd4d8",
"#U c #74706c",
"#V c #bcbab1",
"#W c #f4ede8",
"#X c #647664",
"#Y c #ccc6ac",
"#Z c #4c3e3c",
"#0 c #645a5c",
"#1 c #e0e6cc",
"#2 c #343334",
"#3 c #d4d5c9",
"#4 c #646a61",
"#5 c #fcfefa",
"#6 c #9c928c",
"#7 c #9c86ac",
"#8 c #7c8ea4",
"#9 c #fce4f0",
"a. c #c4b2bc",
"a# c #c4ced4",
"aa c #c4a684",
"ab c #dcc6cc",
"ac c #6c5254",
"ad c #6c7b87",
"ae c #7c7684",
"af c #9486a4",
"ag c #acb2cc",
"ah c #d4f2dc",
"ai c #b4b2bc",
"aj c #9caab4",
"ak c #6c5e69",
"al c #6c4654",
"am c #c4cacc",
"an c #9c8a7c",
"ao c #849294",
"ap c #bccac4",
"aq c #748284",
"ar c #ccd6ec",
"as c #847a7c",
"at c #dceaf4",
"au c #646e6f",
"av c #646684",
"aw c #a4bacc",
"ax c #8c6e6c",
"ay c #a2aaa4",
"az c #7c8e84",
"aA c #7c7679",
"aB c #cce6f4",
"aC c #6c6a6f",
"aD c #5c6a84",
"aE c #8caa9c",
"aF c #c4d6cc",
"aG c #ece2dc",
"aH c #c4c6dc",
"aI c #ccc2c0",
"aJ c #6c5068",
"aK c #9cb2ac",
"aL c #a49a94",
"aM c #e4ded4",
"aN c #747584",
"aO c #bcc2bc",
"aP c #7c7a84",
"aQ c #7c5664",
"aR c #e4e5ea",
"aS c #bcaeb4",
"aT c #949284",
"aU c #949297",
"aV c #8c9691",
"aW c #747672",
"aX c #94a28c",
"aY c #bcbeb8",
"aZ c #8c8684",
"a0 c #3c3640",
"a1 c #a4aac0",
"a2 c #7c8294",
"a3 c #5c6450",
"a4 c #8c6a6c",
"a5 c #dcebe1",
"a6 c #8c8082",
"a7 c #647064",
"a8 c #d4babc",
"a9 c #f4faec",
"b. c #3c323c",
"b# c #a4a6a4",
"ba c #54585d",
"bb c #3c3d44",
"bc c #44484d",
"bd c #a49aa1",
"be c #746f75",
"bf c #f4f0f8",
"bg c #8c8d8c",
"bh c #5c6461",
"bi c #acaeb4",
"bj c #f4f6fc",
"bk c #c49e94",
"bl c #4c494c",
"bm c #b4babc",
"bn c #eceeec",
"bo c #747c7c",
"bp c #5c595c",
"bq c #64646c",
"br c #7c727c",
"bs c #4c4f4c",
"bt c #444e54",
"bu c #7c667c",
"bv c #7c7d7c",
"bw c #4c5064",
"bx c #b4aeb4",
"by c #d4c6e4",
"bz c #ece6f4",
"bA c #6c828c",
"bB c #d4d4d4",
"bC c #bcc6cc",
"bD c #7c7e94",
"bE c #e4e2f4",
"bF c #e4d6cc",
"bG c #645e64",
"bH c #7c8274",
"bI c #4c4242",
"bJ c #8c9286",
"bK c #645e5b",
"bL c #646a6c",
"bM c #4c424c",
"bN c #a49ea4",
"bO c #746a6f",
"bP c #4c5654",
"bQ c #3c4244",
"bR c #6c767c",
"bS c #84868c",
"bT c #f4fefc",
/* pixels */
"..bc.w#2bb.m.Sbp.m#a.5#pbbbl#A.waJ.S#t.w#t#t#Fbb.mbsa0.K.w#A.m.w",
"#A.w.U#A#F.y#q.U.4#t#P.i#A#F#abb.M.d#P#2.i#F.5#Pbb.w.i.w.mbb#2#t",
".y#Z..bcbl#g.m.X.F.X.w#a.Bbb.mblax.U#P.U#A.Bbbbb.m#p.y#M#M#D#A.B",
"#Fbbbl#2.4ba.P#q#D#a.ybQbsbbbs.UaJ.d.w#tbbbb#t#tbb#qbM#t..bbbbb.",
"#p#Hbl.C.Ubp#abL.gbvaA.X#P.w#qbs.Tbs.4#t..#ibQ#p.UbQbb.m#2bI#2..",
".U.mbb.Kbp#D.y.9bv.vbrbebK#qbQ#D.cbl.i.K#P#A.w#A.wbbbl.Sa0.wbcb.",
"#2.wbl.d#2.Vbha7#mbe#.#JaUbqblbK.T#P.i#p#t#tbb#Pbcbl.4b.bl#t#M#2",
"a0.d.4bs.o.h#4#ebobRaXay.1#Jbh.g#7.Sbl.X.d#P.d.X#Fbb.4bb#M#t#P#q",
"a0.g.i#F#a.Jbp#DaP#Na6am#C#NbS.Wa4.a#Lba.Ca3blblbc.w#Ha0#tbc.5bM",
".C.S#qbG.4.maU.oaVaVbm#yap.7aL#X.faP#H.dbL#e#sau#D#qblbhbp.w#Abc",
".w.y#s.mbgbh#Pad#ubH#ca.#1at#CbJ.f#QaWbp#U.t.o#4.4#4.g.g.O#D.mbs",
"bp#qbp#D.U.eaZasan.R.0#h#VaM#kaMa8aj.rayaz.H.9bK.o.9bKbh#D.F#P.o",
".P.XbpbLbqas.va1a6#d#3aa#E#h#R.x#3.uam.zbe.n.kbobgbv.Y.Cbe.F#p.g",
"#r#Hbq##.Ha2#o#.ad#hbd#w#faMa9bj.s#W.Qa#.n.6#S#Jb#as.EbR.9.3#abP",
".Yau.c.9#ebebNay.JbiaHbyah.2.Z.Z#5.2bfbf#B.lbxaLaKb##4aCaT.Xbeba",
"bh#s#L#4avadbS#Caj#TbzaraB#W#5bT#5#5#5aR#E#TbB#V#j.WaUa3#6.G#U#o",
"aW.W.W#laVaEaL.I.N.Q.s.s.2.2#5#5#5#5#5.Z.2#T#h.R#V#Oa1#N.L.V#m.r",
".3bG.raDao#v#jay.q.7.7#w#9bfbfbT#5bT.2aR.A#naG.7.Jaia2aZbA.GbO#d",
"bpba.X#x#U.F##.#.J#c.7aFaF.Dat.ZbT#z#z.2aG#V#VaX#8#ybg#m.XaN.Sbt",
"bsbpbG.Ebwauaq.v#N#6.n.q#VbF.b#9bn.Z#fbEa5abbD.qaN#v#o.oaA#D.y#H",
"#a#x.9au.obpaWaCaP.G.##NbNbJbiag#1#Wbz.N.Dbk#K#jbKaw#mbe#qbObabs",
".X#M#abcbebtbGbO.9#4anakbe#IaA#y#Y.A.D#naYaI.T#3#m#s.g.8.S.X.C.4",
".4#H#a.y.w#q#q.o.g.XaA.obe#P#ga6.p.jbmaOaS.qay#G.n.3bs.mau.ObsbK",
"bb.4#M.CbQbabs.XbGbP.C#L.Sbp.F#b.ua3bC#SbB#.#VaWbJa3ay#q#MbcaWbb",
"bb#t.mbQ#abc.w#t#q#q#H.4bcbs.hakafaN##aObd#3.kaA#0a7bsaebl.ybb#2",
".d#x#t.4.4bbbl.i#Ab..K#A#H#Pbs#abu.a.Xas.W#ma6bRaN#H.X.h.ObQ.w#P",
"bbbb.wbl#Pbc#PbIbl.4.K.wbsbs#P#qaQ#H#P.gaNbSaA#gbvaW.gaPbc#PbI#p",
".mbs#PbIbc#Dbl#A#p#t.B#t...4.wblal#P#M.g.XaAaP#m#Hbl#H#P#Hbb#tbb",
".d#qbQa0#H.4#Fbb#t#tbb.wbb#A.i.d.TbPbQ.dbsaC.9.X#0bp#H#Fbb#D.i#t",
"..#i#2blbI#A#t#x.4.4bba0..#p.i.m.M#Pbbbs#a.XbpbebK#gbP.O#D.4.m.w",
"a0bb#i#t..#tbM#A..bb.ia0.i.4a0.4ac.O#P#pa0#D#a#H#e#q.mb..i.O.4#2",
"#2#Fb.#A#xbb#Dblbc#2a0.wbs.i.U#2bu.S.m#F#pbQblba#xbl.g.i.w#2#P.B"
};
SIMPLE = T BITPIX = 8 NAXIS = 2 NAXIS1 = 32 NAXIS2 = 32 HISTORY Written by XV 3.10a END 3256M?PHG19?O8>4nHI16@IWOIc7@4D48=.;-:E6.;879D9E[JE6;OQSpQI99MB1,33KD59MCA<<,75FaD?LPaZp^^SMQ?J=AR?;UE2>9:=B=69EoQ@BImhd_[R1?M7:HNEGHMK75=2;)D=GTIDgfxyˆSLTBS?;<<;?IDGDELA1AMKEScREdw†w]{wc{HFE8CJ;CB?H75733TAOOp``€‹Š…tvUaPKB=F>8KANI@<PSRDJPOcŽu|¾ Ñ‚z]iN{JI=2ABBX=WLc_SV^DYbb¼`ª՗»ta¤QEHr<@UOK@RRmfbynrF[ƒ ·¿³³©z•|OHjNL_dBOGpL`nijˆfmy¨ÂóàλÅoЉUdŒIcWDMOgjk]tj|ž¤²àïåàߪז_µˆpRmYLL\_tQj~zš•™´¸ÙÆíëûòããÍ€¶uƒfovNKTYUeKs_z‘œ°¹ÍÌàçûúøùóä¸ºš‹ Œ‰cvKJ|d†hŒ„•¤¸½¼ÝíîóøþùöäðÊàÞ´„‹{mŠtŽ‘·’Ÿš¼ÞåêêõöþûþþùûöÙÕË»ª©œ{s…‡aQYbjx„Æ¥ÕêÖÝíþúþþþææÕÑ»—“]”ŽrdUjPiorœ§®ÈÑåöùöþóïóäÓ¯œ¨¥gjboY]WdyƒgœwÔšÙïà÷öìîâÌ™ ¬ª¤}psg|NS]bZjezv©…‡Ô¬åÓíâѽʟr—‚w{TWsb8eWUZP?pˆ~ŒÒ“ÕºÞÜÛÄ¥†©†haml_`R^Ik@LUH_Eyµ{¯ºÞäÁ¥}p[pemdAffcNTHOXGU`@K‘m‘‘·¤Ä½Ÿn¦yTDfoViQRL_\<3H7d91K¢YPz†ÇÄœ…u\\WVaFLG?V9<F=D:AEPpNgqxv™¥‡§_g“JJbADCb/<C:E9DR0?I@2r^h†r™ª”dI`nD69;<<EHIC6I=E4?H>1XRKi|vvq`UCNOH82G3@7@;JK8AD57VJX?ZNhg}ueE>POqN?:.2B5@B>E3E3,-@I1DX]SRQJ?J>P=_CA:<>::=RF;,=A5KA+GJ[Ge`a>Q5=FLu?I=65=;I6KEDL744??60LS?@<E86/Q?bBD380:F;A;?F>1<-H@2<IIXHO98=H4?ZI:<<;0?HL70A4G@ kfourier-1.1/kfourier/help/ 40755 1750 144 0 6473666311 14765 5 ustar antonio users kfourier-1.1/kfourier/help/kfourier_es.html 100644 1750 144 36613 6473645315 20317 0 ustar antonio users <HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en] (X11; I; Linux 2.0.29 i586) [Netscape]">
</HEAD>
<BODY>
<CENTER>
<H1>
<B><U><FONT SIZE=+2>TRANSFORMADA DE FOURIER</FONT></U></B></H1></CENTER>
<CENTER><FONT SIZE=+2>Por <B>Antonio Larrosa Jimenez</B></FONT></CENTER>
<CENTER><FONT SIZE=+1>alumno de 2o de Matematicas, para la asignatura de
Libre Configuracion : "Procesamiento de Imagenes"</FONT></CENTER>
<CENTER><FONT SIZE=+1></FONT></CENTER>
<B><FONT SIZE=+2>Indice</FONT></B>
<OL>
<UL>
<LI>
<A HREF="#0. Como instalar el programa y donde conseguirlo">0. Como instalar
el programa y donde conseguirlo</A></LI>
<LI>
<A HREF="#1. Como cargar imagenes">1. Como cargar imagenes</A></LI>
<UL>
<LI>
<A HREF="#1.1 Como grabar una imagen">1.1 Como grabar una imagen</A></LI>
</UL>
<LI>
<A HREF="#2. Hacer la transformada de Fourier de una imagen">2. Hacer la
transformada de Fourier de una imagen</A></LI>
<UL>
<LI>
<A HREF="#2.1. Transformada original">2.1. Transformada original</A></LI>
<LI>
<A HREF="#2.2. Transformada rapida">2.2. Transformada rapida</A></LI>
</UL>
<LI>
<A HREF="#3. Distintos tipos de filtros">3. Distintos tipos de filtros</A></LI>
</UL>
<UL>
<UL>
<LI>
<A HREF="#3.1. Filtros de paso baja">3.1. Filtros de paso baja</A></LI>
<LI>
<A HREF="#3.2. Filtros de paso alta">3.2. Filtros de paso alta</A></LI>
<LI>
<A HREF="#3.3. Filtros de paso de banda">3.3. Filtros de paso de banda</A></LI>
<LI>
<A HREF="#3.4. Filtros de detencion de banda">3.4. Filtros de detencion de banda</A></LI>
<LI>
<A HREF="#3.5. Filtros de interpolacion lineal">3.5. Filtros de Interpolacion lineal</A></LI>
</UL>
<LI>
<A HREF="#4. Opciones de los filtros">4. Opciones de los filtros</A></LI>
<UL>
<LI>
<A HREF="#4.1. Cambio de los valores de paso y de detencion">4.1. Cambio de
los valores de paso y de detencion</A></LI>
<LI>
<A HREF="#4.2. Activacion/Desactivacion de cuadrantes">4.2. Activacion/Desactivacion
de cuadrantes</A></LI>
<LI>
<A HREF="#4.3. Cambio del centro de los filtros">4.3. Cambio del centro
de los filtros</A></LI>
</UL>
<LI>
<A HREF="#5. Opciones de color">5. Opciones de color</A></LI>
<UL>
<LI>
<A HREF="#5.1. RGB">5.1 RGB</A></LI>
<LI>
<A HREF="#5.2. HSV">5.2 HSV</A></LI>
</UL>
<LI>
<A HREF="#6. Dos ejemplos">6. Dos ejemplos</A></LI>
</UL>
</OL>
<A NAME="0. Como instalar el programa y donde conseguirlo"></A><B><FONT SIZE=+2>0.
Como instalar el programa y donde conseguirlo</FONT></B>
<P>Para instalar el programa, necesita haber instalado antes el entorno
KDE, que puede conseguir de <A HREF="http://www.kde.org">www.kde.org</A>
.
<BR>Una vez instaladas las librerias de KDE, basta con descomprimir el fichero tfourier-1.0.tgz y ejecutar (entrando en el directorio creado) :
<BR>"configure", "make" y "make install" (este ultimo, como root)
<BR>Una vez hecho esto, ya se puede ejecutar tfourier !
<BR>Tfourier estara en internet a finales de Febrero, en principio en <A HREF="http://www.arrakis.es/~rlarrosa/index.html"> mi
pagina personal</A> y poco despues en cualquier mirror de <A HREF="ftp://ftp.kde.org">ftp.kde.org</A>
<P><A NAME="1. Como cargar imagenes"></A><B><FONT SIZE=+2>1. Como cargar
imagenes</FONT></B>
<P>Para cargar una imagen puede usar 3 metodos:
<BR> 1. Pulsar 'Abrir ...' en el menu 'Archivo'
<BR> 2. Pulsar en el boton de 'Abrir archivo' de la barra
de tareas (<IMG SRC="fileopen.xpm" ALIGN=TEXTTOP>)
<BR> 3. Coger un fichero de una ventana del gestor de
ficheros y arrastrarlo con el raton hasta que este
<BR> sobre la ventana del programa. (haciendo Drag&Drop)
<P>Se pueden abrir imagenes en formato xpm (estandard de XWindows/Linux)
, gif (estandard de Internet, propietario de Compuserve) y bmp (estandard
de Windows).
<BR>Al cargar una imagen, esta debe aparecer en la ventana , en una columna
con 4 imagenes, la primera (superior ) es la imagen cargada, y las otras
tres son la descomposicion de esa imagen en <A HREF="#5.1. RGB">RGB</A>
o <A HREF="#5.2. HSV">HSV</A> segun la <A HREF="#5. Opciones de color">opcion
de color</A> elegida
<BR>
<P><A NAME="1.1 Como grabar una imagen"></A><B><FONT SIZE=+2>1.1 Como grabar
una imagen</FONT></B>
<P>Para grabar una imagen en disco, basta con elegir la opcion "Guardar
..." del menu "Archivo", y una vez hecho esto, pulsar
<BR>con el boton izquierdo del raton sobre la imagen que se quiera guardar,
entonces aparecera un dialogo donde escribir el nombre
<BR>del archivo y (si se desea), cambiar el directorio actual.
<P>Si antes de pulsar sobre una imagen se decide que no se desea grabarla
en disco, se puede volver a seleccionar "Guardar ..." para volver al estado
inicial.
<P>Para guardar una imagen se puede utilizar el formato xpm (si se elige
"Guardar (XPM) ...") o el formato bmp (si se elige "Guardar (BMP)
..."). No es posible guardar una imagen en formato gif pues Compuserve
tiene la patente de este formato y solo esta en el dominio publico la posibilidad
de leerlo, para grabarlo hace falta una licencia.
<P><A NAME="2. Hacer la transformada de Fourier de una imagen"></A><B><FONT SIZE=+2>2.
Hacer la transformada de Fourier de una imagen</FONT></B>
<P>Al hacer la transformada de Fourier, el resultado debe aparecer en una
segunda columna justo al lado de la primera. La transformada de Fourier
se hace a los tres planos descompuestos de la imagen original, y despues
estos se unen para formar la transformada de Fourier general (superior
)
<P>Despues de realizar la transformada de Fourier, se puede realizar la
transformada de Fourier inversa, que, genera imagenes nuevas que aparecen
en una tercera columna, en la que vuelven a aparecer una imagen general
y sus tres descomposiciones ( o quizas seria mas adecuado decir que aparecen
tres imagenes que se unen para formar una imagen general )
<P>Hay dos metodos para hacer la transformada de Fourier :
<P><A NAME="2.1. Transformada original"></A><B><FONT SIZE=+2>2.1. Transformada
original</FONT></B>
<P>Este metodo usa la funcion que dimos en clase para calcular la transformada.
Debido a que hay muchas sumas, senos y cosenos a realizar en cada punto,
este metodo puede resultar sumamente lento.
<BR>Se puede elegir la opcion del menu "Transformada | T.F. Directa" o
la barra de tareas, en el boton <IMG SRC="forward.xpm" ALIGN=TEXTTOP>
<P>Para realizar la inversa, solo hay que elegir "Transformada | T.F. Inversa"
o en la barra de tareas, el boton <IMG SRC="back.xpm" ALIGN=TEXTTOP>
<BR>
<P><A NAME="2.2. Transformada rapida"></A><B><FONT SIZE=+2>2.2. Transformada
rapida</FONT></B>
<P>El metodo que mas se usa es el de la transformada rapida de Fourier
( o FFT ).
<BR>Es millones de veces mas rapido que el original, y de igual precision.
<BR>Encontre el algoritmo de la FFT unidimensional en la revista
Dr Dobbs Journal de Febrero de 1995 y despues lo cambie un poco para que
usara el tipo de datos que me convenia por el programa y para aumentar
un poco la claridad y la velocidad del codigo fuente. Ademas, el algoritmo
es unidimensional, con lo que tuve que dividir una transformada de Fourier
bidimensional en varias unidimensionales en distintas direcciones.
<BR>Se puede elegir la opcion del menu "Transformada | FFT Directa" o en
la barra de tareas, el boton <IMG SRC="finish.xpm" ALIGN=TEXTTOP> asi como la tecla "Espacio" para hacer la FFT de la imagen original
<BR>Para la inversa, estan el menu "Transformada | FFT Inversa", el boton <IMG SRC="start.xpm" ALIGN=TEXTTOP> de la barra de tareas o la tecla de borrado atras (backspace)
<BR>Para realizar una FFT, hace falta que las dimensiones de la imagen
sean potencias de 2 (32, 64, 128 , etc.) por lo que si se carga una imagen
con otras dimensiones (por ejemplo 55x81) en vez de negarse a hacer una
FFT como otros programas, tfourier primero expande la imagen (en el ejemplo,
hasta 64x128), haciendo negro todo el marco creado y despues realiza la
FFT. Para hacer la inversa, la imagen que se muestra en pantalla, se recorta,
para que no muestre el marco negro.
<P><A NAME="3. Distintos tipos de filtros"></A><B><FONT SIZE=+2>3. Distintos
tipos de filtros</FONT></B>
<P>El filtro que se quiere usar se debe elegir del menu Filtros
<BR>Una vez elegido, se puede usar pulsando el boton izquierdo del raton
sobre una imagen de la columna central (transformadas de Fourier). Algunos
filtros requieren dos parametros, para lo que se pulsa el boton derecho.
<BR>Los filtros se pueden pasar a los tres canales de la descomposicion
o solo a uno de ellos, segun se pulse en la imagen superior
<BR>o en las tres inferiores.
<P><A NAME="3.1. Filtros de paso baja"></A><B><FONT SIZE=+2>3.1. Filtros
de paso baja</FONT></B>
<P>Los filtros de paso baja eliminan las altas frecuencias de la imagen,
resultando una imagen mas difuminada.
<BR>Pulsando el boton izquierdo sobre un punto de la imagen se especifica
el radio limite a partir del cual, se eliminan las frecuencias.
<BR>Ejemplo:
<BR><IMG SRC="pasobaja.xpm" >
<P><A NAME="3.2. Filtros de paso alta"></A><B><FONT SIZE=+2>3.2. Filtros
de paso alta</FONT></B>
<P>Los filtros de paso alta eliminan las bajas frecuencias, lo que da una
imagen en la que se aumenta el contraste en los bordes.
<BR>El modo de uso es igual que el del filtro de paso baja
<BR>Ejemplo:
<BR> <IMG SRC="pasoalta.xpm" >
<P>Aqui solo le he quitado un pequeño rango de bajas frecuencias,
con lo que en las baldosas se nota que ya no son de color
<BR>constante como antes, sino que en el centro han cambiado de color.
<P><A NAME="3.3. Filtros de paso de banda"></A><B><FONT SIZE=+2>3.3. Filtros
de paso de banda</FONT></B>
<P>Los filtros de paso de banda, eliminan las frecuencias mas bajas que
una dada y las mas altas que otra frecuencia dada.
<BR>Para ello, necesita definir una corona circular, esto se hace pulsando
con el boton derecho del raton en el radio mayor, y con el boton izquierdo
en el menor.
<BR>Ejemplo:
<BR> <IMG SRC="pasobanda.xpm" >
<P><A NAME="3.4. Filtros de detencion de banda"></A><B><FONT SIZE=+2>3.4. Filtros
de detencion de banda</FONT></B>
<P>Los filtros de detencion de banda (band-stop) eliminan una franja de frecuencias.
El funcionamiento es igual que el de los filtros de paso de banda.
<BR>Ejemplo:
<BR><IMG SRC="parobanda.xpm" >
<P><A NAME="3.5. Filtros de interpolacion lineal"></A><B><FONT SIZE=+2>3.5. Filtros
de interpolacion lineal</FONT></B>
<P>Este filtro es parecido al de Butterworth, pero mientras que un filtro
de Butterworth usa una funcion del estilo :
<BR><IMG SRC="grafbutter.xpm" >
<BR>La interpolacion lineal usa una asi :
<BR><IMG SRC="graflin.xpm" >
<BR>Esto lo he hecho asi porque me parece mas util si se pudiese definir
el rango de frecuencias donde actua propiamente el
<BR>filtro, y para esto necesita dos parametros (por lo que se usa
como el filtro de paso de banda o detencion de banda)
<P>Ejemplo:
<BR><IMG SRC="interplin.xpm" >
<BR>
<P><A NAME="4. Opciones de los filtros"></A><B><FONT SIZE=+2>4. Opciones
de los filtros</FONT></B>
<P>Los filtros son altamente configurables, para lo que tienen varias opciones
que cambian el funcionamiento de cualquiera de los anteriormente descritos.
<P><A NAME="4.1. Cambio de los valores de paso y de detencion"></A><B><FONT SIZE=+2>4.1.
Cambio de los valores de paso y de detencion</FONT></B>
<P>Cuando un valor de la transformada puede pasar o no, en realidad, se
multiplica por un valor de paso o por uno de detencion.
<BR>Por defecto el valor de paso es 1 (dejar el valor como esta) y el valor
de detencion es 0 (al multiplicar por 0 se anula el valor)
<BR>Pero estos son configurables, asi por ejemplo es posible que un filtro
de paso baja, multiplique las frecuencias bajas por 2 y
<BR>haga 0 las altas, o las atenue multiplicandolas por 0.3
<BR>Tambien es posible que un filtro de paso alta, en realidad sea de paso
baja, simplemente haciendo 0 el valor de paso y 1 el de detencion; esto no es
muy util, pero es posible hacerlo.
<BR>Ejemplo:
<BR>Haciendo los valores de paso y de detencion -1 el resultado de cualquier
filtro es :
<BR><IMG SRC="negativo.xpm" >
<P>Esto es logico, pues en la transformada de Fourier es lineal y por tanto, se puede sacar el signo negativo introducido como factor comun y lo que queda es el negativo de la imagen original
<P><A NAME="4.2. Activacion/Desactivacion de cuadrantes"></A><B><FONT SIZE=+2>4.2.
Activacion/Desactivacion de cuadrantes</FONT></B>
<P>Para comprender mejor el funcionamiento de la transformada de Fourier,
es posible ver que pasa si los filtros, en vez de actuar sobre toda la
transformada, lo hacen sobre uno o varios de los cuadrantes de la images.
<BR>En el menu Filtros, submenu Cuadrantes, se pueden activar y desactivar
los 4 cuadrantes.
<BR>Este son los resultados de eliminar 3 cuadrantes y dejar solo ...
<BR>...el primer cuadrante , el segundo :
<BR><IMG SRC="cuad1.xpm" ><IMG SRC="cuad2.xpm" >
<P>... el tercer cuadrante, y el cuarto:
<BR><IMG SRC="cuad3.xpm" ><IMG SRC="cuad4.xpm" >
<P><A NAME="4.3. Cambio del centro de los filtros"></A><B><FONT SIZE=+2>4.3.
Cambio del centro de los filtros</FONT></B>
<P>Por defecto, el centro de los filtros coincide con el centro de la imagen
(valor nulo de la frecuencia), pero, ¿Que pasa si en una transformada
como la siguiente se quiere eliminar una de esas "estrellas" ?
<BR><IMG SRC="joelmag.xpm" >
<P>Esto es posible cambiando el centro de los filtros, si despues se elige
un filtro de paso alta, se podra eliminar ese punto de
<BR>acumulacion de las frecuencias.
<BR>Una vez elegida la opcion, el centro de los filtros se fijara en el
punto donde se pulse el boton izquierdo del raton. Si una vez elegida la
opcion se decide no cambiar el centro, se puede desactivar, eligiendo de
nuevo "Cambiar Centro" del menu "Filtros"
<P><A NAME="5. Opciones de color"></A><B><FONT SIZE=+2>5. Opciones de color</FONT></B>
<P>En el menu Opciones, se puede cambiar el metodo de descomposicion de
las imagenes :
<P><A NAME="5.1. RGB"></A><B><FONT SIZE=+2>5.1. RGB</FONT></B>
<P>Si se elige RGB, las imagenes se descompondran en sus planos Rojo (Red),
Verde (Green), y Azul (Blue) :
<BR><IMG SRC="r.xpm" ><IMG SRC="g.xpm" ><IMG SRC="b.xpm" >
<BR>
<BR>
<P><A NAME="5.2. HSV"></A><B><FONT SIZE=+2>5.2. HSV</FONT></B>
<BR>
<BR>Si se elige HSV, las imagenes se descompondran en planos de Tonalidad
(Hue) , Saturacion (Saturation) y Valor (Value)
<BR><IMG SRC="h.xpm" ><IMG SRC="s.xpm" ><IMG SRC="v.xpm" >
<P><A NAME="6. Dos ejemplos"></A><B><FONT SIZE=+2>6. Dos ejemplos</FONT></B>
<P>Para terminar voy a poner dos ejemplos:
<BR><A HREF="#4.3. Cambio del centro de los filtros">Poniendo el centro</A>
de los filtros en medio del segundo cuadrante y pasando un <A HREF="#3.5. Filtros de interpolacion lineal">filtro
lineal</A> cada vez mas cerrado , queda la siguiente secuencia de transformadas
de Fourier e imagenes :
<P><IMG SRC="bordef1.xpm" ><IMG SRC="bordef2.xpm" ><IMG SRC="bordef3.xpm" ><IMG SRC="bordef4.xpm" >
<BR><IMG SRC="bordet1.xpm" ><IMG SRC="bordet2.xpm" ><IMG SRC="bordet3.xpm" ><IMG SRC="bordet4.xpm" >
<BR>
</P>
<P>
Y un ejemplo de como usar la transformada de Fourier para eliminar ruidos en una imagen, la imagen original y su transformada son :
<P><IMG SRC="moose1_orig.xpm" ><IMG SRC="moose2_fourier.xpm" >
</P>
<P>
Si le pasamos un filtro de detencion de banda, la transformada y la imagen quedan asi :
<P><IMG SRC="moose3_fourier.xpm" ><IMG SRC="moose4_final.xpm" >
</P>
<P>
y en la imagen original ha desaparecido el ruido !
</P>
<P>
He dejado algunas imagenes para probar el programa en el directorio "ejemplos"</P>
</BODY>
</HTML>
kfourier-1.1/kfourier/help/grafbutter.xpm 100644 1750 144 10315 6473664273 20002 0 ustar antonio users /* XPM */
static char * grafbutter_xpm[] = {
"80 50 2 1",
" c #FFFFFFFFFFFF",
". c #000000000000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" . ",
" . ",
" . ",
" . ",
" . ....... ",
" . ..... ",
" . ... ",
" . . ",
" . . ",
" . .. ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . .. ",
" . .. ",
" . ... ",
" . ... ",
" . ...... ",
" . ......... ",
" . ",
" . ",
" ....................................................................... ",
" . ",
" . ",
" . ",
" . ",
" . ",
" . ",
" . ",
" ",
" ",
" ",
" "};
kfourier-1.1/kfourier/help/kfourier.html 100644 1750 144 32702 6473666311 17622 0 ustar antonio users <HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/4.03 [en] (X11; I; Linux 2.0.29 i586) [Netscape]">
</HEAD>
<BODY>
<CENTER>
<H1>
<B><U><FONT SIZE=+2>KFOURIER</FONT></U></B></H1></CENTER>
<CENTER><FONT SIZE=+2>By <B>Antonio Larrosa Jimenez</B></FONT></CENTER>
<CENTER><FONT SIZE=+1></FONT></CENTER>
<B><FONT SIZE=+2>Index</FONT></B>
<OL>
<UL>
<LI>
<A HREF="#0. How to install the program and where to find it">0. How to install
the program and where to find it</A></LI>
<LI>
<A HREF="#1. How to load images">1. How to load images</A></LI>
<UL>
<LI>
<A HREF="#1.1 How to save images">1.1 How to save images</A></LI>
</UL>
<LI>
<A HREF="#2. Doing the Fourier transform of an image">2. Doing the
Fourier transform of an image</A></LI>
<UL>
<LI>
<A HREF="#2.1. Original transform">2.1. Original transformada</A></LI>
<LI>
<A HREF="#2.2. Fast transform">2.2. Fast transform</A></LI>
</UL>
<LI>
<A HREF="#3. Some filters">3. Some filters</A></LI>
</UL>
<UL>
<UL>
<LI>
<A HREF="#3.1. Low pass filters">3.1. Low pass filters</A></LI>
<LI>
<A HREF="#3.2. High pass filters">3.2. High pass filters</A></LI>
<LI>
<A HREF="#3.3. Band pass filters">3.3. Band pass filters</A></LI>
<LI>
<A HREF="#3.4. Band stop filters">3.4. Band stop filters</A></LI>
<LI>
<A HREF="#3.5. Linear interpolation filters">3.5. Linear interpolation filters</A></LI>
</UL>
<LI>
<A HREF="#4. Filter options">4. Filter options</A></LI>
<UL>
<LI>
<A HREF="#4.1. Pass and stop value change">4.1. Pass and stop value change</A></LI>
<LI>
<A HREF="#4.2. Activating/Desactivating cuadrants">4.2. Activating/Desactivating
cuadrants</A></LI>
<LI>
<A HREF="#4.3. Changing center of filters">4.3. Changing center of filters</A></LI>
</UL>
<LI>
<A HREF="#5. Color options">5. Color options</A></LI>
<UL>
<LI>
<A HREF="#5.1. RGB">5.1 RGB</A></LI>
<LI>
<A HREF="#5.2. HSV">5.2 HSV</A></LI>
</UL>
<LI>
<A HREF="#6. Examples">6. Examples</A></LI>
</UL>
</OL>
<P>
NOTE: I've not included the bitmaps in the source package because it would
make it grow up to 1.5 Mb , so it will appear some broken links through this
file, if you want to have also the images, go to kfourier's homepage and
download the images from there, where you will find them in a separate package.
Sorry for the inconveniences.
</P>
<A NAME="0. How to install the program and where to find it"></A><B><FONT SIZE=+2>0.
How to install the program and where to find it</FONT></B>
<BR>Once installed the KDE libs, you just have to decompress the file kfourier-1.1.tgz and execute in the newly created directory :
<BR>"configure", "make" and "make install" (the last one as root)
<BR>You can now run kfourier !
<BR>You can download the latest version of kfourier from its homepage, at <A HREF="http://www.arrakis.es/~rlarrosa/kfourier.html"> http://www.arrakis.es/~rlarrosa/kfourier.html</A>
<P><A NAME="1. How to load images"></A><B><FONT SIZE=+2>1. How to load images</FONT></B>
<P>To load an image you can use 3 methods:
<BR> 1. Press 'Open ...' from the 'File' menu
<BR> 2. Press the 'Open file' button in the toolbar (<IMG SRC="fileopen.xpm" ALIGN=TEXTTOP>)
<BR> 3. Take a file from the kfm and drag it to kfourier's window (doing Drag&Drop)
<P>You can open files in xpm,gif and bmp formats
<BR>When you load an image, it should appear a column with 4 images
, the first one (upper) is the loaded image, and the other 3 are the decomposition in <A HREF="#5.1. RGB">RGB</A>
or <A HREF="#5.2. HSV">HSV</A> following the choosed <A HREF="#5. Color options">color option</A>
<BR>
<P><A NAME="1.1 How to save an image"></A><B><FONT SIZE=+2>1.1 How to save an image</FONT></B>
<P>To save an image to the disk, you just have to choose the option "Save(BMP)
..." or "Save (XPM)..." from the 'File" menu, once done that, just click
<BR>with the mouse on the image you wish to save, then it will appear a window
where you can write the name of the new file
<P>If you decide not to save an image just before clicking over any, but you have already selected the "Save ..." menu, you can press on it again to deselect it
<P>You can choose to save in XPM or BMP formats by selecting the 'Save (XPM)...' or 'Save (BMP)...' options in the menu. It's not possible to save an image in
gif format because I would need a licence from Compuserve who has a patent over
the gif format.
<P><A NAME="2. Doing the Fourier transform of an image"></A><B><FONT SIZE=+2>2.
Doing the Fourier transform of an image</FONT></B>
<P>When doing the Fourier transform of an image the result will appear in a second row just next to the first. The Fourier transform is made to the 3 decomposed planes of the original image and then they are joint to make the Fourier transform (upper)
<P>After doing the Fourier transform, you can do the inverse Fourier transform
that generates new images that appear on a third row in which it appear again
a general image and their decomposition (or perhaps it would be better to say
that appear three images that are joint to make a general image)
<P>There are two methods to do the Fourier transform :
<P><A NAME="2.1. Original transform"></A><B><FONT SIZE=+2>2.1. Original transform</FONT></B>
<P>This method uses the definition of the Fourier transform to calculate it.
Due to the lot of sins, cosins, and additions that are required for each point, this method is EXTREMELY SLOW.
<BR>You can choose the menu option "Transform | Forward F.T." or
from the toolbar, the button <IMG SRC="forward.xpm" ALIGN=TEXTTOP>
<P>To calculate the inverse, you just have to choose "Transform | Inverse F.T."
or from the toolbar, the button <IMG SRC="back.xpm" ALIGN=TEXTTOP>
<BR>
<P><A NAME="2.2. Fast transform"></A><B><FONT SIZE=+2>2.2. Fast transform</FONT></B>
<P>The more often used method is the fast Fourier transform (or FFT)
<BR>It's millions and millions faster than the original, and with the same precision.
<BR>I found the one-dimensional FFT algorith in Dr Dobbs Journal of February from 1995 and then I change it a little to use the data type that I needed and to clarify it a little. Also, the algorithm was one-dimensional and I needed to do a two-dimensional FFT, so I had to divide a two dimensional F.T. in many one-dimensional in different directions to use this algorithm
<BR>You can choose the "Transform | Forward FFT" option in the menu, or in the toolbar, the button <IMG SRC="finish.xpm" ALIGN=TEXTTOP> , or just the space key from the keyboard
<BR>To do the inverse FFT, you can choose "Transform | Inverse FFT", the button <IMG SRC="start.xpm" ALIGN=TEXTTOP> in the toolbar or the backspace key
<BR>To realize a FFT it's needed for the dimensions of the image to be a power of 2 (32, 64, 128 , etc.) that's why if you load an image with other dimensions (i.e. 55x81) instead of rejecting it, kfourier first expands the image (in the example, to 64x128), doing black all the created frame and then it calculates the FFT. To do the inverse, the image that is shown in the screen is cropped so that the black frame is not showed.
<P><A NAME="3. Some filters"></A><B><FONT SIZE=+2>3. Some filters</FONT></B>
<P>You have to choose from the Filters menu, the filter you want to use
<BR>Once choosed, you can use it by pressing with the left mouse button over
an image of the central column (Fourier transforms). Some filters require
two parameter, so they also use the right button.
<BR>The filters can be used on the three channels or just on only one of them, by pressing on the upper image, or in the three others.
<P><A NAME="3.1. Low pass filters"></A><B><FONT SIZE=+2>3.1. Low pass filters</FONT></B>
<P>The low pass filters remove the high frequencies of an image, thus leaving a soften image.
<BR>Pressing with the left button over a point of the transform, you select the limit radius, so that higher frequencies will be removed
<BR>Example:
<BR><IMG SRC="pasobaja.xpm" >
<P><A NAME="3.2. High pass filters"></A><B><FONT SIZE=+2>3.2. High pass filters</FONT></B>
<P>The high pass filters remove the low frequencies, so the result image has increased the edges contrast
<BR>It's used just as the low pass filter
<BR>Example:
<BR> <IMG SRC="pasoalta.xpm" >
<P><A NAME="3.3. Band pass filters"></A><B><FONT SIZE=+2>3.3. Band pass filters</FONT></B>
<P>Tha band pass filters, remove the frequencies that are lower than a specified one and higher that another specified one
<BR>For that you must define a circular crown, you can do that, by pressing
with the right button on the bigger radius, and then with the left button on the smallest one.
<BR>Example:
<BR> <IMG SRC="pasobanda.xpm" >
<P><A NAME="3.4. Band stop filters"></A><B><FONT SIZE=+2>3.4. Band stop filters</FONT></B>
<P>The band stop filters remove a range of frequencies.
They work as the band pass filters.
<BR>Example:
<BR><IMG SRC="parobanda.xpm" >
<P><A NAME="3.5. Linear interpolation filters"></A><B><FONT SIZE=+2>3.5. Linear interpolation filters</FONT></B>
<P>This filter is similar to the Butterworth one, but while a Butterworth filter uses a function like this :
<BR><IMG SRC="grafbutter.xpm" >
<BR>The linear interpolation uses one like that :
<BR><IMG SRC="graflin.xpm" >
<BR>I have made this in that way because I though that it might be more useful to have a filter with two parameters thus defining a range of frequencies
where the filter works (so it's used as a band pass or band stop filter)
<P>Example:
<BR><IMG SRC="interplin.xpm" >
<BR>
<P><A NAME="4. Filter options"></A><B><FONT SIZE=+2>4. Filter options</FONT></B>
<P>The filters are highly configurables, so they are some options
that change the way of working of any of them.
<P><A NAME="4.1. Pass and stop value change"></A><B><FONT SIZE=+2>4.1.
Pass and stop value change</FONT></B>
<P>When a value of the transform can pass or not, it's really multiplied by a pass or stop value.
<BR>By default, the pass value is 1 (leaving the value just as it is) and the
stop value is 0 (multiplying by 0, the value is made 0)
<BR>But this values are configurable, so it's possible that a low pass filter multiply the low frequencies by 2 and make 0 the high freqs. or soft them a little, multiplying them by 0.3
<BR>It's also possible (but not too interesting) to use a low pass filter achieve the same result than a high pass filter, just by making 0 the pass value and 1 the stop value
<BR>Example:
<BR>By setting both the pass and stop value to -1 you can obtaing with any filter the same result :
<BR><IMG SRC="negativo.xpm" >
<P>This is obviously the negative of the image, because the Fourier transform is a linear transform
<P><A NAME="4.2. Activating/Desactivating cuadrants"></A><B><FONT SIZE=+2>4.2. Activating/Desactivating cuadrants</FONT></B>
<P>To understand better the workings of a Fourier transform, it's possible to see what happens if you make the filter work only over one or selected cuadrants instead of all the transform.
<BR>In the Filters menu, Cuadrants submenu, you can activate and desactivate the 4 cuadrants
<BR>This are the results of removing the 3 cuadrants and leaving only ...
<BR>...the first cuadrant, the second :
<BR><IMG SRC="cuad1.xpm" ><IMG SRC="cuad2.xpm" >
<P>... the third cuadrant, and the fourth:
<BR><IMG SRC="cuad3.xpm" ><IMG SRC="cuad4.xpm" >
<P><A NAME="4.3. Changing center of filters"></A><B><FONT SIZE=+2>4.3. Changing center of filters</FONT></B>
<P>By default the center of filters is set to the center of the image
(void value of the frequencies), but, what about removing one of the following "stars" ?
<BR><IMG SRC="joelmag.xpm" >
<P>This is possible by changing the center of the filters, so if you then choose a high pass filter, you can remove that point of accumulation of frequencies
<BR>Once choosen the option, the center of the filters will be set
on the point where you press the left button. If once choosen, you decide
not to change the center, you can desactivate it by choosing it again
from the menu
<P><A NAME="5. Color options"></A><B><FONT SIZE=+2>5. Color options</FONT></B>
<P>In the 'Options' menu, you can change the decomposition method of the images:
<P><A NAME="5.1. RGB"></A><B><FONT SIZE=+2>5.1. RGB</FONT></B>
<P>If you choose RGB, the images will be decomposed in the Red, Green and Blue channels:
<BR><IMG SRC="r.xpm" ><IMG SRC="g.xpm" ><IMG SRC="b.xpm" >
<BR>
<BR>
<P><A NAME="5.2. HSV"></A><B><FONT SIZE=+2>5.2. HSV</FONT></B>
<BR>
<BR>If you choose HSV, the images will be decomposed in the Hue, Saturation and Value channels:
<BR><IMG SRC="h.xpm" ><IMG SRC="s.xpm" ><IMG SRC="v.xpm" >
<P><A NAME="6. Examples"></A><B><FONT SIZE=+2>6. Examples</FONT></B>
<P>To finish, I will give two examples:
<BR><A HREF="#4.3. Changing center of filters">Placing the center</A>
of the filters in the middle of the second cuadrant and using a <A HREF="#3.5. Linear interpolation filters"> linear filter
</A> closing it each time , you can get the following sequence of Fourier transforms and images:
<P><IMG SRC="bordef1.xpm" ><IMG SRC="bordef2.xpm" ><IMG SRC="bordef3.xpm" ><IMG SRC="bordef4.xpm" >
<BR><IMG SRC="bordet1.xpm" ><IMG SRC="bordet2.xpm" ><IMG SRC="bordet3.xpm" ><IMG SRC="bordet4.xpm" >
<BR>
</P>
<P>
And an example on how to use the Fourier transform to remove noise of an image, the original image and it transform are:
<P><IMG SRC="moose1_orig.xpm" ><IMG SRC="moose2_fourier.xpm" >
</P>
<P>
If we use a band stop filter the transform and the image are left this way:
<P><IMG SRC="moose3_fourier.xpm" ><IMG SRC="moose4_final.xpm" >
</P>
<P>
and the noise has been removed from the original image !
</P>
</BODY>
</HTML>
kfourier-1.1/kfourier/help/graflin.xpm 100644 1750 144 10312 6473664273 17254 0 ustar antonio users /* XPM */
static char * graflin_xpm[] = {
"80 50 2 1",
" c #FFFFFFFFFFFF",
". c #000000000000",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" . ",
" . ",
" . ",
" . ",
" . ............ ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . . ",
" . ..................... ",
" ....................................................................... ",
" . ",
" . ",
" . ",
" . ",
" . ",
" . ",
" . ",
" ",
" ",
" ",
" "};
kfourier-1.1/kfourier/COPYING 100444 1750 144 43217 6461475226 15212 0 ustar antonio users GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
59 Temple Place - Suite 330
Boston, MA 02111-1307, USA.
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
1. You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
2. You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
b) You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
c) If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
a) Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
b) Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
c) Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
5. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
7. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
9. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
10. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
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; see the file COPYING. If not, write to
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the appropriate
parts of the General Public License. Of course, the commands you use may
be called something other than `show w' and `show c'; they could even be
mouse-clicks or menu items--whatever suits your program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
`Gnomovision' (which makes passes at compilers) written by James Hacker.
<signature of Ty Coon>, 1 April 1989
Ty Coon, President of Vice
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
Public License instead of this License.
kfourier-1.1/kfourier/fft1d.cc 100644 1750 144 10042 6461473720 15457 0 ustar antonio users /**************************************************************************
fft1d.cc - The 1 dimension FFT algorithm from Dr Dobbs Journal
changed to clarify and optimize a bit
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., 675 Mass Ave, Cambridge, MA 02139, USA.
Send comments and bug fixes to antlarr@arrakis.es
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
***************************************************************************/
#include "fft1d.h"
#include <sys/types.h>
#include <stdio.h>
static double CosArray[28]=
{ /* cos (-2pi/N) for N=2,4,8,...,16384 */
-1.00000000000000, 0.00000000000000, 0.70710678118655,
0.92387953251129, 0.98078528040323, 0.99518472667220,
0.99879545620517, 0.99969881869620, 0.99992470183914,
0.99998117528260, 0.99999529380958, 0.99999882345170,
0.99999970586288, 0.99999992646572,
/* cos (2pi/N) for N=2,4,8...16384 */
-1.00000000000000, 0.00000000000000, 0.70710678118655,
0.92387953251129, 0.98078528040323, 0.99518472667220,
0.99879545620517, 0.99969881869620, 0.99992470183914,
0.99998117528260, 0.99999529380958, 0.99999882345170,
0.99999970586288, 0.99999992646572
};
static double SinArray[28]=
{ /* sin (-2pi/N) for N=2,4,8,...,16384 */
0.00000000000000, -1.00000000000000, -0.70710678118655,
-0.38268343236509, -0.19509032201613, -0.09801714032956,
-0.04906767432742, -0.02454122852291, -0.01227153828572,
-0.00613588464915, -0.00306795676297, -0.00153398018628,
-0.00076699031874, -0.00038349518757,
/* sin (2pi/N) for N=2,4,8,...,16384 */
0.00000000000000, 1.00000000000000, 0.70710678118655,
0.38268343236509, 0.19509032201613, 0.09801714032956,
0.04906767432742, 0.02454122852291, 0.01227153828572,
0.00613588464915, 0.00306795676297, 0.00153398018628,
0.00076699031874, 0.00038349518757
};
u_int ShuffleIndex(u_int i, int WordLength)
{
u_int NewIndex;
u_char BitNr;
NewIndex=0;
for (BitNr=0;BitNr<=WordLength-1;BitNr++)
{
NewIndex=NewIndex << 1;
if ((i&1)!=0) NewIndex = NewIndex+1;
i = i >> 1;
};
return NewIndex;
};
void Shuffle2Arr(double_complex *a, int bitlength)
{
u_int indexOld,indexNew;
double_complex temp;
u_int N;
int bitlengthtemp;
bitlengthtemp=bitlength;
N=1;
do
{
N=N*2;
bitlength=bitlength-1;
} while (bitlength > 0);
for (indexOld=0; indexOld <= N-1 ;indexOld++)
{
indexNew = ShuffleIndex(indexOld,bitlengthtemp);
if (indexNew > indexOld)
{
temp=a[indexOld];
a[indexOld]=a[indexNew];
a[indexNew]=temp;
};
};
};
void FFT( double_complex *data, int Pwr, int Dir)
{
int pwrhelp;
int N;
int Section;
int AngleCounter;
int FlyDistance;
int FlyCount;
int index1,index2;
double_complex temp;
double scale;
double_complex Q;
Shuffle2Arr(data,Pwr);
pwrhelp=Pwr;
N=1;
do
{
N*=2;
pwrhelp--;
} while (pwrhelp>0);
if (Dir>=1) AngleCounter=0;
else AngleCounter=14;
Section=1;
while (Section<N)
{
FlyDistance = 2*Section;
double_complex giro(CosArray[AngleCounter],SinArray[AngleCounter]);
Q*=0;
Q+=1;
for (FlyCount=0;FlyCount<=Section-1;FlyCount++)
{
index1=FlyCount;
do
{
index2 = index1 + Section;
temp= Q*data[index2];
data[index2]=data[index1]-temp;
data[index1]=data[index1]+temp;
index1=index1+FlyDistance;
} while (index1 <= (N-1));
Q=Q*giro;
};
Section*=2;
AngleCounter++;
};
if (Dir<=0)
{
scale = 1.0/N;
for (index1=0;index1<=N-1;index1++)
{
data[index1]*=scale;
};
};
};
kfourier-1.1/kfourier/tfourier.cc 100644 1750 144 4576 6477577124 16323 0 ustar antonio users /**************************************************************************
tfourier.cc - The functions that do the Fourier transform by its definition
Copyright (C) 1998 Antonio Larrosa Jimenez
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., 675 Mass Ave, Cambridge, MA 02139, USA.
Send comments and bug fixes to antlarr@arrakis.es
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
***************************************************************************/
#include "tfourier.h"
#include <stdio.h>
#include <math.h>
int FT_Direct(int w,int h,u_int **in,double_complex **out)
{
/*
h-1 w-1
/- ___ ___
I- [f](n,m) = \ \ i 2 PI (ni/w+mj/h)
J /__ /__ f(i,j) e
j=0 i=0
i a
e = cos (a) + i sen (a)
*/
double f;
int m,n;
int i,j;
double pi2=2*PI;
double_complex cmplx(0,0);
for (m=0;m<h;m++)
{
printf("Row : %d\n",m);
for (n=0;n<w;n++)
{
// Calculate F[f](n,m)
cmplx*=0;
for (j=0;j<h;j++)
{
for (i=0;i<w;i++)
{
f=-pi2*((double)(n*i)/(double)w+(double)(m*j)/(double)h);
double_complex tmp(cos(f),sin(f));
cmplx+=in[j][i]*tmp;
};
};
out[m][n]=cmplx;
};
};
return 0;
};
int FT_Inverse(int w,int h, double_complex **in,u_int **out)
{
double f;
int m,n;
int i,j;
double pi2=2*PI;
double tempreal;
for (m=0;m<h;m++)
{
printf("Row : %d\n",m);
for (n=0;n<w;n++)
{
// Calculate F[f](n,m)
tempreal=0;
for (j=0;j<h;j++)
{
for (i=0;i<w;i++)
{
f=pi2*((double)(n*i)/(double)w+(double)(m*j)/(double)h);
double_complex tmp(cos(f),sin(f));
tmp=tmp * in[j][i];
tempreal+=tmp.real();
};
};
out[m][n]=(u_int)(tempreal/(double)(w*h));
};
};
return 0;
};
kfourier-1.1/kfourier/fft1d.h 100644 1750 144 2172 6461474013 15302 0 ustar antonio users /**************************************************************************
fft1d.h - The 1 dimension FFT algorithm header
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., 675 Mass Ave, Cambridge, MA 02139, USA.
Send comments and bug fixes to antlarr@arrakis.es
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
***************************************************************************/
#ifndef FFT1D_H
#define FFT1D_H
#include <complex.h>
void FFT(double_complex *data, int Pwr, int Dir);
#endif
kfourier-1.1/kfourier/fft2d.cc 100644 1750 144 6574 6461474000 15447 0 ustar antonio users /**************************************************************************
fft2d.cc - The 2D FFT algorithm (based in the 1D FFT)
Copyright (C) 1998 Antonio Larrosa Jimenez
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., 675 Mass Ave, Cambridge, MA 02139, USA.
Send comments and bug fixes to antlarr@arrakis.es
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
***************************************************************************/
#include "fft2d.h"
#include "fft1d.h"
#include <stdio.h>
#include <unistd.h>
#include "pow2.h"
double_complex *Allocate_complex_array(int l)
{
double_complex *data=new double_complex[l];
if (data==NULL)
{
printf("No memory\n");
exit(1);
};
return data;
};
void FFT2D(double_complex **in, double_complex **out,int w,int h, int Dir)
{
printf("Preparing data ...\n");
double_complex **temp;
int i,j;
int w_bits,h_bits;
w_bits=(int)(ceil(log(w)/log(2)));
h_bits=(int)(ceil(log(h)/log(2)));
//printf("w : %d,%d, h : %d,%d\n",w,w_bits,h,h_bits);
temp=new double_complex*[h];
for (i=0;i<h;i++)
{
temp[i]=Allocate_complex_array(w);
for (j=0;j<w;j++)
{
temp[i][j]=in[i][j];
};
};
printf("Doing Horiz FFT ...\n");
for (i=0;i<h;i++)
{
// printf("Row %d\n",i);
FFT(temp[i],w_bits,Dir);
};
printf("Preparing 2nd data ...\n");
double_complex **temp2=new double_complex*[w];
for (i=0;i<w;i++)
{
temp2[i]=Allocate_complex_array(h);
for (j=0;j<h;j++)
{
temp2[i][j]=temp[j][i];
};
};
printf("Doing Vert FFT ...\n");
for (i=0;i<w;i++)
{
// printf("Column %d\n",i);
FFT(temp2[i],h_bits,Dir);
};
for (i=0;i<h;i++)
{
for (j=0;j<w;j++)
out[i][j]=temp2[j][i];
};
printf("Deallocating memory ...\n");
for (i=0;i<w;i++)
{
delete temp2[i];
};
delete temp2;
for (i=0;i<h;i++)
{
delete temp[i];
};
delete temp;
};
void FFT2D_real(u_int **in, double_complex **out,int w,int h, int Dir)
{
w=is2pow(w);
h=is2pow(h);
printf("Converting real to complex array... \n");
double_complex **input;
input=new double_complex*[h];
int i,j;
for (i=0;i<h;i++)
{
input[i]=Allocate_complex_array(w);
for (j=0;j<w;j++)
input[i][j]=in[i][j];
};
FFT2D(input,out,w,h,Dir);
for (i=0;i<h;i++)
delete input[i];
delete input;
};
void FFT2D_real(double_complex **in, u_int **out,int w,int h, int Dir)
{
w=is2pow(w);
h=is2pow(h);
printf("Allocating temp complex array ... \n");
double_complex **output;
output=new double_complex*[h];
int i,j;
for (i=0;i<h;i++)
output[i]=Allocate_complex_array(w);
printf("Doing 2D FFT ...\n");
FFT2D(in,output,w,h,Dir);
printf("Converting real to complex array... \n");
for (i=0;i<h;i++)
for (j=0;j<w;j++)
out[i][j]=(u_int)(output[i][j].real());
for (i=0;i<h;i++)
delete output[i];
delete output;
};
kfourier-1.1/kfourier/pow2.h 100644 1750 144 2327 6461474566 15204 0 ustar antonio users /**************************************************************************
pow2.h - A simple function that returns the next power of 2
Copyright (C) 1998 Antonio Larrosa Jimenez
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., 675 Mass Ave, Cambridge, MA 02139, USA.
Send comments and bug fixes to antlarr@arrakis.es
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
***************************************************************************/
#ifndef POW2_H
#define POW2_H
int is2pow(int i);
// Returns i if i is a power of 2 or the smaller power of 2
// that is larger than i
#endif
kfourier-1.1/kfourier/pow2.cc 100644 1750 144 2315 6463160630 15321 0 ustar antonio users /**************************************************************************
pow2.cc - A simple function that returns the next power of 2
Copyright (C) 1998 Antonio Larrosa Jimenez
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., 675 Mass Ave, Cambridge, MA 02139, USA.
Send comments and bug fixes to antlarr@arrakis.es
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
***************************************************************************/
#include "pow2.h"
#include <math.h>
int is2pow(int i)
{
int i_bits=(int)ceil(log(i)/log(2));
int j=(int)pow(2,i_bits);
return j;
};
kfourier-1.1/kfourier/cfgdlg.cpp 100644 1750 144 5127 6464033746 16071 0 ustar antonio users /**************************************************************************
cfgdlg.cpp - The dialog to configure the pass and stop values
Copyright (C) 1998 Antonio Larrosa Jimenez
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., 675 Mass Ave, Cambridge, MA 02139, USA.
Send comments and bug fixes to antlarr@arrakis.es
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
***************************************************************************/
#include "cfgdlg.moc"
#include <qpushbt.h>
#include <qlistbox.h>
#include <qlabel.h>
#include <qfiledlg.h>
#include <kapp.h>
#include <qlined.h>
#include <qvalidator.h>
#include <values.h>
#include <stdlib.h>
ConfigDialog::ConfigDialog(double pv,double sv, QWidget *parent,const char *name) : QDialog(parent,name,TRUE)
{
passvalue=pv;
stopvalue=sv;
setCaption("Configura los valores de paso y de detencion");
setMinimumSize(360,240);
setMaximumSize(360,240);
ok=new QPushButton("OK",this);
ok->setGeometry(140,200,100,30);
connect(ok,SIGNAL(clicked()),SLOT(accept()) );
cancel=new QPushButton("Cancelar",this);
cancel->setGeometry(250,200,100,30);
connect(cancel,SIGNAL(clicked()),SLOT(reject()) );
char tmp[100];
sprintf(tmp,"%g",passvalue);
label=new QLabel("Valor de paso :",this);
label->adjustSize();
label->move(10,10);
ledit_pv=new QLineEdit(this,"pv");
ledit_pv->setGeometry(10,30,340,30);
valid=new QDoubleValidator(-MAXDOUBLE,MAXDOUBLE,5,this,"validate");
ledit_pv->setValidator(valid);
ledit_pv->setText(tmp);
sprintf(tmp,"%g",stopvalue);
label2=new QLabel("Valor de detencion :",this);
label2->adjustSize();
label2->move(10,70);
ledit_sv=new QLineEdit(this,"sv");
ledit_sv->setGeometry(10,90,340,30);
valid2=new QDoubleValidator(-MAXDOUBLE,MAXDOUBLE,5,this,"validate2");
ledit_sv->setValidator(valid);
ledit_sv->setText(tmp);
};
void ConfigDialog::accept()
{
passvalue=strtod(ledit_pv->text(),NULL);
stopvalue=strtod(ledit_sv->text(),NULL);
QDialog::accept();
};
double ConfigDialog::passvalue=1;
double ConfigDialog::stopvalue=0;
kfourier-1.1/kfourier/cfgdlg.h 100644 1750 144 3140 6461474165 15530 0 ustar antonio users /**************************************************************************
cfgdlg.h - The dialog to configure the pass and stop values
Copyright (C) 1998 Antonio Larrosa Jimenez
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., 675 Mass Ave, Cambridge, MA 02139, USA.
Send comments and bug fixes to antlarr@arrakis.es
or to Antonio Larrosa, Rio Arnoya, 10 5B, 29006 Malaga, Spain
***************************************************************************/
#include <qdialog.h>
class DeviceManager;
class QLabel;
class QPushButton;
class QListBox;
class QLineEdit;
class QDoubleValidator;
class ConfigDialog : public QDialog
{
Q_OBJECT
public:
ConfigDialog(double pv,double sv,QWidget *parent,const char *name);
private:
QLabel *label;
QLabel *label2;
QLineEdit *ledit_pv;
QLineEdit *ledit_sv;
QDoubleValidator *valid;
QDoubleValidator *valid2;
QPushButton *ok;
QPushButton *cancel;
public:
static double passvalue;
static double stopvalue;
protected slots:
virtual void accept();
};
kfourier-1.1/kfourier/kfourier.kdelnk 100644 1750 144 512 6520664707 17130 0 ustar antonio users # KDE Config File
[KDE Desktop Entry]
Comment[C]=Transformada de Fourier
BinaryPattern=kfourier;
Name=Transformada de Fourier
Protocols=file;
Name[C]=Transformada de Fourier
MimeType=
Comment=Transformada de Fourier
Exec=kfourier
Icon=kfourier.xpm
TerminalOptions=
Path=
DocPath=kfourier/kfourier.html
Type=Application
Terminal=0
kfourier-1.1/kfourier/README 100644 1750 144 535 6477577237 15011 0 ustar antonio users Hi,
Thanks for trying kfourier 1.1, I made this program as a work for a subject
called "Image processing", and this is what I gave to my teacher translated
to english.
I hope that you like it,
tell me if you need help or want to improve the program.
Bye,
Antonio Larrosa Jimenez
antlarr@arrakis.es
http://www.arrakis.es/~rlarrosa/kfourier.html
kfourier-1.1/kfourier/kfourier-1.1.lsm 100644 1750 144 1207 6473674323 16774 0 ustar antonio users Begin
Title: kfourier
Version: 1.1
Entered-date: 220298
Description: Image processing application with lots of filters
Keywords: image process fourier transform filter photoshop gif bmp
Author: Antonio Larrosa Jimenez <antlarr@arrakis.es>
Maintained-by: Antonio Larrosa Jimenez <antlarr@arrakis.es>
Primary-site: http://www.arrakis.es/~rlarrosa/kfourier.html
File1: kfourier-1.1.tgz
Home-page: http://www.arrakis.es/~rlarrosa/kfourier.html
Original-site: http://www.arrakis.es/~rlarrosa/kfourier.html
Platform: Linux, BSD and others, needs Qt 1.3,X11 and kde libs
Copying-policy: GPL
End
kfourier-1.1/INSTALL 100644 1750 144 15472 6412167357 13365 0 ustar antonio users Basic Installation
==================
These are generic installation instructions.
The `configure' shell script attempts to guess correct values for
various system-dependent variables used during compilation. It uses
those values to create a `Makefile' in each directory of the package.
It may also create one or more `.h' files containing system-dependent
definitions. Finally, it creates a shell script `config.status' that
you can run in the future to recreate the current configuration, a file
`config.cache' that saves the results of its tests to speed up
reconfiguring, and a file `config.log' containing compiler output
(useful mainly for debugging `configure').
If you need to do unusual things to compile the package, please try
to figure out how `configure' could check whether to do them, and mail
diffs or instructions to the address given in the `README' so they can
be considered for the next release. If at some point `config.cache'
contains results you don't want to keep, you may remove or edit it.
The file `configure.in' is used to create `configure' by a program
called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'.
The simplest way to compile this package is:
1. `cd' to the directory containing the package's source code and type
`./configure' to configure the package for your system. If you're
using `csh' on an old version of System V, you might need to type
`sh ./configure' instead to prevent `csh' from trying to execute
`configure' itself.
Running `configure' takes a while. While running, it prints some
messages telling which features it is checking for.
2. Type `make' to compile the package.
3. Type `make install' to install the programs and any data files and
documentation.
4. You can remove the program binaries and object files from the
source code directory by typing `make clean'.
Compilers and Options
=====================
Some systems require unusual options for compilation or linking that
the `configure' script does not know about. You can give `configure'
initial values for variables by setting them in the environment. Using
a Bourne-compatible shell, you can do that on the command line like
this:
CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
Or on systems that have the `env' program, you can do it like this:
env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
Compiling For Multiple Architectures
====================================
You can compile the package for more than one kind of computer at the
same time, by placing the object files for each architecture in their
own directory. To do this, you must use a version of `make' that
supports the `VPATH' variable, such as GNU `make'. `cd' to the
directory where you want the object files and executables to go and run
the `configure' script. `configure' automatically checks for the
source code in the directory that `configure' is in and in `..'.
If you have to use a `make' that does not supports the `VPATH'
variable, you have to compile the package for one architecture at a time
in the source code directory. After you have installed the package for
one architecture, use `make distclean' before reconfiguring for another
architecture.
Installation Names
==================
By default, `make install' will install the package's files in
`/usr/local/bin', `/usr/local/man', etc. You can specify an
installation prefix other than `/usr/local' by giving `configure' the
option `--prefix=PATH'.
You can specify separate installation prefixes for
architecture-specific files and architecture-independent files. If you
give `configure' the option `--exec-prefix=PATH', the package will use
PATH as the prefix for installing programs and libraries.
Documentation and other data files will still use the regular prefix.
If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' the
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Optional Features
=================
Some packages pay attention to `--enable-FEATURE' options to
`configure', where FEATURE indicates an optional part of the package.
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
is something like `gnu-as' or `x' (for the X Window System). The
`README' should mention any `--enable-' and `--with-' options that the
package recognizes.
For packages that use the X Window System, `configure' can usually
find the X include and library files automatically, but if it doesn't,
you can use the `configure' options `--x-includes=DIR' and
`--x-libraries=DIR' to specify their locations.
Specifying the System Type
==========================
There may be some features `configure' can not figure out
automatically, but needs to determine by the type of host the package
will run on. Usually `configure' can figure that out, but if it prints
a message saying it can not guess the host type, give it the
`--host=TYPE' option. TYPE can either be a short name for the system
type, such as `sun4', or a canonical name with three fields:
CPU-COMPANY-SYSTEM
See the file `config.sub' for the possible values of each field. If
`config.sub' isn't included in this package, then this package doesn't
need to know the host type.
If you are building compiler tools for cross-compiling, you can also
use the `--target=TYPE' option to select the type of system they will
produce code for and the `--build=TYPE' option to select the type of
system on which you are compiling the package.
Sharing Defaults
================
If you want to set default values for `configure' scripts to share,
you can create a site shell script called `config.site' that gives
default values for variables like `CC', `cache_file', and `prefix'.
`configure' looks for `PREFIX/share/config.site' if it exists, then
`PREFIX/etc/config.site' if it exists. Or, you can set the
`CONFIG_SITE' environment variable to the location of the site script.
A warning: not all `configure' scripts look for a site script.
Operation Controls
==================
`configure' recognizes the following options to control how it
operates.
`--cache-file=FILE'
Use and save the results of the tests in FILE instead of
`./config.cache'. Set FILE to `/dev/null' to disable caching, for
debugging `configure'.
`--help'
Print a summary of the options to `configure', and exit.
`--quiet'
`--silent'
`-q'
Do not print messages saying which checks are being made.
`--srcdir=DIR'
Look for the package's source code in directory DIR. Usually
`configure' can determine that directory automatically.
`--version'
Print the version of Autoconf used to generate the `configure'
script, and exit.
`configure' also accepts some other, not widely useful, options.
kfourier-1.1/libtool 100755 1750 144 11066 6501172360 13706 0 ustar antonio users #! /bin/sh
# libtool - Provide generalized library-building support services.
#
# Generated automatically by ltconfig - GNU libtool 1.0i
# This program was configured as follows,
# on host jupiter.malaga.es:
#
# CC="g++" CFLAGS="-O2 -Wall" CPPFLAGS="" \
# LD="/usr/bin/ld" NM="/usr/bin/nm -B" RANLIB="ranlib" LN_S="ln -s" \
# ./ltconfig --disable-static --with-gcc --with-gnu-ld --no-verify ./ltmain.sh i586-pc-linux-gnulibc1
#
# Compiler and other test output produced by ltconfig, useful for
# debugging ltconfig, is in ./config.log if it exists.
# Sed that helps us avoid accidentally triggering echo(1) options like -n.
Xsed="sed -e s/^X//"
# The HP-UX ksh and POSIX shell print the target directory to stdout
# if CDPATH is set.
if test "${CDPATH+set}" = set; then CDPATH=; export CDPATH; fi
# An echo program that doesn't interpret backslashes.
echo="echo"
# The version of ltconfig that generated this script.
LTCONFIG_VERSION="1.0i"
# Shell to use when invoking shell scripts.
SHELL=/bin/sh
# Whether or not to build libtool libraries.
build_libtool_libs=yes
# Whether or not to build old-style libraries.
build_old_libs=no
# The host system.
host_alias="i586-pc-linux-gnulibc1"
host="i586-pc-linux-gnulibc1"
# The archiver.
AR="ar"
# The default C compiler.
CC="g++"
# The linker used to build libraries.
LD="/usr/bin/ld"
# Whether we need hard or soft links.
LN_S="ln -s"
# A BSD-compatible nm program.
NM="/usr/bin/nm -B"
# The name of the directory that contains temporary libtool files.
objdir=".libs"
# How to create reloadable object files.
reload_flag=" -r"
reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
# How to pass a linker flag through the compiler.
wl="-Wl,"
# Additional compiler flags for building library objects.
pic_flag=" -fPIC"
# Compiler flag to prevent dynamic linking.
link_static_flag=""
# Compiler flag to turn off builtin functions.
no_builtin_flag=" -fno-builtin"
# Compiler flag to allow reflexive dlopens.
export_dynamic_flag_spec="\${wl}--export-dynamic"
# Pattern to match compiler flags for creating libNAME_p libraries:
profile_flag_pattern="-pg?"
# Library versioning type.
version_type=linux
# Format of library name prefix.
libname_spec="lib\$name"
# List of archive names. First name is the real one, the rest are links.
# The last name is the one that the linker finds with -lNAME.
library_names_spec="\${libname}\${release}.so.\$versuffix \${libname}\${release}.so.\$major \$libname.so"
# The coded name of the library, if different from the real name.
soname_spec="\${libname}\${release}.so.\$major"
# Commands used to build and install an old-style archive.
RANLIB="ranlib"
old_archive_cmds="\$AR cru \$oldlib\$oldobjs;\$RANLIB \$oldlib"
old_postinstall_cmds="\$RANLIB \$oldlib;chmod 644 \$oldlib"
old_postuninstall_cmds=""
# Create an old-style archive from a shared archive.
old_archive_from_new_cmds=""
# Commands used to build and install a shared archive.
archive_cmds="\$CC -shared \${wl}-soname \$wl\$soname -o \$lib\$libobjs"
postinstall_cmds=""
postuninstall_cmds=""
# Flag that allows shared libraries with undefined symbols to be built.
allow_undefined_flag=""
# Commands used to finish a libtool library installation in a directory.
finish_cmds="PATH=\\\"\$PATH:/sbin\\\" ldconfig -n \$libdir"
# Same as above, but a single script fragment to be evaled but not shown.
finish_eval=""
# Take the output of nm and produce a listing of raw symbols and C names.
global_symbol_pipe="sed -n -e 's/^.* [ABCDGISTUW] \\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\1/p'"
# How to strip a library file.
striplib=""
old_striplib=""
# This is the shared library runtime path variable.
runpath_var=LD_RUN_PATH
# This is the shared library path variable.
shlibpath_var=LD_LIBRARY_PATH
# How to hardcode a shared library path into an executable.
hardcode_action=immediate
# Flag to hardcode $libdir into a binary during linking.
# This must work even if $libdir does not exist.
hardcode_libdir_flag_spec="\${wl}--rpath \${wl}\$libdir"
# Whether we need a single -rpath flag with a separated argument.
hardcode_libdir_separator=""
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
# resulting binary.
hardcode_direct=no
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
# resulting binary.
hardcode_minus_L=no
# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
# the resulting binary.
hardcode_shlibpath_var=unsupported
# Find the path to this script.
thisdir=`$echo "X$0" | $Xsed -e 's%/[^/]*$%%'`
test "X$0" = "X$thisdir" && thisdir=.
# Execute the libtool backend.
. $thisdir/./ltmain.sh
exit 1
kfourier-1.1/Makefile.am 100644 1750 144 1173 6473675155 14350 0 ustar antonio users ## kdebase/Makefile.am
## (C) 1997 Stephan Kulow
AUTOMAKE_OPTIONS = foreign
SUBDIRS = @TOPSUBDIRS@
DISTCLEANFILES = inst-apps
install-data-local:
@echo ""
@echo ""
@echo ""
@echo "*************** Important *************************"
@echo ""
@echo " set KDEDIR to "$(prefix)
@echo " add "$(libdir)" to your LD_LIBRARY_PATH"
@echo " add "$(bindir)" to your PATH"
@echo ""
@echo " Please report bugs with our web form at"
@echo " http://buglist.kde.org."
@echo ""
@echo "I hope that you like kfourier"
@echo "Antonio Larrosa (antlarr@arrakis.es)"
@echo "****************************************************"
@echo ""
kfourier-1.1/Makefile.in 100644 1750 144 17455 6473675221 14405 0 ustar antonio users # Makefile.in generated automatically by automake 1.0 from Makefile.am
# Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
SHELL = /bin/sh
srcdir = @srcdir@
top_srcdir = @top_srcdir@
VPATH = @srcdir@
prefix = @prefix@
exec_prefix = @exec_prefix@
bindir = @bindir@
sbindir = @sbindir@
libexecdir = @libexecdir@
datadir = @datadir@
sysconfdir = @sysconfdir@
sharedstatedir = @sharedstatedir@
localstatedir = @localstatedir@
libdir = @libdir@
infodir = @infodir@
mandir = @mandir@
includedir = @includedir@
oldincludedir = /usr/include
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkgincludedir = $(includedir)/@PACKAGE@
top_builddir = .
INSTALL = @INSTALL@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
transform = @program_transform_name@
AUTOMAKE_OPTIONS = foreign
SUBDIRS = @TOPSUBDIRS@
DISTCLEANFILES = inst-apps
ACLOCAL = aclocal.m4
mkinstalldirs = $(top_srcdir)/mkinstalldirs
DIST_COMMON = README COPYING INSTALL Makefile.am Makefile.in README \
aclocal.m4 config.guess config.sub configure configure.in install-sh \
mkinstalldirs
PACKAGE = @PACKAGE@
VERSION = @VERSION@
DISTFILES = $(DIST_COMMON) $(SOURCES) $(BUILT_SOURCES) $(HEADERS) \
$(TEXINFOS) $(INFOS) $(MANS) $(EXTRA_DIST) $(DATA)
DEP_DISTFILES = $(DIST_COMMON) $(SOURCES) $(BUILT_SOURCES) $(HEADERS) \
$(TEXINFOS) $(INFO_DEPS) $(MANS) $(EXTRA_DIST) $(DATA)
TAR = tar
default: all
#$(srcdir)/Makefile.in: Makefile.am configure.in
# cd $(srcdir) && automake Makefile
# For an explanation of the following Makefile rules, see node
# `Automatic Remaking' in GNU Autoconf documentation.
Makefile: Makefile.in config.status
CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
config.status: configure
./config.status --recheck
$(srcdir)/configure: configure.in $(ACLOCAL) $(CONFIGURE_DEPENDENCIES)
cd $(srcdir) && autoconf
$ac_output: $(top_builddir)/config.status $ac_output.in
cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= ./config.status
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
# (1) if the variable is set in `config.status', edit `config.status'
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
@SET_MAKE@
all-recursive install-data-recursive install-exec-recursive \
installdirs-recursive install-recursive uninstall-recursive \
check-recursive installcheck-recursive info-recursive dvi-recursive \
mostlyclean-recursive clean-recursive distclean-recursive \
maintainer-clean-recursive:
for subdir in $(SUBDIRS); do \
target=`echo $@ | sed s/-recursive//`; \
echo making $$target in $$subdir; \
(cd $$subdir && $(MAKE) $$target) \
|| case "$(MFLAGS)" in *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags: TAGS
tags-recursive:
list="$(SUBDIRS)"; for subdir in $$list; do \
(cd $$subdir && $(MAKE) tags); \
done
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(CONFIG_HEADER) \
$(TAGS_DEPENDENCIES)
tags=; \
here=`pwd`; \
for subdir in $(SUBDIRS); do \
test -f $$subdir/TAGS && { \
tags="$$tags -i $$here/$$subdir/TAGS"; \
} \
done; \
test -z "$(ETAGS_ARGS)$(CONFIG_HEADER)$(SOURCES)$(HEADERS)$$tags" \
|| etags $(ETAGS_ARGS) $$tags $(CONFIG_HEADER) $(SOURCES) $(HEADERS)
mostlyclean-tags:
clean-tags:
distclean-tags:
rm -f TAGS ID
maintainer-clean-tags:
distdir = $(PACKAGE)-$(VERSION)
# This target untars the dist file and tries a VPATH configuration. Then
# it guarantees that the distribution is self-contained by making another
# tarfile.
distcheck: dist
rm -rf $(distdir)
$(TAR) zxf $(distdir).tar.gz
mkdir $(distdir)/=build
mkdir $(distdir)/=inst
dc_install_base=`cd $(distdir)/=inst && pwd`; \
cd $(distdir)/=build \
&& ../configure --srcdir=.. --prefix=$$dc_install_base \
&& $(MAKE) \
&& $(MAKE) check \
&& $(MAKE) install \
&& $(MAKE) installcheck \
&& $(MAKE) dist
rm -rf $(distdir)
@echo "========================"; \
echo "$(distdir).tar.gz is ready for distribution"; \
echo "========================"
dist: distdir
chmod -R a+r $(distdir)
$(TAR) chozf $(distdir).tar.gz $(distdir)
rm -rf $(distdir)
distdir: $(DEP_DISTFILES)
rm -rf $(distdir)
mkdir $(distdir)
chmod 777 $(distdir)
distdir=`cd $(distdir) && pwd` \
&& cd $(srcdir) \
&& automake --include-deps --output-dir=$$distdir --strictness=foreign
@for file in `cd $(srcdir) && echo $(DISTFILES)`; do \
test -f $(distdir)/$$file \
|| ln $(srcdir)/$$file $(distdir)/$$file 2> /dev/null \
|| cp -p $(srcdir)/$$file $(distdir)/$$file; \
done
for subdir in $(SUBDIRS); do \
test -d $(distdir)/$$subdir \
|| mkdir $(distdir)/$$subdir \
|| exit 1; \
chmod 777 $(distdir)/$$subdir; \
(cd $$subdir && $(MAKE) distdir=../$(distdir)/$$subdir distdir) \
|| exit 1; \
done
info: info-recursive
dvi: dvi-recursive
check: check-recursive
installcheck: installcheck-recursive
all-am: Makefile
install-data-am: install-data-local
install-exec: install-exec-recursive
install-data: install-data-recursive install-data-am
install: install-recursive install-data-am
@:
uninstall: uninstall-recursive
all: all-recursive all-am
install-strip:
$(MAKE) INSTALL_PROGRAM='$(INSTALL_PROGRAM) -s' install
installdirs: installdirs-recursive
mostlyclean-generic:
test -z "$(MOSTLYCLEANFILES)" || rm -f $(MOSTLYCLEANFILES)
clean-generic:
test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
rm -f Makefile $(DISTCLEANFILES)
rm -f config.cache config.log $(CONFIG_HEADER) stamp-h
maintainer-clean-generic:
test -z "$(MAINTAINERCLEANFILES)" || rm -f $(MAINTAINERCLEANFILES)
test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
mostlyclean-am: mostlyclean-tags mostlyclean-generic
clean-am: clean-tags clean-generic mostlyclean-am
distclean-am: distclean-tags distclean-generic clean-am
maintainer-clean-am: maintainer-clean-tags maintainer-clean-generic \
distclean-am
mostlyclean: mostlyclean-am mostlyclean-recursive
clean: clean-am clean-recursive
distclean: distclean-am distclean-recursive
rm -f config.status
maintainer-clean: maintainer-clean-am maintainer-clean-recursive
@echo "This command is intended for maintainers to use;"
@echo "it deletes files that may require special tools to rebuild."
rm -f config.status
.PHONY: default install-data-recursive uninstall-data-recursive \
install-exec-recursive uninstall-exec-recursive installdirs-recursive \
uninstalldirs-recursive all-recursive check-recursive \
installcheck-recursive info-recursive dvi-recursive \
mostlyclean-recursive distclean-recursive clean-recursive \
maintainer-clean-recursive tags tags-recursive mostlyclean-tags \
distclean-tags clean-tags maintainer-clean-tags distdir info dvi check \
installcheck all-am install-data-am install-exec install-data install \
uninstall all installdirs mostlyclean-generic distclean-generic \
clean-generic maintainer-clean-generic clean mostlyclean distclean \
maintainer-clean
install-data-local:
@echo ""
@echo ""
@echo ""
@echo "*************** Important *************************"
@echo ""
@echo " set KDEDIR to "$(prefix)
@echo " add "$(libdir)" to your LD_LIBRARY_PATH"
@echo " add "$(bindir)" to your PATH"
@echo ""
@echo " Please report bugs with our web form at"
@echo " http://buglist.kde.org."
@echo ""
@echo " I hope that you like kfourier"
@echo " Antonio Larrosa (antlarr@arrakis.es)"
@echo "****************************************************"
@echo ""
.SUFFIXES:
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
kfourier-1.1/SUBDIRS 100644 1750 144 11 6473663705 13276 0 ustar antonio users kfourier
kfourier-1.1/acconfig.h 100644 1750 144 615 6412167357 14207 0 ustar antonio users /* Define if the C++ compiler supports BOOL */
#undef HAVE_BOOL
#undef VERSION
#undef PACKAGE
/* defines if having libgif (always 1) */
#undef HAVE_LIBGIF
/* defines if having libjpeg (always 1) */
#undef HAVE_LIBJPEG
/* defines which to take for ksize_t */
#undef ksize_t
/* define if you have setenv */
#undef HAVE_FUNC_SETENV
/* Define to 1 if NLS is requested. */
#undef ENABLE_NLS
kfourier-1.1/acinclude.m4 100644 1750 144 137715 6472430304 14541 0 ustar antonio users
## This file is part of the KDE libraries/packages
## Copyright (C) 1997 Janos Farkas (chexum@shadow.banki.hu)
## (C) 1997 Stephan Kulow (coolo@kde.org)
## 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., 675 Mass Ave, Cambridge, MA 02139, USA.
##
## ------------------------------------------------------------------------
## Find a file (or one of more files in a list of dirs)
## ------------------------------------------------------------------------
##
AC_DEFUN(AC_FIND_FILE,
[
$3=NO
for i in $2;
do
for j in $1;
do
if test -r "$i/$j"; then
$3=$i
break 2
fi
done
done
])
## ------------------------------------------------------------------------
## Find the meta object compiler in the PATH, in $QTDIR/bin, and some
## more usual places
## ------------------------------------------------------------------------
##
AC_DEFUN(AC_PATH_QT_MOC,
[
AC_PATH_PROG(MOC, moc, /usr/bin/moc,
$QTDIR/bin:$PATH:/usr/bin:/usr/X11R6/bin:/usr/lib/qt/bin:/usr/local/qt/bin)
])
AC_DEFUN(KDE_REPLACE_ROOT,
$1=`echo "$$1" | sed -e "s#^/#\$\{install_root\}/#"`
)
AC_DEFUN(AC_CREATE_KFSSTND,
[
AC_MSG_CHECKING(for KDE paths)
AC_REQUIRE([AC_CHECK_RPATH])
AC_REQUIRE([AC_CHECK_BOOL])
if test "$1" = "default"; then
kde_htmldir="\$(prefix)/share/doc/HTML"
kde_appsdir="\$(prefix)/share/applnk"
kde_icondir="\$(prefix)/share/icons"
kde_minidir="\$(prefix)/share/icons/mini"
kde_datadir="\$(prefix)/share/apps"
kde_locale="\$(prefix)/share/locale"
kde_cgidir="\$(exec_prefix)/cgi-bin"
kde_confdir="\$(prefix)/share/config"
kde_mimedir="\$(prefix)/share/mimelnk"
kde_toolbardir="\$(prefix)/share/toolbar"
kde_wallpaperdir="\$(prefix)/share/wallpapers"
kde_bindir="\$(exec_prefix)/bin"
kde_partsdir="\$(exec_prefix)/parts"
AC_MSG_RESULT(defaults)
else
AC_CACHE_VAL(kde_cv_all_paths,
[
AC_LANG_CPLUSPLUS
cat > conftest.$ac_ext <<EOF
#include <stdio.h>
#include "confdefs.h"
#include "config.h.bot"
#include <kapp.h>
int main() {
printf("kde_htmldir=\\"%s\\"\n", KApplication::kde_htmldir().data());
printf("kde_appsdir=\\"%s\\"\n", KApplication::kde_appsdir().data());
printf("kde_icondir=\\"%s\\"\n", KApplication::kde_icondir().data());
printf("kde_minidir=\\"%s\\"\n", KApplication::kde_minidir().data());
printf("kde_datadir=\\"%s\\"\n", KApplication::kde_datadir().data());
printf("kde_locale=\\"%s\\"\n", KApplication::kde_localedir().data());
printf("kde_cgidir=\\"%s\\"\n", KApplication::kde_cgidir().data());
printf("kde_confdir=\\"%s\\"\n", KApplication::kde_configdir().data());
printf("kde_mimedir=\\"%s\\"\n", KApplication::kde_mimedir().data());
printf("kde_toolbardir=\\"%s\\"\n", KApplication::kde_toolbardir().data());
printf("kde_wallpaperdir=\\"%s\\"\n", KApplication::kde_wallpaperdir().data());
printf("kde_bindir=\\"%s\\"\n", KApplication::kde_bindir().data());
printf("kde_partsdir=\\"%s\\"\n", KApplication::kde_partsdir().data());
return 0;
}
EOF
if test -n "$kde_libraries"; then
KDE_TEST_RPATH="-rpath $kde_libraries"
fi
if test -n "$qt_libraries"; then
KDE_TEST_RPATH="$KDE_TEST_RPATH -rpath $qt_libraries $KDE_EXTRA_RPATH"
fi
ac_link='/bin/sh ./libtool --mode=link ${CXX-g++} -o conftest $CXXFLAGS $all_includes $CPPFLAGS $LDFLAGS $all_libraries conftest.$ac_ext $LIBS -lkdecore -lqt -lXext -lX11 $LIBSOCKET $KDE_TEST_RPATH 1>&5'
if AC_TRY_EVAL(ac_link) && test -s conftest
then
eval `./conftest 2>&5`
./conftest 2> /dev/null >&5 # make an echo for config.log
kde_have_all_paths=yes
fi
AC_LANG_CPLUSPLUS
if test "$kde_have_all_paths" = "yes"; then
kde_cv_all_paths="kde_have_all_paths=\"yes\" \
kde_htmldir=\"$kde_htmldir\" \
kde_appsdir=\"$kde_appsdir\" \
kde_icondir=\"$kde_icondir\" \
kde_minidir=\"$kde_minidir\" \
kde_datadir=\"$kde_datadir\" \
kde_locale=\"$kde_locale\" \
kde_cgidir=\"$kde_cgidir\" \
kde_confdir=\"$kde_confdir\" \
kde_mimedir=\"$kde_mimedir\" \
kde_toolbardir=\"$kde_toolbardir\" \
kde_wallpaperdir=\"$kde_wallpaperdir\" \
kde_bindir=\"$kde_bindir\" \
kde_partsdir=\"$kde_partsdir\""
fi
rm -fr conftest*
])
eval "$kde_cv_all_paths"
if test -z "$kde_htmldir" || test -z "$kde_appsdir" ||
test -z "$kde_icondir" || test -z "$kde_minidir" ||
test -z "$kde_datadir" || test -z "$kde_locale" ||
test -z "$kde_cgidir" || test -z "$kde_confdir" ||
test -z "$kde_mimedir" || test -z "$kde_toolbardir" ||
test -z "$kde_wallpaperdir" || test -z "$kde_bindir" ||
test -z "$kde_partsdir" || test "$kde_have_all_paths" != "yes"; then
AC_MSG_RESULT(problems)
kde_have_all_paths=no
AC_MSG_ERROR([configure can not run a little KDE program to test the environment.
Look at config.log for details. If you are not able to fix this, please contact Stephan Kulow <coolo@kde.org>.])
else
AC_MSG_RESULT(done)
fi
if test -n "$install_root"; then
KDE_REPLACE_ROOT(kde_htmldir)
KDE_REPLACE_ROOT(kde_appsdir)
KDE_REPLACE_ROOT(kde_icondir)
KDE_REPLACE_ROOT(kde_minidir)
KDE_REPLACE_ROOT(kde_datadir)
KDE_REPLACE_ROOT(kde_locale)
KDE_REPLACE_ROOT(kde_cgidir)
KDE_REPLACE_ROOT(kde_confdir)
KDE_REPLACE_ROOT(kde_mimedir)
KDE_REPLACE_ROOT(kde_toolbardir)
KDE_REPLACE_ROOT(kde_wallpaperdir)
KDE_REPLACE_ROOT(kde_bindir)
KDE_REPLACE_ROOT(kde_partsdir)
AC_SUBST(install_root)
fi
fi
bindir=$kde_bindir
])
AC_DEFUN(AC_SUBST_KFSSTND,
[
AC_SUBST(kde_htmldir)
AC_SUBST(kde_appsdir)
AC_SUBST(kde_icondir)
AC_SUBST(kde_minidir)
AC_SUBST(kde_datadir)
AC_SUBST(kde_locale)
AC_SUBST(kde_cgidir)
AC_SUBST(kde_confdir)
AC_SUBST(kde_mimedir)
AC_SUBST(kde_toolbardir)
AC_SUBST(kde_wallpaperdir)
AC_SUBST(kde_bindir)
AC_SUBST(kde_partsdir)
])
## ------------------------------------------------------------------------
## Find the header files and libraries for X-Windows. Extended the
## macro AC_PATH_X
## ------------------------------------------------------------------------
##
AC_DEFUN(K_PATH_X,
[
AC_MSG_CHECKING(for X)
AC_CACHE_VAL(ac_cv_have_x,
[# One or both of the vars are not set, and there is no cached value.
ac_x_includes=NO ac_x_libraries=NO
AC_PATH_X_DIRECT
AC_PATH_X_XMKMF
if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
AC_MSG_ERROR([Can't find X includes. Please check your installation and add the correct paths!])
else
# Record where we found X for the cache.
ac_cv_have_x="have_x=yes \
ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
fi])dnl
eval "$ac_cv_have_x"
if test "$have_x" != yes; then
AC_MSG_RESULT($have_x)
no_x=yes
else
# If each of the values was on the command line, it overrides each guess.
test "x$x_includes" = xNONE && x_includes=$ac_x_includes
test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
# Update the cache value to reflect the command line values.
ac_cv_have_x="have_x=yes \
ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
AC_MSG_RESULT([libraries $x_libraries, headers $x_includes])
fi
if test -z "$x_includes" || test "x$x_includes" = xNONE; then
X_INCLUDES=""
x_includes="."; dnl better than nothing :-
else
X_INCLUDES="-I$x_includes"
fi
if test -z "$x_libraries" || test "$x_libraries" = xNONE; then
X_LDFLAGS=""
x_libraries="/usr/lib"; dnl better than nothing :-
all_libraries=""
else
X_LDFLAGS="-L$x_libraries"
all_libraries=$X_LDFLAGS
fi
AC_SUBST(X_INCLUDES)
AC_SUBST(X_LDFLAGS)
all_includes=$X_INCLUDES
])
AC_DEFUN(KDE_PRINT_QT_PROGRAM,
[
AC_LANG_CPLUSPLUS
cat > conftest.$ac_ext <<EOF
#include "confdefs.h"
#include <qmovie.h>
int main() {
QMovie m;
m.setSpeed(20);
return 0;
}
EOF
])
AC_DEFUN(KDE_CHECK_QT_DIRECT,
[
AC_MSG_CHECKING([if Qt compiles without flags])
AC_CACHE_VAL(kde_cv_qt_direct,
[
ac_LD_LIBRARY_PATH_safe=$LD_LIBRARY_PATH
ac_LIBRARY_PATH=$LIBRARY_PATH
ac_cxxflags_safe=$CXXFLAGS
ac_ldflags_safe=$LDFLAGS
ac_libs_safe=$LIBS
CXXFLAGS="$CXXFLAGS -I$qt_includes"
LDFLAGS="$X_LDFLAGS"
LIBS="-lqt -lXext -lX11 $LIBSOCKET"
LD_LIBRARY_PATH=
export LD_LIBRARY_PATH
LIBRARY_PATH=
export LIBRARY_PATH
KDE_PRINT_QT_PROGRAM
if AC_TRY_EVAL(ac_link) && test -s conftest; then
kde_cv_qt_direct="yes"
else
kde_cv_qt_direct="no"
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
fi
rm -f conftest*
CXXFLAGS=$ac_cxxflags_safe
LDFLAGS=$ac_ldflags_safe
LIBS=$ac_libs_safe
LD_LIBRARY_PATH=$ac_LD_LIBRARY_PATH_safe
export LD_LIBRARY_PATH
LIBRARY_PATH=$ac_LIBRARY_PATH
export LIBRARY_PATH
])
if test "$kde_cv_qt_direct" = "yes"; then
AC_MSG_RESULT(yes)
$1
else
AC_MSG_RESULT(no)
$2
fi
])
## ------------------------------------------------------------------------
## Try to find the QT headers and libraries.
## $(QT_LDFLAGS) will be -Lqtliblocation (if needed)
## and $(QT_INCLUDES) will be -Iqthdrlocation (if needed)
## ------------------------------------------------------------------------
##
AC_DEFUN(AC_PATH_QT_1_3,
[
AC_REQUIRE([K_PATH_X])
AC_MSG_CHECKING([for QT])
ac_qt_includes=NO ac_qt_libraries=NO
qt_libraries=""
qt_includes=""
AC_ARG_WITH(qt-dir,
[ --with-qt-dir where the root of qt is installed ],
[ ac_qt_includes="$withval"/include
ac_qt_libraries="$withval"/lib
])
AC_ARG_WITH(qt-includes,
[ --with-qt-includes where the qt includes are. ],
[
ac_qt_includes="$withval"
])
AC_ARG_WITH(qt-libraries,
[ --with-qt-libraries where the qt library is installed.],
[ ac_qt_libraries="$withval"
])
if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
AC_CACHE_VAL(ac_cv_have_qt,
[#try to guess qt locations
qt_incdirs="$ac_qt_includes /usr/lib/qt/include /usr/local/qt/include /usr/include/qt /usr/include /usr/X11R6/include/X11/qt $x_includes $QTINC"
test -n "$QTDIR" && qt_incdirs="$QTDIR/include $QTDIR $qt_incdirs"
AC_FIND_FILE(qmovie.h, $qt_incdirs, qt_incdir)
ac_qt_includes=$qt_incdir
qt_libdirs="$ac_qt_libraries /usr/lib/qt/lib /usr/local/qt/lib /usr/lib/qt /usr/lib $x_libraries $QTLIB"
test -n "$QTDIR" && qt_libdirs="$QTDIR/lib $QTDIR $qt_libdirs"
AC_FIND_FILE(libqt.so libqt.so.1.30 libqt.so.1.31 libqt.so.1 libqt.a libqt.sl, $qt_libdirs, qt_libdir)
ac_qt_libraries=$qt_libdir
ac_cxxflags_safe=$CXXFLAGS
ac_ldflags_safe=$LDFLAGS
ac_libs_safe=$LIBS
CXXFLAGS="$CXXFLAGS -I$qt_incdir"
LDFLAGS="-L$qt_libdir $X_LDFLAGS"
LIBS="$LIBS -lqt -lXext -lX11 $LIBSOCKET"
KDE_PRINT_QT_PROGRAM
if AC_TRY_EVAL(ac_link) && test -s conftest; then
rm -f conftest*
else
echo "configure: failed program was:" >&AC_FD_CC
cat conftest.$ac_ext >&AC_FD_CC
ac_qt_libraries="NO"
fi
rm -f conftest*
CXXFLAGS=$ac_cxxflags_safe
LDFLAGS=$ac_ldflags_safe
LIBS=$ac_libs_safe
if test "$ac_qt_includes" = NO || test "$ac_qt_libraries" = NO; then
ac_cv_have_qt="have_qt=no"
ac_qt_notfound=""
if test "$ac_qt_includes" = NO; then
if test "$ac_qt_libraries" = NO; then
ac_qt_notfound="(headers and libraries)";
else
ac_qt_notfound="(headers)";
fi
else
ac_qt_notfound="(libraries)";
fi
AC_MSG_ERROR([QT-1.3 $ac_qt_notfound not found. Please check your installation! ]);
else
have_qt="yes"
fi
])
else
have_qt="yes"
fi
eval "$ac_cv_have_qt"
if test "$have_qt" != yes; then
AC_MSG_RESULT([$have_qt]);
else
ac_cv_have_qt="have_qt=yes \
ac_qt_includes=$ac_qt_includes ac_qt_libraries=$ac_qt_libraries"
AC_MSG_RESULT([libraries $ac_qt_libraries, headers $ac_qt_includes])
qt_libraries=$ac_qt_libraries
qt_includes=$ac_qt_includes
fi
KDE_CHECK_QT_DIRECT(qt_libraries= ,[])
AC_SUBST(qt_libraries)
AC_SUBST(qt_includes)
if test "$qt_includes" = "$x_includes" || test -z "$qt_includes"; then
QT_INCLUDES="";
else
QT_INCLUDES="-I$qt_includes"
all_includes="$QT_INCLUDES $all_includes"
fi
if test "$qt_libraries" = "$x_libraries" || test -z "$qt_libraries"; then
QT_LDFLAGS=""
else
QT_LDFLAGS="-L$qt_libraries"
all_libraries="$QT_LDFLAGS $all_libraries"
fi
AC_SUBST(QT_INCLUDES)
AC_SUBST(QT_LDFLAGS)
AC_PATH_QT_MOC
])
AC_DEFUN(AC_PATH_QT,
[
AC_PATH_QT_1_3
])
## ------------------------------------------------------------------------
## Now, the same with KDE
## $(KDE_LDFLAGS) will be the kdeliblocation (if needed)
## and $(kde_includes) will be the kdehdrlocation (if needed)
## ------------------------------------------------------------------------
##
AC_DEFUN(AC_BASE_PATH_KDE,
[
AC_REQUIRE([AC_PATH_QT])dnl
AC_MSG_CHECKING([for KDE])
if test "${prefix}" != NONE; then
kde_libraries=${prefix}/lib
kde_includes=${prefix}/include
ac_kde_libraries=$prefix/lib
ac_kde_includes=$prefix/include
else
ac_kde_includes=
ac_kde_libraries=
kde_libraries=""
kde_includes=""
fi
AC_CACHE_VAL(ac_cv_have_kde,
[#try to guess kde locations
if test -z "$1"; then
kde_incdirs="$ac_kde_includes /usr/lib/kde/include /usr/local/kde/include /usr/kde/include /usr/include/kde /usr/include /opt/kde/include $x_includes $qt_includes"
test -n "$KDEDIR" && kde_incdirs="$KDEDIR/include $KDEDIR $kde_incdirs"
AC_FIND_FILE(ksock.h, $kde_incdirs, kde_incdir)
if test -n "$ac_kde_includes" && test ! -r "$ac_kde_includes/ksock.h"; then
AC_MSG_ERROR([
in the prefix, you've choosen, are no kde headers installed. This will fail.
So, check this please and use another prefix!])
fi
ac_kde_includes=$kde_incdir
kde_libdirs="$ac_kde_libraries /usr/lib/kde/lib /usr/local/kde/lib /usr/kde/lib /usr/lib/kde /usr/lib /usr/X11R6/lib /opt/kde/lib /usr/X11R6/kde/lib"
test -n "$KDEDIR" && kde_libdirs="$KDEDIR/lib $KDEDIR $kde_libdirs"
AC_FIND_FILE(libkdecore.la, $kde_libdirs, kde_libdir)
if test -n "$ac_kde_libraries" && test ! -r "$ac_kde_libraries/libkdecore.la"; then
AC_MSG_ERROR([
in the prefix, you've choosen, are no kde libraries installed. This will fail.
So, check this please and use another prefix!])
fi
ac_kde_libraries=$kde_libdir
if test "$ac_kde_includes" = NO || test "$ac_kde_libraries" = NO; then
ac_cv_have_kde="have_kde=no"
else
ac_cv_have_kde="have_kde=yes \
ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
fi
else dnl test -z $1
ac_cv_have_kde="have_kde=no"
fi
])dnl
eval "$ac_cv_have_kde"
if test "$have_kde" != "yes"; then
if test "${prefix}" = NONE; then
ac_kde_prefix=$ac_default_prefix
else
ac_kde_prefix=$prefix
fi
AC_MSG_RESULT(["will be installed in" $ac_kde_prefix])
kde_libraries=${ac_kde_prefix}/lib
kde_includes=${ac_kde_prefix}/include
else
ac_cv_have_kde="have_kde=yes \
ac_kde_includes=$ac_kde_includes ac_kde_libraries=$ac_kde_libraries"
AC_MSG_RESULT([libraries $ac_kde_libraries, headers $ac_kde_includes])
kde_libraries=$ac_kde_libraries
kde_includes=$ac_kde_includes
fi
AC_SUBST(kde_libraries)
AC_SUBST(kde_includes)
if test "$kde_includes" = "$x_includes" || test "$kde_includes" = "$qt_includes" ; then
KDE_INCLUDES=""
else
KDE_INCLUDES="-I$kde_includes"
all_includes="$KDE_INCLUDES $all_includes"
fi
if test "$kde_libraries" = "$x_libraries" || test "$kde_libraries" = "$qt_libraries" ; then
KDE_LDFLAGS=""
else
KDE_LDFLAGS="-L$kde_libraries"
all_libraries="$KDE_LDFLAGS $all_libraries"
fi
AC_SUBST(KDE_LDFLAGS)
AC_SUBST(KDE_INCLUDES)
AC_MSG_CHECKING(for extra includes)
AC_ARG_WITH(extra-includes, [ --with-extra-includes adds non standard include paths],
kde_use_extra_includes=$withval,
kde_use_extra_includes=NONE
)
if test -n "$kde_use_extra_includes" && \
test "$kde_use_extra_includes" != "NONE"; then
ac_save_ifs=$IFS
IFS=':'
for dir in $kde_use_extra_includes; do
all_includes="$all_includes -I$dir"
done
IFS=$ac_save_ifs
kde_use_extra_includes="added"
else
kde_use_extra_includes="no"
fi
AC_MSG_RESULT($kde_use_extra_includes)
AC_MSG_CHECKING(for extra libs)
AC_ARG_WITH(extra-libs, [ --with-extra-libs adds non standard library paths],
kde_use_extra_libs=$withval,
kde_use_extra_libs=NONE
)
if test -n "$kde_use_extra_libs" && \
test "$kde_use_extra_libs" != "NONE"; then
ac_save_ifs=$IFS
IFS=':'
for dir in $kde_use_extra_libs; do
all_libraries="$all_libraries -L$dir"
KDE_EXTRA_RPATH="$KDE_EXTRA_RPATH -rpath $dir"
done
IFS=$ac_save_ifs
kde_use_extra_libs="added"
else
kde_use_extra_libs="no"
fi
AC_MSG_RESULT($kde_use_extra_libs)
AC_SUBST(all_includes)
AC_SUBST(all_libraries)
])
AC_DEFUN(AC_PATH_KDE,
[
AC_BASE_PATH_KDE
AC_ARG_ENABLE(path-check, [ --disable-path-check don't try to find out, where to install],
[
if test "$enableval" = "no";
then ac_use_path_checking="default"
else ac_use_path_checking=""
fi
], [ac_use_path_checking=""]
)
AC_ARG_WITH(install-root, [ --with-install-root the root, where to install to [default=/]],
[
if test "$withval" = "no";
then kde_install_root="";
else kde_install_root=$withval;
fi
], [kde_install_root=""]
)
if test -n "$kde_install_root"; then
install_root="$kde_install_root"
else
install_root=
fi
AC_CREATE_KFSSTND($ac_use_path_checking)
AC_SUBST_KFSSTND
])
dnl slightly changed version of AC_CHECK_FUNC(setenv)
AC_DEFUN(AC_CHECK_SETENV,
[AC_MSG_CHECKING([for setenv])
AC_CACHE_VAL(ac_cv_func_setenv,
[AC_LANG_C
AC_TRY_LINK(
dnl Don't include <ctype.h> because on OSF/1 3.0 it includes <sys/types.h>
dnl which includes <sys/select.h> which contains a prototype for
dnl select. Similarly for bzero.
[#include <assert.h>
]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
extern "C"
#endif
])dnl
[/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
#include <stdlib.h>
], [
/* The GNU C library defines this for functions which it implements
to always fail with ENOSYS. Some functions are actually named
something starting with __ and the normal name is an alias. */
#if defined (__stub_$1) || defined (__stub___$1)
choke me
#else
setenv("TEST", "alle", 1);
#endif
], eval "ac_cv_func_setenv=yes", eval "ac_cv_func_setenv=no")])
if test "$ac_cv_func_setenv" = "yes"; then
AC_MSG_RESULT(yes)
AC_DEFINE_UNQUOTED(HAVE_FUNC_SETENV)
else
AC_MSG_RESULT(no)
fi
])
AC_DEFUN(AC_CHECK_GETDOMAINNAME,
[
AC_LANG_CPLUSPLUS
save_CXXFLAGS=$CXXFLAGS
if test "$GCC" = "yes"; then
CXXFLAGS="$CXXFLAGS -pedantic-errors"
fi
AC_MSG_CHECKING(for getdomainname)
AC_CACHE_VAL(ac_cv_func_getdomainname,
[
AC_TRY_COMPILE([
#include <stdlib.h>
#include <unistd.h>
],
[
char buffer[200];
getdomainname(buffer, 200);
],
ac_cv_func_getdomainname=yes,
ac_cv_func_getdomainname=no)
])
AC_MSG_RESULT($ac_cv_func_getdomainname)
if eval "test \"`echo `$ac_cv_func_getdomainname\" = yes"; then
AC_DEFINE(HAVE_GETDOMAINNAME)
fi
CXXFLAGS=$save_CXXFLAGS
])
AC_DEFUN(AC_CHECK_GETHOSTNAME,
[
AC_LANG_CPLUSPLUS
save_CXXFLAGS=$CXXFLAGS
if test "$GCC" = "yes"; then
CXXFLAGS="$CXXFLAGS -pedantic-errors"
fi
AC_MSG_CHECKING([for gethostname])
AC_CACHE_VAL(ac_cv_func_gethostname,
[
AC_TRY_COMPILE([
#include <stdlib.h>
#include <unistd.h>
],
[
char buffer[200];
gethostname(buffer, 200);
],
ac_cv_func_gethostname=yes,
ac_cv_func_gethostname=no)
])
AC_MSG_RESULT($ac_cv_func_gethostname)
if eval "test \"`echo `$ac_cv_func_gethostname\" = yes"; then
AC_DEFINE(HAVE_GETHOSTNAME)
fi
CXXFLAGS=$save_CXXFLAGS
])
AC_DEFUN(AC_CHECK_USLEEP,
[
AC_LANG_CPLUSPLUS
AC_MSG_CHECKING([for usleep])
AC_CACHE_VAL(ac_cv_func_usleep,
[
ac_libs_safe=$LIBS
LIBS="$LIBS $LIBUCB"
AC_TRY_LINK([
#include <stdlib.h>
#include <unistd.h>
],
[
usleep(200);
],
ac_cv_func_usleep=yes,
ac_cv_func_usleep=no)
])
AC_MSG_RESULT($ac_cv_func_usleep)
if eval "test \"`echo `$ac_cv_func_usleep\" = yes"; then
AC_DEFINE(HAVE_USLEEP)
fi
LIBS=$ac_libs_safe
])
AC_DEFUN(AC_FIND_GIF,
[AC_MSG_CHECKING([for giflib])
AC_CACHE_VAL(ac_cv_lib_gif,
[ac_save_LIBS="$LIBS"
LIBS="$all_libraries -lgif -lX11 $LIBSOCKET"
AC_TRY_LINK(dnl
[
#ifdef __cplusplus
extern "C" {
#endif
int GifLastError(void);
#ifdef __cplusplus
}
#endif
/* We use char because int might match the return type of a gcc2
builtin and then its argument prototype would still apply. */
],
[return