Applying analysis filter bank to get even length of low pass and odd length pass filter
1 view (last 30 days)
Show older comments
I have an image i have to apply the 1‐D (5,3)(to each row (pixel values) of the image)analysis filter bank with the (1,2) normalization (i.e., DC gain of 1 for the low‐pass filter and Nyquist gain of 2 for the high‐pass filter). Then i have to get L subband consists of the even samples (starting with sample zero) and the H subband consists of the odd samples.
I got this code online but it says it has even subbands for both low and high pass filter. can anyone tell me how to apply the above analysis filter bank(5,3).
function [lo, hi] = afb(x, af)
% [lo, hi] = afb(x, af)
%
% Analysis filter bank
% x -- N-point vector (N even); the resolution should be 2x filter length
%
% af -- analysis filters
% af(:, 1): lowpass filter (even length)
% af(:, 2): highpass filter (even length)
%
% lo: Low frequency
% hi: High frequency
%
N = length(x);
L = length(af)/2;
x = cshift(x,-L);
% lowpass filter
lo = upfirdn(x, af(:,1), 1, 2);
lo(1:L) = lo(N/2+[1:L]) + lo(1:L);
lo = lo(1:N/2);
% highpass filter
hi = upfirdn(x, af(:,2), 1, 2);
hi(1:L) = hi(N/2+[1:L]) + hi(1:L);
hi = hi(1:N/2);
or any other way to apply analysis filter bank to get even length of low pass subband and odd length of high pass subband?
0 Comments
Answers (0)
See Also
Categories
Find more on Filter Banks in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!