Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ SWT - Scilab Wavelet Toolbox
Copyright (C) 2011 - 2014 Holger Nahrstaedt
Copyright (C) 2005-2008 Scilab Wavelet Toolbox Team
__________________________________________________________________
0.3.2
+ Works with Scilab 6.1.x
0.3.1
+ some bug fixes (Thanks to Pingmin)
0.3.0
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

Wavelet Toolbox containing FWT, CWT and SWT utility functions.

SWT (version 0.3.0 For Scilab 5 and 6)
SWT (version 0.3.3 For Scilab 2025.0.0)

This toolbox is aimed to mimic matlab wavelet toolbox. Most of the functions are similiar to their counterparts in Matlab equivalents.

This toolbox is a fork from http://scwt.sf.net.
[![Build Status](https://travis-ci.org/holgern/swt.svg?branch=master)](https://travis-ci.org/holgern/swt)

AUTHORS
* Holger Nahrstaedt 2010 - 2015
* Daubechies wavelets coefficents DB2 - DB50 from Bob Strunz - University of Limerick, Ireland
* Principal author: Roger Liu <rogeruclan@gmail.com> from China P.R.
* Co-author: Isaac Zhi <QFWFQzhi@gmail.com> from China P.R.
* Co-author: Isaac Zhi <QFWFQzhi@gmail.com> from China P.R.
4 changes: 2 additions & 2 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

Wavelet Toolbox containing FWT, CWT and SWT utility functions.

SWT (version 0.3.0 For Scilab 5 and 6)
======================
SWT (version 0.3.3 For Scilab 2025.0.0)
=======================================

This toolbox is aimed to mimic matlab wavelet toolbox. Most of the functions are similiar to their counterparts in Matlab equivalents.

Expand Down
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.3.3
4 changes: 2 additions & 2 deletions builder.sce
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ function builder_main()
if (getscilabmode() ~= "NWNI") then
tbx_builder_help(toolbox_dir);
end;
tbx_build_loader(TOOLBOX_NAME, toolbox_dir);
tbx_build_cleaner(TOOLBOX_NAME, toolbox_dir);
tbx_build_loader(toolbox_dir);
tbx_build_cleaner(toolbox_dir);

endfunction
// =============================================================================
Expand Down
14 changes: 0 additions & 14 deletions demos/cwt.sce
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,9 @@ mode(1);lines(0);clc; figure(); clf;
// generate sine wave
x=[1:512];
y=sin(2*%pi*x/64);
// increase memory size
stacksize(10000000);
// continous wavelet transform
coef=cwt(y,1:128,'DOG');
surf(coef);
halt("press enter to proceed");
cwtplot(coef,1:128);
// Please ensure SIVP is installed and load SIVP first
halt("press enter to proceed");
// pseduo color display, SIVP needed
// colormap obtaining
cmap=jetcolormap(512);
// matrix normalization
n=wcodemat(abs(coef),512);
// encode matrix
w=ind2rgb(n,cmap);
// display the matrix
imshow(w);


42 changes: 23 additions & 19 deletions demos/image.sce
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
mode(7)
// Please ensure SIVP is installed and load SIVP first
// load an image
demopath = get_absolute_file_path("image.sce");
im=imread(demopath+'/image/woman.bmp');
// Display the image
imshow(im);
// Convert the color to gray
G=rgb2gray(im);
// Display the image
imshow(G);
// Convert integer to double
x=im2double(G);
// one level decomposition
[cA,cH,cV,cD]=dwt2(x,'bior3.3');
// normalize the approximation matrix
a = cA-min(cA);
a=a/max(a);
// display the approximation matrix
imshow(a);
if atomsIsInstalled("IPCV") || atomsIsInstalled("sivp")
// load an image
demopath = get_absolute_file_path();
im=imread(demopath+'/image/woman.bmp');
// Display the image
imshow(im);
// Convert the color to gray
G=rgb2gray(im);
// Display the image
imshow(G);
// Convert integer to double
x=im2double(G);
// one level decomposition
[cA,cH,cV,cD]=dwt2(x,'bior3.3');
// normalize the approximation matrix
a = cA-min(cA);
a=a/max(a);
// display the approximation matrix
imshow(a);
else
messagebox("Please install IPCV or sivp toolbox to run this demo")
end

48 changes: 26 additions & 22 deletions demos/imageDenoising.sce
Original file line number Diff line number Diff line change
@@ -1,26 +1,30 @@
mode(7)
// Please ensure SIVP is installed and load SIVP first
// load an image
demopath = pathconvert(get_swt_path()+"demos/");
im=imread(demopath+'/image/woman.bmp');
// Display the image
imshow(im);
// Convert the color to gray
G=rgb2gray(im);
// Display the image
imshow(G);
// Generate noisy image.
x = double(G) + 15*rand(double(X),'norm');
imshow(uint8(x))
// Find default values. In this case fixed form threshold
// is used with estimation of level noise, thresholding
// mode is soft and the approximation coefficients are
// kept.
[thr,sorh,keepapp] = ddencmp('den','wv',x);
if atomsIsInstalled("IPCV") || atomsIsInstalled("sivp")
demopath = get_absolute_file_path();
gcf().immediate_drawing = "on"
im=imread(demopath+'/image/woman.bmp');
// Display the image
imshow(im);
// Convert the color to gray
G=rgb2gray(im);
// Display the image
imshow(G);
// Generate noisy image.
x = double(G) + 15*rand(double(G),'normal');
imshow(uint8(x))
// Find default values. In this case fixed form threshold
// is used with estimation of level noise, thresholding
// mode is soft and the approximation coefficients are
// kept.
[thr,sorh,keepapp] = ddencmp('den','wv',x);

// thr is equal to estimated_sigma*sqrt(log(prod(size(X))))
// thr is equal to estimated_sigma*sqrt(log(prod(size(X))))

// De-noise image using global thresholding option.
xd = wdencmp('gbl',x,'sym4',2,thr,sorh,keepapp);
// Plots.
imshow(uint8(xd));
// De-noise image using global thresholding option.
xd = wdencmp('gbl',x,'sym4',2,thr,sorh,keepapp);
// Plots.
imshow(uint8(xd));
else
messagebox("Please install IPCV or sivp toolbox to run this demo")
end
2 changes: 1 addition & 1 deletion demos/semibalance.sce
Original file line number Diff line number Diff line change
Expand Up @@ -65,4 +65,4 @@ subplot(5,1,5);
grayplot(1:size(s,2),1:size(s,1),s');
title('Semblance'); ylabel('Wavelength');a=gca();a.tight_limits="on";
//colormap(jet(256));
f.color_map =jetcolormap(256);
f.color_map =jet(256);
113 changes: 58 additions & 55 deletions etc/swt.start
Original file line number Diff line number Diff line change
@@ -1,55 +1,58 @@
// Copyright (C) 2008 - INRIA
// Copyright (C) 2009 - DIGITEO

// This file is released under the 3-clause BSD license. See COPYING-BSD.

function swtlib = startModule()

mprintf("Start swt toolbox - (0.3.1)\n");

if isdef("swtlib") then
warning("Toolbox swt library is already loaded");
return;
end

etc_tlbx = get_absolute_file_path("swt.start");
etc_tlbx = getshortpathname(etc_tlbx);
root_tlbx = strncpy( etc_tlbx, length(etc_tlbx)-length("\etc") );

//Load functions library
// =============================================================================
mprintf("\tLoad macros\n");
pathmacros = pathconvert( root_tlbx ) + "macros" + filesep();
swtlib = lib(pathmacros);
clear pathmacros;

// load gateways
// =============================================================================
mprintf("\tLoad gateways\n");
verboseMode = ilib_verbose();
ilib_verbose(0);
exec(pathconvert(root_tlbx+"/sci_gateway/loader_gateway.sce",%f));
ilib_verbose(verboseMode);

// Load and add help chapter
// =============================================================================
if or(getscilabmode() == ["NW";"STD"]) then
mprintf("\tLoad help\n");
path_addchapter = pathconvert(root_tlbx+"/jar");
if ( isdir(path_addchapter) <> [] ) then
add_help_chapter("swt", path_addchapter, %F);
end
end

// Load demos
// =============================================================================
if or(getscilabmode() == ["NW";"STD"]) then
mprintf("\tLoad demos\n");
pathdemos = pathconvert(root_tlbx+"/demos/swt.dem.gateway.sce",%F,%T);
add_demo("wavelet toolbox",pathdemos);
end

endfunction

swtlib = startModule();
clear startModule; // remove startModule on stack
// ====================================================================
// Allan CORNET - DIGITEO - 2010
// Stéphane MOTTELET - UTC - 2024
// ====================================================================


etc_tlbx = get_absolute_file_path();
etc_tlbx = getshortpathname(etc_tlbx);
root_tlbx = strncpy( etc_tlbx, length(etc_tlbx)-length("\etc\") );

if isdef("swt") then
warning("Scilab wavelet toolbox library is already loaded.");
clear root_tlbx;
clear etc_tlbx;
return;
end

mprintf("Start Scilab wavelet toolbox %s: ",mgetl(fullfile(root_tlbx,"VERSION")));

//Load functions library
// =============================================================================
mprintf("load macros");
pathmacros = pathconvert( root_tlbx ) + "macros" + filesep();
swtlib = lib(pathmacros);
clear pathmacros;
// =============================================================================
mprintf(", gateways");
verbose_mode = ilib_verbose();
ilib_verbose(0);
exec( pathconvert(root_tlbx+"/sci_gateway/loader_gateway.sce",%f));
ilib_verbose(verbose_mode);
clear verbose_mode;

// Load and add help chapter
// =============================================================================
if or(getscilabmode() == ["NW";"STD"]) then
mprintf(", help");
path_addchapter = pathconvert(root_tlbx+"/jar");
if ( isdir(path_addchapter) <> [] ) then
add_help_chapter("Wavelet Toolbox", path_addchapter, %F);
clear add_help_chapter;
clear path_addchapter;
end
end
// Load demos
// =============================================================================
if or(getscilabmode() == ["NW";"STD"]) then
mprintf(", demos");
pathdemos = pathconvert(root_tlbx+"/demos/swt.dem.gateway.sce",%F,%T);
add_demo("Wavelet Toolbox",pathdemos);
clear pathdemos add_demo;
end
mprintf(".\n");
// =============================================================================
clear root_tlbx;
clear etc_tlbx;
// =============================================================================

15 changes: 4 additions & 11 deletions help/en_US/continuous_wavelet_analysis/cwt.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,10 @@ cwt is an utility of continuous wavelet transform computing. For fast wavelet tr
<refsection>
<title>Examples</title>
<programlisting role="example"><![CDATA[
x=[1:512];
y=sin(2*%pi*x/32);
stacksize(100000000);
coef=cwt(x,1:128,'sym4');
w=wcodemat(coef,512);
cmap=jetcolormap(512);
c=ind2rgb(w,cmap); // SIP function
imshow(c); // SIP and SIVP function



x = [1:512];
y = sin(2*%pi*x/32);
coef = cwt(x,1:128,'sym4');
cwtplot(coef,1:128,%t);
]]></programlisting>
</refsection>

Expand Down
2 changes: 1 addition & 1 deletion help/en_US/continuous_wavelet_analysis/cwtplot.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ tab_FREQ = tab_OMEGA/(2*%pi);
tab_COEFS = [5,3,2];
x = zeros(1,P);
for k = 1:3;
x = x+tab_COEFS(k)*sin(tab_OMEGA(k)*t);
x = x+tab_COEFS(k)*sin(tab_OMEGA(k)*t);
end
// Set scales
scales = [1:1:60];
Expand Down
2 changes: 1 addition & 1 deletion help/en_US/discrete_wavelet_analysis/appcoef2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ A1=appcoef2(C,S,'db2',1);
A2=appcoef2(C,S,'db2',2);
A3=appcoef2(C,S,'db2',3);
scf();clf();
f=gcf();f.color_map=graycolormap(256);
f=gcf();f.color_map=gray(256);
subplot(221)
Matplot(X);
a=gca();a.tight_limits="on";
Expand Down
Loading