-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathunbias.m
More file actions
33 lines (28 loc) · 857 Bytes
/
unbias.m
File metadata and controls
33 lines (28 loc) · 857 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
%{
Author: Shane Kramer
Course: SPCE 5105 Remote Sensing
Date: 11.4.15
---------------------------------------------------
This function will take a matric, determine the lowest
value of the matrix, and if that value is less than 0 it
will add the difference (abs(lowest-0)) and add that value
to every other element.
%}
function [outputImage] = unbias(inputImage)
% ----------------------------------------------------
% Establish constants
% ----------------------------------------------------
% Determine the bias
minimum = min(min(inputImage));
if minimum < 0
bias = abs(minimum);
[pixelMapSizeX,pixelMapSizeY] = size(inputImage);
for m = 1:pixelMapSizeX
for n = 1:pixelMapSizeY
% unbias
outputImage(m,n) = (inputImage(m,n) + bias);
end
end
else
outputImage = inputImage;
end