demons算法matlab代码,非刚性图像配准 matlab简单示例 demons算法

这篇博客提供了一个使用DEMONS算法在MATLAB中进行非刚性图像配准的简单示例。首先清理并加载所需文件,然后读取两幅图像,设置静态和移动图像,并设定Alpha常数和平滑核。接着通过迭代计算差异图像,应用扩展的DEMONS力公式,平滑并累加变形场,最终实现图像配准。示例包括了计算像素位移、平滑变换场以及移动像素的函数。
摘要由CSDN通过智能技术生成

% Clean clc; clear all; close all;

% Compile the mex files %compile_c_files

% Read two images I1=im2double(imread('ssftrinew1.png'));

I2=im2double(imread('ssftri.png'));

% Set static and moving image S=I2; M=I1;

% Alpha (noise) constant alpha=2.5;

% Velocity field smoothing kernel Hsmooth=fspecial('gaussian',[60 60],10);

% The transformation fields Tx=zeros(size(M)); Ty=zeros(size(M)); Tz=zeros(size(M));

[Sy,Sx] = gradient(S); for itt=1:200      % Difference image between moving and static image         Idiff=M-S;

% Default demon force, (Thirion 1998)         %Ux = -(Idiff.*Sx)./((Sx.^2+Sy.^2)+Idiff.^2);         %Uy = -(Idiff.*Sy)./((Sx.^2+Sy.^2)+Idiff.^2);

% Extended demon force. With forces from the gradients from both         % moving as static image. (Cachier 1999,

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值