0
点赞
收藏
分享

微信扫一扫

远处场景的烟雾识别matlab仿真

独兜曲 2022-10-10 阅读 53


1.问题描述:

一种基于数据集的图像分离方法[2]来自太浩湖和南加州地区的图片。这里我们介绍一个用小像素区域确定大图像显著区域的抠图技术与烟雾相对应。这就允许了大量的不重要的区域将图像传递给分类器时要过滤掉的。

2.部分程序:

%% ACMA M1 Assignment Question 1
clc,clear;
close all;
addpath 'func\'
global  M1 M2 N tau h1 h2 S1 S2 
T = 1; %end time

% N  = 100; % Number of timesteps taken to get to time total
% M1 = 50; % number of spatial nodes 
% M2 = 50; % number of spatial nodes 

%设置一个稀疏比例稀疏NN

 
K1 = 5;
K2 = 2;
K3 = 2;

N  = floor(100/K1); % Number of timesteps taken to get to time total
M1 = floor(50/K2);  % number of spatial nodes 
M2 = floor(50/K2);  % number of spatial nodes 
S1 = floor(100/K3); %integral interval of alpha 
S2 = floor(100/K3); %integral interval of beta

x=zeros(M1-1,1);
y=zeros(M2-1,1);
t=zeros(N-1,1);

% x = linspace(0,1,M1-1)';y = linspace(0,1,M2-1)';t = linspace(0,T,N)';
alpha=zeros(S1,1);
beta=zeros(S2,1);
uold=zeros(M1-1,1);
% U=zeros(M1-1,M2-1);
u_star=zeros(M1-1,1);
% U_star=zeros(M1-1,M1-1);

h1 = 1/M1; % spatial step length
h2 = 1/M2; % spatial step length

tau = 4*T/N; % timestep length

for i=1:M1-1
    x(i)=i*h1;
end
for l=1:M2-1
    y(l)=l*h2;
end
for k=1:N
    t(k)=k*tau/4;%这里除以4,保证整体时间不变
end

 figure;
 [x,y]=meshgrid(x,y);
 u_exact = u_analytic_solution(x,y,1);
 scatter3(x(:),y(:),u_exact(:),'.','b');
 hold on;

u0 = 0; uM1 = 0; uM2 = 0;  % Boundary conditions are dirichlet = 0;
% Intialise ...
A = zeros(M1-1); b = zeros(M1-1,1);
B = zeros(M2-1); c = zeros(M2-1,1);
 

% set up A matrix
for i = 1:M1-2
    A(i,i)=1;
    A(i,i+1)=0;
    for j=1:S1 % shift formula is different since Matlab indexs from 1
        alpha=alpha_func(j);
        P = P_func(j);
        A(i,i) = A(i,i) - (tau/S1)*(P*(-alpha)/h1^alpha);
        A(i,i+1) = A(i,i+1) - tau/S1*(P/h1^alpha);
    end
   
    for k=1:i-1
        for j=1:S1
        alpha=alpha_func(j);
        P = P_func(j);
        g1 = g1_func(i,j,k);
        A(i,k) = A(i,k) - tau/S1*P/h1^alpha*g1; 
        end
    end
end
 for k=1:M1-2
     for j=1:S1
     alpha=alpha_func(j);
     P = P_func(j);
     g1 = g1_func(M1-1,j,k);
     A(M1-1,k)=A(M1-1,k)-tau/S1*P/h1^alpha*g1;
     end
 end
 A(M1-1,M1-1)=A(M1-2,M1-2);
 

% set up B matrix
for k = 1:M2-2
    B(k,k)=1;
    B(k,k+1)=0;
    for j=1:S2 % shift formula is different since Matlab indexs from 1
        beta=beta_func(j);
        Q = Q_func(j);
        B(k,k) = B(k,k) - tau/S2*(Q*(-beta)/h2^beta);
        B(k,k+1) = B(k,k+1) - tau/S2*Q/h2^beta;
    end
    for l=1:k-1
        for j=1:S2
        beta=beta_func(j);
        Q = Q_func(j);
        g2 = g2_func(l,j,k);
        B(k,l) = B(k,l) - (tau/S2)*(Q/h2^beta)*g2;
        end
    end
end
for l=1:M2-2
    for j=1:S2
    beta=beta_func(j);
    Q = Q_func(j);
    g2 = g2_func(l,j,M2-1);
    B(M2-1,l) = B(M2-1,l) - (tau/S2)*(Q/h2^beta)*g2;
    end
end
B(M2-1,M2-1)=B(M2-2,M2-2);
 

%% 
U_star=[];
% slove u_star
for l=1:M2-1
    u_star=u_initial_func(x,y);
    for k=1:N-1
        uold=u_star;
        for i = 1:M1-1       
            f = source_func(x(i)+0.05,y(l)-0.05,t(k+1)); % eval(i) = uold(i) + tau*f; % eval(K2/4)/(K3^0.65);

for i=1:M1-1     
    c = real(U_star(i,:)'); % eval(1);
% plot3(x,y,U','r.');hold on;
h1=mesh(x,y,abs(U'));hold on;
set(h1,'facealpha',0.3)
title('u(x,y,t)')
xlabel('x')
ylabel('y')
view([-144,28]);
u_a=zeros(11);
u_n=zeros(11);
 
norm(u_analytic_solution(x,y,t(N)) + U,2)
 

figure;
subplot(121);
scatter3(x(:),y(:),u_exact(:),'.','b');
title('u exact')
xlabel('x')
ylabel('y')
subplot(122);
h1=mesh(x,y,abs(U'));hold on;
set(h1,'facealpha',0.3)
title('u(x,y,t)')
xlabel('x')
ylabel('y')

3.仿真结论:

远处场景的烟雾识别matlab仿真_lua

远处场景的烟雾识别matlab仿真_数据集_02

D-25

举报

相关推荐

0 条评论