removalmap.m

来自「Using the idea from Seam Carving for Co」· M 代码 · 共 31 行

M
31
字号
function SeamVector=removalMap(X);
% REMOVALMAP takes a given image and finds the ordered set of (vertical)
% seams that are removed from an image and returns them in an array, where
% the Nth column in the array corresponds to the Nth seam to be removed.
%
% Author: Danny Luong
%         http://danluong.com
%
% Last updated: 12/20/07

[rows cols dim]=size(X);

E=findEnergy(X);    %Finds the gradient image
imshow(E);
S=findSeamImg(E);
cols-1
for i=1:cols-1
i
    %find "energy map" image used for seam calculation given the gradient image
    S=findSeamImg(E);

    %find seam vector given input "energy map" seam calculation image
    SeamVector(:,i)=findSeam(S);
    %remove seam from image
    X=SeamCut(X,SeamVector(:,i));
    E=SeamCut(E,SeamVector(:,i));

    %updates size of image
    [rows cols dim]=size(X);
end

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?