通过MATLAB实现基于冠状动脉造影图像序列的心脏及血管的三维光流运动估计
Posted fpga&matlab
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了通过MATLAB实现基于冠状动脉造影图像序列的心脏及血管的三维光流运动估计相关的知识,希望对你有一定的参考价值。
1.仿真预览
2.部分核心代码
function [us,vs] = func_guangliu(images01,images02,areas);
imag01 = images01;
imag02 = images02;
%获取图像对边界进行调整
[r,c] = size(images01);
r_5 = r-5;
c_5 = c-5;
z = zeros(r,c);
v1 = z;
v2 = z;
%初始化
gradt = v1;
gradx = v1;
grady = v1;
alpha2 = 625;
times = 20;
%计算梯度
gradt(5:r_5,5:c_5) = ( imag02(6:r_5+1,6:c_5+1)-imag01(6:r_5+1,6:c_5+1) + imag02(6:r_5+1,5:c_5) - imag01(6:r_5+1,5:c_5) + imag02(5:r_5 ,6:c_5+1) - imag01(5:r_5 ,6:c_5+1) + imag02(5:r_5 ,5:c_5) - imag01(5:r_5 , 5:c_5))/4;
grady(5:r_5,5:c_5) = ( imag02(6:r_5+1,6:c_5+1)-imag02(5:r_5 ,6:c_5+1) + imag02(6:r_5+1,5:c_5) - imag02(5:r_5 ,5:c_5) + imag01(6:r_5+1,6:c_5+1) - imag01(5:r_5 ,6:c_5+1) + imag01(6:r_5+1,5:c_5) - imag01(5:r_5 , 5:c_5))/4;
gradx(5:r_5,5:c_5) = ( imag02(6:r_5+1,6:c_5+1)-imag02(6:r_5+1,5:c_5) + imag02(5:r_5 ,6:c_5+1) - imag02(5:r_5 ,5:c_5) + imag01(6:r_5+1,6:c_5+1) - imag01(6:r_5+1,5:c_5) + imag01(5:r_5 ,6:c_5+1) - imag01(5:r_5 , 5:c_5))/4;
for i=1:times
delta =(gradx.*v1+grady.*v2+gradt)./(alpha2+gradx.^2+grady.^2);
v1 = v1-gradx.*delta;
v2 = v2-grady.*delta;
end;
u = z;
u(5:r_5,5:c_5) = v1(5:r_5,5:c_5);
v = z;
v(5:r_5,5:c_5) = v2(5:r_5,5:c_5);
xskip = round(r/areas);
[us1,vs1] = size(u(1:xskip:r,1:xskip:c));
us = zeros(us1,vs1);
vs = us;
N = xskip^2;
for i=1:us1-1
for j=1:vs1-1
hk = i*xskip-xskip+1;
hl = i*xskip;
wk = j*xskip-xskip+1;
wl = j*xskip;
us(i,j) = sum(sum(u(hk:hl,wk:wl)))/N;
vs(i,j) = sum(sum(v(hk:hl,wk:wl)))/N;
end;
end;
C31
以上是关于通过MATLAB实现基于冠状动脉造影图像序列的心脏及血管的三维光流运动估计的主要内容,如果未能解决你的问题,请参考以下文章
MATLAB教程案例29基于Baker映射和Logistic混沌序列的图像加解密matlab实现
MATLAB教程案例98基于混沌序列的图像加解密matlab仿真,并进行各类攻击测试
FPGA教程案例45图像案例5——基于FPGA的图像均值滤波verilog实现,通过MATLAB进行辅助验证