代做matlab和similink仿真,MATLAB代做|FPGA代做|simulink代做–Horn-Schunk算法的matlab仿真…

代做matlab和similink仿真,MATLAB代做|FPGA代做|simulink代做–Horn-Schunk算法的matlab仿真…function[u,v]=HornSchunck();ite=100;alpha=25;im1=imread(‘MobileCalendar034.bmp’);im2=imread(‘MobileCalendar035.bmp’);im1=rgb2gray(im1);im2=rgb2gray(im2);im1=double(im1);im2=double(im2);im1=smoot…

代做matlab和similink仿真,MATLAB代做|FPGA代做|simulink代做--Horn-Schunk算法的matlab仿真...

function [u, v] = HornSchunck();

ite=100;

alpha=25;

im1=imread(‘MobileCalendar034.bmp’);

im2=imread(‘MobileCalendar035.bmp’);

im1=rgb2gray(im1);

im2=rgb2gray(im2);

im1=double(im1);

im2=double(im2);

im1 = smoothts(im1, ‘g’, 5);

im2 = smoothts(im2, ‘g’, 5);

fx = conv2(im1,0.25* [-1 1; -1 1],’same’) + conv2(im2, 0.25*[-1 1; -1 1],’same’);

fy = conv2(im1, 0.25*[-1 -1; 1 1], ‘same’) + conv2(im2, 0.25*[-1 -1; 1 1], ‘same’);

ft = conv2(im1, 0.25*ones(2),’same’) + conv2(im2, -0.25*ones(2),’same’);

u = zeros(size(im1));

v = zeros(size(im2));

kernel_1=[1/12 1/6 1/12;1/6 0 1/6;1/12 1/6 1/12];

for i=1:ite

uAvg=conv2(u,kernel_1,’same’);

vAvg=conv2(v,kernel_1,’same’);

u= uAvg – ( fx .* ( ( fx .* uAvg ) + ( fy .* vAvg ) + ft ) ) ./ ( alpha^2 + fx.^2 + fy.^2);

v= vAvg – ( fy .* ( ( fx .* uAvg ) + ( fy .* vAvg ) + ft ) ) ./ ( alpha^2 + fx.^2 + fy.^2);

end

figure;

rSize=1;

scale=2;

imshow(im1,[0 255]);

hold on;

for i=1:size(u,1)

for j=1:size(u,2)

if floor(i/rSize)~=i/rSize || floor(j/rSize)~=j/rSize

u(i,j)=0;

v(i,j)=0;

end

end

end

quiver(u, v, scale, ‘color’, ‘y’, ‘linewidth’, 1);

set(gca,’YDir’,’reverse’);

今天的文章代做matlab和similink仿真,MATLAB代做|FPGA代做|simulink代做–Horn-Schunk算法的matlab仿真…分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/32610.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注