📄 extractneighbourhood.m
字号:
function [Y,center] = extractNeighbourhood(band,block,parentband,parent)% function [Y,center] = extractNeighbourhood(band,block,parentband,parent)%% Extracts all neighbourhoods of size 'block(1)'x'bock(2)' from the subband% 'band'. If 'prnt'>0 the parent coefficient in band 'parentband' will be% included in the neighbourhood as well. All possible (overlapping) patches% of this size are stored in 'Y'. The index of the center coefficient in a% neighbourhood willl be 'center'. Patches which will not have full size% because of the border of the image won't be created.%% where% 'band' is the current subband% 'block' the size of the neighborhood (block sized) [D D]% 'parentband' and 'parent' the same for the parental subband%% 'Y' the extracted block neighborhoods% 'center' the index of the center coefficient%% Peter-Vincent Gehler 15.March 2005% The number of coefficients ...nCoeff = (size(band,1)-block(1)+1) * (size(band,2)-block(2)+1);nblv = size(band,1)-block(1)+1;nblh = size(band,2)-block(2)+1;Ly = (block(1)-1)/2;Lx = (block(2)-1)/2;N = prod(block) + parent;Y = zeros(nCoeff,N);n=0;for nx=Lx:-1:-Lx, for ny=Ly:-1:-Ly, n = n + 1; Y(:,n) = vectorize(band(Ly+1-ny:Ly+nblv-ny,Lx+1-nx:Lx+nblh-nx)); endendif parent n = n + 1; Y(:,n) = vectorize(parentband(Ly+1:Ly+nblv,Lx+1:Lx+nblh));endcenter = (prod(block)+1)/2;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -