paths
Scattering paths
Description
Examples
Scattering Paths of Wavelet Image Scattering Network
Create an image scattering network with an image size of 256-by-256 and invariance scale equal to the minimum of the image size. The default OptimizePath
value is 1 (true
).
sf = waveletScattering2('ImageSize',[256 256],'InvarianceScale',128)
sf = waveletScattering2 with properties: ImageSize: [256 256] InvarianceScale: 128 NumRotations: [6 6] QualityFactors: [1 1] Precision: 'single' OversamplingFactor: 0 OptimizePath: 1
Obtain the number of scattering paths in each order. Display the total number of scattering paths.
[spaths,npaths] = paths(sf); sum(npaths)
ans = 391
Set the OptimizePath
value of the network to false
. Display the total number of scattering paths. For the modified network, the scattering transform does not reduce the number of paths to compute based on a bandwidth consideration.
sf.OptimizePath = false; [spaths,npaths] = paths(sf); sum(npaths)
ans = 571
Wavelets on Scattering Path
This example shows how the OptimizePath
property can affect the scattering paths that include a specific wavelet.
Create the default wavelet image scattering network. Obtain all the wavelet filters and center spatial frequencies for the network. Obtain all the scattering paths. Display the total number of paths.
sf = waveletScattering2
sf = waveletScattering2 with properties: ImageSize: [128 128] InvarianceScale: 64 NumRotations: [6 6] QualityFactors: [1 1] Precision: 'single' OversamplingFactor: 0 OptimizePath: 1
[~,psifilters,f] = filterbank(sf);
[spaths,npaths] = paths(sf);
disp(['Total Number of Paths: ',num2str(sum(npaths))])
Total Number of Paths: 241
Display the number of wavelet filters in each filter bank.
disp(['Filter Bank 1: ',num2str(size(psifilters{1},3))])
Filter Bank 1: 24
disp(['Filter Bank 2: ',num2str(size(psifilters{2},3))])
Filter Bank 2: 24
Choose a wavelet from the first filter bank and display its spatial center frequency. Use spaths
to find all the three-element paths that include the chosen wavelet. Display the paths.
waveletA = 14;
disp(['Center Frequency: ',num2str(f{1}(waveletA,:))])
Center Frequency: 0.08119 0.046875
ind = find(spaths{3}.path(:,2)==waveletA); spaths{3}(ind,:)
ans=6×1 table
path
_____________
0 14 19
0 14 20
0 14 21
0 14 22
0 14 23
0 14 24
Plot the center frequencies of the wavelet filters on the paths.
plot(f{1}(waveletA,1),f{1}(waveletA,2),'k^') xlabel('f_x') ylabel('f_y') hold on waveletBs = spaths{3}.path(ind,3); plot(f{2}(waveletBs,1),f{2}(waveletBs,2),'bx') hold off grid on legend('First Filter Bank Wavelet','Second Filter Bank Wavelets',... 'Location','northeastoutside')
Now set the OptimizePath
property of the scattering network sf
to false
. Obtain the wavelet filters, center spatial frequencies, and scattering paths of the network.
sf.OptimizePath = false
sf = waveletScattering2 with properties: ImageSize: [128 128] InvarianceScale: 64 NumRotations: [6 6] QualityFactors: [1 1] Precision: 'single' OversamplingFactor: 0 OptimizePath: 0
[~,psifilters2,f2] = filterbank(sf);
[spaths2,npaths2] = paths(sf);
disp(['Total Number of Paths: ',num2str(sum(npaths2))])
Total Number of Paths: 385
Choose the same wavelet as above. To confirm it is the same wavelet, display its spatial center frequency. Use spaths
to find all the three-element paths that include the wavelet. Because OptimizePath
is set to false
, the wavelet filter has more children.
waveletA = 14;
disp(['Center Frequency: ',num2str(f2{1}(waveletA,:))])
Center Frequency: 0.08119 0.046875
ind = find(spaths2{3}.path(:,2)==waveletA); spaths2{3}(ind,:)
ans=12×1 table
path
_____________
0 14 13
0 14 14
0 14 15
0 14 16
0 14 17
0 14 18
0 14 19
0 14 20
0 14 21
0 14 22
0 14 23
0 14 24
Plot the center frequencies of the wavelet filters on the paths. Some of child filters have center frequencies higher than the chosen wavelet.
plot(f2{1}(waveletA,1),f2{1}(waveletA,2),'k^') xlabel('f_x') ylabel('f_y') hold on waveletBs = spaths2{3}.path(ind,3); plot(f2{2}(waveletBs,1),f2{2}(waveletBs,2),'bx') hold off grid on legend('First Filter Bank Wavelet','Second Filter Bank Wavelets',... 'Location','northeastoutside')
Input Arguments
sf
— Wavelet image scattering network
waveletScattering2
object
Wavelet image scattering network, specified as a waveletScattering2
object.
Output Arguments
spaths
— Scattering paths
cell array
Scattering paths of all orders of the scattering network, returned as a cell array
of MATLAB tables. spaths
has n elements,
where n is the number of orders in the scattering network.
Each MATLAB table in spaths
contains a single variable,
path
. The variable path
is a row vector with one
column for each element of the path. The scalar 0 denotes the original image. Positive
integers in the Lth column denote the corresponding wavelet filter in
the (L−1)th filter bank. Wavelet bandpass filters are ordered by
decreasing center frequency. There are NumRotations
wavelets per
center frequency pair.
npaths
— Number of scattering paths
column vector
Number of scattering paths in each order of the scattering network.
npaths
is a no-by-1 column vector where
no is the number of orders in the scattering network. The sum of
the elements of npaths
is the total number of scattering
paths.
Version History
Introduced in R2019a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)