-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnoisemap.m
22 lines (20 loc) · 838 Bytes
/
noisemap.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
% Script to create an empirical noise map from a given image
% Returns a matrix of the same size as image, with each element containing
% the variance of a region defined by a rectangular region of size 'rad';
% pep/08May12
% Arguments:
% skymap : Pixel array containing the map
% rad : Region with radius defined in pixels over which to generate the
% noise stats.
% NOTE: DEPRECATED. PLEASE USE genimgnoisemap.m
function [map] = noisemap (skymap, rad)
if (rad > length (skymap))
disp ('Region larger than image!'); return;
end
map = zeros (length(skymap));
for xpos = rad+1:length(skymap)-rad;
for ypos = rad+1:length(skymap)-rad;
subarr = skymap (xpos-rad:xpos+rad, ypos-rad:ypos+rad);
map (xpos, ypos) = var(var(subarr));
end;
end;