https://github.com/Hongyu-Miao/DMI
Tip revision: fb3e484da2ecff9ab22c28df7fb91ffedea92bb5 authored by Hongyu Miao on 13 September 2016, 14:27:07 UTC
Add files via upload
Add files via upload
Tip revision: fb3e484
MaskSimSP.m
function [ BgNet ] = MaskSimSP( gsd, extSize, NetSize )
%Generate the mask for simulating the background network.
% gsd : ground truth network
% extSize : extra size of background (constrain)
% NetSize : real size of network
Sgsd = (extSize/NetSize - 1) * sum(sum(gsd));
seed = importdata('seed.mat');
rng(seed);
P = rand( NetSize, NetSize );
A = randn( NetSize, NetSize );
A( P > (Sgsd / (NetSize * NetSize) ) ) = 0;
A( A ~= 0) = 1;
BgNet = sparse(gsd + A >=1);
BgNet(eye(NetSize)==1) = 0;
%BgNet = sparse(BgNet);
% subplot(2,2,2);
% imshow(BgNet == 0);
end