⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 comp_backgrad.m

📁 this is a very very very nice code
💻 M
字号:
%This function computes the backward difference or forward difference,
%depending on the value of input variable "type". Mask defines the regions
%to be computed, and wind defines the search space.
function [fyb, fxb] = comp_backgrad_test(IM,pix_set,type)
    
    if type == 1
        %Compute the backward difference. Note that I use the convention
        %that the "forward" direction is from the bottom of the image to
        %the top of the image
        fxb = zeros(size(IM));
        fyb = zeros(size(IM));
        for k = 1:size(pix_set,1)
            y = pix_set(k,1);
            x = pix_set(k,2);
            fyb(y,x) = IM(y,x) - IM(y+1,x);
            fxb(y,x) = IM(y,x) - IM(y,x-1);
        end
    else
        %Compute the forward difference. Note that I use the convention
        %that the "forward" direction is from the bottom of the image to
        %the top of the image
        fxb = zeros(size(IM));
        fyb = zeros(size(IM));
        for k = 1:size(pix_set,1)
            y = pix_set(k,1);
            x = pix_set(k,2);
            fyb(y,x) = IM(y-1,x) - IM(y,x);
            fxb(y,x) = IM(y,x+1) - IM(y,x);
        end
    end

⌨️ 快捷键说明

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